diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index fa13febb96..356c288bd6 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -16,11 +16,11 @@ jobs: artifact-name: Athena build-options: "-Ponlylinuxathena" - container: wpilib/raspbian-cross-ubuntu:10-20.04 - artifact-name: Raspbian - build-options: "-Ponlylinuxraspbian" + artifact-name: Arm32 + build-options: "-Ponlylinuxarm32" - container: wpilib/aarch64-cross-ubuntu:bionic-20.04 - artifact-name: Aarch64 - build-options: "-Ponlylinuxaarch64bionic" + artifact-name: Arm64 + build-options: "-Ponlylinuxarm64" - container: wpilib/ubuntu-base:20.04 artifact-name: Linux build-options: "-Ponlylinuxx86-64" @@ -64,7 +64,7 @@ jobs: - os: macOS-11 artifact-name: macOS architecture: x64 - build-options: "" + build-options: "-Pbuildalldesktop" task: "build" name: "Build - ${{ matrix.artifact-name }}" runs-on: ${{ matrix.os }} @@ -100,7 +100,7 @@ jobs: ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} - name: Sign Libraries with Developer ID - run: ./gradlew build -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ env.EXTRA_GRADLE_ARGS }} + run: ./gradlew build -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }} if: | matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))) diff --git a/README.md b/README.md index a1d82ff293..9f7a7d8c22 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Using Gradle makes building WPILib very straightforward. It only has a few depen - Run `./gradlew installRoboRioToolchain` after cloning this repository - If the WPILib installer was used, this toolchain is already installed - Raspberry Pi toolchain (optional) - - Run `./gradlew installRaspbianToolchain` after cloning this repository + - Run `./gradlew installArm32Toolchain` after cloning this repository ## Setup diff --git a/build.gradle b/build.gradle index 2edfeeca11..620a13b9af 100644 --- a/build.gradle +++ b/build.gradle @@ -156,5 +156,5 @@ ext.getCurrentArch = { } wrapper { - gradleVersion = '7.3.3' + gradleVersion = '7.5-rc-2' } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 41d42c93ca..b90fc771d8 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -5,5 +5,5 @@ repositories { } } dependencies { - implementation "edu.wpi.first:native-utils:2023.0.2" + implementation "edu.wpi.first:native-utils:2023.0.7" } diff --git a/cscore/build.gradle b/cscore/build.gradle index 974adcad07..c1a7243164 100644 --- a/cscore/build.gradle +++ b/cscore/build.gradle @@ -23,8 +23,8 @@ model { enableCheckTask true javaCompileTasks << compileJava jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.roborio) - jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.raspbian) - jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.aarch64bionic) + jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm32) + jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm64) sources { cpp { @@ -180,7 +180,7 @@ model { components { examplesMap.each { key, value -> if (key == "usbviewer") { - if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { + if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { "${key}"(NativeExecutableSpec) { targetBuildTypes 'debug' binaries.all { @@ -189,7 +189,7 @@ model { lib project: ':wpigui', library: 'wpigui', linkage: 'static' lib library: 'cscore', linkage: 'shared' nativeUtils.useRequiredLibrary(it, 'imgui_static') - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) { it.buildable = false return } diff --git a/datalogtool/build.gradle b/datalogtool/build.gradle index 8c8fc6c7d4..c7f1c158b5 100644 --- a/datalogtool/build.gradle +++ b/datalogtool/build.gradle @@ -1,6 +1,6 @@ import org.gradle.internal.os.OperatingSystem -if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { +if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { description = "roboRIO Team Number Setter" @@ -27,12 +27,12 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra nativeUtils { nativeDependencyContainer { libssh(getNativeDependencyTypeClass('WPIStaticMavenDependency')) { - groupId = "edu.wpi.first.thirdparty.frc2022" + groupId = "edu.wpi.first.thirdparty.frc2023" artifactId = "libssh" headerClassifier = "headers" sourceClassifier = "sources" ext = "zip" - version = '0.95-1' + version = '0.95-3' targetPlatforms.addAll(nativeUtils.wpi.platforms.desktopPlatforms) } } @@ -107,7 +107,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) { it.buildable = false return } diff --git a/datalogtool/publish.gradle b/datalogtool/publish.gradle index 2130d0449a..9608bef7b6 100644 --- a/datalogtool/publish.gradle +++ b/datalogtool/publish.gradle @@ -10,7 +10,7 @@ model { tasks { // Create the run task. $.components.datalogtool.binaries.each { bin -> - if (bin.buildable && bin.name.toLowerCase().contains("debug")) { + if (bin.buildable && bin.name.toLowerCase().contains("debug") && nativeUtils.isNativeDesktopPlatform(bin.targetPlatform)) { Task run = project.tasks.create("run", Exec) { commandLine bin.tasks.install.runScriptFile.get().asFile.toString() } @@ -30,10 +30,10 @@ model { def icon = file("$project.projectDir/src/main/native/mac/datalogtool.icns") // Create the macOS bundle. - def bundleTask = project.tasks.create("bundleDataLogToolOsxApp", Copy) { + def bundleTask = project.tasks.create("bundleDataLogToolOsxApp" + binary.targetPlatform.architecture.name, Copy) { description("Creates a macOS application bundle for DataLogTool") from(file("$project.projectDir/Info.plist")) - into(file("$project.buildDir/outputs/bundles/DataLogTool.app/Contents")) + into(file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/DataLogTool.app/Contents")) into("MacOS") { with copySpec { from binary.executable.file } } into("Resources") { with copySpec { from icon } } @@ -48,7 +48,7 @@ model { "codesign --force --strict --deep " + "--timestamp --options=runtime " + "--verbose -s ${project.findProperty("developerID")} " + - "$project.buildDir/outputs/bundles/DataLogTool.app/" + "$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/DataLogTool.app/" ] commandLine args } @@ -58,12 +58,12 @@ model { // Reset the application path if we are creating a bundle. if (binary.targetPlatform.operatingSystem.isMacOsX()) { - applicationPath = file("$project.buildDir/outputs/bundles") + applicationPath = file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name") project.build.dependsOn bundleTask } // Create the ZIP. - def task = project.tasks.create("copyDataLogToolExecutable", Zip) { + def task = project.tasks.create("copyDataLogToolExecutable" + binary.targetPlatform.architecture.name, Zip) { description("Copies the DataLogTool executable to the outputs directory.") destinationDirectory = outputsFolder diff --git a/fieldImages/build.gradle b/fieldImages/build.gradle index 476dd3c309..0d1dbb1cfc 100644 --- a/fieldImages/build.gradle +++ b/fieldImages/build.gradle @@ -1,6 +1,6 @@ import org.gradle.internal.os.OperatingSystem -if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { +if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { apply plugin: 'cpp' apply plugin: 'c' diff --git a/glass/build.gradle b/glass/build.gradle index 9f42d6f182..6c31d17234 100644 --- a/glass/build.gradle +++ b/glass/build.gradle @@ -1,6 +1,6 @@ import org.gradle.internal.os.OperatingSystem -if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { +if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { description = "A different kind of dashboard" @@ -100,7 +100,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) { it.buildable = false return } @@ -128,7 +128,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) { it.buildable = false return } @@ -169,7 +169,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) { it.buildable = false return } diff --git a/glass/publish.gradle b/glass/publish.gradle index 4dce506947..b127c11321 100644 --- a/glass/publish.gradle +++ b/glass/publish.gradle @@ -64,7 +64,8 @@ model { tasks { // Create the run task. $.components.glassApp.binaries.each { bin -> - if (bin.buildable && bin.name.toLowerCase().contains("debug")) { + if (bin.buildable && bin.name.toLowerCase().contains("debug") && nativeUtils.isNativeDesktopPlatform(bin.targetPlatform)) { + Task run = project.tasks.create("run", Exec) { commandLine bin.tasks.install.runScriptFile.get().asFile.toString() } @@ -84,10 +85,10 @@ model { def icon = file("$project.projectDir/src/app/native/mac/glass.icns") // Create the macOS bundle. - def bundleTask = project.tasks.create("bundleGlassOsxApp", Copy) { + def bundleTask = project.tasks.create("bundleGlassOsxApp" + binary.targetPlatform.architecture.name, Copy) { description("Creates a macOS application bundle for Glass") from(file("$project.projectDir/Info.plist")) - into(file("$project.buildDir/outputs/bundles/Glass.app/Contents")) + into(file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/Glass.app/Contents")) into("MacOS") { with copySpec { from binary.executable.file } } into("Resources") { with copySpec { from icon } } @@ -102,7 +103,7 @@ model { "codesign --force --strict --deep " + "--timestamp --options=runtime " + "--verbose -s ${project.findProperty("developerID")} " + - "$project.buildDir/outputs/bundles/Glass.app/" + "$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/Glass.app/" ] commandLine args } @@ -112,12 +113,12 @@ model { // Reset the application path if we are creating a bundle. if (binary.targetPlatform.operatingSystem.isMacOsX()) { - applicationPath = file("$project.buildDir/outputs/bundles") + applicationPath = file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name") project.build.dependsOn bundleTask } // Create the ZIP. - def task = project.tasks.create("copyGlassExecutable", Zip) { + def task = project.tasks.create("copyGlassExecutable" + binary.targetPlatform.architecture.name, Zip) { description("Copies the Glass executable to the outputs directory.") destinationDirectory = outputsFolder diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2a..249e5832f0 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e5897b5..26e62a13f1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-rc-2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787337..a69d9cb6c2 100755 --- a/gradlew +++ b/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index ac1b06f938..53a6b238d4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/outlineviewer/build.gradle b/outlineviewer/build.gradle index 17c5baf8b9..cbf0a16c63 100644 --- a/outlineviewer/build.gradle +++ b/outlineviewer/build.gradle @@ -1,6 +1,6 @@ import org.gradle.internal.os.OperatingSystem -if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { +if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { description = "NetworkTables Viewer" @@ -93,7 +93,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) { it.buildable = false return } diff --git a/outlineviewer/publish.gradle b/outlineviewer/publish.gradle index 78f044fa6e..85bb26c69a 100644 --- a/outlineviewer/publish.gradle +++ b/outlineviewer/publish.gradle @@ -10,7 +10,7 @@ model { tasks { // Create the run task. $.components.outlineviewer.binaries.each { bin -> - if (bin.buildable && bin.name.toLowerCase().contains("debug")) { + if (bin.buildable && bin.name.toLowerCase().contains("debug") && nativeUtils.isNativeDesktopPlatform(bin.targetPlatform)) { Task run = project.tasks.create("run", Exec) { commandLine bin.tasks.install.runScriptFile.get().asFile.toString() } @@ -30,10 +30,10 @@ model { def icon = file("$project.projectDir/src/main/native/mac/ov.icns") // Create the macOS bundle. - def bundleTask = project.tasks.create("bundleOutlineViewerOsxApp", Copy) { + def bundleTask = project.tasks.create("bundleOutlineViewerOsxApp" + binary.targetPlatform.architecture.name, Copy) { description("Creates a macOS application bundle for OutlineViewer") from(file("$project.projectDir/Info.plist")) - into(file("$project.buildDir/outputs/bundles/OutlineViewer.app/Contents")) + into(file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/OutlineViewer.app/Contents")) into("MacOS") { with copySpec { from binary.executable.file } } into("Resources") { with copySpec { from icon } } @@ -48,7 +48,7 @@ model { "codesign --force --strict --deep " + "--timestamp --options=runtime " + "--verbose -s ${project.findProperty("developerID")} " + - "$project.buildDir/outputs/bundles/OutlineViewer.app/" + "$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/OutlineViewer.app/" ] commandLine args } @@ -58,12 +58,12 @@ model { // Reset the application path if we are creating a bundle. if (binary.targetPlatform.operatingSystem.isMacOsX()) { - applicationPath = file("$project.buildDir/outputs/bundles") + applicationPath = file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name") project.build.dependsOn bundleTask } // Create the ZIP. - def task = project.tasks.create("copyOutlineViewerExecutable", Zip) { + def task = project.tasks.create("copyOutlineViewerExecutable" + binary.targetPlatform.architecture.name, Zip) { description("Copies the OutlineViewer executable to the outputs directory.") destinationDirectory = outputsFolder diff --git a/roborioteamnumbersetter/build.gradle b/roborioteamnumbersetter/build.gradle index 4a08fdcc19..2ca1215b2e 100644 --- a/roborioteamnumbersetter/build.gradle +++ b/roborioteamnumbersetter/build.gradle @@ -1,6 +1,6 @@ import org.gradle.internal.os.OperatingSystem -if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { +if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { description = "roboRIO Team Number Setter" @@ -27,12 +27,12 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra nativeUtils { nativeDependencyContainer { libssh(getNativeDependencyTypeClass('WPIStaticMavenDependency')) { - groupId = "edu.wpi.first.thirdparty.frc2022" + groupId = "edu.wpi.first.thirdparty.frc2023" artifactId = "libssh" headerClassifier = "headers" sourceClassifier = "sources" ext = "zip" - version = '0.95-1' + version = '0.95-3' targetPlatforms.addAll(nativeUtils.wpi.platforms.desktopPlatforms) } } @@ -107,7 +107,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) { it.buildable = false return } diff --git a/roborioteamnumbersetter/publish.gradle b/roborioteamnumbersetter/publish.gradle index 478f3d39a0..10b9de1d0f 100644 --- a/roborioteamnumbersetter/publish.gradle +++ b/roborioteamnumbersetter/publish.gradle @@ -10,7 +10,7 @@ model { tasks { // Create the run task. $.components.roborioteamnumbersetter.binaries.each { bin -> - if (bin.buildable && bin.name.toLowerCase().contains("debug")) { + if (bin.buildable && bin.name.toLowerCase().contains("debug") && nativeUtils.isNativeDesktopPlatform(bin.targetPlatform)) { Task run = project.tasks.create("run", Exec) { commandLine bin.tasks.install.runScriptFile.get().asFile.toString() } @@ -30,10 +30,10 @@ model { def icon = file("$project.projectDir/src/main/native/mac/rtns.icns") // Create the macOS bundle. - def bundleTask = project.tasks.create("bundleroboRIOTeamNumberSetterOsxApp", Copy) { + def bundleTask = project.tasks.create("bundleroboRIOTeamNumberSetterOsxApp" + binary.targetPlatform.architecture.name, Copy) { description("Creates a macOS application bundle for roboRIO Team Number Setter") from(file("$project.projectDir/Info.plist")) - into(file("$project.buildDir/outputs/bundles/roboRIOTeamNumberSetter.app/Contents")) + into(file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/roboRIOTeamNumberSetter.app/Contents")) into("MacOS") { with copySpec { from binary.executable.file } } into("Resources") { with copySpec { from icon } } @@ -48,7 +48,7 @@ model { "codesign --force --strict --deep " + "--timestamp --options=runtime " + "--verbose -s ${project.findProperty("developerID")} " + - "$project.buildDir/outputs/bundles/roboRIOTeamNumberSetter.app/" + "$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/roboRIOTeamNumberSetter.app/" ] commandLine args } @@ -58,12 +58,12 @@ model { // Reset the application path if we are creating a bundle. if (binary.targetPlatform.operatingSystem.isMacOsX()) { - applicationPath = file("$project.buildDir/outputs/bundles") + applicationPath = file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name") project.build.dependsOn bundleTask } // Create the ZIP. - def task = project.tasks.create("copyroboRIOTeamNumberSetterExecutable", Zip) { + def task = project.tasks.create("copyroboRIOTeamNumberSetterExecutable" + binary.targetPlatform.architecture.name, Zip) { description("Copies the roboRIOTeamNumberSetter executable to the outputs directory.") destinationDirectory = outputsFolder diff --git a/shared/config.gradle b/shared/config.gradle index fa02c5ee55..a565026cc6 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -7,17 +7,17 @@ if (project.hasProperty('ciDebugOnly')) { } nativeUtils.addWpiNativeUtils() -nativeUtils.withRoboRIO() -nativeUtils.withRaspbian() -nativeUtils.withBionic() +nativeUtils.withCrossRoboRIO() +nativeUtils.withCrossLinuxArm32() +nativeUtils.withCrossLinuxArm64() nativeUtils { wpi { configureDependencies { wpiVersion = "-1" niLibVersion = "2022.4.0" - opencvVersion = "4.5.2-1" - googleTestVersion = "1.9.0-5-437e100-1" - imguiVersion = "1.86-1" + opencvVersion = "4.5.5-3" + googleTestVersion = "1.11.0-2" + imguiVersion = "1.87-2" wpimathVersion = "-1" } } @@ -38,7 +38,7 @@ nativeUtils.platformConfigs.each { return } it.linker.args << '-Wl,-rpath,\'$ORIGIN\'' - if (it.name == 'osxx86-64') { + if (it.name == 'osxx86-64' || it.name == 'osxarm64') { it.linker.args << "-headerpad_max_install_names" } } diff --git a/shared/java/javacommon.gradle b/shared/java/javacommon.gradle index 0065886fe3..4c57f1f49e 100644 --- a/shared/java/javacommon.gradle +++ b/shared/java/javacommon.gradle @@ -81,7 +81,7 @@ test { finalizedBy jacocoTestReport } -if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxraspbian') || project.hasProperty('onlylinuxaarch64bionic')) { +if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxarm32') || project.hasProperty('onlylinuxarm64')) { test.enabled = false } diff --git a/shared/jni/setupBuild.gradle b/shared/jni/setupBuild.gradle index f89780647d..10d1740d09 100644 --- a/shared/jni/setupBuild.gradle +++ b/shared/jni/setupBuild.gradle @@ -104,8 +104,8 @@ model { enableCheckTask !project.hasProperty('skipJniCheck') javaCompileTasks << compileJava jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.roborio) - jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.raspbian) - jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.aarch64bionic) + jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm32) + jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm64) sources { cpp { source { @@ -145,8 +145,8 @@ model { enableCheckTask !project.hasProperty('skipJniCheck') javaCompileTasks << compileJava jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.roborio) - jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.raspbian) - jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.aarch64bionic) + jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm32) + jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm64) sources { cpp { source { diff --git a/shared/plugins/setupBuild.gradle b/shared/plugins/setupBuild.gradle index 6b0eb0771f..3caa30a3f7 100644 --- a/shared/plugins/setupBuild.gradle +++ b/shared/plugins/setupBuild.gradle @@ -57,7 +57,7 @@ if (!project.hasProperty('onlylinuxathena')) { } } binaries.all { - if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { + if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { project(':hal').addHalDependency(it, 'shared') lib library: pluginName if (project.hasProperty('includeNtCore')) { @@ -84,7 +84,7 @@ if (!project.hasProperty('onlylinuxathena')) { model { tasks { def c = $.components - if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { + if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { project.tasks.create('runCpp', Exec) { group = 'WPILib' description = "Run the ${pluginName}Dev executable" diff --git a/simulation/frc_gazebo_plugins/build.gradle b/simulation/frc_gazebo_plugins/build.gradle index f42b70bf88..a7f7a76cac 100644 --- a/simulation/frc_gazebo_plugins/build.gradle +++ b/simulation/frc_gazebo_plugins/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'cpp' apply plugin: "google-test" ext.skiplinuxathena = true -ext.skiplinuxraspbian = true +ext.skiplinuxarm32 = true apply from: "${rootDir}/shared/config.gradle" diff --git a/simulation/gz_msgs/build.gradle b/simulation/gz_msgs/build.gradle index 31f3df4985..c77b24634c 100644 --- a/simulation/gz_msgs/build.gradle +++ b/simulation/gz_msgs/build.gradle @@ -9,7 +9,7 @@ description = "A C++ and Java library to pass FRC Simulation Messages in and out /* The simulation does not run on real hardware; so we always skip Athena */ ext.skiplinuxathena = true -ext.skiplinuxraspbian = true +ext.skiplinuxarm32 = true apply from: "${rootDir}/shared/config.gradle" /* Use a sort of poor man's autoconf to find the protobuf development diff --git a/simulation/halsim_ds_socket/build.gradle b/simulation/halsim_ds_socket/build.gradle index f21fb552b9..186903e8eb 100644 --- a/simulation/halsim_ds_socket/build.gradle +++ b/simulation/halsim_ds_socket/build.gradle @@ -21,7 +21,7 @@ apply from: "${rootDir}/shared/plugins/setupBuild.gradle" model { testSuites { def comps = $.components - if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { + if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { "${pluginName}Test"(GoogleTestTestSuiteSpec) { for(NativeComponentSpec c : comps) { if (c.name == pluginName) { diff --git a/simulation/halsim_gazebo/build.gradle b/simulation/halsim_gazebo/build.gradle index 8d340d38c7..3e4eb396ca 100644 --- a/simulation/halsim_gazebo/build.gradle +++ b/simulation/halsim_gazebo/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'edu.wpi.first.NativeUtils' apply plugin: 'cpp' ext.skiplinuxathena = true -ext.skiplinuxraspbian = true +ext.skiplinuxarm32 = true ext.pluginName = 'halsim_gazebo' /* If gz_msgs or gazebo is not available, do not attempt a build */ diff --git a/simulation/halsim_gui/build.gradle b/simulation/halsim_gui/build.gradle index b947733f54..b9dcc316bf 100644 --- a/simulation/halsim_gui/build.gradle +++ b/simulation/halsim_gui/build.gradle @@ -1,4 +1,4 @@ -if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { +if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { description = "A plugin that creates a simulation gui" @@ -29,7 +29,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra lib project: ':wpinet', library: 'wpinet', linkage: 'shared' lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' nativeUtils.useRequiredLibrary(it, 'imgui_static') - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) { it.buildable = false return } diff --git a/simulation/halsim_ws_server/build.gradle b/simulation/halsim_ws_server/build.gradle index 94237d426d..e4eb6c2f70 100644 --- a/simulation/halsim_ws_server/build.gradle +++ b/simulation/halsim_ws_server/build.gradle @@ -21,7 +21,7 @@ apply from: "${rootDir}/shared/plugins/setupBuild.gradle" model { testSuites { def comps = $.components - if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { + if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { "${pluginName}Test"(GoogleTestTestSuiteSpec) { for(NativeComponentSpec c : comps) { if (c.name == pluginName) { diff --git a/wpigui/build.gradle b/wpigui/build.gradle index c37d9e0cbc..40b0a52243 100644 --- a/wpigui/build.gradle +++ b/wpigui/build.gradle @@ -1,6 +1,6 @@ import org.gradle.internal.os.OperatingSystem -if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { +if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) { apply plugin: 'cpp' if (OperatingSystem.current().isMacOsX()) { @@ -49,7 +49,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra } binaries.all { nativeUtils.useRequiredLibrary(it, 'imgui_static') - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) { it.buildable = false return } @@ -111,7 +111,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra } binaries { all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) { it.buildable = false return } diff --git a/wpilibNewCommands/WPILibNewCommands.json b/wpilibNewCommands/WPILibNewCommands.json index fb6622786c..22e1c6f395 100644 --- a/wpilibNewCommands/WPILibNewCommands.json +++ b/wpilibNewCommands/WPILibNewCommands.json @@ -25,12 +25,13 @@ "skipInvalidPlatforms": true, "binaryPlatforms": [ "linuxathena", - "linuxraspbian", - "linuxaarch64bionic", + "linuxarm32", + "linuxarm64", "windowsx86-64", "windowsx86", "linuxx86-64", - "osxx86-64" + "osxx86-64", + "osxarm64" ] } ] diff --git a/wpilibjExamples/build.gradle b/wpilibjExamples/build.gradle index 431dbd5ad1..a241925ee1 100644 --- a/wpilibjExamples/build.gradle +++ b/wpilibjExamples/build.gradle @@ -21,7 +21,7 @@ test { finalizedBy jacocoTestReport } -if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxraspbian') || project.hasProperty('onlylinuxaarch64bionic')) { +if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxarm32') || project.hasProperty('onlylinuxarm64')) { test.enabled = false } diff --git a/wpiutil/src/main/java/edu/wpi/first/util/RuntimeDetector.java b/wpiutil/src/main/java/edu/wpi/first/util/RuntimeDetector.java index d4ad833042..81a9e21dc7 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/RuntimeDetector.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/RuntimeDetector.java @@ -4,11 +4,7 @@ package edu.wpi.first.util; -import java.io.BufferedReader; import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; public final class RuntimeDetector { private static String filePrefix; @@ -22,6 +18,7 @@ public final class RuntimeDetector { boolean intel32 = is32BitIntel(); boolean intel64 = is64BitIntel(); + boolean arm64 = isArm64(); if (isWindows()) { filePrefix = ""; @@ -35,7 +32,9 @@ public final class RuntimeDetector { filePrefix = "lib"; fileExtension = ".dylib"; if (intel32) { - filePath = "/osx/x86"; + filePath = "/osx/x86/"; + } else if (arm64) { + filePath = "/osx/arm64/"; } else { filePath = "/osx/x86-64/"; } @@ -48,10 +47,10 @@ public final class RuntimeDetector { filePath = "/linux/x86-64/"; } else if (isAthena()) { filePath = "/linux/athena/"; - } else if (isRaspbian()) { - filePath = "/linux/raspbian/"; - } else if (isAarch64()) { - filePath = "/linux/aarch64bionic/"; + } else if (isArm32()) { + filePath = "/linux/arm32/"; + } else if (arm64) { + filePath = "/linux/arm64/"; } else { filePath = "/linux/nativearm/"; } @@ -128,29 +127,23 @@ public final class RuntimeDetector { } /** - * Check if OS is Raspbian. + * Check if OS is Arm32. * - * @return True if OS is Raspbian. + * @return True if OS is Arm32. */ - public static boolean isRaspbian() { - try (BufferedReader reader = Files.newBufferedReader(Paths.get("/etc/os-release"))) { - String value = reader.readLine(); - if (value == null) { - return false; - } - return value.contains("Raspbian"); - } catch (IOException ex) { - return false; - } + public static boolean isArm32() { + String arch = System.getProperty("os.arch"); + return "arm".equals(arch) || "arm32".equals(arch); } /** - * check if architecture is aarch64. + * check if architecture is Arm64. * - * @return if architecture is aarch64 + * @return if architecture is Arm64 */ - public static boolean isAarch64() { - return "aarch64".equals(System.getProperty("os.arch")); + public static boolean isArm64() { + String arch = System.getProperty("os.arch"); + return "aarch64".equals(arch) || "arm64".equals(arch); } public static boolean isLinux() {