Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 1 | apply plugin: 'maven-publish' |
| 2 | |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 3 | def baseExamplesArtifactId = 'examples' |
| 4 | def baseTemplatesArtifactId = 'templates' |
| 5 | def baseCommandsArtifactId = 'commands' |
| 6 | def artifactGroupId = 'edu.wpi.first.wpilibc' |
| 7 | |
| 8 | def examplesZipBaseName = '_GROUP_edu_wpi_first_wpilibc_ID_examples_CLS' |
| 9 | def templatesZipBaseName = '_GROUP_edu_wpi_first_wpilibc_ID_templates_CLS' |
| 10 | def commandsZipBaseName = '_GROUP_edu_wpi_first_wpilibc_ID_commands_CLS' |
| 11 | |
| 12 | def outputsFolder = file("$project.buildDir/outputs") |
| 13 | |
| 14 | task cppExamplesZip(type: Zip) { |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame] | 15 | destinationDirectory = outputsFolder |
| 16 | archiveBaseName = examplesZipBaseName |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 17 | |
| 18 | from(licenseFile) { |
| 19 | into '/' |
| 20 | } |
| 21 | |
| 22 | from('src/main/cpp/examples') { |
| 23 | into 'examples' |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | task cppTemplatesZip(type: Zip) { |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame] | 28 | destinationDirectory = outputsFolder |
| 29 | archiveBaseName = templatesZipBaseName |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 30 | |
| 31 | from(licenseFile) { |
| 32 | into '/' |
| 33 | } |
| 34 | |
| 35 | from('src/main/cpp/templates') { |
| 36 | into 'templates' |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | task cppCommandsZip(type: Zip) { |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame] | 41 | destinationDirectory = outputsFolder |
| 42 | archiveBaseName = commandsZipBaseName |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 43 | |
| 44 | from(licenseFile) { |
| 45 | into '/' |
| 46 | } |
| 47 | |
| 48 | from('src/main/cpp/commands') { |
| 49 | into 'commands' |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | build.dependsOn cppTemplatesZip |
| 54 | build.dependsOn cppExamplesZip |
| 55 | build.dependsOn cppCommandsZip |
| 56 | |
| 57 | addTaskToCopyAllOutputs(cppTemplatesZip) |
| 58 | addTaskToCopyAllOutputs(cppExamplesZip) |
| 59 | addTaskToCopyAllOutputs(cppCommandsZip) |
| 60 | |
| 61 | publishing { |
| 62 | publications { |
| 63 | examples(MavenPublication) { |
| 64 | artifact cppExamplesZip |
| 65 | |
| 66 | artifactId = baseExamplesArtifactId |
| 67 | groupId artifactGroupId |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 68 | version wpilibVersioning.version.get() |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | templates(MavenPublication) { |
| 72 | artifact cppTemplatesZip |
| 73 | |
| 74 | artifactId = baseTemplatesArtifactId |
| 75 | groupId artifactGroupId |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 76 | version wpilibVersioning.version.get() |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | commands(MavenPublication) { |
| 80 | artifact cppCommandsZip |
| 81 | |
| 82 | artifactId = baseCommandsArtifactId |
| 83 | groupId artifactGroupId |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 84 | version wpilibVersioning.version.get() |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 85 | } |
| 86 | } |
| 87 | } |