Skip to content

Commit

Permalink
include transitive dependencies in procedural plugin
Browse files Browse the repository at this point in the history
this even further simplifies the end users build.gradle scripts
  • Loading branch information
skovati committed Oct 14, 2024
1 parent 117a3cf commit c9c0324
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
9 changes: 4 additions & 5 deletions procedural/plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ tasks.publish {
dependsOn("check")
}

version = '0.0.1'

publishing {
publications {
maven(MavenPublication)
pluginMaven(MavenPublication)
}
repositories {
maven {
name = findProperty("publishing.name")
url = findProperty("publishing.url")
name="GitHubCopiePackages"
url="https://maven.pkg.github.com/skovati/copie"
version=findProperty("publishing.version")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

// afterEvaluate ensures these dependencies are passed to projects applying this plugin, not this plugin itself
project.afterEvaluate {
dependencies {
annotationProcessor findProject(':procedural:processor') ?: "gov.nasa.ammos.aerie.procedural:processor:${findProperty("aerieVersion")}"
implementation findProject(':procedural:constraints') ?: "gov.nasa.ammos.aerie.procedural:constraints:${findProperty("aerieVersion")}"
implementation findProject(':procedural:scheduling') ?: "gov.nasa.ammos.aerie.procedural:scheduling:${findProperty("aerieVersion")}"
implementation findProject(':procedural:timeline') ?: "gov.nasa.ammos.aerie.procedural:timeline:${findProperty("aerieVersion")}"
implementation findProject(':merlin-driver') ?: "gov.nasa.jpl.aerie:merlin-driver:${findProperty("aerieVersion")}"
implementation findProject(':type-utils') ?: "gov.nasa.jpl.aerie:type-utils:${findProperty("aerieVersion")}"
implementation findProject(':contrib') ?: "gov.nasa.jpl.aerie:contrib:${findProperty("aerieVersion")}"
}
}

tasks.register('buildAllSchedulingProcedureJars') {
group = 'SchedulingProcedureJars'

Expand Down Expand Up @@ -28,16 +41,16 @@ tasks.create("generateSchedulingProcedureJarTasks") {

files.toList().each { file ->
final nameWithoutExtension = file.name.replace(".java", "")
final jarPath = nameWithoutExtension + ".jar"
final taskName = "buildSchedulingProcedureJar_${nameWithoutExtension}"

println "Generating ${taskName} task, which will build ${nameWithoutExtension}.jar"
println "Generating ${taskName} task, which will build ${jarPath}"

tasks.create(taskName, ShadowJar) {
group = 'SchedulingProcedureJars'
configurations = [project.configurations.compileClasspath]
configurations = [project.configurations.runtimeClasspath]
from sourceSets.main.output
archiveBaseName = "" // clear
archiveClassifier.set(nameWithoutExtension) // set output jar name
archiveFileName = jarPath
manifest {
attributes 'Main-Class': getMainClassFromGeneratedFile(file)
}
Expand Down

0 comments on commit c9c0324

Please sign in to comment.