-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle.kts
119 lines (98 loc) · 3.96 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.jfrog.bintray.gradle.BintrayExtension
import org.jetbrains.dokka.gradle.DokkaTask
plugins {
kotlin("jvm")
`maven-publish`
id("com.jfrog.bintray")
id("org.jetbrains.dokka")
id("com.github.johnrengelman.shadow")
}
dependencies {
compileOnly(kotlin("stdlib-jdk8"))
compileOnly(kotlin("reflect"))
api(kotlin("main-kts"))
api(project(":kotlin-shell-core"))
api("org.slf4j:slf4j-nop:1.7.26")
}
val dokkaJarConfig: (task: TaskProvider<DokkaTask>) -> Jar.() -> Unit by rootProject.extra
val dokkaJar by tasks.creating(Jar::class, dokkaJarConfig(tasks.dokka))
val sourcesJarConfig: Jar.() -> Unit by rootProject.extra
val sourcesJar by tasks.creating(Jar::class, sourcesJarConfig)
tasks {
val jarBaseName = "kotlin-shell-kts"
val dokkaConfig: DokkaTask.() -> Unit by rootProject.extra
dokka(dokkaConfig)
val relocatedPackagesRoot = "$group.relocated"
val packagesToRelocate = listOf(
"org.jetbrains.kotlin",
"kotlin.script.dependencies",
// "kotlin.script.experimental.annotations",
// "kotlin.script.experimental.api",
// "kotlin.script.experimental.host",
// "kotlin.script.experimental.jvm",
// "kotlin.script.experimental.util",
"kotlin.script.experimental.dependencies",
"kotlin.script.experimental.jvmhost",
"kotlin.script.experimental.location",
"fr.jayasoft.ivy",
"org.intellij",
"org.jetbrains.annotations",
"org.zeroturnaround",
"org.slf4j"
// commented ones cause errors on script compilation
)
fun ShadowJar.configureShadow(classifier: String) {
setProperty("archiveBaseName", jarBaseName)
setProperty("archiveClassifier", classifier)
}
shadowJar {
configureShadow("all")
dependencies {
// stdlib
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk8:"))
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk7:"))
// reflect
exclude(dependency("org.jetbrains.kotlin:kotlin-reflect:"))
// main-kts
exclude("META-INF/kotlin/script/templates/org.jetbrains.kotlin.mainKts.MainKtsScript.classname")
exclude(dependency("org.jetbrains.kotlin:kotlin-scripting-jvm-host-embeddable:"))
exclude(dependency("org.jetbrains.kotlin:kotlin-compiler-embeddable:"))
exclude(dependency("org.jetbrains.kotlin:kotlin-script-runtime:"))
exclude(dependency("org.jetbrains.kotlin:kotlin-daemon-embeddable:"))
exclude(dependency("org.jetbrains.intellij.deps:trove4j:1.0.20181211"))
exclude(dependency("org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:"))
exclude(dependency("org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:"))
exclude(dependency("org.jetbrains.kotlin:kotlin-scripting-jvm:"))
exclude(dependency("org.jetbrains.kotlin:kotlin-scripting-common:"))
// shell-core
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib:"))
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib-common:"))
exclude(dependency("org.jetbrains:annotations:"))
}
packagesToRelocate.forEach {
relocate(it, "$relocatedPackagesRoot.$it")
}
}
}
artifacts {
archives(sourcesJar)
archives(dokkaJar)
archives(tasks.jar)
}
val bintrayPublication = "kotlin-shell-kts"
val publicationConfig: (Project, String, List<Jar>) -> Action<PublishingExtension> by rootProject.extra
publishing(
publicationConfig(
project,
bintrayPublication,
listOf(tasks.jar.get(), sourcesJar, dokkaJar, tasks.shadowJar.get())
)
)
val uploadConfig: (String, String) -> Action<BintrayExtension> by rootProject.extra
bintray(
uploadConfig(
bintrayPublication,
"Script definition for Kotlin shell scripting"
)
)