Skip to content

Commit 7b689b1

Browse files
PaulaRudyPaulaRudy
authored andcommitted
Merge branch 'master' of https://github.com/WPIRoboticsProjects/GRIP into issue316
2 parents 90b4af8 + 201dcbb commit 7b689b1

3 files changed

Lines changed: 30 additions & 8 deletions

File tree

.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 build/distributions | awk '
2+
ls -R ui/build/distributions | awk '
33
/:$/&&f{s=$0;f=0}
44
/:$/&&!f{sub(/:$/,"");s=$0;f=1;next}
55
NF&&f{ print s"/"$0 }'

build.gradle

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ plugins {
1515
}
1616
apply plugin: 'nebula-aggregate-javadocs'
1717

18-
1918
allprojects {
2019
apply plugin: 'java'
2120
apply plugin: 'application'
@@ -37,7 +36,7 @@ allprojects {
3736
testCompile group: 'junit', name: 'junit', version: '4.12'
3837
}
3938

40-
version = '1.1.0'
39+
version = '1.1.1'
4140

4241
compileJava {
4342
options.compilerArgs << "-g"
@@ -77,7 +76,8 @@ allprojects {
7776
}
7877
}
7978

80-
def os = osdetector.classifier.replace("osx", "macosx").replace("windows-x86_32", "windows-x86")
79+
def os = osdetector.classifier.replace("osx", "macosx").replace("x86_32", "x86")
80+
def arch = osdetector.arch.replace("x86_64", "x64")
8181

8282
project(":core") {
8383
apply plugin: 'java'
@@ -215,6 +215,15 @@ project(":ui") {
215215
}
216216

217217
javafx {
218+
profiles {
219+
linux {
220+
category = 'Development'
221+
bundleArguments = [
222+
// for DEB bundles
223+
'email': 'wpilib@wpi.edu', // This is the email used for the deb maintainer field.
224+
]
225+
}
226+
}
218227
appID = 'GRIP'
219228
appName = 'GRIP'
220229
mainClass = "edu.wpi.grip.ui.Main"
@@ -227,6 +236,16 @@ project(":ui") {
227236
jvmArgs = ["-XX:-OmitStackTraceInFastThrow"]
228237
}
229238
mainClassName = javafx.mainClass
239+
240+
// The JavaFX plugin does not provide a way to change the installer artifact's name without changing the appName or appID,
241+
// so instead, we simply rename the artifact to append the architecture (x86 or x64)
242+
jfxDeploy.doLast {
243+
def filet = fileTree(dir: 'build/distributions', include: "${javafx.appName}-${version}.*")
244+
filet.each { File f ->
245+
def f2 = new File(f.getParentFile(), "${f.getName().replace("${version}", "${version}-${arch}")}")
246+
f.renameTo(f2)
247+
}
248+
}
230249
}
231250

232251
/*

ui/src/main/java/edu/wpi/grip/ui/DeployController.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.io.InputStreamReader;
2828
import java.io.InterruptedIOException;
2929
import java.io.StringWriter;
30+
import java.net.URLDecoder;
3031
import java.net.UnknownHostException;
3132
import java.util.Optional;
3233
import java.util.logging.Level;
@@ -42,6 +43,8 @@
4243
public class DeployController {
4344
private final static String GRIP_JAR = "grip.jar";
4445
private final static String PROJECT_FILE = "project.grip";
46+
private final static String LOCAL_GRIP_JAR = URLDecoder.decode(
47+
Project.class.getProtectionDomain().getCodeSource().getLocation().getPath());
4548

4649
@FXML private TextField address;
4750
@FXML private TextField user;
@@ -125,7 +128,7 @@ private void deploy(String address, String user, String password, String javaHom
125128
setStatusAsync("Connecting to " + address, false);
126129

127130
try (SSHClient ssh = new SSHClient()) {
128-
ssh.loadKnownHosts();
131+
ssh.addHostKeyVerifier((hostname, port, key) -> true);
129132
ssh.connect(address);
130133
ssh.authPassword(user, password);
131134

@@ -149,8 +152,7 @@ public StreamCopier.Listener file(String name, long size) {
149152

150153
// Upload the GRIP core JAR and the serialized project to the robot
151154
scp.upload(new StringInMemoryFile(PROJECT_FILE, projectWriter.toString()), deployDir + "/");
152-
scp.upload(new FileSystemFile(Project.class.getProtectionDomain().getCodeSource().getLocation().getPath()),
153-
deployDir + "/" + GRIP_JAR);
155+
scp.upload(new FileSystemFile(LOCAL_GRIP_JAR), deployDir + "/" + GRIP_JAR);
154156

155157
// Stop the pipeline before running it remotely, so the two instances of GRIP don't try to publish to the
156158
// same NetworkTables keys.
@@ -160,7 +162,8 @@ public StreamCopier.Listener file(String name, long size) {
160162
setStatusAsync("Running GRIP", false);
161163
Session session = ssh.startSession();
162164
session.allocateDefaultPTY();
163-
Session.Command cmd = session.exec(javaHome + "/bin/java -jar " + deployDir + "/" + GRIP_JAR + " " + deployDir + "/" + PROJECT_FILE);
165+
Session.Command cmd = session.exec(javaHome + "/bin/java -jar " + deployDir + "/" + GRIP_JAR + "' '"
166+
+ deployDir + "/" + PROJECT_FILE + "'");
164167

165168
LineReader inputReader = new LineReader(new InputStreamReader(cmd.getInputStream()));
166169
while (isNotCanceled()) {

0 commit comments

Comments
 (0)