John Park | 7eb9042 | 2018-01-27 12:04:57 -0800 | [diff] [blame] | 1 | apply plugin: 'maven-publish' |
| 2 | apply plugin: 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' |
| 3 | |
| 4 | if (!hasProperty('releaseType')) { |
| 5 | WPILibVersion { |
| 6 | releaseType = 'dev' |
| 7 | } |
| 8 | } |
| 9 | |
| 10 | def pubVersion |
| 11 | if (project.hasProperty("publishVersion")) { |
| 12 | pubVersion = project.publishVersion |
| 13 | } else { |
| 14 | pubVersion = WPILibVersion.version |
| 15 | } |
| 16 | |
| 17 | def baseExamplesArtifactId = 'examples' |
| 18 | def baseTemplatesArtifactId = 'templates' |
| 19 | def artifactGroupId = 'edu.wpi.first.wpilibc' |
| 20 | |
| 21 | def outputsFolder = file("$project.buildDir/outputs") |
| 22 | |
| 23 | task cppExamplesZip(type: Zip) { |
| 24 | destinationDir = outputsFolder |
| 25 | baseName = 'wpilibc-examples' |
| 26 | |
| 27 | from(licenseFile) { |
| 28 | into '/' |
| 29 | } |
| 30 | |
| 31 | from('src/main/cpp/examples') { |
| 32 | into 'examples' |
| 33 | } |
| 34 | |
| 35 | from ('examples.xml') { |
| 36 | into 'examples' |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | task cppTemplatesZip(type: Zip) { |
| 41 | destinationDir = outputsFolder |
| 42 | baseName = 'wpilibc-templates' |
| 43 | |
| 44 | from(licenseFile) { |
| 45 | into '/' |
| 46 | } |
| 47 | |
| 48 | from('src/main/cpp/templates') { |
| 49 | into 'templates' |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | build.dependsOn cppTemplatesZip |
| 54 | build.dependsOn cppExamplesZip |
| 55 | |
| 56 | publishing { |
| 57 | publications { |
| 58 | examples(MavenPublication) { |
| 59 | artifact cppExamplesZip |
| 60 | |
| 61 | artifactId = baseExamplesArtifactId |
| 62 | groupId artifactGroupId |
| 63 | version pubVersion |
| 64 | } |
| 65 | |
| 66 | templates(MavenPublication) { |
| 67 | artifact cppTemplatesZip |
| 68 | |
| 69 | artifactId = baseTemplatesArtifactId |
| 70 | groupId artifactGroupId |
| 71 | version pubVersion |
| 72 | } |
| 73 | } |
| 74 | } |