forked from wpilibsuite/ntcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.gradle
132 lines (111 loc) · 3.71 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import org.gradle.internal.os.OperatingSystem
apply plugin: 'maven-publish'
apply plugin: 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin'
def getVersion = {
if (WPILibVersion.version.contains('-'))
return WPILibVersion.version.substring(WPILibVersion.version.indexOf('-'))
else
return ""
}
if (!hasProperty('releaseType')) {
WPILibVersion {
releaseType = 'dev'
}
}
def ntVersion
def utilVersion
if (project.hasProperty("ntPublishVersion")) {
ntVersion = project.ntPublishVersion
} else {
ntVersion = WPILibVersion.version
}
if (project.hasProperty("utilPublishVersion")) {
utilVersion = project.utilPublishVersion
} else {
utilVersion = "1.0.2${-> getVersion()}"
}
def utilFile = file("$buildDir/wpiutil.txt")
def ntcoreFile = file("$buildDir/ntcore.txt")
task outputVersions() {
description = 'Prints the versions of ntcore and wpiutil to a file for use by the downstream packaging project'
group = 'Build'
outputs.files(utilFile, ntcoreFile)
doFirst {
buildDir.mkdir()
}
doLast {
utilFile.write utilVersion
ntcoreFile.write ntVersion
}
}
task clean(type: Delete) {
delete utilFile
delete ntcoreFile
}
outputVersions.mustRunAfter clean
project(':native:wpiutil').build.dependsOn outputVersions
project(':native:ntcore').build.dependsOn outputVersions
if (project.buildArm) {
project(':arm:wpiutil').build.dependsOn outputVersions
project(':arm:ntcore').build.dependsOn outputVersions
}
// We change what repo we publish to depending on whether this is a development, beta, stable, or full
// release. This is set up in the main gradle file.
publishing {
publications {
def nat = project('native:ntcore')
if (!project.hasProperty('skipJava')) {
java(MavenPublication) {
artifact nat.jar
artifact nat.networktablesJavaSource
artifact nat.networktablesJavadoc
if (project.buildArm) {
def natArm = project('arm:ntcore')
artifact natArm.jar
// If the library is not embedded include it in the repo
if (!project.hasProperty('compilerPrefix')) {
artifact natArm.ntcoreZip
}
}
if (project.hasProperty('makeDesktop')) {
artifact nat.jar, {
classifier = 'desktop'
}
}
groupId 'edu.wpi.first.wpilib.networktables.java'
artifactId 'NetworkTables'
version ntVersion
}
}
cpp(MavenPublication) {
artifact nat.ntcoreZip
artifact ntcoreSourceZip
if (project.buildArm) {
artifact project(':arm:ntcore').ntcoreZip
}
if (project.hasProperty('makeDesktop')) {
artifact nat.ntcoreZip, {
classifier = 'desktop'
}
}
groupId 'edu.wpi.first.wpilib.networktables.cpp'
artifactId 'NetworkTables'
version ntVersion
}
wpiutil(MavenPublication) {
artifact project(':native:wpiutil').wpiutilZip
artifact wpiutilSourceZip
if (project.buildArm) {
artifact project(':arm:wpiutil').wpiutilZip
}
if (project.hasProperty('makeDesktop')) {
artifact project(':native:wpiutil').wpiutilZip, {
classifier = 'desktop'
}
}
groupId 'edu.wpi.first.wpilib'
artifactId 'wpiutil'
version utilVersion
}
}
}