Skip to content

Commit

Permalink
Fix minor Gradle caching issues (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
snazy authored Jun 30, 2021
1 parent 5e42051 commit 046cd6f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -58,6 +59,11 @@ class ReflectionConfigPlugin : Plugin<Project> {
tasks.named(processResourcesTaskName) {
dependsOn(genRefCfg)
}
try {
tasks.named(sourcesJarTaskName) {
dependsOn(genRefCfg)
}
} catch (ignore: UnknownTaskException) { null }
}
}
}
5 changes: 5 additions & 0 deletions conformance/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,8 @@ protobuf {
artifact = "com.google.protobuf:protoc:$versionProtobuf"
}
}

// The protobuf-plugin should ideally do this
tasks.named<Jar>("sourcesJar") {
dependsOn(tasks.named("generateProto"))
}
2 changes: 2 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ tasks.register<Jar>("testJar") {
val testClasses = tasks.getByName<JavaCompile>("compileTestJava")
val baseJar = tasks.getByName<Jar>("jar")
from(testClasses.destinationDirectory)
dependsOn(testClasses)
dependsOn(tasks.named("processTestResources"))
archiveBaseName.set(baseJar.archiveBaseName)
destinationDirectory.set(baseJar.destinationDirectory)
archiveClassifier.set("tests")
Expand Down
5 changes: 5 additions & 0 deletions generated-antlr/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Jar>("sourcesJar") {
dependsOn(tasks.named("generateGrammarSource"))
}
7 changes: 7 additions & 0 deletions generated-pb/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ tasks.register<Jar>("testJar") {
val testClasses = tasks.getByName<JavaCompile>("compileTestJava")
val baseJar = tasks.getByName<Jar>("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")
Expand All @@ -96,3 +98,8 @@ artifacts {
builtBy(testJar)
}
}

// The protobuf-plugin should ideally do this
tasks.named<Jar>("sourcesJar") {
dependsOn(tasks.named("generateProto"))
}

0 comments on commit 046cd6f

Please sign in to comment.