Skip to content

Commit 26efe08

Browse files
author
James Hagborg
committed
Merge maven build with 2018 updates
2 parents d44deb0 + 6aea98e commit 26efe08

Some content is hidden

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

42 files changed

+2653
-528
lines changed

.travis.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
11
language: java
22
jdk:
33
- oraclejdk8
4-
sudo: false
4+
sudo: required
5+
6+
services:
7+
- docker
8+
9+
before_install:
10+
- docker build -t my-image .
11+
12+
install:
13+
- echo "skip 'gradle assemble' step"
14+
15+
script:
16+
- docker run -v "$(pwd):/hyperLib" my-image /hyperLib/.travis_docker_script.sh
17+
518
notifications:
619
slack:
720
rooms:
821
- babysmith:ULSqFgVgfIwVZhqtqM7d27kv#git
922
- babysmith:ULSqFgVgfIwVZhqtqM7d27kv#hyperlib
10-
addons:
11-
apt:
12-
packages:
13-
- oracle-java8-installer
23+
1424
env:
1525
global:
26+
- GRADLE_CACHES="/home/travis/.gradle"
27+
- DOCKER_GRADLE_CACHES="/root/.gradle"
1628
- secure: KbemNv66/YeG1d5rh/DIQ/IzFGO+jkUIxyrC/Rv6qqgIAIzPljTAgvbOwlIS4VWxAc+6u3TgZ1ITHqcISmqQBd3xfqnSjzGyCmiumXmKjP3f/lsXOY0G2dqK8B5UxGyWfHuOldDIZxVs0nlNfW8cvgnVtWikAl+8oM+vZ6OFm6nZf1IqZU7PHHsF8sxi5H2PGo3IJjhkNNpjbi/N+KHpNyeKOPHGmu5jxUg1y+Xk+tpSDij/ko3URy5r1D+GX/BaZBAcRAIk4e1LIka4v6XVhbenO1vTKtmaoWhlSPpdjhi9/6No/rWWb2c+BzaN2hBhyU6g5ZY7goNsb9uzrh3LDWBiXoASPaVMOK17VTJRlARYcXRUK9HgAMj1o8wdgREVFKy8aTIX3amep2O114tnkTbCAefqWqESev5FMY/8TTsoUepO1f7La2EPt4xuckXJBLfb2yH8bbP8u8n8PtHjUJ+jmerGq3MlP8EQj21Qxk299KZ5/NaL2lnYN7krlb+2IMiDJX1Xb3AUVDtM3BFiCefLVPd7EAqbGgicSHRgal1YYaaOVmRq1kqBtTG72Pslh0PHRfjDpWG7NbNntZJG/S05iLJS9cpDeoyEri7mjC48L7Ej/V2Wwd0lEQyWf98FBFvWLja6S5o0VTjE5K1LEWoNpshxia7uZUYiW3JeC9o=
29+
1730
deploy:
1831
- provider: releases
1932
api_key:

.travis_docker_script.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -e -x
4+
5+
cd /hyperLib
6+
./gradlew assemble
7+
./gradlew check

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ubuntu:16.04
2+
MAINTAINER James Hagborg <[email protected]>
3+
CMD bash
4+
5+
RUN apt-get update && apt-get -y install git openjdk-8-jdk openjfx

build.gradle

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,40 @@ jgitver {
1111
mavenLike = true
1212
}
1313

