From d9c754c30f4685c73a5a987d2110c37b375d1afb Mon Sep 17 00:00:00 2001 From: Thad House Date: Sun, 13 Aug 2017 08:02:29 -0700 Subject: [PATCH] Add a java version of the dev app. (#218) --- build.gradle | 16 +++++++++++++++- src/dev/java/edu/wpi/first/ntcore/DevMain.java | 12 ++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/dev/java/edu/wpi/first/ntcore/DevMain.java diff --git a/build.gradle b/build.gradle index 1da36f0dce..7cc63e99b2 100644 --- a/build.gradle +++ b/build.gradle @@ -44,6 +44,10 @@ if (project.hasProperty('onlyAthena')) { test.enabled = false } +sourceSets { + dev +} + task nativeTestFilesJar(type: Jar) { destinationDir = project.buildDir classifier = "nativeTestFiles" @@ -62,13 +66,23 @@ task nativeTestFilesJar(type: Jar) { } } +task run(type: JavaExec) { + classpath = sourceSets.dev.runtimeClasspath + + main = 'edu.wpi.first.ntcore.DevMain' +} + test.dependsOn nativeTestFilesJar +run.dependsOn nativeTestFilesJar + dependencies { compile 'edu.wpi.first.wpiutil:wpiutil-java:+' - runtime 'edu.wpi.first.wpiutil:wpiutil-java:+' testCompile 'junit:junit:4.12' testRuntime files(project(':').nativeTestFilesJar.archivePath) + devCompile 'edu.wpi.first.wpiutil:wpiutil-java:+' + devCompile sourceSets.main.output + devRuntime files(project(':').nativeTestFilesJar.archivePath) } diff --git a/src/dev/java/edu/wpi/first/ntcore/DevMain.java b/src/dev/java/edu/wpi/first/ntcore/DevMain.java new file mode 100644 index 0000000000..a6b4699d22 --- /dev/null +++ b/src/dev/java/edu/wpi/first/ntcore/DevMain.java @@ -0,0 +1,12 @@ +package edu.wpi.first.ntcore; + +import edu.wpi.first.wpilibj.networktables.NetworkTablesJNI; +import edu.wpi.first.wpiutil.RuntimeDetector; + +public class DevMain { + public static void main(String[] args) { + System.out.println("Hello World!"); + System.out.println(RuntimeDetector.getPlatformPath()); + NetworkTablesJNI.flush(); + } +}