Skip to content

Commit b109fe2

Browse files
Merge pull request #47 from SpineEventEngine/fix-ksp-tasks-dependencies
Fix KSP tasks dependencies
2 parents 8c5f463 + e9c3bf4 commit b109fe2

File tree

10 files changed

+90
-95
lines changed

10 files changed

+90
-95
lines changed

buildSrc/src/main/kotlin/io/spine/dependency/build/Ksp.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import io.spine.dependency.Dependency
3636
@Suppress("unused")
3737
object Ksp : Dependency() {
3838
override val version = "2.2.20-2.0.4"
39-
val dogfoodingVersion = "2.1.21-2.0.1"
39+
val dogfoodingVersion = version
4040
override val group = "com.google.devtools.ksp"
4141

4242
const val id = "com.google.devtools.ksp"

buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvmCompiler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ object CoreJvmCompiler {
4646
/**
4747
* The version used to in the build classpath.
4848
*/
49-
const val dogfoodingVersion = "2.0.0-SNAPSHOT.017"
49+
const val dogfoodingVersion = "2.0.0-SNAPSHOT.018"
5050

5151
/**
5252
* The version to be used for integration tests.
5353
*/
54-
const val version = "2.0.0-SNAPSHOT.017"
54+
const val version = "2.0.0-SNAPSHOT.018"
5555

5656
/**
5757
* The ID of the Gradle plugin.

dependencies.md

Lines changed: 51 additions & 51 deletions
Large diffs are not rendered by default.

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ kotlin.tests.individualTaskReports=true
2323
# For details please see:
2424
# https://kotlinlang.org/docs/dokka-migration.html#enable-migration-helpers
2525
org.jetbrains.dokka.experimental.gradle.pluginMode=V2EnabledWithHelpers
26+
27+
#org.gradle.debug=true

ksp/src/main/kotlin/io/spine/tools/core/jvm/ksp/gradle/KspBasedPlugin.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ public abstract class KspBasedPlugin : Plugin<Project> {
117117
private fun Project.addDependencies() {
118118
sourceSets.forEach { sourceSet ->
119119
val configurationName = sourceSet.compileOnlyConfigurationName
120-
dependencies.add(configurationName,
120+
dependencies.add(
121+
configurationName,
121122
autoServiceAnnotations
122123
)
123124
}
@@ -227,10 +228,11 @@ private fun Project.makeKspTasksDependOnSpineCompiler() {
227228
val kspTasks = kspTasks()
228229
kspTasks.forEach { (ssn, kspTask) ->
229230
val taskName = CompilerTaskName(ssn)
230-
val compilerTask = tasks.findByName(taskName.value())
231-
if (compilerTask != null) {
232-
kspTask.dependsOn(compilerTask)
233-
}
231+
// Even if a task with `taskName` does not exist, the call
232+
// to `mustRunAfter` won't fail.
233+
// We do this instead of `dependsOn` because historically it
234+
// proves to be unreliable in this particular case.
235+
kspTask.mustRunAfter(taskName.value())
234236
}
235237
}
236238
}

pom.xml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject.
1010
-->
1111
<groupId>io.spine.tools</groupId>
1212
<artifactId>core-jvm-compiler</artifactId>
13-
<version>2.0.0-SNAPSHOT.018</version>
13+
<version>2.0.0-SNAPSHOT.019</version>
1414

1515
<inceptionYear>2015</inceptionYear>
1616

@@ -23,12 +23,6 @@ all modules and does not describe the project structure per-subproject.
2323
</licenses>
2424

2525
<dependencies>
26-
<dependency>
27-
<groupId>com.google.auto.service</groupId>
28-
<artifactId>auto-service-annotations</artifactId>
29-
<version>1.1.1</version>
30-
<scope>compile</scope>
31-
</dependency>
3226
<dependency>
3327
<groupId>com.google.devtools.ksp</groupId>
3428
<artifactId>symbol-processing-aa-embeddable</artifactId>
@@ -287,6 +281,12 @@ all modules and does not describe the project structure per-subproject.
287281
<version>5.13.2</version>
288282
<scope>test</scope>
289283
</dependency>
284+
<dependency>
285+
<groupId>com.google.auto.service</groupId>
286+
<artifactId>auto-service-annotations</artifactId>
287+
<version>1.1.1</version>
288+
<scope>provided</scope>
289+
</dependency>
290290
<dependency>
291291
<groupId>com.google.code.findbugs</groupId>
292292
<artifactId>jsr305</artifactId>
@@ -306,7 +306,7 @@ all modules and does not describe the project structure per-subproject.
306306
<dependency>
307307
<groupId>com.google.devtools.ksp</groupId>
308308
<artifactId>symbol-processing-cmdline</artifactId>
309-
<version>2.1.21-2.0.1</version>
309+
<version>2.2.20-2.0.4</version>
310310
</dependency>
311311
<dependency>
312312
<groupId>com.google.errorprone</groupId>
@@ -369,17 +369,17 @@ all modules and does not describe the project structure per-subproject.
369369
<dependency>
370370
<groupId>io.spine.tools</groupId>
371371
<artifactId>core-jvm-gradle-plugins</artifactId>
372-
<version>2.0.0-SNAPSHOT.017</version>
372+
<version>2.0.0-SNAPSHOT.018</version>
373373
</dependency>
374374
<dependency>
375375
<groupId>io.spine.tools</groupId>
376376
<artifactId>core-jvm-plugins</artifactId>
377-
<version>2.0.0-SNAPSHOT.017</version>
377+
<version>2.0.0-SNAPSHOT.018</version>
378378
</dependency>
379379
<dependency>
380380
<groupId>io.spine.tools</groupId>
381381
<artifactId>core-jvm-routing</artifactId>
382-
<version>2.0.0-SNAPSHOT.017</version>
382+
<version>2.0.0-SNAPSHOT.018</version>
383383
</dependency>
384384
<dependency>
385385
<groupId>io.spine.tools</groupId>

routing-tests/build.gradle.kts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,6 @@ sourceSets.testFixtures {
117117
kotlin.srcDir("generated/ksp/testFixtures/kotlin")
118118
}
119119

120-
// Avoid Gradle warning on disabled execution optimization because of the absence of
121-
// explicit or implicit dependencies.
122-
afterEvaluate {
123-
val kspTestFixturesKotlin by tasks.getting
124-
val launchTestFixturesSpineCompiler by tasks.getting
125-
kspTestFixturesKotlin.dependsOn(launchTestFixturesSpineCompiler)
126-
}
127120

128121
configurations
129122
// https://detekt.dev/docs/gettingstarted/gradle/#dependencies
@@ -135,3 +128,11 @@ configurations
135128
)
136129
}
137130
}
131+
132+
// Avoid Gradle warning on disabled execution optimization because of the absence of
133+
// explicit or implicit dependencies.
134+
afterEvaluate {
135+
val kspTestFixturesKotlin by tasks.getting
136+
val launchTestFixturesSpineCompiler by tasks.getting
137+
kspTestFixturesKotlin.dependsOn(launchTestFixturesSpineCompiler)
138+
}

routing/build.gradle.kts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ dependencies {
6464
testImplementation(Logging.testLib)
6565
}
6666

67-
// Avoid the missing file error for generated code when running tests out of the IDE.
68-
afterEvaluate {
69-
val kspTestKotlin by tasks.getting
70-
val launchTestSpineCompiler by tasks.getting
71-
kspTestKotlin.dependsOn(launchTestSpineCompiler)
72-
}
73-
7467
if (JavaVersion.current() >= JavaVersion.VERSION_16) {
7568
tasks.withType<Test>().configureEach {
7669
jvmArgs(
@@ -88,6 +81,13 @@ if (JavaVersion.current() >= JavaVersion.VERSION_16) {
8881
}
8982
}
9083

84+
// Avoid the missing file error for generated code when running tests out of the IDE.
85+
afterEvaluate {
86+
val kspTestKotlin by tasks.getting
87+
val launchTestSpineCompiler by tasks.getting
88+
kspTestKotlin.dependsOn(launchTestSpineCompiler)
89+
}
90+
9191
afterEvaluate {
9292
val writeSpineCompilerSettings by tasks.getting
9393
val processResources by tasks.getting

tests/build.gradle.kts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,4 @@ subprojects {
219219
}
220220

221221
disableDocumentationTasks()
222-
223-
afterEvaluate {
224-
val kspKotlin by tasks.getting
225-
val launchSpineCompiler by tasks.getting
226-
kspKotlin.dependsOn(launchSpineCompiler)
227-
228-
val kspTestKotlin by tasks.getting
229-
val launchTestSpineCompiler by tasks.getting
230-
kspTestKotlin.dependsOn(launchTestSpineCompiler)
231-
}
232222
}

version.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@
2929
*
3030
* Do not rename this property, as it is also used in the integration tests via its name.
3131
*/
32-
val coreJvmCompilerVersion by extra("2.0.0-SNAPSHOT.018")
32+
val coreJvmCompilerVersion by extra("2.0.0-SNAPSHOT.019")
3333
val versionToPublish by extra(coreJvmCompilerVersion)

0 commit comments

Comments
 (0)