@@ -10,7 +10,7 @@ buildscript {
10
10
11
11
dependencies {
12
12
// Kotlin JVM
13
- classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$k otlin_version "
13
+ classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$k otlinVersion "
14
14
}
15
15
}
16
16
@@ -33,13 +33,12 @@ allprojects { project ->
33
33
// }
34
34
ext {
35
35
// Kotlin JVM
36
- general_kotlin_version = kotlin_version
36
+ general_kotlinVersion = kotlinVersion
37
37
38
38
// Junit
39
39
junitVersion = " 4.12"
40
40
41
- project. ext. kotlin_version = kotlinVersion
42
- project. ext. group = " com.jtransc"
41
+ project. ext. kotlinVersion = kotlinVersion
43
42
project. ext. jtranscVersion = " ${ jtranscVersion} "
44
43
}
45
44
@@ -54,6 +53,8 @@ allprojects { project ->
54
53
55
54
apply plugin : ' com.jfrog.bintray'
56
55
56
+ project. version = jtranscVersion
57
+
57
58
// Java target version
58
59
sourceCompatibility = 1.8
59
60
targetCompatibility = 1.8
@@ -80,7 +81,7 @@ task updateVersion() {
80
81
doLast {
81
82
def newversion = jtranscVersion
82
83
println " Updating jtransc to version '$newversion '"
83
- println " Updating kotlin to version '$k otlin_version '"
84
+ println " Updating kotlin to version '$k otlinVersion '"
84
85
85
86
def isSnapshot = " $newversion " . endsWith(" -SNAPSHOT" )
86
87
@@ -103,9 +104,9 @@ task updateVersion() {
103
104
}
104
105
105
106
// Kotlin version
106
- sed(" jtransc-utils/src/com/jtransc/KotlinVersion.kt" , ' val KotlinVersion = "(.*)"' , " val KotlinVersion = \" $k otlin_version \" " )
107
- sed(" jtransc-maven-plugin/resources/META-INF/maven/plugin.xml" , ' <!--kotlin--><version>(.*)<\\ /version>' , " <!--kotlin--><version>$k otlin_version </version>" )
108
- sed(" jtransc-maven-plugin/example/pom.xml" , ' <!--kotlin--><version>(.*)<\\ /version>' , " <!--kotlin--><version>$k otlin_version </version>" )
107
+ sed(" jtransc-utils/src/com/jtransc/KotlinVersion.kt" , ' val KotlinVersion = "(.*)"' , " val KotlinVersion = \" $k otlinVersion \" " )
108
+ sed(" jtransc-maven-plugin/resources/META-INF/maven/plugin.xml" , ' <!--kotlin--><version>(.*)<\\ /version>' , " <!--kotlin--><version>$k otlinVersion </version>" )
109
+ sed(" jtransc-maven-plugin/example/pom.xml" , ' <!--kotlin--><version>(.*)<\\ /version>' , " <!--kotlin--><version>$k otlinVersion </version>" )
109
110
}
110
111
}
111
112
@@ -146,3 +147,175 @@ idea {
146
147
]
147
148
}
148
149
}
150
+
151
+ subprojects {
152
+ def hasKotlin = project. name != " jtransc-annotations"
153
+
154
+ apply plugin : ' maven-publish'
155
+ apply plugin : ' com.jfrog.bintray'
156
+ apply plugin : ' jacoco'
157
+
158
+ def props = rootProject. extensions. getExtraProperties()
159
+
160
+ if (! props. has(" gitVersion" )) {
161
+ try {
162
+ props. set(" gitVersion" , " git describe" . execute(). text. trim())
163
+ } catch (Throwable ) {
164
+ props. set(" gitVersion" , " ${ jtranscVersion} " )
165
+ }
166
+ }
167
+
168
+ def publicationVersion = ((" $project . version " . endsWith(" -SNAPSHOT" )) ? (props. get(" gitVersion" ) ?: " git describe" . execute(). text. trim()) : " $project . version " ) ?: " $project . version " ?: " unknown"
169
+
170
+ publishing {
171
+ publications {
172
+ MyPublication (MavenPublication ) {
173
+ from components. java
174
+ groupId group
175
+ artifactId project. name
176
+ version publicationVersion
177
+ }
178
+ }
179
+ }
180
+
181
+ bintray {
182
+ user = System . getenv(" BINTRAY_USER" ) ?: properties[' BINTRAY_USER' ] ?: rootProject. properties[' BINTRAY_USER' ]
183
+ key = System . getenv(" BINTRAY_KEY" ) ?: properties[' BINTRAY_USER' ] ?: rootProject. properties[' BINTRAY_KEY' ]
184
+
185
+ publications = [' MyPublication' ]
186
+
187
+ dryRun = false
188
+ publish = true
189
+ if (" $project . version " . endsWith(" -SNAPSHOT" )) {
190
+ override = true
191
+ }
192
+
193
+ pkg {
194
+ userOrg = ' jtransc'
195
+ repo = ' jtransc'
196
+ name = ' jtransc'
197
+ // name = rootProject.name
198
+ licenses = [' Apache-2.0' ]
199
+ vcsUrl = ' https://github.com/jtransc/jtransc.git'
200
+ }
201
+ }
202
+
203
+ jacocoTestReport {
204
+ reports {
205
+ xml. enabled true
206
+ html. enabled false
207
+ csv. enabled false
208
+ }
209
+ }
210
+
211
+ check. dependsOn jacocoTestReport
212
+
213
+ group = group
214
+ version = " ${ project.ext.jtranscVersion} "
215
+
216
+ compileJava. options. encoding = ' UTF-8'
217
+ compileTestJava. options. encoding = ' UTF-8'
218
+
219
+ configurations {
220
+ provided
221
+ }
222
+ sourceSets {
223
+ main { compileClasspath + = configurations. provided }
224
+ }
225
+
226
+ repositories {
227
+ mavenLocal()
228
+ mavenCentral()
229
+ }
230
+
231
+ if (hasKotlin) {
232
+ apply plugin : ' kotlin'
233
+
234
+ // https://kotlinlang.org/docs/reference/using-gradle.html#compiler-options
235
+
236
+ compileKotlin {
237
+ kotlinOptions. suppressWarnings = true
238
+ }
239
+ compileTestKotlin {
240
+ kotlinOptions. suppressWarnings = true
241
+ }
242
+ }
243
+
244
+ sourceSets {
245
+ main. java. srcDirs = [ ' src' ]
246
+ main. resources. srcDirs = [ ' resources' ]
247
+ test. java. srcDirs = [ ' test' ]
248
+ test. resources. srcDirs = [ ' testresources' ]
249
+ if (hasKotlin) {
250
+ main. kotlin. srcDirs = [' src' ]
251
+ test. kotlin. srcDirs = [' test' ]
252
+ }
253
+ }
254
+
255
+ if (System . getenv(" JTRANCS_DEPLOY" ) != null ) {
256
+ task javadoc2(type : Javadoc ) {
257
+ failOnError = false
258
+ }
259
+
260
+ task javadocJar(type : Jar , dependsOn : javadoc2) {
261
+ classifier = ' javadoc'
262
+ from ' build/docs/javadoc'
263
+ }
264
+
265
+ task sourcesJar(type : Jar ) {
266
+ from sourceSets. main. allSource
267
+ classifier = ' sources'
268
+ }
269
+
270
+ artifacts {
271
+ archives jar
272
+ archives javadocJar
273
+ archives sourcesJar
274
+ }
275
+
276
+ signing {
277
+ sign configurations. archives
278
+ }
279
+
280
+ uploadArchives {
281
+ repositories {
282
+ mavenDeployer {
283
+ beforeDeployment { MavenDeployment deployment -> signing. signPom(deployment) }
284
+
285
+ repository(url : " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ) {
286
+ authentication(userName : sonatypeUsername, password : sonatypePassword)
287
+ }
288
+
289
+ pom. project {
290
+ name " ${ project.name} "
291
+ packaging ' jar'
292
+ description ' JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.'
293
+ url ' https://github.com/jtransc/jtransc/'
294
+ inceptionYear ' 2015'
295
+
296
+ scm {
297
+ url
' scm:[email protected] :jtransc/jtransc.git'
298
+ connection
' scm:[email protected] :jtransc/jtransc.git'
299
+ developerConnection
' scm:[email protected] :jtransc/jtransc.git'
300
+ }
301
+
302
+ licenses {
303
+ license {
304
+ name ' The Apache Software License, Version 2.0'
305
+ url ' http://www.apache.org/licenses/LICENSE-2.0.txt'
306
+ distribution ' repo'
307
+ }
308
+ }
309
+
310
+ developers {
311
+ developer {
312
+ id ' soywiz'
313
+ name ' Carlos Ballesteros Velasco'
314
+ }
315
+ }
316
+ }
317
+ }
318
+ }
319
+ }
320
+ }
321
+ }
0 commit comments