|
1 | 1 | @file:Suppress("UnstableApiUsage") |
2 | 2 |
|
3 | 3 | import gg.jte.gradle.GenerateJteTask |
4 | | -import org.jetbrains.kotlin.gradle.dsl.* |
5 | 4 |
|
6 | 5 | plugins { |
7 | | - id("org.gradle.kotlin.kotlin-dsl") |
| 6 | + id("plugin.kotlin-dsl") |
8 | 7 | embeddedKotlin("plugin.serialization") |
9 | 8 | // embeddedKotlin("jvm") |
10 | | - com.github.`ben-manes`.versions |
11 | | - com.diffplug.spotless |
12 | 9 | gg.jte.gradle |
13 | 10 | plugin.publishing |
14 | 11 | } |
15 | 12 |
|
16 | 13 | description = "Gradle build project plugins!" |
17 | 14 |
|
18 | | -// Java version used for Kotlin Gradle precompiled script plugins. |
19 | | -val dslJavaVersion = libs.versions.kotlin.dsl.jvmtarget |
20 | | - |
21 | 15 | kotlin { |
22 | | - compilerOptions { |
23 | | - jvmTarget = dslJavaVersion.map(JvmTarget::fromTarget) |
24 | | - freeCompilerArgs.addAll( |
25 | | - "-Xjdk-release=${dslJavaVersion.get()}", |
26 | | - "-Xno-param-assertions", |
27 | | - "-Xno-call-assertions", |
28 | | - "-Xno-receiver-assertions") |
29 | | - optIn.addAll( |
30 | | - "kotlin.ExperimentalStdlibApi", |
31 | | - "kotlin.time.ExperimentalTime", |
32 | | - "kotlin.io.encoding.ExperimentalEncodingApi", |
33 | | - "kotlinx.validation.ExperimentalBCVApi", |
34 | | - "kotlinx.coroutines.ExperimentalCoroutinesApi", |
35 | | - "kotlinx.serialization.ExperimentalSerializationApi", |
36 | | - "org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi", |
37 | | - "org.jetbrains.kotlin.gradle.ExperimentalWasmDsl", |
38 | | - "org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDistributionDsl", |
39 | | - "org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDceDsl") |
40 | | - } |
41 | | - |
42 | | - // explicitApiWarning() |
43 | | -} |
44 | | - |
45 | | -tasks { |
46 | | - // Restrict the java release version used in Gradle kotlin DSL to |
47 | | - // avoid accidentally using higher version JDK API in build scripts. |
48 | | - compileJava { |
49 | | - options.apply { |
50 | | - release = dslJavaVersion.map { it.toInt() } |
51 | | - isIncremental = true |
52 | | - } |
53 | | - } |
54 | | - |
55 | | - validatePlugins { |
56 | | - failOnWarning = true |
57 | | - enableStricterValidation = true |
58 | | - } |
59 | | - |
60 | | - withType<GenerateJteTask>().configureEach { mustRunAfter("sourcesJar") } |
61 | | - |
62 | | - // Include the generated build version catalog accessors to the final jar |
63 | | - // named<Jar>("jar") { |
64 | | - // from(sourceSets.main.get().output) |
65 | | - // from(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) |
66 | | - // archiveClassifier = "" |
67 | | - // } |
| 16 | + compilerOptions.optIn.addAll( |
| 17 | + "kotlinx.validation.ExperimentalBCVApi", |
| 18 | + "org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi", |
| 19 | + "org.jetbrains.kotlin.gradle.ExperimentalWasmDsl", |
| 20 | + "org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDistributionDsl", |
| 21 | + "org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDceDsl") |
68 | 22 | } |
69 | 23 |
|
70 | 24 | jte { |
@@ -114,6 +68,17 @@ gradlePlugin { |
114 | 68 | } |
115 | 69 | } |
116 | 70 |
|
| 71 | +tasks { |
| 72 | + withType<GenerateJteTask>().configureEach { mustRunAfter("sourcesJar") } |
| 73 | + |
| 74 | + // Include the generated catalog accessors to the final jar |
| 75 | + // named<Jar>("jar") { |
| 76 | + // from(sourceSets.main.get().output) |
| 77 | + // from(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) |
| 78 | + // archiveClassifier = "" |
| 79 | + // } |
| 80 | +} |
| 81 | + |
117 | 82 | dependencies { |
118 | 83 | implementation(projects.plugins.shared) |
119 | 84 | implementation(libs.build.zip.prefixer) |
@@ -163,7 +128,6 @@ dependencies { |
163 | 128 | // implementation(libs.build.includegit.plugin) |
164 | 129 | // implementation(libs.build.dependencyanalysis) |
165 | 130 |
|
166 | | - testImplementation(gradleTestKit()) |
167 | 131 | // For using kotlin-dsl in pre-compiled script plugins |
168 | 132 | // implementation("${libs.build.kotlin.dsl.get().module}:${expectedKotlinDslPluginsVersion}") |
169 | 133 | } |
0 commit comments