16
16
// You should have received a copy of the GNU Lesser General Public License
17
17
// along with this library; if not, see http://www.gnu.org/licenses/
18
18
19
- version ' 1.0-SNAPSHOT'
20
-
21
- apply plugin : ' kotlin'
22
- apply plugin : ' java'
23
-
24
- repositories {
25
- mavenCentral()
26
- }
27
-
28
19
buildscript {
29
- ext. kotlin_version = ' 1.0.5-2'
30
-
31
20
repositories {
32
21
mavenCentral()
22
+ jcenter()
33
23
}
34
24
35
25
dependencies {
36
26
classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
27
+ classpath " org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version "
37
28
}
38
29
}
39
30
31
+ plugins {
32
+ id " com.jfrog.bintray" version " 1.7.3"
33
+ id ' net.researchgate.release' version " 2.5.0"
34
+ }
35
+
36
+ apply plugin : ' kotlin'
37
+ apply plugin : ' java'
38
+ apply plugin : ' org.jetbrains.dokka'
39
+ apply plugin : ' maven-publish'
40
+
41
+ assert name == ' kotlin-argparser'
42
+ def prettyName = ' Kotlin ArgParser'
43
+ def tagline = ' Concise and easy yet powerful and robust command line argument parsing for Kotlin'
44
+
45
+ group ' com.xenomachina'
46
+ def githubRepo = " xenomachina/$name "
47
+ def vcsUrl = " https://github.com/$githubRepo "
48
+
49
+ sourceCompatibility = 1.6
50
+
51
+ repositories {
52
+ mavenCentral()
53
+ }
54
+
40
55
dependencies {
41
56
testCompile ' junit:junit:4.12'
42
57
compile " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
@@ -46,3 +61,119 @@ dependencies {
46
61
sourceSets {
47
62
main. java. srcDirs + = ' src/main/kotlin'
48
63
}
64
+
65
+ // ////////////////////////////////////////////////////////////////////////////
66
+ // Dokka config
67
+ // ////////////////////////////////////////////////////////////////////////////
68
+
69
+ // Based on https://github.com/Kotlin/dokka
70
+ dokka {
71
+ moduleName = project. name
72
+ outputFormat = ' javadoc'
73
+ outputDirectory = " $buildDir /javadoc"
74
+ processConfigurations = [' compile' ]
75
+ // includes = ['packages.md', 'extra.md']
76
+ // samples = ['samples/basic.kt', 'samples/advanced.kt']
77
+ linkMapping {
78
+ dir = " src/main/kotlin"
79
+ url = " $vcsUrl /blob/master/src/main/kotlin"
80
+ suffix = " #L"
81
+ }
82
+ sourceDirs = files(' src/main/kotlin' )
83
+ }
84
+
85
+ // From @dimsuz at https://github.com/Kotlin/dokka/issues/42
86
+ task dokkaJavadoc (type : org.jetbrains.dokka.gradle.DokkaTask ) {
87
+ outputFormat = ' javadoc'
88
+ outputDirectory = javadoc. destinationDir
89
+ inputs. dir ' src/main/kotlin'
90
+ }
91
+ task javadocJar (type : Jar , dependsOn : dokkaJavadoc) {
92
+ classifier = ' javadoc'
93
+ from javadoc. destinationDir
94
+ }
95
+
96
+ // ////////////////////////////////////////////////////////////////////////////
97
+ // bintrayUpload config
98
+ // ////////////////////////////////////////////////////////////////////////////
99
+
100
+ // Based on https://github.com/bintray/gradle-bintray-plugin
101
+ bintray {
102
+ user = System . getenv(' BINTRAY_USER' )
103
+ key = System . getenv(' BINTRAY_KEY' )
104
+
105
+ pkg {
106
+ repo = ' maven'
107
+ name = project. name
108
+
109
+ licenses = [' LGPL-2.1' ]
110
+ vcsUrl = vcsUrl
111
+ websiteUrl = vcsUrl
112
+ issueTrackerUrl = " $vcsUrl /issues"
113
+ githubRepo = githubRepo
114
+ // TODO githubReleaseNotesFile = ???
115
+
116
+ version {
117
+ name = project. version
118
+ desc = " $prettyName version $project . version "
119
+ released = new Date ()
120
+ vcsTag = " $project . version "
121
+ }
122
+ }
123
+
124
+ publications = [' MyPublication' ]
125
+ }
126
+
127
+ // Create the pom configuration:
128
+ def pomConfig = {
129
+ licenses {
130
+ license {
131
+ name " GNU Lesser General Public License, Version 2.1"
132
+ url " https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt"
133
+ distribution " repo"
134
+ }
135
+ }
136
+ developers {
137
+ developer {
138
+ id " xenomachina"
139
+ name " Laurence Gonsalves"
140
+
141
+ // State-of-the art anti-scraper encryption. ;-)
142
+ email " moc.anihcamonex@ecnerual" . reverse()
143
+ }
144
+ }
145
+ }
146
+
147
+ task sourcesJar (type : Jar , dependsOn : classes) {
148
+ classifier = ' sources'
149
+ from sourceSets. main. allSource
150
+ }
151
+
152
+ // Create the publication with the pom configuration:
153
+ publishing {
154
+ publications {
155
+ MyPublication (MavenPublication ) {
156
+ from components. java
157
+ artifact sourcesJar
158
+ artifact javadocJar
159
+ // We use default groupId, artifactId, and version
160
+
161
+ pom. withXml {
162
+ def root = asNode()
163
+ root. appendNode(' description' , tagline)
164
+ root. appendNode(' name' , prettyName)
165
+ root. appendNode(' url' , vcsUrl)
166
+ root. children(). last() + pomConfig
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ // ////////////////////////////////////////////////////////////////////////////
173
+ // gradle-release plugin config
174
+ // ////////////////////////////////////////////////////////////////////////////
175
+
176
+ // Based on https://github.com/researchgate/gradle-release
177
+
178
+ // This causes './gradlew release' to also upload release package to bintray.
179
+ afterReleaseBuild. dependsOn bintrayUpload
0 commit comments