-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.gradle
103 lines (82 loc) · 2.59 KB
/
publish.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
apply plugin: 'maven-publish'
// Ensure that the WPILibVersioningPlugin is setup by setting the release type, if releaseType wasn't
// already specified on the command line
if (!hasProperty('releaseType')) {
WPILibVersion {
releaseType = 'dev'
}
}
ext.licenseFile = files("$rootDir/LICENSE.txt")
def pubVersion = ''
if(ext.hasProperty("coreVersion")){
pubVersion = ext.coreVersion
}
else{
pubVersion = WPILibVersion.version
}
def outputsFolder = file("$buildDir/allOutputs")
def versionFile = file("$outputsFolder/version.txt")
task outputVersions() {
description = 'Prints the versions of wpilib to a file for use by the downstream packaging project'
group = 'Build'
outputs.files(versionFile)
doFirst {
buildDir.mkdir()
outputsFolder.mkdir()
}
doLast {
versionFile.write pubVersion
}
}
task libraryBuild() {}
build.dependsOn outputVersions
task copyAllOutputs(type: Copy) {
destinationDir outputsFolder
}
build.dependsOn copyAllOutputs
copyAllOutputs.dependsOn outputVersions
ext.addTaskToCopyAllOutputs = { task ->
copyAllOutputs.dependsOn task
copyAllOutputs.inputs.file task.archivePath
copyAllOutputs.from task.archivePath
}
//Publishes to folder with name core under com/ctre/phoenix
def baseArtifactId = 'core'
def artifactGroupId = 'com.ctre.phoenix'
def zipBaseName = '_GROUP_com_ctre_phoenix_ID_core_CLS'
task cppHeadersZip(type: Zip) {
destinationDir = outputsFolder
baseName = zipBaseName
classifier = "headers"
from(licenseFile) {
into '/'
}
from('src/include') {
into '/'
}
}
build.dependsOn cppHeadersZip
addTaskToCopyAllOutputs(cppHeadersZip)
model {
publishing {
def coreTaskList = createComponentZipTasks($.components, 'FakeLibForPublish', zipBaseName, Zip, project, includeStandardZipFormat)
def allTask
if (!project.hasProperty('jenkinsBuild')) {
allTask = createAllCombined(coreTaskList, 'FakeLibForPublish', zipBaseName, Zip, project)
}
publications {
cpp(MavenPublication) {
coreTaskList.each {
artifact it
}
if (!project.hasProperty('jenkinsBuild')) {
artifact allTask
}
artifact cppHeadersZip
artifactId = baseArtifactId
groupId artifactGroupId
version pubVersion
}
}
}
}