Skip to content

Commit b211720

Browse files
committed
Merge remote-tracking branch 'upstream/master' into findbugs
# Conflicts: # .travis.yml # appveyor.yml # build.gradle # core/src/main/java/edu/wpi/grip/core/OperationDescription.java
2 parents 239d619 + 4eefca3 commit b211720

File tree

96 files changed

+770
-361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+770
-361
lines changed

.pullapprove.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
approve_by_comment: true
2+
approve_regex: ^(Approved|LGTM)
3+
reject_regex: ^Rejected
4+
reset_on_push: true
5+
reviewers:
6+
-
7+
name: "GRIP Merge Approvers"
8+
required: 1
9+
teams:
10+
- grip-merge-approvers

.travis-scripts/before-deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
ls -R ui/build/distributions | awk '
2+
ls -R ui/build/jfx/native | awk '
33
/:$/&&f{s=$0;f=0}
44
/:$/&&!f{sub(/:$/,"");s=$0;f=1;next}
55
NF&&f{ print s"/"$0 }'

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ before_install:
2727

2828
# Only do an assemble when we aren't building a pull request
2929
install:
30-
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./gradlew :ui:assemble --stacktrace || ./gradlew --stacktrace '
30+
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./gradlew :ui:jfxNative --stacktrace || ./gradlew --stacktrace '
3131

3232
script:
33-
- ./gradlew checkstyleMain checkstyleTest findbugsMain findbugsTest jacocoTestReport jacocoRootReport test --stacktrace -Pheadless=true -PlogTests
33+
- ./gradlew checkstyleMain checkstyleTest pmdMain findbugsMain findbugsTest jacocoTestReport jacocoRootReport test --stacktrace -Pheadless=true -PlogTests
3434

3535
after_success:
3636
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then codecov ; fi
@@ -56,7 +56,7 @@ deploy:
5656
api_key:
5757
secure: bdjiFXG3VBcM1iyxeputsWA9vHxgLNcxRB1i0REDNAnIEvDWpAdVr1jPBejeiOEw9s+k6EItATvQ2I7Xp5iKnYaXn0NuHzM3OSY8WNVCc+gBTaQwkijPBqi/vEXaO502CscW+H2U26QZGS/jJiUuieeErtzCNcWmCv8SRc5NFOVYdSlhAmp+aPeu2YwuweiMZNVquYM2hx7murghOYSF5hQTKq4/zrziENVi78XZS8rJFmxwOGqNj1GBLul2F9poIPjzDbPVJLeXTJEY+N3aYGJ4GyZYf6p8ynDO/v043/GuOAyNfkgSwhCcTQlmLG/mm6P9CUMoDQR9klh2eDswgrIP4rGLwILg3035nqHqwgTIKVXfspni3P/65siS6lXV0M5flEkRysMBr1GQhaIEUM32ArreMzAtC2Vn2CviKG0TwLmxyd/7W3JdoX4KrHAcKBwbqFDImWw43S6N63oTUEw6GjrI+CndwgF9RNgr5SAyS28LFXViOJe7JlGVUNU33kMNpEJxzVREzkJsO8aicaZTrvDniFOfg2WhrAyhjxmh4/IOHDE6qgtxw+2+TUzMlwdzdxb90BeXg2XfMichmKfQYQFEmZntCZcoHHDG5jbCTyAvFuOv6tdPjpr69QjiEJhEbohw8CEwoGhy1kxxQcCDCfABrOTivJ39Ui8MC6k=
5858
file_glob: true
59-
file: "ui/build/distributions/*.{deb,pkg,dmg}"
59+
file: "ui/build/jfx/native/*.{deb,pkg,dmg}"
6060
skip_cleanup: true
6161
on:
6262
repo: WPIRoboticsProjects/GRIP

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ Include details about your configuration and environment:</br>
6969

7070
### Code Formatting
7171

