1
1
buildscript {
2
- repositories { jcenter() }
2
+ repositories {
3
+ jcenter()
4
+ maven {
5
+ url " https://plugins.gradle.org/m2/"
6
+ }
7
+ }
3
8
4
9
dependencies {
5
10
classpath ' com.netflix.nebula:gradle-aggregate-javadocs-plugin:2.2.+'
11
+ classpath ' net.ltgt.gradle:gradle-errorprone-plugin:0.0.8'
6
12
}
7
13
}
8
14
plugins {
@@ -15,10 +21,78 @@ plugins {
15
21
}
16
22
apply plugin : ' nebula-aggregate-javadocs'
17
23
24
+ def getGitCommit = { ->
25
+ String HEAD_REF = new File (rootDir, ' .git/HEAD' ). text. replace(" ref: " , " " ). replace(" \n " , " " )
26
+ String COMMIT_HASH = new File (rootDir, " .git/${ HEAD_REF} " ). text. substring(0 , 7 )
27
+ return COMMIT_HASH
28
+ }
29
+
30
+ idea. project {
31
+ ipr. withXml { provider ->
32
+ def node = provider. asNode()
33
+ def compilerConfig = node. component. find { it. ' @name' == ' CompilerConfiguration' }
34
+ compilerConfig. annotationProcessing[0 ]. ' @enabled' = ' true'
35
+ // def ccfg = node.component.find { it.@name == 'CompilerConfiguration' }
36
+ // ccfg.remove(ccfg.annotationProcessing)
37
+ // ccfg.append(new NodeBuilder().annotationProcessing() {
38
+ // profile(default: true, name: 'Default', enabled: true) {
39
+ // processorPath(useClasspath: true)
40
+ // }
41
+ // })
42
+ }
43
+ }
44
+
45
+ /*
46
+ * Gets the version name from the latest Git tag
47
+ * http://ryanharter.com/blog/2013/07/30/automatic-versioning-with-git-and-gradle/
48
+ */
49
+ def getVersionName = { ->
50
+ if (project. hasProperty(" vers" )) return vers
51
+ try {
52
+ def stdout = new ByteArrayOutputStream ()
53
+ exec {
54
+ commandLine ' git' , ' describe' , ' --tags'
55
+ standardOutput = stdout
56
+ }
57
+ return stdout. toString(). trim(). substring(1 )
58
+ } catch (org.gradle.process.internal.ExecException e) {
59
+ if (! new File (rootDir, ' .git/HEAD' ). exists()) {
60
+ println (" WARN: Could not fetch Git Tag for build version. No Git HEAD available. Substituting version 0.0.0" )
61
+ return " 0.0.0"
62
+ }
63
+ println (" WARN: Could not fetch Git Tag for build version. Please install Git and add it to your PATH. For now, the Git commit hash has been substituted." )
64
+ return getGitCommit()
65
+ }
66
+ }
67
+
68
+ def getVersionSimple = { ->
69
+ if (project. hasProperty(" vers" )) return vers
70
+ try {
71
+ def stdout = new ByteArrayOutputStream ()
72
+ exec {
73
+ commandLine ' git' , ' describe' , ' --tags' , ' --abbrev=0'
74
+ standardOutput = stdout
75
+ }
76
+ return stdout. toString(). trim(). substring(1 )
77
+ } catch (org.gradle.process.internal.ExecException e) {
78
+ if (! new File (rootDir, ' .git/HEAD' ). exists()) {
79
+ println (" WARN: Could not fetch Git Tag for build version. No Git HEAD available. Substituting version 0.0.0" )
80
+ return " 0.0.0"
81
+ }
82
+ println (" WARN: Could not fetch Git Tag for build version. Please install Git and add it to your PATH. For now, the Git commit hash has been substituted." )
83
+ return getGitCommit()
84
+ }
85
+ }
86
+
18
87
allprojects {
19
88
apply plugin : ' java'
20
89
apply plugin : ' application'
21
90
apply plugin : ' jacoco'
91
+ apply plugin : ' net.ltgt.errorprone'
92
+
93
+ configurations. errorprone {
94
+ resolutionStrategy. force ' com.google.errorprone:error_prone_core:2.0.8'
95
+ }
22
96
23
97
24
98
repositories {
@@ -34,9 +108,11 @@ allprojects {
34
108
testCompile group : ' net.jodah' , name : ' concurrentunit' , version : ' 0.4.2'
35
109
testCompile group : ' org.hamcrest' , name : ' hamcrest-all' , version : ' 1.3'
36
110
testCompile group : ' junit' , name : ' junit' , version : ' 4.12'
111
+ testCompile group : ' com.google.truth' , name : ' truth' , version : ' 0.28'
112
+ testCompile group : ' com.google.guava' , name : ' guava-testlib' , version : ' 19.0'
37
113
}
38
114
39
- version = ' 0.3.0 '
115
+ version = getVersionName()
40
116
41
117
compileJava {
42
118
options. compilerArgs << " -g"
@@ -76,7 +152,8 @@ allprojects {
76
152
}
77
153
}
78
154
79
- def os = osdetector. classifier. replace(" osx" , " macosx" ). replace(" windows-x86_32" , " windows-x86" )
155
+ def os = osdetector. classifier. replace(" osx" , " macosx" ). replace(" x86_32" , " x86" )
156
+ def arch = osdetector. arch. replace(" x86_64" , " x64" )
80
157
81
158
project(" :core" ) {
82
159
apply plugin : ' java'
@@ -91,10 +168,17 @@ project(":core") {
91
168
repositories {
92
169
flatDir {
93
170
dirs ' libs'
171
+ maven {
172
+ url = " http://first.wpi.edu/FRC/roborio/maven/development"
173
+ }
174
+ maven {
175
+ url = " https://github.com/WPIRoboticsProjects/rosjava_mvn_repo/raw/master"
176
+ }
94
177
}
95
178
}
96
179
97
180
dependencies {
181
+ compile group : ' com.google.code.findbugs' , name : ' jsr305' , version : ' 3.0.1'
98
182
compile group : ' org.bytedeco' , name : ' javacv' , version : ' 1.1'
99
183
compile group : ' org.bytedeco.javacpp-presets' , name : ' opencv' , version : ' 3.0.0-1.1'
100
184
compile group : ' org.bytedeco.javacpp-presets' , name : ' opencv' , version : ' 3.0.0-1.1' , classifier : os
@@ -103,9 +187,19 @@ project(":core") {
103
187
compile group : ' org.python' , name : ' jython' , version : ' 2.7.0'
104
188
compile group : ' com.thoughtworks.xstream' , name : ' xstream' , version : ' 1.4.8'
105
189
compile group : ' org.apache.commons' , name : ' commons-lang3' , version : ' 3.4'
106
- compile group : ' com.google.guava' , name : ' guava' , version : ' 18.0'
107
- compile group : ' com.google.inject' , name : ' guice' , version : ' 4.0'
190
+ compile group : ' com.google.guava' , name : ' guava' , version : ' 19.0'
191
+ compile group : ' com.google.auto.value' , name : ' auto-value' , version : ' 1.1'
192
+ // We use the no_aop version of Guice because the aop isn't avaiable in arm java
193
+ // http://stackoverflow.com/a/15235190/3708426
194
+ // https://github.com/google/guice/wiki/OptionalAOP
195
+ compile group : ' com.google.inject' , name : ' guice' , version : ' 4.0' , classifier : ' no_aop'
108
196
compile group : ' com.google.inject.extensions' , name : ' guice-assistedinject' , version : ' 4.0'
197
+
198
+ // Network publishing dependencies
199
+ compile group : ' org.ros.rosjava_core' , name : ' rosjava' , version : ' [0.2,0.3)'
200
+ compile group : ' org.ros.rosjava_messages' , name : ' grip_msgs' , version : ' 0.0.1'
201
+ compile group : ' edu.wpi.first.wpilib.networktables.java' , name : ' NetworkTables' , version : ' 3.0.0-SNAPSHOT' , classifier : ' desktop'
202
+ compile group : ' edu.wpi.first.wpilib.networktables.java' , name : ' NetworkTables' , version : ' 3.0.0-SNAPSHOT' , classifier : ' arm'
109
203
}
110
204
111
205
mainClassName = ' edu.wpi.grip.core.Main'
@@ -172,8 +266,8 @@ project(":core") {
172
266
173
267
idea. module {
174
268
sourceDirs + = sourceSets. generated. java. srcDirs
269
+ sourceDirs + = file(' generated' )
175
270
}
176
- // End IDE setup
177
271
}
178
272
179
273
project(" :ui" ) {
@@ -191,9 +285,7 @@ project(":ui") {
191
285
compile project(path : ' :core' , configuration : ' shadow' )
192
286
ideProvider project(path : ' :core' , configuration : ' compile' )
193
287
compile group : ' org.controlsfx' , name : ' controlsfx' , version : ' 8.40.10'
194
- compile group : ' org.apache.ant' , name : ' ant-jsch' , version : ' 1.8.1'
195
- compile group : ' com.jcabi' , name : ' jcabi-ssh' , version : ' 1.5'
196
- compile group : ' org.jdeferred' , name : ' jdeferred-core' , version : ' 1.2.4'
288
+ compile group : ' com.hierynomus' , name : ' sshj' , version : ' 0.15.0'
197
289
testCompile files(project(' :core' ). sourceSets. test. output. classesDir)
198
290
testCompile files(project(' :core' ). sourceSets. test. output. resourcesDir)
199
291
testCompile group : ' org.testfx' , name : ' testfx-core' , version : ' 4.0.+'
@@ -208,9 +300,19 @@ project(":ui") {
208
300
}
209
301
210
302
javafx {
303
+ profiles {
304
+ linux {
305
+ category = ' Development'
306
+ bundleArguments = [
307
+ // for DEB bundles
308
+ ' email' :
' [email protected] ' ,
// This is the email used for the deb maintainer field.
309
+ ]
310
+ }
311
+ }
211
312
appID = ' GRIP'
212
313
appName = ' GRIP'
213
314
mainClass = " edu.wpi.grip.ui.Main"
315
+ version = getVersionSimple()
214
316
215
317
// This prevents the JIT from eating stack traces that get thrown a lot
216
318
// This is slower but means we actually get the stack traces instead of
@@ -220,6 +322,16 @@ project(":ui") {
220
322
jvmArgs = [" -XX:-OmitStackTraceInFastThrow" ]
221
323
}
222
324
mainClassName = javafx. mainClass
325
+
326
+ // The JavaFX plugin does not provide a way to change the installer artifact's name without changing the appName or appID,
327
+ // so instead, we simply rename the artifact to append the architecture (x86 or x64)
328
+ jfxDeploy. doLast {
329
+ def filet = fileTree(dir : ' build/distributions' , include : " ${ javafx.appName} -${ getVersionSimple()} .*" )
330
+ filet. each { File f ->
331
+ def f2 = new File (f. getParentFile(), " ${ f.getName().replace("${getVersionSimple()}", "${getVersionSimple()}-${arch}")} " )
332
+ f. renameTo(f2)
333
+ }
334
+ }
223
335
}
224
336
225
337
/*
0 commit comments