import org.gradle.internal.os.OperatingSystem apply plugin: 'maven-publish' apply plugin: 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' def getVersion = { if (WPILibVersion.version.contains('-')) return WPILibVersion.version.substring(WPILibVersion.version.indexOf('-')) else return "" } if (!hasProperty('releaseType')) { WPILibVersion { releaseType = 'dev' } } def ntVersion def utilVersion if (project.hasProperty("ntPublishVersion")) { ntVersion = project.ntPublishVersion } else { ntVersion = WPILibVersion.version } if (project.hasProperty("utilPublishVersion")) { utilVersion = project.utilPublishVersion } else { utilVersion = "1.0.2${-> getVersion()}" } def utilFile = file("$buildDir/wpiutil.txt") def ntcoreFile = file("$buildDir/ntcore.txt") task outputVersions() { description = 'Prints the versions of ntcore and wpiutil to a file for use by the downstream packaging project' group = 'Build' outputs.files(utilFile, ntcoreFile) doFirst { buildDir.mkdir() } doLast { utilFile.write utilVersion ntcoreFile.write ntVersion } } task clean(type: Delete) { delete utilFile delete ntcoreFile } outputVersions.mustRunAfter clean project(':native:wpiutil').build.dependsOn outputVersions project(':native:ntcore').build.dependsOn outputVersions if (project.buildArm) { project(':arm:wpiutil').build.dependsOn outputVersions project(':arm:ntcore').build.dependsOn outputVersions } // We change what repo we publish to depending on whether this is a development, beta, stable, or full // release. This is set up in the main gradle file. publishing { publications { def nat = project('native:ntcore') if (!project.hasProperty('skipJava')) { java(MavenPublication) { artifact nat.jar artifact nat.networktablesJavaSource artifact nat.networktablesJavadoc if (project.buildArm) { def natArm = project('arm:ntcore') artifact natArm.jar // If the library is not embedded include it in the repo if (!project.hasProperty('compilerPrefix')) { artifact natArm.ntcoreZip } } if (project.hasProperty('makeDesktop')) { artifact nat.jar, { classifier = 'desktop' } } groupId 'edu.wpi.first.wpilib.networktables.java' artifactId 'NetworkTables' version ntVersion } } cpp(MavenPublication) { artifact nat.ntcoreZip artifact ntcoreSourceZip if (project.buildArm) { artifact project(':arm:ntcore').ntcoreZip } if (project.hasProperty('makeDesktop')) { artifact nat.ntcoreZip, { classifier = 'desktop' } } groupId 'edu.wpi.first.wpilib.networktables.cpp' artifactId 'NetworkTables' version ntVersion } wpiutil(MavenPublication) { artifact project(':native:wpiutil').wpiutilZip artifact wpiutilSourceZip if (project.buildArm) { artifact project(':arm:wpiutil').wpiutilZip } if (project.hasProperty('makeDesktop')) { artifact project(':native:wpiutil').wpiutilZip, { classifier = 'desktop' } } groupId 'edu.wpi.first.wpilib' artifactId 'wpiutil' version utilVersion } } }