Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor Gradle caching issues #25

Merged
merged 1 commit into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"))
}