| apply plugin: 'maven-publish' |
| apply plugin: 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' |
| |
| if (!hasProperty('releaseType')) { |
| WPILibVersion { |
| releaseType = 'dev' |
| } |
| } |
| |
| def pubVersion |
| if (project.hasProperty("publishVersion")) { |
| pubVersion = project.publishVersion |
| } else { |
| pubVersion = WPILibVersion.version |
| } |
| |
| def baseArtifactId = 'wpilibj' |
| def artifactGroupId = 'edu.wpi.first.wpilibj' |
| |
| def outputsFolder = file("$project.buildDir/outputs") |
| |
| task cppSourcesZip(type: Zip) { |
| destinationDir = outputsFolder |
| baseName = 'wpilibJNI' |
| classifier = "sources" |
| |
| from(licenseFile) { |
| into '/' |
| } |
| |
| from('src/main/native/cpp') { |
| into '/' |
| } |
| |
| model { |
| tasks { |
| it.each { |
| if (it in getJNIHeadersClass()) { |
| from (it.outputs.files) { |
| into '/' |
| } |
| dependsOn it |
| } |
| } |
| } |
| } |
| } |
| |
| task sourcesJar(type: Jar, dependsOn: classes) { |
| classifier = 'sources' |
| from sourceSets.main.allSource |
| } |
| |
| task javadoc(type: Javadoc, overwrite: true) { |
| javadoc.options.links("http://docs.oracle.com/javase/8/docs/api/") |
| options.addStringOption "tag", "pre:a:Pre-Condition" |
| options.addStringOption('Xdoclint:accessibility,syntax,html', '-quiet') |
| source = sourceSets.main.allJava |
| failOnError = true |
| } |
| |
| task javadocJar(type: Jar, dependsOn: javadoc) { |
| classifier = 'javadoc' |
| from javadoc.destinationDir |
| } |
| |
| if (project.hasProperty('jenkinsBuild')) { |
| jar { |
| classifier = 'javaArtifact' |
| } |
| } |
| |
| artifacts { |
| archives sourcesJar |
| archives javadocJar |
| archives cppSourcesZip |
| } |
| |
| model { |
| publishing { |
| def wpilibJNIStaticTaskList = createComponentZipTasks($.components, 'wpilibJNIStatic', 'jni', Jar, project, { task, value -> |
| value.each { binary-> |
| if (binary.buildable) { |
| if (binary instanceof SharedLibraryBinarySpec) { |
| task.dependsOn binary.buildTask |
| task.from (binary.sharedLibraryFile) { |
| into getPlatformPath(binary) |
| } |
| } |
| } |
| } |
| }) |
| |
| def wpilibJNISharedTaskList = createComponentZipTasks($.components, 'wpilibJNIShared', 'jni', Jar, project, { task, value -> |
| value.each { binary-> |
| if (binary.buildable) { |
| if (binary instanceof SharedLibraryBinarySpec) { |
| task.dependsOn binary.buildTask |
| task.from (binary.sharedLibraryFile) { |
| into getPlatformPath(binary) + '/shared' |
| } |
| task.from(new File(binary.sharedLibraryFile.absolutePath + ".debug")) { |
| into getPlatformPath(binary) + '/shared' |
| } |
| } |
| } |
| } |
| }) |
| |
| def allSharedTask |
| if (!project.hasProperty('jenkinsBuild')) { |
| allSharedTask = createAllCombined(wpilibJNISharedTaskList, 'wpilibJNIShared', 'jni', Jar, project) |
| } |
| |
| def allStaticTask |
| if (!project.hasProperty('jenkinsBuild')) { |
| allStaticTask = createAllCombined(wpilibJNIStaticTaskList, 'wpilibJNIStatic', 'jni', Jar, project) |
| } |
| |
| publications { |
| jniShared(MavenPublication) { |
| wpilibJNISharedTaskList.each { |
| artifact it |
| } |
| |
| if (!project.hasProperty('jenkinsBuild')) { |
| artifact allSharedTask |
| } |
| |
| artifact cppSourcesZip |
| |
| artifactId = "${baseArtifactId}-jniShared" |
| groupId artifactGroupId |
| version pubVersion |
| } |
| |
| jni(MavenPublication) { |
| wpilibJNIStaticTaskList.each { |
| artifact it |
| } |
| |
| if (!project.hasProperty('jenkinsBuild')) { |
| artifact allStaticTask |
| } |
| |
| artifact cppSourcesZip |
| |
| artifactId = "${baseArtifactId}-jni" |
| groupId artifactGroupId |
| version pubVersion |
| } |
| } |
| } |
| } |
| |
| |
| publishing { |
| publications { |
| |
| java(MavenPublication) { |
| artifact jar |
| artifact sourcesJar |
| artifact javadocJar |
| |
| artifactId = "${baseArtifactId}-java" |
| groupId artifactGroupId |
| version pubVersion |
| } |
| } |
| } |