forked from ihmcrobotics/ihmc-open-robotics-software
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
165 lines (131 loc) · 3.97 KB
/
build.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.ajoberstar:gradle-git:1.4.0-rc.1'
}
}
apply plugin: 'maven-publish'
import org.ajoberstar.grgit.*
project.ext.repo = Grgit.open(projectDir)
version = '0.7.10'
project.ext.fullVersion = version
project.ext.vcsUrl = "https://github.com/ihmcrobotics/ihmc-open-robotics-software"
project.ext.snapshotCounter = 1
project.ext.releaseCandidateCounter = 1
getDate()
if (buildType.equals("NIGHTLY")) {
project.ext.fullVersion = version += "-NIGHTLY+date.${project.ext.date}.rev.${repo.head().abbreviatedId}"
}
if (buildType.equals("LOCAL")) {
project.ext.fullVersion = "LOCAL"
}
if (buildType.equals("SNAPSHOT")) {
project.ext.fullVersion = version += "-SNAPSHOT${project.ext.snapshotCounter}.rev.${repo.head().abbreviatedId}"
}
if (buildType.equals("RC")) {
project.ext.fullVersion = version += "-RC${project.ext.releaseCandidateCounter}.rev.${repo.head().abbreviatedId}"
}
if (buildType.equals("RELEASE")) {
if (!project.ext.repo.branch.current.name.equals("master")) {
throw new GradleException("Cannot make RELEASE build from branch \"${project.ext.repo.branch.current.name}\", it is not the branch used for stable releases!")
}
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven {
url "https://bengal.ihmc.us/nexus/content/repositories/thirdparty/"
}
}
task performRelease(type: GradleBuild) {
if (!buildType.equals("RELEASE")) {
return
}
buildFile "build.gradle"
startParameter gradle.startParameter
tasks = ["bintrayUpload", ":RobotDataCommunication:publishLoggerDistributionToBintray"]
}
task publishAllToMavenLocal(type: GradleBuild) {
buildFile "build.gradle"
def allTasks = new ArrayList<String>()
subprojects.each { subproject ->
allTasks.add(":" + subproject.name + ":publishToMavenLocal")
}
tasks = allTasks
}
gradle.taskGraph.whenReady { TaskExecutionGraph graph ->
if (graph.hasTask(publishAllToMavenLocal)) {
buildType = "LOCAL"
project.ext.fullVersion = "LOCAL"
subprojects.each { subproject ->
subproject.ext.fullVersion = "LOCAL"
}
}
if (graph.hasTask(performRelease)) {
if (!buildType.equals("RELEASE")) {
throw new GradleException("Cannot perform release unless -PbuildType=RELEASE")
}
}
}
subprojects { subproject ->
apply plugin: 'maven-publish'
apply plugin: 'java'
subproject.ext {
getOpenRoboticsSoftwareProject = {
if (subproject.getParent().name.equals(rootProject.name)) {
return rootProject
} else {
return project(':IHMCOpenRoboticsSoftware')
}
}
getOpenRoboticsSoftwareGradlePath = {
if (subproject.getParent().name.equals(rootProject.name)) {
return ""
} else {
return ":IHMCOpenRoboticsSoftware"
}
}
}
jar {
from(project.projectDir) {
include 'LICENSE*txt'
}
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId 'us.ihmc'
artifactId "${project.name}"
version "${project.ext.fullVersion}"
from components.java
artifact sourceJar {
classifier "sources"
}
pom.withXml {
def licenseNode = asNode().appendNode('licenses').appendNode('license')
licenseNode.appendNode('name', project.ext.licenseName)
licenseNode.appendNode('url', project.ext.licenseURL)
}
}
}
}
task testFast(type: Test) {
ignoreFailures true
include "**/*FastTestSuite.class"
}
task testSlow(type: Test) {
ignoreFailures true
include "**/*SlowTestSuite.class"
}
}
def getDate() {
def date = new Date()
def formattedDate = date.format('yyyy.MM.dd')
project.ext.date = formattedDate
}