blob: 854a99677b37c1c3fbd533456ed5db8eab173402 [file] [log] [blame]
Brian Silverman41cdd3e2019-01-19 19:48:58 -08001apply plugin: 'maven-publish'
2
3def pubVersion
4if (project.hasProperty("publishVersion")) {
5 pubVersion = project.publishVersion
6} else {
7 pubVersion = WPILibVersion.version
8}
9
10def outputsFolder = file("$buildDir/outputs")
11
12def baseArtifactId = nativeName
13def artifactGroupId = "edu.wpi.first.${nativeName}"
14def zipBaseName = "_GROUP_edu_wpi_first_${nativeName}_ID_${nativeName}-cpp_CLS"
15
16def licenseFile = file("$rootDir/license.txt")
17
18task cppSourcesZip(type: Zip) {
19 destinationDir = outputsFolder
20 baseName = zipBaseName
21 classifier = "sources"
22
23 from(licenseFile) {
24 into '/'
25 }
26
27 from('src/main/native/cpp') {
28 into '/'
29 }
30}
31
32task cppHeadersZip(type: Zip) {
33 destinationDir = outputsFolder
34 baseName = zipBaseName
35 classifier = "headers"
36
37 from(licenseFile) {
38 into '/'
39 }
40
41 from('src/main/native/include') {
42 into '/'
43 }
44}
45
46artifacts {
47 archives cppHeadersZip
48 archives cppSourcesZip
49}
50
51addTaskToCopyAllOutputs(cppSourcesZip)
52addTaskToCopyAllOutputs(cppHeadersZip)
53
54model {
55 publishing {
56 def taskList = createComponentZipTasks($.components, [nativeName], zipBaseName, Zip, project, includeStandardZipFormat)
57
58 publications {
59 cpp(MavenPublication) {
60 taskList.each {
61 artifact it
62 }
63 artifact cppHeadersZip
64 artifact cppSourcesZip
65
66 artifactId = "${baseArtifactId}-cpp"
67 groupId artifactGroupId
68 version pubVersion
69 }
70 }
71 }
72}