-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
168 lines (135 loc) · 5.64 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// Add a build dependency on Packr to build native executables
buildscript {
dependencies {
classpath files("build-libs/packr-all-4.0.0.jar")
}
}
import com.badlogicgames.packr.*;
plugins {
id 'java'
id 'edu.wpi.first.WpilibTools' version '1.1.0'
}
group 'com.swrobotics'
version '2024'
compileJava {
sourceCompatibility = '17'
targetCompatibility = '17'
}
// ALL of these should be updated when updating WPILib version
// They are found in https://github.com/wpilibsuite/GradleRIO/blob/main/src/main/java/edu/wpi/first/gradlerio/wpi/WPIVersionsExtension.java
def WPILIB_VERSION = '2024.3.1'
def JACKSON_VERSION = '2.15.2'
def EJML_VERSION = '0.43.1'
def QUICKBUF_VERSION = '1.3.2'
def P5X_VERSION = '0.353.0-beta-3'
def LWJGL_VERSION = '3.3.1'
def IMGUI_VERSION = '1.86.4'
wpilibTools.deps.wpilibVersion = WPILIB_VERSION
def nativeConfigName = 'wpilibNatives'
def nativeConfig = configurations.create(nativeConfigName)
def nativeTasks = wpilibTools.createExtractionTasks {
configurationName = nativeConfigName
}
nativeTasks.addToSourceSetResources(sourceSets.main)
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpimath")
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpinet")
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil")
nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore")
static def lwjglModule(module) {
def prefix = 'org.lwjgl:lwjgl'
if (module != null) prefix += '-' + module
return [
prefix,
prefix + '::natives-linux',
prefix + '::natives-linux-arm64',
prefix + '::natives-linux-arm32',
prefix + '::natives-macos',
prefix + '::natives-windows',
prefix + '::natives-windows-x86'
]
}
dependencies {
implementation project(':Messenger:MessengerClient')
implementation project(':MathLib')
implementation "org.praxislive.libp5x:processing-core:${P5X_VERSION}"
implementation("org.praxislive.libp5x:processing-lwjgl:${P5X_VERSION}") {
exclude group: 'org.lwjgl'
}
implementation "io.github.spair:imgui-java-binding:${IMGUI_VERSION}"
implementation "io.github.spair:imgui-java-natives-linux:${IMGUI_VERSION}"
implementation "io.github.spair:imgui-java-natives-macos:${IMGUI_VERSION}"
implementation "io.github.spair:imgui-java-natives-windows:${IMGUI_VERSION}"
implementation("io.github.spair:imgui-java-lwjgl3:${IMGUI_VERSION}") {
exclude group: 'org.lwjgl'
}
implementation platform("org.lwjgl:lwjgl-bom:${LWJGL_VERSION}")
implementation lwjglModule(null)
implementation lwjglModule('assimp')
implementation lwjglModule('glfw')
implementation lwjglModule('opengl')
implementation lwjglModule('stb')
implementation "com.fazecast:jSerialComm:2.9.3"
implementation wpilibTools.deps.wpilibJava("wpiutil")
implementation wpilibTools.deps.wpilibJava("wpimath")
implementation wpilibTools.deps.wpilibJava("wpinet")
implementation wpilibTools.deps.wpilibJava("ntcore")
implementation group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: JACKSON_VERSION
implementation group: "com.fasterxml.jackson.core", name: "jackson-core", version: JACKSON_VERSION
implementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: JACKSON_VERSION
implementation group: "us.hebi.quickbuf", name: "quickbuf-runtime", version: QUICKBUF_VERSION
implementation group: "org.ejml", name: "ejml-simple", version: EJML_VERSION
implementation group: "org.joml", name: "joml", version: "1.10.5"
implementation "com.google.code.gson:gson:2.10.1"
implementation "com.jcraft:jsch:0.1.55"
}
jar {
dependsOn ':Messenger:MessengerClient:jar'
dependsOn ':MathLib:jar'
manifest {
attributes 'Main-Class': 'com.swrobotics.shufflelog.ShuffleLog'
}
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
def JRE_LINUX_X64 = "OpenJDK11U-jre_x64_linux_hotspot_11.0.17_8.tar.gz"
def JRE_WINDOWS_X64 = "OpenJDK11U-jre_x64_windows_hotspot_11.0.17_8.zip"
static boolean deleteDirectory(File directoryToBeDeleted) {
File[] allContents = directoryToBeDeleted.listFiles()
if (allContents != null) {
for (File file : allContents) {
deleteDirectory(file)
}
}
return directoryToBeDeleted.delete()
}
static void packForPlatform(platform, jre) {
def JRE_DOWNLOAD_ROOT = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.17%2B8/"
System.out.println((Object) "Packing executable for ${platform} with jre ${jre}")
def workingPath = System.getProperty("user.dir")
def workingDir = new File(workingPath)
def s = File.separator
def outDir = new File(workingDir, "ShuffleLog${s}build${s}pack${s}${platform}")
deleteDirectory(outDir)
outDir.mkdirs()
def packConfig = new PackrConfig(
platform,
(JRE_DOWNLOAD_ROOT + jre).toString(),
"ShuffleLog-${platform}".toString(),
Arrays.asList("${workingPath}${s}ShuffleLog${s}build${s}libs${s}ShuffleLog-2023.jar".toString()),
'com.swrobotics.shufflelog.ShuffleLog'.toString(),
outDir
)
packConfig.vmArgs = new ArrayList<>()
packConfig.jrePath = "jre"
new Packr().pack(packConfig)
}
tasks.register("pack") {
dependsOn "jar"
doLast {
packForPlatform(PackrConfig.Platform.Windows64, JRE_WINDOWS_X64)
packForPlatform(PackrConfig.Platform.Linux64, JRE_LINUX_X64)
}
}