-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
68 lines (55 loc) · 2.54 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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
val jvmTargetVersion = deps.versions.jvmTarget
val buildConfigPluginId = deps.plugins.buildConfig.get().pluginId
plugins {
alias(deps.plugins.kotlin.jvm) apply false
alias(deps.plugins.ksp) apply false
alias(deps.plugins.kmp) apply false
alias(deps.plugins.buildConfig) apply false
}
subprojects {
group = project.property("GROUP") as String
version = project.property("VERSION_NAME") as String
// Apply the buildConfig plugin to all subprojects
apply(plugin = buildConfigPluginId)
// configure the buildConfig plugin to generate the fields we need for both
// the compiler plugin and the gradle plugin
extensions.configure<com.github.gmazzo.buildconfig.BuildConfigExtension> {
packageName.set("de.thermondo.funlin")
documentation.set("Generated at build time to share between modules")
buildConfigField<String>("PLUGIN_ID", "funlinPlugin")
buildConfigField<String>("ENABLED", "enabled")
buildConfigField<String>("LOGGING", "logging")
buildConfigField<String>("CALLABLE_TARGET_PATH", "callableTargetPath")
buildConfigField<String>("ANNOTATION", "annotation")
buildConfigField<String>("EXTENSION_NAME", "funlin")
buildConfigField<String>("GROUP_ID", "de.thermondo.funlin")
buildConfigField<String>("ARTIFACT_ID", "funlin-compiler-plugin")
buildConfigField<String>("VERSION", "0.0.1")
buildConfigField<String>("EMPTY_STRING", "")
}
pluginManager.withPlugin("java") {
configure<JavaPluginExtension> {
toolchain { languageVersion.set(deps.versions.jdk.map(JavaLanguageVersion::of)) }
}
tasks.withType<JavaCompile>().configureEach {
options.release.set(jvmTargetVersion.map(String::toInt))
}
}
plugins.withType<KotlinBasePlugin> {
project.tasks.withType<KotlinCompilationTask<*>>().configureEach {
compilerOptions {
progressiveMode.set(true)
if (this is KotlinJvmCompilerOptions) {
jvmTarget.set(jvmTargetVersion.map(JvmTarget::fromTarget))
freeCompilerArgs.addAll("-Xjvm-default=all")
}
}
}
configure<KotlinProjectExtension> { explicitApi() }
}
}