72-
* GRIP uses standard Java formatting rules, although we don't care if your line length is over 80 characters. You can probably use your IDE's built-in formatter. This helps keep the code more consistent and readable.
72+
* GRIP follows the [Google Java Styleguide](https://google.github.io/styleguide/javaguide.html) with a few modifications regarding import order. We use the gradle [checkstyle](http://checkstyle.sourceforge.net/) plugin to ensure that code conforms to this styleguide. There are plugins for most major IDE's that support importing the `checkstyle.xml` file.

appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ install:
22
- choco install -y InnoSetup
33

44
build_script:
5-
- gradlew.bat :ui:assemble --stacktrace
5+
- gradlew.bat :ui:jfxNative --stacktrace
66

77
# to run your custom scripts instead of automatic tests
88
test_script:
9-
- gradlew.bat checkstyleMain checkstyleTest findbugsMain findbugsTest jacocoTestReport jacocoRootReport test --stacktrace -Pheadless=true -PlogTests
9+
- gradlew.bat checkstyleMain checkstyleTest pmdMain findbugsMain findbugsTest jacocoTestReport jacocoRootReport test --stacktrace -Pheadless=true -PlogTests
1010

1111
platform:
1212
- x64
1313

1414
artifacts:
15-
- path: ui\build\distributions\*.exe
15+
- path: ui\build\jfx\native\*.exe
1616

1717

1818
deploy:

build.gradle

Lines changed: 85 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ buildscript {
77
}
88

99
dependencies {
10+
classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: '8.5.2'
1011
classpath 'com.netflix.nebula:gradle-aggregate-javadocs-plugin:2.2.+'
1112
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.8'
1213
}
@@ -84,12 +85,13 @@ def getVersionSimple = { ->
8485
}
8586
}
8687

