Skip to content

Commit

Permalink
Merge branch 'main' into jnitestrebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty authored Nov 1, 2024
2 parents 53b9105 + 9234ce8 commit e5545d4
Show file tree
Hide file tree
Showing 40 changed files with 144 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: Maven
path: ~/.m2/
path: ~/.m2/repository/

- name: Setup RoboRIO Toolchain
if: ${{ (matrix.language == 'cpp') || (matrix.language == 'asm') || (matrix.language == 'jni') }}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repositories {
dependencies {
api 'com.google.code.gson:gson:2.8.6'

api 'edu.wpi.first:native-utils:2024.6.1'
api 'edu.wpi.first:native-utils:2025.4.0'

api 'de.undercouch:gradle-download-task:4.1.2'

Expand Down Expand Up @@ -109,6 +109,6 @@ examplesFolder.eachFile { File file ->
jar.finalizedBy zipExamples

wrapper {
gradleVersion = '8.5'
gradleVersion = '8.10.2'
distributionType = Wrapper.DistributionType.BIN
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = 2024.3.2
version = 2025.1.1-beta-1
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ public List<String> getAllowedImageVersions() {
return allowedImageVersions;
}

private static String parseMessage(String imageVersion) {
return "Invalid RoboRIO Image Version!" +
"\nRoboRIO image and GradleRIO versions are incompatible:" +
"\n\tCurrent image version: " + imageVersion +
"\n\tGradleRIO-compatible image versions: 2024_v2.* except 2024_v2.0" +
"\nSee https://docs.wpilib.org/en/stable/docs/zero-to-robot/step-3/imaging-your-roborio.html" +
"for information about upgrading the RoboRIO image." +
"\nSee https://docs.wpilib.org/en/stable/docs/zero-to-robot/step-2/wpilib-setup.html and" +
"\nhttps://docs.wpilib.org/en/stable/docs/software/vscode-overview/importing-gradle-project.html" +
"\nfor information about updating WPILib and GradleRIO.";
}

private static String parseMessage(String imageVersion, List<String> allowedImageVersions) {
return "Invalid RoboRIO Image Version!" +
"\nRoboRIO image and GradleRIO versions are incompatible:" +
Expand All @@ -46,12 +34,6 @@ public InvalidImageException(String imageVersion, List<String> allowedImageVersi
this.allowedImageVersions = new ArrayList<>(allowedImageVersions);
}

public InvalidImageException(String imageVersion, boolean isSpecialCase) {
super(parseMessage(imageVersion));
this.imageVersion = imageVersion;
this.allowedImageVersions = new ArrayList<>();
}

public InvalidImageException() {
super("Could not parse image version!");
allowedImageVersions = List.of();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ private void readAndVerifyImage(DeployContext context) {
}

private void verifyImageVersion(String image) {
if (image.equalsIgnoreCase("2024_v2.0")) {
throw new InvalidImageException(image, true);
}

boolean foundMatch = validImageVersions.stream().filter(x -> {
int index = x.indexOf("*");
if (index == -1) {
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/edu/wpi/first/gradlerio/wpi/WPIExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public class WPIExtension {
// WPILib (first.wpi.edu/FRC/roborio/maven) libs

private static final List<String> validImageVersions = List.of("2024_v2.*");
private static final List<String> validImageVersions = List.of("2025_v1.*");

private String jreArtifactLocation = "edu.wpi.first.jdk:roborio-2024:17.0.9u7-3";

Expand Down Expand Up @@ -58,7 +58,7 @@ public WPIExtension(Project project) {
platforms = new NativePlatforms();

frcYear = factory.property(String.class);
frcYear.convention("2024");
frcYear.convention("2025");

frcHome = factory.directoryProperty().fileProvider(project.provider(WPIExtension::computeHomeRoot))
.dir(frcYear);
Expand Down Expand Up @@ -147,8 +147,6 @@ private static File computeHomeRoot() {
// "wpilibVersion" : new Tuple("WPILib", wpilibVersion, "wpilib"),
// "opencvVersion" : new Tuple("OpenCV", opencvVersion, "opencv"),
// "frcYear " : new Tuple("FRC Year", frcYear, "frcYear"),
// "googleTestVersion" : new Tuple("Google Test", googleTestVersion,
// "googleTest"),
// "imguiVersion" : new Tuple("ImGUI", imguiVersion, "imgui"),
// "wpimathVersion" : new Tuple("WPIMath", wpimathVersion, "wpimath"),
// "ejmlVersion" : new Tuple("EJML", ejmlVersion, "ejml"),
Expand Down
29 changes: 13 additions & 16 deletions src/main/java/edu/wpi/first/gradlerio/wpi/WPIVersionsExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,29 @@

public abstract class WPIVersionsExtension {

private static final String wpilibVersion = "2024.3.2";
private static final String niLibrariesVersion = "2024.2.1";
private static final String opencvVersion = "4.8.0-2";
private static final String wpilibVersion = "2025.1.1-beta-1";
private static final String niLibrariesVersion = "2025.0.0";
private static final String opencvVersion = "4.8.0-4";
private static final String imguiVersion = "1.89.9-1";
private static final String ejmlVersion = "0.43.1";
private static final String jacksonVersion = "2.15.2";
private static final String quickbufVersion = "1.3.3";
private static final String wpimathVersion = "2024.3.2";
private static final String googleTestVersion = "1.14.0-1";
private static final String wpimathVersion = "2025.1.1-beta-1";

private static final String smartDashboardVersion = "2024.3.2";
private static final String shuffleboardVersion = "2024.3.2";
private static final String outlineViewerVersion = "2024.3.2";
private static final String robotBuilderVersion = "2024.3.2";
private static final String pathWeaverVersion = "2024.3.2";
private static final String glassVersion = "2024.3.2";
private static final String sysIdVersion = "2024.3.2";
private static final String roboRIOTeamNumberSetterVersion = "2024.3.2";
private static final String dataLogToolVersion = "2024.3.2";
private static final String smartDashboardVersion = "2025.1.1-beta-1";
private static final String shuffleboardVersion = "2025.1.1-beta-1";
private static final String outlineViewerVersion = "2025.1.1-beta-1";
private static final String robotBuilderVersion = "2025.1.1-beta-1";
private static final String pathWeaverVersion = "2025.1.1-beta-1";
private static final String glassVersion = "2025.1.1-beta-1";
private static final String sysIdVersion = "2025.1.1-beta-1";
private static final String roboRIOTeamNumberSetterVersion = "2025.1.1-beta-1";
private static final String dataLogToolVersion = "2025.1.1-beta-1";


public abstract Property<String> getWpilibVersion();
public abstract Property<String> getNiLibrariesVersion();
public abstract Property<String> getOpencvVersion();
public abstract Property<String> getGoogleTestVersion();
public abstract Property<String> getImguiVersion();
public abstract Property<String> getWpimathVersion();

Expand All @@ -52,7 +50,6 @@ public WPIVersionsExtension() {
getWpilibVersion().convention(wpilibVersion);
getNiLibrariesVersion().convention(niLibrariesVersion);
getOpencvVersion().convention(opencvVersion);
getGoogleTestVersion().convention(googleTestVersion);
getImguiVersion().convention(imguiVersion);
getWpimathVersion().convention(wpimathVersion);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,10 @@ public WPINativeExtension(Project project, WPIExtension wpi, WPIVersionsExtensio
// nte.setSinglePrintPerPlatform();

nte.getWpi().configureDependencies(wpiDeps -> {
wpiDeps.getGoogleTestYear().set("frc2024");
wpiDeps.getOpencvYear().set("frc2024");
wpiDeps.getWpiVersion().set(versions.getWpilibVersion());
wpiDeps.getNiLibVersion().set(versions.getNiLibrariesVersion());
wpiDeps.getOpencvVersion().set(versions.getOpencvVersion());
wpiDeps.getGoogleTestVersion().set(versions.getGoogleTestVersion());
wpiDeps.getImguiVersion().set(versions.getImguiVersion());
wpiDeps.getWpimathVersion().set(versions.getWpimathVersion());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private void runToolWindows() {
private void runToolUnix() {
Directory toolsFolder = this.toolsFolder.get();
String toolName = this.toolName.get();
File outputFile = toolsFolder.file(toolName + ".py").getAsFile();
File outputFile = toolsFolder.file(toolName + ".sh").getAsFile();
getProject().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 @@ -213,8 +213,8 @@ private static void extractScriptWindows(Directory toolsFolder, String toolName)
}

private static void extractScriptUnix(Project project, Directory toolsFolder, String toolName) {
File outputFile = toolsFolder.file(toolName + ".py").getAsFile();
try (InputStream it = ToolInstallTask.class.getResourceAsStream("/ScriptBase.py")) {
File outputFile = toolsFolder.file(toolName + ".sh").getAsFile();
try (InputStream it = ToolInstallTask.class.getResourceAsStream("/ScriptBase.sh")) {
ResourceGroovyMethods.setText(outputFile, IOGroovyMethods.getText(it));
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void runToolWindows() {
private void runToolUnix() {
Directory toolsFolder = this.toolsFolder.get();
String toolName = this.toolName.get();
File outputFile = toolsFolder.file(toolName + ".py").getAsFile();
File outputFile = toolsFolder.file(toolName + ".sh").getAsFile();
getProject().exec(spec -> {
spec.setExecutable(outputFile.getAbsolutePath());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ public class WPIJavaDepsExtension {

private final ProviderFactory providers;

private static String dependencyNotation(String groupId, String artifactId, Provider<String> version) {
return groupId + ":" + artifactId + ":" + version.get();
}

private void createJavaDependencies(String groupdId, String artifactId, Provider<String> version) {
wpilibDeps.add(providers.provider(() -> {
return groupdId + ":" + artifactId + ":" + version.get();
return dependencyNotation(groupdId, artifactId, version);
}));

wpilibSources.add(providers.provider(() -> {
return groupdId + ":" + artifactId + ":" + version.get() + ":sources";
return dependencyNotation(groupdId, artifactId, version) + ":sources";
}));
}

private Provider<String> createJniDependency(String groupdId, String artifactId, Provider<String> version, boolean debug, String platform) {
String debugString = debug ? "debug" : "";
return providers.provider(() -> {
return groupdId + ":" + artifactId + ":" + version.get() + ":" + platform + debugString + "@zip";
return dependencyNotation(groupdId, artifactId, version) + ":" + platform + debugString + "@zip";
});
}

Expand All @@ -50,6 +54,7 @@ public WPIJavaDepsExtension(WPIVersionsExtension versions, ProviderFactory provi
createJavaDependencies("edu.wpi.first.wpiutil", "wpiutil-java", versions.getWpilibVersion());
createJavaDependencies("edu.wpi.first.apriltag", "apriltag-java", versions.getWpilibVersion());
createJavaDependencies("edu.wpi.first.wpiunits", "wpiunits-java", versions.getWpilibVersion());
createJavaDependencies("edu.wpi.first.epilogue", "epilogue-runtime-java", versions.getWpilibVersion());

createJavaDependencies("edu.wpi.first.thirdparty.frc2024.opencv", "opencv-java", versions.getOpencvVersion());
createJavaDependencies("org.ejml", "ejml-simple", versions.getEjmlVersion());
Expand All @@ -65,6 +70,16 @@ public List<Provider<String>> wpilib() {
return wpilibDeps;
}

/** Dependencies required for using WPILib's Java annotations during compilation. */
public List<Provider<String>> wpilibAnnotations() {
// epilogue-runtime is a dependency of epilogue-processor, and needs to be on the annotation processor
// classpath at compile time for the processor to function
return List.of(
providers.provider(() -> dependencyNotation("edu.wpi.first.epilogue", "epilogue-processor-java", versions.getWpilibVersion())),
providers.provider(() -> dependencyNotation("edu.wpi.first.epilogue", "epilogue-runtime-java", versions.getWpilibVersion()))
);
}

public List<Provider<String>> wpilibSources() {
return wpilibSources;
}
Expand Down
17 changes: 17 additions & 0 deletions src/main/resources/ScriptBase.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

SCRIPT_PATH="$(dirname "$(realpath "$0")")"
SCRIPT_NAME="$(basename "$(realpath "$0")")"
SCRIPT_BASE="$(basename -s .sh "$SCRIPT_NAME")"
JAR_NAME="$SCRIPT_BASE.jar"
JDK_DIR="$(realpath "$SCRIPT_PATH/../jdk/bin/java")"

if ! "$JDK_DIR" -jar "$SCRIPT_PATH/$JAR_NAME"; then
echo "ERROR launching $SCRIPT_PATH/$JAR_NAME using $JDK_DIR"
if ! "$JAVA_HOME/bin/java" -jar "$SCRIPT_PATH/$JAR_NAME"; then
echo "ERROR launching $SCRIPT_PATH/$JAR_NAME using $JAVA_HOME"
if ! java -jar "$SCRIPT_PATH/$JAR_NAME"; then
echo "ERROR launching $SCRIPT_PATH/$JAR_NAME using java from path: $(which java)"
fi
fi
fi
4 changes: 2 additions & 2 deletions testing/asm/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

plugins {
id "assembler"
id "edu.wpi.first.GradleRIO" version "2024.3.2"
id "edu.wpi.first.GradleRIO" version "2025.1.1-beta-1"
}

def projectFolder = project.buildFile.parentFile
Expand Down Expand Up @@ -77,6 +77,6 @@ model {
}

wrapper {
gradleVersion = '8.1'
gradleVersion = '8.10.2'
distributionType = Wrapper.DistributionType.BIN
}
Binary file modified testing/asm/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion testing/asm/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions testing/asm/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
Loading

0 comments on commit e5545d4

Please sign in to comment.