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 = 'halsim-print' def artifactGroupId = 'edu.wpi.first.halsim' def outputsFolder = file("$project.buildDir/outputs") task cppSourcesZip(type: Zip) { destinationDir = outputsFolder baseName = 'halsim-print' classifier = "sources" from(licenseFile) { into '/' } from('src/main/native/cpp') { into '/' } } task cppHeadersZip(type: Zip) { destinationDir = outputsFolder baseName = 'halsim-print' classifier = "headers" from(licenseFile) { into '/' } from('src/main/native/include') { into '/' } } build.dependsOn cppSourcesZip build.dependsOn cppHeadersZip model { publishing { def pluginTaskList = createComponentZipTasks($.components, 'halsim_print', 'zipcpp', Zip, 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' } } } } }) def allTask if (!project.hasProperty('jenkinsBuild')) { allTask = createAllCombined(pluginTaskList, 'halsim_print', 'zipcpp', Zip, project) } publications { cpp(MavenPublication) { pluginTaskList.each { artifact it } if (!project.hasProperty('jenkinsBuild')) { artifact allTask } artifact cppHeadersZip artifact cppSourcesZip artifactId = baseArtifactId groupId artifactGroupId version pubVersion } } } }