Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ repositories {
mavenLocal()
}

configurations {
processstarterDownload
}

def processstarterToolVersion = "2025.3.2"

dependencies {

api 'com.google.code.gson:gson:2.13.1'

api 'edu.wpi.first:native-utils:2025.9.1'
Expand All @@ -27,6 +34,13 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.13.4")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testImplementation gradleTestKit()

processstarterDownload "edu.wpi.first.tools:processstarter:$processstarterToolVersion:windowsx86-64@zip"
processstarterDownload "edu.wpi.first.tools:processstarter:$processstarterToolVersion:linuxx86-64@zip"
processstarterDownload "edu.wpi.first.tools:processstarter:$processstarterToolVersion:linuxarm32@zip"
processstarterDownload "edu.wpi.first.tools:processstarter:$processstarterToolVersion:linuxarm64@zip"
processstarterDownload "edu.wpi.first.tools:processstarter:$processstarterToolVersion:osxuniversal@zip"
processstarterDownload "edu.wpi.first.tools:processstarter:$processstarterToolVersion:windowsarm64@zip"
}

tasks.withType(Test).configureEach {
Expand Down Expand Up @@ -112,6 +126,46 @@ examplesFolder.eachFile { File file ->

jar.finalizedBy zipExamples

task processprocessstarterDownload {
inputs.files configurations.processstarterDownload
doLast {
configurations.processstarterDownload.each { downloadedFile ->
def destinationDir = file("${buildDir}/resources/main")
// Unzip and copy files
copy {
from(zipTree(downloadedFile)) {
include 'processstarter*'
}
into destinationDir
}

// Rename the extracted file to include the classifier
destinationDir.eachFile { extractedFile ->

if (extractedFile.name.startsWith('processstarter') && !extractedFile.name.contains('-')) {
def destinationFile = file("${buildDir}/resources/main/processstarter")
if (downloadedFile.name.contains("linuxarm32")) {
destinationFile = file("${buildDir}/resources/main/processstarter-linuxarm32")
} else if (downloadedFile.name.contains("linuxarm64")) {
destinationFile = file("${buildDir}/resources/main/processstarter-linuxarm64")
} else if (downloadedFile.name.contains("linuxx86-64")) {
destinationFile = file("${buildDir}/resources/main/processstarter-linuxx86-64")
} else if (downloadedFile.name.contains("osxuniversal")) {
destinationFile = file("${buildDir}/resources/main/processstarter-osxuniversal")
} else if (downloadedFile.name.contains("windowsx86-64")) {
destinationFile = file("${buildDir}/resources/main/processstarter-windowsx86-64.exe")
} else if (downloadedFile.name.contains("windowsarm64")) {
destinationFile = file("${buildDir}/resources/main/processstarter-windowsarm64.exe")
}
extractedFile.renameTo(destinationFile)
}
}
}
}
}

jar.dependsOn processprocessstarterDownload

wrapper {
gradleVersion = '8.11'
distributionType = Wrapper.DistributionType.BIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public abstract class WPIVersionsExtension {
private static final String roboRIOTeamNumberSetterVersion = "2025.3.2";
private static final String dataLogToolVersion = "2025.3.2";
private static final String wpicalToolVersion = "2025.3.2";
private static final String processstarterToolVersion = "2025.3.2";


public abstract Property<String> getWpilibVersion();
Expand All @@ -46,6 +47,7 @@ public abstract class WPIVersionsExtension {
public abstract Property<String> getRoboRIOTeamNumberSetterVersion();
public abstract Property<String> getDataLogToolVersion();
public abstract Property<String> getwpicalToolVersion();
public abstract Property<String> getprocessstarterToolVersion();

@Inject
public WPIVersionsExtension() {
Expand All @@ -68,6 +70,7 @@ public WPIVersionsExtension() {
getRoboRIOTeamNumberSetterVersion().convention(roboRIOTeamNumberSetterVersion);
getDataLogToolVersion().convention(dataLogToolVersion);
getwpicalToolVersion().convention(wpicalToolVersion);
getprocessstarterToolVersion().convention(processstarterToolVersion);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ private String getArgumentPath(String toolNameLower) {
private void runToolWindows() {
Directory toolsFolder = this.toolsFolder.get();
String toolName = this.toolName.get();
File outputFile = toolsFolder.file(toolName + ".vbs").getAsFile();
ProcessBuilder builder = new ProcessBuilder("wscript.exe", outputFile.getAbsolutePath(), "silent",
File outputFile = toolsFolder.file(toolName + ".exe").getAsFile();
ProcessBuilder builder = new ProcessBuilder(outputFile.getAbsolutePath(),
getArgumentPath(toolName.toLowerCase()));
try {
Process proc = builder.start();
Expand All @@ -80,7 +80,7 @@ private void runToolWindows() {
private void runToolUnix() {
Directory toolsFolder = this.toolsFolder.get();
String toolName = this.toolName.get();
File outputFile = toolsFolder.file(toolName + ".sh").getAsFile();
File outputFile = toolsFolder.file(toolName).getAsFile();
operations.exec(spec -> {
spec.setExecutable(outputFile.getAbsolutePath());
spec.args(getArgumentPath(toolName.toLowerCase()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;

import edu.wpi.first.toolchain.NativePlatforms;

import org.codehaus.groovy.runtime.IOGroovyMethods;
import org.codehaus.groovy.runtime.ResourceGroovyMethods;
import org.gradle.api.Action;
Expand Down Expand Up @@ -138,7 +140,7 @@ private static synchronized void setToolVersion(Directory toolsFolder, ToolConfi
}

private static File getScriptFile(Directory toolsFolder, String toolName) {
return toolsFolder.file(toolName + ".vbs").getAsFile();
return toolsFolder.file(toolName + ".exe").getAsFile();
}

private static Dependency getDependencyObject(Configuration configuration, String artifactName) {
Expand Down Expand Up @@ -218,18 +220,25 @@ public void execute(CopySpec cp) {
}

private static void extractScriptWindows(Directory toolsFolder, String toolName) {
File outputFile = toolsFolder.file(toolName + ".vbs").getAsFile();
try (InputStream it = ToolInstallTask.class.getResourceAsStream("/ScriptBase.vbs")) {
ResourceGroovyMethods.setText(outputFile, IOGroovyMethods.getText(it));
File outputFile = toolsFolder.file(toolName + ".exe").getAsFile();
String inputFileName = "/processstarter-" + NativePlatforms.desktopOS() + NativePlatforms.desktopArchDirect() + ".exe";
try (InputStream it = ToolInstallTask.class.getResourceAsStream(inputFileName)) {
ResourceGroovyMethods.setBytes(outputFile, IOGroovyMethods.getBytes(it));
} catch (IOException e) {
throw new RuntimeException(e);
}
}

private void extractScriptUnix(Project project, Directory toolsFolder, String toolName) {
File outputFile = toolsFolder.file(toolName + ".sh").getAsFile();
try (InputStream it = ToolInstallTask.class.getResourceAsStream("/ScriptBase.sh")) {
ResourceGroovyMethods.setText(outputFile, IOGroovyMethods.getText(it));
File outputFile = toolsFolder.file(toolName).getAsFile();
String inputFileName = "/processstarter-";
if (OperatingSystem.current().isMacOsX())
inputFileName += "osxuniversal";
else
inputFileName += NativePlatforms.desktopOS() + NativePlatforms.desktopArchDirect();
System.out.println("Extracting Unix: " + inputFileName + " to " + outputFile.getAbsolutePath());
try (InputStream it = ToolInstallTask.class.getResourceAsStream(inputFileName)) {
ResourceGroovyMethods.setBytes(outputFile, IOGroovyMethods.getBytes(it));
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public void runTool() {
private void runToolWindows() {
Directory toolsFolder = this.toolsFolder.get();
String toolName = this.toolName.get();
File outputFile = toolsFolder.file(toolName + ".vbs").getAsFile();
ProcessBuilder builder = new ProcessBuilder("wscript.exe", outputFile.getAbsolutePath(), "silent");
File outputFile = toolsFolder.file(toolName + ".exe").getAsFile();
ProcessBuilder builder = new ProcessBuilder(outputFile.getAbsolutePath());
Process proc;
try {
proc = builder.start();
Expand All @@ -79,7 +79,7 @@ private void runToolWindows() {
private void runToolUnix() {
Directory toolsFolder = this.toolsFolder.get();
String toolName = this.toolName.get();
File outputFile = toolsFolder.file(toolName + ".sh").getAsFile();
File outputFile = toolsFolder.file(toolName).getAsFile();
operations.exec(spec -> {
spec.setExecutable(outputFile.getAbsolutePath());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public void apply(Project project) {
"edu.wpi.first.tools:wpical", toolsFolder));
}

cppTools.add(new WPICppTool(project, "processstarter", wpi.getVersions().getprocessstarterToolVersion(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting, its not indented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's an artifact of the github view. Although the next line was indented too much, so I fixed that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, it wasn't supposed to be in that conditional. Fixed.

"edu.wpi.first.tools:processstarter", toolsFolder));

project.getTasks().register("InstallAllTools", task -> {
task.setGroup("GradleRIO");
task.setDescription("Install All Tools");
Expand Down
55 changes: 0 additions & 55 deletions src/main/resources/ScriptBase.py

This file was deleted.

17 changes: 0 additions & 17 deletions src/main/resources/ScriptBase.sh

This file was deleted.

84 changes: 0 additions & 84 deletions src/main/resources/ScriptBase.vbs

This file was deleted.

15 changes: 15 additions & 0 deletions versionupdates.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def versionMap = [
imguiVersion: 'edu.wpi.first.thirdparty.frc2024:imgui:+:headers',
wpimathVersion: 'edu.wpi.first.wpimath:wpimath-java:+',
wpicalToolVersion: 'edu.wpi.first.tools:wpical:+:windowsx86-64@zip',
processstarterToolVersion: 'edu.wpi.first.tools:processstarter:+:windowsx86-64@zip',
]

configurations {
Expand All @@ -39,6 +40,7 @@ dependencies {
}

String regex = "String\\s+?placeholder\\s+?=\\s+?[\\\"|\\'].+?[\\\"|\\']"
String buildRegex = "def\\s+?placeholder\\s+?=\\s+?[\\\"|\\'].+?[\\\"|\\']"
String mavenDevRegex = "this\\.useDevelopment\\s*=\\s*(true|false)"
String validVersionsRegex = "validImageVersions = List\\.of\\((.+)\\);"

Expand Down Expand Up @@ -67,6 +69,19 @@ tasks.register('UpdateVersions') {
}
extFile.text = extText

def buildFile = file('build.gradle')
def buildText = buildFile.text
configurations.gradleRioVersions.resolvedConfiguration.resolvedArtifacts.each {
versionMap.each { key, value ->
def id = it.moduleVersion.id
if (value.startsWith("${id.group}:${it.name}:+".toString())) {
def localBuildRegex = buildRegex.replace('placeholder', key)
buildText = buildText.replaceAll(localBuildRegex, "def ${key} = \"${id.version}\"".toString())
}
}
}
buildFile.text = buildText

def allowedVersions = ""
def first = true
configurations.gradleRioVersions.resolvedConfiguration.resolvedArtifacts.each {
Expand Down