1+ // -----------------------------------------------------------------------------
2+ // Collect publishing information
3+ // -----------------------------------------------------------------------------
4+ ext. publishing = [:]
5+ ext. publishing. bintray = [:]
6+
7+ ext. publishing. pomName = ext. publishing. artifactId
8+
9+ apply from : " gradle/project-info.gradle"
10+
11+ // -----------------------------------------------------------------------------
12+ // Performs publishing
13+ // -----------------------------------------------------------------------------
14+
15+ task javadocJar (type : Jar , dependsOn : javadoc) {
16+ classifier = ' javadoc'
17+ from javadoc. destinationDir
18+ }
19+
20+ // create one jar for the source files
21+ task sourcesJar (type : Jar , dependsOn : classes) {
22+ classifier = ' sources'
23+ from sourceSets. main. allSource
24+ }
25+
26+ artifacts {
27+ archives jar
28+ archives javadocJar
29+ archives sourcesJar
30+ }
31+ Date buildTimeAndDate = new Date ()
32+ ext {
33+ buildDate = new java.text.SimpleDateFormat (' yyyy-MM-dd' ). format(buildTimeAndDate)
34+ buildTime = new java.text.SimpleDateFormat (' HH:mm:ss.SSSZ' ). format(buildTimeAndDate)
35+ }
36+
37+ jar {
38+ manifest {
39+ attributes(
40+ ' Built-By' : System . properties[' user.name' ],
41+ ' Created-By' : System . properties[' java.version' ] + " (" + System . properties[' java.vendor' ] + " " + System . properties[' java.vm.version' ] + " )" ,
42+ ' Build-Date' : project. buildDate,
43+ ' Build-Time' : project. buildTime,
44+ ' Build-Revision' : versioning. info. commit,
45+ ' Specification-Title' : project. name,
46+ ' Specification-Version' : project. version,
47+ ' Implementation-Title' : project. name,
48+ ' Implementation-Version' : project. version
49+ )
50+ }
51+ }
52+
53+
54+ def pomConfig = {
55+ name ext. publishing. pomName
56+ description ext. publishing. desc
57+ url ext. publishing. websiteUrl
58+ inceptionYear ext. publishing. inceptionYear
59+ licenses {
60+ license([:]) {
61+ name ext. publishing. license
62+ url ext. publishing. licenseUrl
63+ distribution ' repo'
64+ }
65+ }
66+ scm {
67+ url ext. publishing. vcsUrl
68+ connection ext. publishing. vcsUrl
69+ developerConnection ext. publishing. vcsUrl
70+ }
71+ developers {
72+ developer {
73+ id ext. publishing. developerNameAlias
74+ name ext. publishing. developerName
75+ }
76+ }
77+ }
78+
79+ publishing {
80+ publications {
81+ mavenCustom(MavenPublication ) {
82+ groupId publishing. groupId
83+ artifactId publishing. artifactId
84+ version publishing. versionId
85+ from components. java
86+ artifact sourcesJar
87+ artifact javadocJar
88+
89+ pom. withXml {
90+ def root = asNode()
91+ root. appendNode ' description' , publishing. desc
92+ root. children(). last() + pomConfig
93+ }
94+ }
95+ }
96+ }
97+
98+ if (! project. hasProperty(' bintrayUsername' )) ext. bintrayUsername = ' '
99+ if (! project. hasProperty(' bintrayApiKey' )) ext. bintrayApiKey = ' '
100+
101+ bintray {
102+ user = project. bintrayUsername
103+ key = project. bintrayApiKey
104+ publications = [' mavenCustom' ]
105+ pkg {
106+ repo = publishing. bintray. repo
107+ userOrg = publishing. bintray. userOrg
108+ name = publishing. bintray. name
109+ desc = publishing. desc
110+ licenses = [publishing. license]
111+ labels = publishing. labels
112+ websiteUrl = publishing. websiteUrl
113+ issueTrackerUrl = publishing. issueTrackerUrl
114+ vcsUrl = publishing. vcsUrl
115+ publicDownloadNumbers = true
116+
117+ version {
118+ name = publishing. versionId
119+ vcsTag = ' v' + publishing. versionId
120+ }
121+ }
122+ }
0 commit comments