mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Right now, the `zipBaseName` variable in various publish.gradle files contains the group ID and artifact ID for use by the combiner, however, they are also duplicated in `artifactGroupId` and `baseArtifactId`, leading to potential mistakes if they aren't updated together. This fixes that by adding a new utility function `makeZipBaseName` to automatically create the right name given a group ID and artifact ID. This also fixes publishing for thirdparty subprojects, which didn't update `zipBaseName`.
110 lines
2.5 KiB
Groovy
110 lines
2.5 KiB
Groovy
apply plugin: 'maven-publish'
|
|
|
|
def baseExamplesArtifactId = 'examples'
|
|
def baseTemplatesArtifactId = 'templates'
|
|
def baseCommandsArtifactId = 'commands'
|
|
def artifactGroupId = 'org.wpilib.wpilibj'
|
|
|
|
def examplesZipBaseName = makeZipBaseName(artifactGroupId, baseExamplesArtifactId)
|
|
def templatesZipBaseName = makeZipBaseName(artifactGroupId, baseTemplatesArtifactId)
|
|
def commandsZipBaseName = makeZipBaseName(artifactGroupId, baseCommandsArtifactId)
|
|
|
|
def outputsFolder = file("$project.buildDir/outputs")
|
|
|
|
def mainFile = file("$projectDir/src/main/java/org/wpilib/Main.java")
|
|
|
|
task javaExamplesZip(type: Zip) {
|
|
destinationDirectory = outputsFolder
|
|
archiveBaseName = examplesZipBaseName
|
|
|
|
from(licenseFile) {
|
|
into '/'
|
|
}
|
|
|
|
from(mainFile) {
|
|
into '/'
|
|
}
|
|
|
|
from('src/main/java/org/wpilib/examples') {
|
|
into 'examples'
|
|
}
|
|
|
|
from('src/test/java/org/wpilib/examples') {
|
|
into 'examples_test'
|
|
}
|
|
}
|
|
|
|
task javaTemplatesZip(type: Zip) {
|
|
destinationDirectory = outputsFolder
|
|
archiveBaseName = templatesZipBaseName
|
|
|
|
from(licenseFile) {
|
|
into '/'
|
|
}
|
|
|
|
from(mainFile) {
|
|
into '/'
|
|
}
|
|
|
|
from('src/main/java/org/wpilib/templates') {
|
|
into 'templates'
|
|
}
|
|
|
|
from('src/test/java/org/wpilib/templates') {
|
|
into 'templates_test'
|
|
}
|
|
}
|
|
|
|
task javaCommandsZip(type: Zip) {
|
|
destinationDirectory = outputsFolder
|
|
archiveBaseName = commandsZipBaseName
|
|
|
|
from(licenseFile) {
|
|
into '/'
|
|
}
|
|
|
|
from('src/main/java/org/wpilib/commands') {
|
|
into 'commands'
|
|
}
|
|
|
|
from('src/test/java/org/wpilib/commands') {
|
|
into 'commands_test'
|
|
}
|
|
}
|
|
|
|
build.dependsOn javaTemplatesZip
|
|
build.dependsOn javaExamplesZip
|
|
build.dependsOn javaCommandsZip
|
|
|
|
addTaskToCopyAllOutputs(javaTemplatesZip)
|
|
addTaskToCopyAllOutputs(javaExamplesZip)
|
|
addTaskToCopyAllOutputs(javaCommandsZip)
|
|
|
|
publishing {
|
|
publications {
|
|
examples(MavenPublication) {
|
|
artifact javaExamplesZip
|
|
|
|
artifactId = baseExamplesArtifactId
|
|
groupId = artifactGroupId
|
|
version = wpilibVersioning.version.get()
|
|
}
|
|
|
|
templates(MavenPublication) {
|
|
artifact javaTemplatesZip
|
|
|
|
artifactId = baseTemplatesArtifactId
|
|
groupId = artifactGroupId
|
|
version = wpilibVersioning.version.get()
|
|
}
|
|
|
|
commands(MavenPublication) {
|
|
artifact javaCommandsZip
|
|
|
|
artifactId = baseCommandsArtifactId
|
|
groupId = artifactGroupId
|
|
version = wpilibVersioning.version.get()
|
|
}
|
|
}
|
|
}
|