apply plugin: 'maven-publish' def pubVersion if (project.hasProperty("publishVersion")) { pubVersion = project.publishVersion } else { pubVersion = WPILibVersion.version } def baseExamplesArtifactId = 'examples' def baseTemplatesArtifactId = 'templates' def baseCommandsArtifactId = 'commands' def artifactGroupId = 'edu.wpi.first.wpilibc' def outputsFolder = file("$project.buildDir/outputs") task cppExamplesZip(type: Zip) { destinationDir = outputsFolder baseName = 'wpilibc-examples' from(licenseFile) { into '/' } from('src/main/cpp/examples') { into 'examples' } } task cppTemplatesZip(type: Zip) { destinationDir = outputsFolder baseName = 'wpilibc-templates' from(licenseFile) { into '/' } from('src/main/cpp/templates') { into 'templates' } } task cppCommandsZip(type: Zip) { destinationDir = outputsFolder baseName = 'wpilibc-commands' from(licenseFile) { into '/' } from('src/main/cpp/commands') { into 'commands' } } build.dependsOn cppTemplatesZip build.dependsOn cppExamplesZip build.dependsOn cppCommandsZip publishing { publications { examples(MavenPublication) { artifact cppExamplesZip artifactId = baseExamplesArtifactId groupId artifactGroupId version pubVersion } templates(MavenPublication) { artifact cppTemplatesZip artifactId = baseTemplatesArtifactId groupId artifactGroupId version pubVersion } commands(MavenPublication) { artifact cppCommandsZip artifactId = baseCommandsArtifactId groupId artifactGroupId version pubVersion } } }