blob: 924bf179848ed0845ad6237fa9a490012430d7e0 [file] [log] [blame]
John Park7eb90422018-01-27 12:04:57 -08001apply plugin: 'maven-publish'
2apply plugin: 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin'
3
4if (!hasProperty('releaseType')) {
5 WPILibVersion {
6 releaseType = 'dev'
7 }
8}
9
10def pubVersion = ''
11if (project.hasProperty("publishVersion")) {
12 pubVersion = project.publishVersion
13} else {
14 pubVersion = WPILibVersion.version
15}
16
17def baseArtifactId = 'hal'
18def artifactGroupId = 'edu.wpi.first.hal'
19
20def outputsFolder = file("$project.buildDir/outputs")
21
22task cppSourcesZip(type: Zip) {
23 destinationDir = outputsFolder
24 baseName = 'hal'
25 classifier = "sources"
26
27 from(licenseFile) {
28 into '/'
29 }
30
31 from('src/main/native/athena') {
32 into '/athena'
33 }
34
35 from('src/main/native/sim') {
36 into '/sim'
37 }
38
39 from('src/main/native/shared') {
40 into '/shared'
41 }
42}
43
44task cppHeadersZip(type: Zip) {
45 destinationDir = outputsFolder
46 baseName = 'hal'
47 classifier = "headers"
48
49 from(licenseFile) {
50 into '/'
51 }
52
53 from('src/main/native/include') {
54 into '/'
55 }
56}
57
58build.dependsOn cppHeadersZip
59build.dependsOn cppSourcesZip
60
61
62model {
63 publishing {
64 def halAthenaTaskList = []
65 if (!project.hasProperty('skipAthena')) {
66 halAthenaTaskList = createComponentZipTasks($.components, 'halAthena', 'zipcpp', Zip, project, includeStandardZipFormat)
67 }
68 def halSimTaskList = []
69 if (!project.hasProperty('onlyAthena')) {
70 halSimTaskList = createComponentZipTasks($.components, 'halSim', 'zipcpp', Zip, project, includeStandardZipFormat)
71 }
72
73 def allTask
74 if (!project.hasProperty('jenkinsBuild')) {
75 def combinedList = []
76 halAthenaTaskList.each {
77 combinedList.add(it)
78 }
79 halSimTaskList.each {
80 combinedList.add(it)
81 }
82 allTask = createAllCombined(combinedList, 'hal', 'zipcpp', Zip, project)
83 }
84
85 def halSimStaticDepsTaskList = []
86 if (project.hasProperty('buildHalStaticDeps')) {
87 halSimStaticDepsTaskList = createComponentZipTasks($.components, 'halSimStaticDeps', 'zipcpp', Zip, project, includeStandardZipFormat)
88 if (!project.hasProperty('jenkinsBuild')) {
89 def staticAllTask = createAllCombined(halSimStaticDepsTaskList, 'halSimStaticDeps', 'zipcpp', Zip, project)
90 halSimStaticDepsTaskList.add(staticAllTask)
91 }
92 }
93
94 publications {
95 cpp(MavenPublication) {
96 halAthenaTaskList.each {
97 artifact it
98 }
99 halSimTaskList.each {
100 artifact it
101 }
102 if (!project.hasProperty('jenkinsBuild')) {
103 artifact allTask
104 }
105 artifact cppHeadersZip
106 artifact cppSourcesZip
107
108 artifactId = baseArtifactId
109 groupId artifactGroupId
110 version pubVersion
111 }
112 if (project.hasProperty('buildHalStaticDeps')) {
113 cppStaticDeps(MavenPublication) {
114 halSimStaticDepsTaskList.each {
115 artifact it
116 }
117
118 artifactId = baseArtifactId + 'StaticDeps'
119 groupId artifactGroupId
120 version pubVersion
121 }
122 }
123 }
124 }
125}