Adds publishing for examples and templates so they can be grabbed from eclipse (#674)

This commit is contained in:
Thad House
2017-10-21 15:33:42 -07:00
committed by Peter Johnson
parent a1ea448406
commit 1e528669ff
4 changed files with 143 additions and 0 deletions

View File

@@ -110,4 +110,5 @@ if (!project.hasProperty('skipAthena')) {
}
}
}
apply from: 'publish.gradle'
}

View File

@@ -0,0 +1,70 @@
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 baseExamplesArtifactId = 'examples'
def baseTemplatesArtifactId = 'templates'
def artifactGroupId = 'edu.wpi.first.wpilibc'
def outputsFolder = file("$project.buildDir/outputs")
task cppExamplesZip(type: Zip) {
destinationDir = outputsFolder
baseName = 'examples'
from(licenseFile) {
into '/'
}
from('src/main/cpp/examples') {
into 'examples'
}
}
task cppTemplatesZip(type: Zip) {
destinationDir = outputsFolder
baseName = 'templates'
from(licenseFile) {
into '/'
}
from('src/main/cpp/templates') {
into 'templates'
}
}
build.dependsOn cppTemplatesZip
build.dependsOn cppExamplesZip
publishing {
publications {
examples(MavenPublication) {
artifact cppExamplesZip
artifactId = baseExamplesArtifactId
groupId artifactGroupId
version pubVersion
}
templates(MavenPublication) {
artifact cppTemplatesZip
artifactId = baseTemplatesArtifactId
groupId artifactGroupId
version pubVersion
}
}
}

View File

@@ -26,3 +26,5 @@ gradle.projectsEvaluated {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Werror"
}
}
apply from: 'publish.gradle'

View File

@@ -0,0 +1,70 @@
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 baseExamplesArtifactId = 'examples'
def baseTemplatesArtifactId = 'templates'
def artifactGroupId = 'edu.wpi.first.wpilibj'
def outputsFolder = file("$project.buildDir/outputs")
task javaExamplesZip(type: Zip) {
destinationDir = outputsFolder
baseName = 'examples'
from(licenseFile) {
into '/'
}
from('src/main/java/edu/wpi/first/wpilibj/examples') {
into 'examples'
}
}
task javaTemplatesZip(type: Zip) {
destinationDir = outputsFolder
baseName = 'templates'
from(licenseFile) {
into '/'
}
from('src/main/java/edu/wpi/first/wpilibj/templates') {
into 'templates'
}
}
build.dependsOn javaTemplatesZip
build.dependsOn javaExamplesZip
publishing {
publications {
examples(MavenPublication) {
artifact javaExamplesZip
artifactId = baseExamplesArtifactId
groupId artifactGroupId
version pubVersion
}
templates(MavenPublication) {
artifact javaTemplatesZip
artifactId = baseTemplatesArtifactId
groupId artifactGroupId
version pubVersion
}
}
}