Skip to content

Commit

Permalink
Merge branch 'main' into frc-docs-shoutout
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty authored Dec 14, 2024
2 parents 39f24af + 2a5a5e7 commit f836419
Show file tree
Hide file tree
Showing 78 changed files with 175 additions and 2,389 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: temurin
- name: Publish to Maven Local
run: ./gradlew build publishToMavenLocal --stacktrace -PlocalPublish
Expand All @@ -20,31 +20,31 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: Maven
path: ~/.m2/
path: ~/.m2/repository/

test_examples:
needs: build
runs-on: ubuntu-22.04
strategy:
matrix:
language: [cpp, java, asm] #, jni, kotlin]
language: [cpp, java, asm] #, jni]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: temurin
- uses: actions/download-artifact@v4
with:
name: Maven
path: ~/.m2/
path: ~/.m2/repository/

- name: Setup RoboRIO Toolchain
if: ${{ (matrix.language == 'cpp') || (matrix.language == 'asm') }}
run: ./gradlew installRoboRioToolchain
run: ../../gradlew installRoboRioToolchain
working-directory: testing/${{ matrix.language }}
- name: Test ${{ matrix.language }} Build
run: ./gradlew build
run: ../../gradlew build
working-directory: testing/${{ matrix.language }}

publish:
Expand All @@ -56,7 +56,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: temurin
- name: Publish
if: ${{ github.repository_owner == 'wpilibsuite' && startsWith(github.ref, 'refs/tags/v') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ jobs:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,19 @@ plugins {

The latest version can be obtained from here: https://plugins.gradle.org/plugin/edu.wpi.first.GradleRIO

## Deploying alternate JRE

For 2023, JRE 17 is deployed. To use JRE 11 from previous years, do the following:

1. Add `wpi.jreArtifactLocation = 'edu.wpi.first.jdk:roborio-2021:11.0.9u11-1'` to build.gradle
2. Set `gcType = 'CMS'` in the FRCJavaArtifact block to use the CMS garbage collector

## Using alternate garbage collector

GradleRIO has built in settings for the CMS garbage collector (for JDK 11) and G1 (for JDK 17).
GradleRIO has built in settings for several different garbage collectors. The G1 Garbage Collector was used for 2023. The Serial Garbage Collector is used for 2024. A list of all Garbage Collectors and settings that GradleRIO has built-in support for setting is available at: https://github.com/wpilibsuite/GradleRIO/blob/main/src/main/java/edu/wpi/first/gradlerio/deploy/roborio/GarbageCollectorType.java. To use another Garbage Collector, in the FRCJavaArtifact block, add `gcType = ` and set it to the value found in the `GarbageCollectorType` enum.

The `Other` `gcType` can be used for complete customization

1. Set `gcType = 'Other'` in the FRCJavaArtifact block
2. Add the appropriate jvmArg for the Garbage Collector and settings in the FRCJavaArtifact (e.g. for the default G1 settings, `jvmArgs.add("-XX:+UseG1GC", "-XX:MaxGCPauseMillis=1", "-XX:GCTimeRatio=1")`
2. Add the appropriate jvmArg for the Garbage Collector and settings in the FRCJavaArtifact. For the default G1 settings:
```
jvmArgs.add("-XX:+UseG1GC")
jvmArgs.add("-XX:MaxGCPauseMillis=1")
jvmArgs.add("-XX:GCTimeRatio=1")
```

# Using GradleRIO custom builds

Expand Down
12 changes: 8 additions & 4 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.6.0'

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

Expand All @@ -38,8 +38,8 @@ base {
}

java {
sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = 17
targetCompatibility = 17
}

allprojects {
Expand All @@ -52,6 +52,10 @@ allprojects {
tasks.withType(Javadoc) {
options.addBooleanOption('Xdoclint:all,-missing', true)
}

tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}

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

wrapper {
gradleVersion = '8.5'
gradleVersion = '8.11'
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.1.1-beta-4
version = 2025.1.1-beta-2
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.11-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 @@ -6,5 +6,6 @@ public class OneDriveException extends java.lang.RuntimeException {
public OneDriveException(Project project) {
super(String.format("Error cannot create project inside OneDrive. Project Directory = %S", project.getRootDir().toString()));
System.out.println(String.format("Error cannot create project inside OneDrive. Project Directory = %S", project.getRootDir().toString()));
System.out.println("To fix this error move your project out of the OneDrive folder.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void deploy(DeployContext arg0) {
}

public FileCollection computeFiles() {
Set<File> configFileCaches = configuration.get().getResolvedConfiguration().getFiles();
Set<File> configFileCaches = configuration.get().getIncoming().getFiles().getFiles();
if (zipped) {
Optional<FileTree> allFiles = configFileCaches.stream().map(file -> getTarget().getProject().zipTree(file).matching(filter)).filter(x -> x != null).reduce((a, b) -> a.plus(b));
if (allFiles.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.List;

public enum GarbageCollectorType {
CMS("-XX:+UseConcMarkSweepGC"),
G1("-XX:+UseG1GC", "-XX:MaxGCPauseMillis=1", "-XX:GCTimeRatio=1"),
G1_LongPause("-XX:+UseG1GC", "-XX:MaxGCPauseMillis=5", "-XX:GCTimeRatio=1"),
G1_Base("-XX:+UseG1GC"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public RoboRIO(String name, Project project, DeployExtension de, FRCExtension fr

setMaxChannels(4);

// Increase timeout. The only time this is really used is if the host is resolved,
// but takes forever to connect, which can happen if the CPU is loaded.
setTimeout(7);

setOnlyIf(ctx -> verifyOnlyIf(ctx));

// Make a copy of valid image versions so user defined cannot modify the global array
Expand Down
27 changes: 22 additions & 5 deletions src/main/java/edu/wpi/first/gradlerio/wpi/WPIExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
import org.gradle.api.provider.Provider;
import org.gradle.internal.os.OperatingSystem;
import org.gradle.nativeplatform.plugins.NativeComponentPlugin;
import org.gradle.plugins.ide.eclipse.EclipsePlugin;
import org.gradle.plugins.ide.eclipse.model.ClasspathEntry;
import org.gradle.plugins.ide.eclipse.model.EclipseClasspath;
import org.gradle.plugins.ide.eclipse.model.EclipseModel;
import org.gradle.plugins.ide.eclipse.model.SourceFolder;

import edu.wpi.first.gradlerio.wpi.java.WPIJavaExtension;
import edu.wpi.first.gradlerio.wpi.cpp.WPINativeExtension;
Expand All @@ -24,9 +29,9 @@
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-1";
private String jreArtifactLocation = "edu.wpi.first.jdk:roborio-2024:17.0.9u7-3";

// WPILib (first.wpi.edu/FRC/roborio/maven) Utilities

Expand Down Expand Up @@ -58,7 +63,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 All @@ -85,6 +90,20 @@ public WPIExtension(Project project) {

project.getPlugins().withType(JavaPlugin.class, p -> {
java = factory.newInstance(WPIJavaExtension.class, project, sim, versions);

project.getPluginManager().apply(EclipsePlugin.class);
EclipseModel eclipse = project.getExtensions().getByType(EclipseModel.class);
EclipseClasspath eclipseClasspath = eclipse.getClasspath();
eclipseClasspath.containers("org.eclipse.buildship.core.gradleclasspathcontainer");
eclipseClasspath.getFile().whenMerged(cp -> {
if (cp instanceof org.gradle.plugins.ide.eclipse.model.Classpath ecp) {
List<ClasspathEntry> entries = ecp.getEntries();
// TODO make this grab the build folder dynamically, and include everything else necessary
SourceFolder src = new SourceFolder("build/generated/sources/annotationProcessor/java/main", null);
entries.add(src);
}
});

});

maven = factory.newInstance(WPIMavenExtension.class, project);
Expand Down Expand Up @@ -147,8 +166,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.1.1-beta-4";
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-2";
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.1.1-beta-4";
private static final String googleTestVersion = "1.14.0-1";
private static final String wpimathVersion = "2025.1.1-beta-2";

private static final String smartDashboardVersion = "2024.1.1-beta-4";
private static final String shuffleboardVersion = "2024.1.1-beta-4";
private static final String outlineViewerVersion = "2024.1.1-beta-4";
private static final String robotBuilderVersion = "2024.1.1-beta-4";
private static final String pathWeaverVersion = "2024.1.1-beta-4";
private static final String glassVersion = "2024.1.1-beta-4";
private static final String sysIdVersion = "2024.1.1-beta-4";
private static final String roboRIOTeamNumberSetterVersion = "2024.1.1-beta-4";
private static final String dataLogToolVersion = "2024.1.1-beta-4";
private static final String smartDashboardVersion = "2025.1.1-beta-2";
private static final String shuffleboardVersion = "2025.1.1-beta-2";
private static final String outlineViewerVersion = "2025.1.1-beta-2";
private static final String robotBuilderVersion = "2025.1.1-beta-2";
private static final String pathWeaverVersion = "2025.1.1-beta-2";
private static final String glassVersion = "2025.1.1-beta-2";
private static final String sysIdVersion = "2025.1.1-beta-2";
private static final String roboRIOTeamNumberSetterVersion = "2025.1.1-beta-2";
private static final String dataLogToolVersion = "2025.1.1-beta-2";


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
@@ -1,7 +1,6 @@
package edu.wpi.first.gradlerio.wpi.cpp;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Iterator;
import java.util.stream.Stream;
Expand Down Expand Up @@ -120,7 +119,7 @@ public Iterator<String> iterator() {
System.out.println(line);
}
}
} catch (IOException e) {
} catch (Exception e) {
Logging.getLogger(WPINativeCompileRules.class).warn(
"Failed to print warnings file. You might need to manually open it to find any compile warnings",
e);
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
Loading

0 comments on commit f836419

Please sign in to comment.