Skip to content

Commit 89a5b62

Browse files
authored
Updates to new wpilib native libraries extraction method and switches back to groovy dsl (#663)
* Initial commit of moving to groovy and using new extraction setup A much cleaner running setup, much easier to build and comprehend.
1 parent b834e14 commit 89a5b62

File tree

45 files changed

+917
-904
lines changed

Some content is hidden

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

45 files changed

+917
-904
lines changed

.gitattributes

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
*.kts text eol=lf
1+
*.gradle text eol=lf
22
*.yml text eol=lf
33
*.sh text eol=lf
44
*.md text eol=lf
5+
*.xml text eol=lf
6+
*.fxml text eol=lf
7+
*.css text eol=lf
58
Dockerfile text eol=lf

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,4 @@ local.properties
7878
.classpath
7979

8080
*.jar
81+
.vscode/

api-test-util/api-test-util.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
description = "Shared test utilities for the API and app projects."

api/api.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
plugins {
2+
id 'java-library'
3+
}
4+
5+
description = "Public API for writing plugins for shuffleboard."
6+
7+
dependencies {
8+
api group: "com.google.guava", name: "guava", version: "21.0"
9+
api group: "com.google.code.gson", name: "gson", version: "2.8.2"
10+
api group: "org.fxmisc.easybind", name: "easybind", version: "1.0.3"
11+
api group: "org.controlsfx", name: "controlsfx", version: "9.0.0"
12+
api group: "de.codecentric.centerdevice", name: "javafxsvg", version: "1.2.1"
13+
api group: "eu.hansolo", name: "Medusa", version: "7.9" // Note the capital 'M' -- lowercase is a much older version!
14+
api group: "com.jfoenix", name: "jfoenix", version: "9.0.8"
15+
api group: "com.github.zafarkhaja", name: "java-semver", version: "0.9.0"
16+
17+
api "com.fasterxml.jackson.core:jackson-annotations:2.10.0"
18+
api "com.fasterxml.jackson.core:jackson-core:2.10.0"
19+
api "com.fasterxml.jackson.core:jackson-databind:2.10.0"
20+
21+
testImplementation project(":api-test-util")
22+
}

api/api.gradle.kts

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

app/app.gradle

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import org.gradle.jvm.tasks.Jar
3+
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
4+
import groovy.lang.GroovyObject
5+
6+
plugins {
7+
id 'java-library'
8+
id 'application'
9+
id 'maven-publish'
10+
}
11+
12+
apply plugin: 'com.github.johnrengelman.shadow'
13+
14+
description = 'All of the application specific code that makes shuffleboard run.'
15+
16+
def nativeConfigName = 'wpilibNatives'
17+
def nativeConfig = configurations.create(nativeConfigName)
18+
19+
def nativeTasks = wpilibTools.createExtractionTasks {
20+
configurationName = nativeConfigName
21+
}
22+
23+
nativeTasks.addToSourceSetResources(sourceSets.main)
24+
25+
wpilibTools.deps.wpilibVersion = "2020.+"
26+
27+
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil")
28+
29+
configurations.implementation.extendsFrom(configurations.javaFxDeps)
30+
31+
dependencies {
32+
javaFxDeps wpilibTools.deps.javafx("media")
33+
javaFxDeps wpilibTools.deps.javafx("swing")
34+
javaFxDeps wpilibTools.deps.javafx("web")
35+
36+
implementation project(':api')
37+
implementation project(':plugins:base')
38+
implementation project(':plugins:cameraserver')
39+
implementation project(':plugins:networktables')
40+
41+
api group: "de.huxhorn.lilith", name: "de.huxhorn.lilith.3rdparty.junique", version: "1.0.4"
42+
implementation group: "org.apache.commons", name: "commons-csv", version: "1.5"
43+
testImplementation project("test_plugins")
44+
testImplementation project(":api-test-util")
45+
}
46+
47+
def theMainClassName = "edu.wpi.first.shuffleboard.app.Main"
48+
49+
application {
50+
mainClassName = theMainClassName
51+
applicationDefaultJvmArgs = [
52+
"-Xverify:none",
53+
"-Dprism.order=d3d,es2,sw"
54+
]
55+
}
56+
57+
tasks.withType(Jar) {
58+
manifest {
59+
attributes["Main-Class"] = theMainClassName
60+
}
61+
}
62+
63+
tasks.withType(Test) {
64+
dependsOn(project("test_plugins").tasks["jar"])
65+
}
66+
67+
tasks.withType(ShadowJar).configureEach {
68+
archiveBaseName = "Shuffleboard"
69+
archiveVersion = ""
70+
exclude("module-info.class")
71+
archiveClassifier.set(wpilibTools.platformMapper.currentPlatform.platformName)
72+
}
73+
74+
addTaskToCopyAllOutputs(shadowJar)
75+
76+
sourceSets["test"].resources.srcDirs.add(new File(project("test_plugins").buildDir, "libs"))

app/app.gradle.kts

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

app/src/main/java/edu/wpi/first/shuffleboard/app/Main.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
import com.sun.javafx.application.LauncherImpl;
44

5+
import edu.wpi.first.wpiutil.CombinedRuntimeLoader;
6+
import edu.wpi.first.wpiutil.WPIUtilJNI;
7+
8+
import java.io.IOException;
59
import java.util.logging.Level;
610
import java.util.logging.Logger;
711

@@ -16,7 +20,10 @@ public final class Main {
1620
private static final Logger logger = Logger.getLogger(Main.class.getName());
1721

1822
@SuppressWarnings("JavadocMethod")
19-
public static void main(String[] args) {
23+
public static void main(String[] args) throws IOException {
24+
WPIUtilJNI.Helper.setExtractOnStaticLoad(false);
25+
CombinedRuntimeLoader.loadLibraries(Main.class, "wpiutiljni");
26+
2027
// JavaFX 11+ uses GTK3 by default, and has problems on some display servers
2128
// This flag forces JavaFX to use GTK2
2229
System.setProperty("jdk.gtk.version", "2");

app/test_plugins/test_plugins.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
id 'java-library'
3+
}
4+
5+
dependencies {
6+
api project(':api')
7+
}

0 commit comments

Comments
 (0)