1
- import org.gradle.api.internal.HasConvention
2
1
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
3
2
import java.io.*
4
3
import java.nio.file.*
5
4
import java.util.concurrent.*
6
5
import java.util.stream.Collectors
7
6
8
- val commitHash by lazy {
9
- val process: Process = Runtime .getRuntime().exec(" git rev-parse --short HEAD" )
10
- process.waitFor()
11
- val output = process.inputStream.use {
12
- it.bufferedReader().use(BufferedReader ::readText)
13
- }
14
- process.destroy()
15
- output.trim()
16
- }
17
-
18
- val isCI = ! System .getenv(" CI" ).isNullOrBlank()
19
-
20
- val shortVersion = " 1.0"
21
- val packageName = " org.covscript.devkt.lang"
22
- val kotlinVersion: String by extra
23
- val pluginCalculatedVersion = if (isCI) " $shortVersion -$commitHash " else shortVersion
24
-
25
- group = packageName
26
- version = pluginCalculatedVersion
7
+ val kotlinVersion = " 1.2.31"
27
8
28
- buildscript {
29
- var kotlinVersion: String by extra
30
- kotlinVersion = " 1.2.31"
31
-
32
- repositories {
33
- mavenCentral()
34
- }
35
-
36
- dependencies {
37
- classpath(kotlin(" gradle-plugin" , kotlinVersion))
38
- }
39
- }
40
-
41
- tasks.withType<Jar > {
42
- manifest {
43
- attributes(mapOf (" Main-Class" to " org.ice1000.devkt.Main" ,
44
- " SplashScreen-Image" to " splash.png" ))
45
- }
46
- }
9
+ group = " org.covscript.devkt.lang"
10
+ version = " v1.0-SNAPSHOT"
47
11
48
12
plugins {
49
13
java
50
14
kotlin(" jvm" ) version " 1.2.31"
51
15
}
52
16
53
- apply {
54
- plugin(" kotlin" )
55
- }
56
-
57
17
java {
58
18
sourceCompatibility = JavaVersion .VERSION_1_8
59
19
targetCompatibility = JavaVersion .VERSION_1_8
60
20
}
61
21
62
- val SourceSet .kotlin
63
- get() = (this as HasConvention ).convention.getPlugin(KotlinSourceSet ::class .java).kotlin
64
-
65
22
java.sourceSets {
66
23
" main" {
67
24
java.setSrcDirs(listOf (" src" ))
68
- kotlin.setSrcDirs(listOf (" src" ))
25
+ withConvention(KotlinSourceSet ::class ) {
26
+ kotlin.setSrcDirs(listOf (" src" ))
27
+ }
69
28
resources.setSrcDirs(listOf (" res" ))
70
29
}
71
30
72
31
" test" {
73
32
java.setSrcDirs(emptyList<Any >())
74
- kotlin.setSrcDirs(emptyList<Any >())
33
+ withConvention(KotlinSourceSet ::class ) {
34
+ kotlin.setSrcDirs(emptyList<Any >())
35
+ }
75
36
resources.setSrcDirs(emptyList<Any >())
76
37
}
77
38
}
@@ -86,3 +47,4 @@ dependencies {
86
47
compileOnly(kotlin(" compiler-embeddable" , kotlinVersion))
87
48
compileOnly(files(* File (" lib" ).listFiles()))
88
49
}
50
+
0 commit comments