87-
allprojects {
88+
configure(allprojects - project(':ui:linuxLauncher')) {
8889
apply plugin: 'java'
8990
apply plugin: 'application'
9091
apply plugin: 'jacoco'
9192
apply plugin: 'net.ltgt.errorprone'
9293
apply plugin: 'checkstyle'
94+
apply plugin: 'pmd'
9395
apply plugin: 'findbugs'
9496

9597
configurations.errorprone {
@@ -99,6 +101,9 @@ allprojects {
99101
checkstyle {
100102
configFile = new File(rootDir, "checkstyle.xml")
101103
toolVersion = '6.19'
104+
if (project.hasProperty("ignoreCheckstyle")) {
105+
ignoreFailures = true
106+
}
102107
}
103108

104109
tasks.withType(Checkstyle) {
@@ -107,6 +112,14 @@ allprojects {
107112
it.dependsOn = []
108113
}
109114

115+
pmd {
116+
consoleOutput = true
117+
sourceSets = [sourceSets.main]
118+
reportsDir = file("$project.buildDir/reports/pmd")
119+
ruleSetFiles = files(new File(rootDir, "pmd-ruleset.xml"))
120+
ruleSets = []
121+
}
122+
110123
findbugs {
111124
sourceSets = [sourceSets.main]
112125
excludeFilter = new File(rootDir, "findBugsSuppressions.xml")
@@ -311,21 +324,59 @@ project(":core") {
311324
}
312325
}
313326

327+
project (":ui:linuxLauncher") {
328+
apply plugin: 'cpp'
329+
330+
model {
331+
binaries {
332+
all {
333+
cppCompiler.args '-pthread', '-ldl'
334+
linker.args '-pthread', '-ldl'
335+
}
336+
}
337+
components {
338+
linuxLauncher(NativeExecutableSpec) {
339+
sources {
340+
cpp {
341+
source {
342+
srcDir "src/cpp"
343+
}
344+
}
345+
}
346+
}
347+
}
348+
}
349+
}
350+
351+
project (":ui:preloader") {
352+
apply plugin: 'java'
353+
apply plugin: 'idea'
354+
apply plugin: 'jacoco'
355+
apply plugin: 'application'
356+
357+
task run(overwrite: true, type: JavaExec) {
358+
classpath = sourceSets.main.runtimeClasspath
359+
main = 'edu.wpi.grip.preloader.GripPreloader'
360+
args 'windowed'
361+
}
362+
}
363+
314364
project(":ui") {
315365
apply plugin: 'java'
316366
apply plugin: 'idea'
317367
apply plugin: 'jacoco'
318368
apply plugin: 'application'
319-
apply from: 'http://dl.bintray.com/shemnon/javafx-gradle/8.1.1/javafx.plugin'
369+
apply plugin: 'javafx-gradle-plugin'
320370

321371
configurations {
322372
ideProvider
323373
}
324374

325375
dependencies {
326376
compile project(path: ':core', configuration: 'shadow')
377+
compile project(path: ':ui:preloader')
327378
ideProvider project(path: ':core', configuration: 'compile')
328-
compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.10'
379+
compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.11'
329380
compile group: 'com.hierynomus', name: 'sshj', version: '0.16.0'
330381
testCompile files(project(':core').sourceSets.test.output.classesDir)
331382
testCompile files(project(':core').sourceSets.test.output.resourcesDir)
@@ -335,6 +386,10 @@ project(":ui") {
335386
}
336387

337388
evaluationDependsOn(':core')
389+
evaluationDependsOn(':ui:preloader')
390+
if (System.getProperty("os.name").toLowerCase().contains("linux")) {
391+
jfxNative.dependsOn tasks.getByPath(':ui:linuxLauncher:linuxLauncherExecutable')
392+
}
338393
compileTestJava.dependsOn tasks.getByPath(':core:testClasses')
339394

340395
idea.module {
@@ -352,39 +407,29 @@ project(":ui") {
352407
}
353408

354409

355-
javafx {
356-
profiles {
357-
linux {
358-
category = 'Development'
359-
bundleArguments = [
360-
// for DEB bundles
361-
'email': '[email protected]', // This is the email used for the deb maintainer field.
362-
]
363-
}
364-
}
365-
appID = 'GRIP'
366-
appName = 'GRIP'
410+
jfx {
367411
mainClass = "edu.wpi.grip.ui.Main"
368-
version = getVersionSimple()
412+
preLoader = "edu.wpi.grip.preloader.GripPreloader"
413+
414+
identifier = "GRIP"
415+
appName = "GRIP"
416+
vendor = "Worcester Polytechnic Institute"
417+
nativeReleaseVersion = "${getVersionSimple()}-${arch}"
418+
419+
jfxMainAppJarName = "${jfx.appName}-${jfx.nativeReleaseVersion}.jar"
369420

370421
// This prevents the JIT from eating stack traces that get thrown a lot
371422
// This is slower but means we actually get the stack traces instead of
372423
// having them become one line like `java.lang.ArrayIndexOutOfBoundsException`
373424
// and as such, would be useless.
374425
// See: https://plumbr.eu/blog/java/on-a-quest-for-missing-stacktraces
375426
jvmArgs = ["-XX:-OmitStackTraceInFastThrow"]
376-
}
377-
mainClassName = javafx.mainClass
378427

379-
// The JavaFX plugin does not provide a way to change the installer artifact's name without changing the appName or appID,
380-
// so instead, we simply rename the artifact to append the architecture (x86 or x64)
381-
jfxDeploy.doLast {
382-
def filet = fileTree(dir: 'build/distributions', include: "${javafx.appName}-${getVersionSimple()}.*")
383-
filet.each { File f ->
384-
def f2 = new File(f.getParentFile(), "${f.getName().replace("${getVersionSimple()}", "${getVersionSimple()}-${arch}")}")
385-
f.renameTo(f2)
386-
}
428+
bundleArguments = [
429+
"linux.launcher.url": file('linuxLauncher/build/exe/linuxLauncher/linuxLauncher').toURI().toURL()
430+
]
387431
}
432+
mainClassName = jfx.mainClass
388433
}
389434

390435
/*
@@ -393,23 +438,25 @@ project(":ui") {
393438
*/
394439
task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
395440
description = 'Generates an aggregate report from all subprojects'
396-
dependsOn(subprojects.test)
441+
configure(subprojects - project(':ui:linuxLauncher')) {
442+
dependsOn(test)
397443

398-
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
399-
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
400-
classDirectories = files(subprojects.sourceSets.main.output)
401-
executionData = files(subprojects.jacocoTestReport.executionData)
444+
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
445+
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
446+
classDirectories = files(sourceSets.main.output)
447+
executionData = files(jacocoTestReport.executionData)
402448

403-
reports {
404-
html.enabled = true
405-
xml.enabled = true
406-
}
449+
reports {
450+
html.enabled = true
451+
xml.enabled = true
452+
}
407453

408-
doFirst {
409-
executionData = files(executionData.findAll { it.exists() })
454+
doFirst {
455+
executionData = files(executionData.findAll { it.exists() })
456+
}
410457
}
411458
}
412459

413460
task wrapper(type: Wrapper) {
414-
gradleVersion = '2.13'
461+
gradleVersion = '2.14.1'
415462
}

checkstyle.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,5 +235,9 @@
235235
<property name="commentFormat" value=".*"/>
236236
</module>
237237
<module name="CommentsIndentation"/>
238+
<module name="Regexp">
239+
<property name="format" value="\(non\-Javadoc\)|System\..*\.print"/>
240+
<property name="illegalPattern" value="true"/>
241+
</module>
238242
</module>
239243
</module>

core/src/main/java/edu/wpi/grip/core/ConnectionValidator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ public interface ConnectionValidator {
1919
* @return The return value of {@link #canConnect(OutputSocket, InputSocket)}
2020
*/
2121
default boolean canConnect(Socket socket1, Socket socket2) {
22-
final OutputSocket<?> outputSocket;
23-
final InputSocket<?> inputSocket;
24-
2522
// One socket must be an input and one must be an output
2623
if (socket1.getDirection() == socket2.getDirection()) {
2724
return false;
2825
}
2926

27+
final OutputSocket<?> outputSocket;
28+
final InputSocket<?> inputSocket;
3029
if (socket1.getDirection().equals(Socket.Direction.OUTPUT)) {
3130
outputSocket = (OutputSocket) socket1;
3231
inputSocket = (InputSocket) socket2;

core/src/main/java/edu/wpi/grip/core/GripCoreModule.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
*/
4343
@SuppressWarnings("PMD.MoreThanOneLogger")
4444
public class GripCoreModule extends AbstractModule {
45+
46+
private final EventBus eventBus;
47+
4548
private static final Logger logger = Logger.getLogger(GripCoreModule.class.getName());
4649

4750
// This is in a static initialization block so that we don't create a ton of
@@ -93,8 +96,6 @@ public synchronized void publish(final LogRecord record) {
9396
}
9497
}
9598

96-
private final EventBus eventBus;
97-
9899
/*
99100
* This class should not be used in tests. Use GRIPCoreTestModule for tests.
100101
*/

core/src/main/java/edu/wpi/grip/core/Main.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
*/
2929
public class Main {
3030

31+
private static final Logger logger = Logger.getLogger(Main.class.getName());
32+
3133
@Inject
3234
private Project project;
3335
@Inject
@@ -39,20 +41,18 @@ public class Main {
3941
@Inject
4042
private CVOperations cvOperations;
4143
@Inject
42-
private Logger logger;
43-
@Inject
4444
private GripServer gripServer;
4545
@Inject
4646
private HttpPipelineSwitcher pipelineSwitcher;
4747

48-
@SuppressWarnings({"PMD.SystemPrintln", "JavadocMethod"})
48+
@SuppressWarnings("JavadocMethod")
4949
public static void main(String[] args) throws IOException, InterruptedException {
50-
final Injector injector = Guice.createInjector(Modules.override(
51-
new GripCoreModule(), new GripSourcesHardwareModule()).with(new GripNetworkModule()));
50+
final Injector injector = Guice.createInjector(Modules.override(new GripCoreModule(),
51+
new GripFileModule(), new GripSourcesHardwareModule()).with(new GripNetworkModule()));
5252
injector.getInstance(Main.class).start(args);
5353
}
5454

55-
@SuppressWarnings({"PMD.SystemPrintln", "JavadocMethod"})
55+
@SuppressWarnings("JavadocMethod")
5656
public void start(String[] args) throws IOException, InterruptedException {
5757
String projectPath = null;
5858
if (args.length == 1) {

0 commit comments

Comments
 (0)