14-
repositories {
15-
mavenCentral()
16-
maven {
17-
url 'http://first.wpi.edu/FRC/roborio/maven/release'
14+
allprojects {
15+
repositories {
16+
mavenCentral()
17+
maven {
18+
url 'http://first.wpi.edu/FRC/roborio/maven/release'
19+
}
1820
}
1921
}
2022

2123
dependencies {
2224
compile group: 'edu.wpi.first.wpilibj', name: 'wpilibj-java', version: '2018.+'
2325
// We only need the desktop version right now, since this build file is only used for local testing.
24-
compile group: 'edu.wpi.first.wpilib.networktables.java', name: 'NetworkTables', version: '3.+', classifier: 'desktop'
26+
compile group: 'edu.wpi.first.ntcore', name: 'ntcore-java', version: '4.+'
27+
compile group: 'edu.wpi.first.wpiutil', name: 'wpiutil-java', version: '3.+'
28+
compile group: 'org.opencv', name: 'opencv-java', version: '3.2.0'
29+
compile group: 'edu.wpi.first.cscore', name: 'cscore-java', version: '1.3.+'
30+
31+
runtime group: 'edu.wpi.first.wpilibj', name: 'wpilibj-jni', version: '2018.+', classifier: 'all'
32+
runtime group: 'edu.wpi.first.ntcore', name: 'ntcore-jni', version: '4.+', classifier: 'all'
33+
runtime group: 'org.opencv', name: 'opencv-jni', version: '3.2.0', classifier: 'all'
34+
runtime group: 'edu.wpi.first.cscore', name: 'cscore-jni', version: '1.3.+', classifier: 'all'
35+
2536
testCompile group: 'junit', name: 'junit', version: '4.+'
37+
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
2638
testCompile group: 'com.google.guava', name: 'guava', version: '19.0'
2739
}
2840

41+
test {
42+
testLogging {
43+
events "failed"
44+
exceptionFormat "full"
45+
}
46+
}
47+
2948
task sourcesJar(type: Jar, dependsOn: classes) {
3049
description 'Builds a jar file full of sources.'
3150
classifier = 'sources'

settings.gradle

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/main/java/org/usfirst/frc/team69/util/CommandBuilder.java

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.Collections;
44
import java.util.function.BooleanSupplier;
5+
import java.util.function.Consumer;
56

67
import edu.wpi.first.wpilibj.command.Command;
78
import edu.wpi.first.wpilibj.command.CommandGroup;
@@ -64,11 +65,16 @@ public CommandBuilder sequential(Command command) {
6465
* @param command
6566
* The command to add in sequence
6667
* @param timeout
67-
* The timeout, in seconds
68+
* The timeout, in seconds. if negative, no timeout is used.
6869
* @return This CommandBuilder object
6970
*/
7071
public CommandBuilder sequential(Command command, double timeout) {
71-
m_cmdGroup.addSequential(command, timeout);
72+
if(timeout >= 0.0) {
73+
m_cmdGroup.addSequential(command, timeout);
74+
} else {
75+
m_cmdGroup.addSequential(command);
76+
}
77+
7278
return this;
7379
}
7480

@@ -99,11 +105,32 @@ public CommandBuilder parallel(Command command) {
99105
* @param command
100106
* The command to add in parallel
101107
* @param timeout
102-
* The timeout, in seconds
108+
* The timeout, in seconds. if negative, no timeout is used.
103109
* @return This CommandBuilder object
104110
*/
105111
public CommandBuilder parallel(Command command, double timeout) {
106-
m_cmdGroup.addParallel(command, timeout);
112+
if(timeout >= 0.0) {
113+
m_cmdGroup.addParallel(command, timeout);
114+
} else {
115+
m_cmdGroup.addParallel(command);
116+
}
117+
return this;
118+
}
119+
120+
/**
121+
* Add a sequence of commands in parallel. Execution of the next command
122+
* will begin immediately, while this one continues to execute in parallel.
123+
* The command will be killed if the timeout expires.
124+
*
125+
* @param command
126+
* A function taking a CommandBuilder specifying the sequence of
127+
* commands
128+
* @return {CommandBuilder}
129+
*/
130+
public CommandBuilder parallel(Consumer<CommandBuilder> command) {
131+
CommandBuilder child = new CommandBuilder();
132+
command.accept(child);
133+
m_cmdGroup.addParallel(child.build());
107134
return this;
108135
}
109136

@@ -152,8 +179,7 @@ public CommandBuilder waitForCondition(BooleanSupplier condition) {
152179
* The timeout in seconds
153180
* @return This CommandBuilder object
154181
*/
155-
public CommandBuilder waitForCondition(BooleanSupplier condition,
156-
double timeout) {
182+
public CommandBuilder waitForCondition(BooleanSupplier condition, double timeout) {
157183
m_cmdGroup.addSequential(QuickCommand.waitFor(condition), timeout);
158184
return this;
159185
}
@@ -182,8 +208,7 @@ public CommandBuilder ifThen(BooleanSupplier condition, Command ifTrue) {
182208
* The command to run if the condition is false
183209
* @return This CommandBuilder object
184210
*/
185-
public CommandBuilder ifThenElse(BooleanSupplier condition, Command ifTrue,
186-
Command ifFalse) {
211+
public CommandBuilder ifThenElse(BooleanSupplier condition, Command ifTrue, Command ifFalse) {
187212
m_cmdGroup.addSequential(new ConditionalCommand(ifTrue, ifFalse) {
188213
@Override
189214
protected boolean condition() {
@@ -238,10 +263,8 @@ private static class Counter {
238263
*/
239264
public CommandBuilder forLoop(int count, Command body) {
240265
Counter counter = new Counter();
241-
m_cmdGroup.addSequential(
242-
QuickCommand.oneShot(null, () -> counter.value = 0));
243-
m_cmdGroup.addSequential(
244-
new WhileCommand(() -> counter.value++ < count, body));
266+
m_cmdGroup.addSequential(QuickCommand.oneShot(null, () -> counter.value = 0));
267+
m_cmdGroup.addSequential(new WhileCommand(() -> counter.value++ < count, body));
245268
return this;
246269
}
247270

@@ -271,8 +294,7 @@ public CommandBuilder release(Subsystem subsystem) {
271294
public CommandBuilder releaseAll() {
272295
m_cmdGroup.addSequential(new InstantCommand() {
273296
{
274-
for (Object req : Collections
275-
.list(GetRequirements.getRequirements(m_cmdGroup))) {
297+
for (Object req : Collections.list(GetRequirements.getRequirements(m_cmdGroup))) {
276298
requires((Subsystem) req);
277299
}
278300
}

0 commit comments

Comments
 (0)