diff --git a/build-tools/src/main/kotlin/org/projectnessie/cel/tools/plugins/ReflectionConfigPlugin.kt b/build-tools/src/main/kotlin/org/projectnessie/cel/tools/plugins/ReflectionConfigPlugin.kt index e39d1b33..52c69e66 100644 --- a/build-tools/src/main/kotlin/org/projectnessie/cel/tools/plugins/ReflectionConfigPlugin.kt +++ b/build-tools/src/main/kotlin/org/projectnessie/cel/tools/plugins/ReflectionConfigPlugin.kt @@ -18,6 +18,7 @@ package org.projectnessie.cel.tools.plugins import org.gradle.api.Plugin import org.gradle.api.Project +import org.gradle.api.UnknownTaskException import org.gradle.api.plugins.JavaLibraryPlugin import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.SourceSetContainer @@ -58,6 +59,11 @@ class ReflectionConfigPlugin : Plugin { tasks.named(processResourcesTaskName) { dependsOn(genRefCfg) } + try { + tasks.named(sourcesJarTaskName) { + dependsOn(genRefCfg) + } + } catch (ignore: UnknownTaskException) { null } } } } diff --git a/conformance/build.gradle.kts b/conformance/build.gradle.kts index 739ca3a2..f2ed340b 100644 --- a/conformance/build.gradle.kts +++ b/conformance/build.gradle.kts @@ -69,3 +69,8 @@ protobuf { artifact = "com.google.protobuf:protoc:$versionProtobuf" } } + +// The protobuf-plugin should ideally do this +tasks.named("sourcesJar") { + dependsOn(tasks.named("generateProto")) +} diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 071a2d33..e5d4208e 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -59,6 +59,8 @@ tasks.register("testJar") { val testClasses = tasks.getByName("compileTestJava") val baseJar = tasks.getByName("jar") from(testClasses.destinationDirectory) + dependsOn(testClasses) + dependsOn(tasks.named("processTestResources")) archiveBaseName.set(baseJar.archiveBaseName) destinationDirectory.set(baseJar.destinationDirectory) archiveClassifier.set("tests") diff --git a/generated-antlr/build.gradle.kts b/generated-antlr/build.gradle.kts index b86885ce..c7a598c8 100644 --- a/generated-antlr/build.gradle.kts +++ b/generated-antlr/build.gradle.kts @@ -27,3 +27,8 @@ dependencies { antlr("org.antlr:antlr4:$versionAntlr") // TODO remove from runtime-classpath *sigh* implementation("org.antlr:antlr4-runtime:$versionAntlr") } + +// The antlr-plugin should ideally do this +tasks.named("sourcesJar") { + dependsOn(tasks.named("generateGrammarSource")) +} diff --git a/generated-pb/build.gradle.kts b/generated-pb/build.gradle.kts index 8ccb34a7..1f454510 100644 --- a/generated-pb/build.gradle.kts +++ b/generated-pb/build.gradle.kts @@ -86,6 +86,8 @@ tasks.register("testJar") { val testClasses = tasks.getByName("compileTestJava") val baseJar = tasks.getByName("jar") from(testClasses.destinationDirectory, project.buildDir.resolve("resources/test")) + dependsOn(testClasses) + dependsOn(tasks.named("processTestResources")) archiveBaseName.set(baseJar.archiveBaseName) destinationDirectory.set(baseJar.destinationDirectory) archiveClassifier.set("tests") @@ -96,3 +98,8 @@ artifacts { builtBy(testJar) } } + +// The protobuf-plugin should ideally do this +tasks.named("sourcesJar") { + dependsOn(tasks.named("generateProto")) +}