diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6a7d092fc3..b64bc9d535 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -10,7 +10,7 @@ jobs: include: - os: ubuntu-latest name: Linux - container: wpilib/roborio-cross-ubuntu:2021-20.04 + container: wpilib/roborio-cross-ubuntu:2022-20.04 flags: "" - os: macos-latest name: macOS diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index fd6a9fc1fa..d2c2efbd99 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -8,7 +8,7 @@ jobs: fail-fast: false matrix: include: - - container: wpilib/roborio-cross-ubuntu:2021-18.04 + - container: wpilib/roborio-cross-ubuntu:2022-18.04 artifact-name: Athena build-options: "-Ponlylinuxathena" - container: wpilib/raspbian-cross-ubuntu:10-18.04 diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 9c6ef81acb..88c58d6fb6 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -10,7 +10,7 @@ jobs: wpiformat: name: "wpiformat" runs-on: ubuntu-latest - container: wpilib/roborio-cross-ubuntu:2021-20.04 + container: wpilib/roborio-cross-ubuntu:2022-20.04 steps: - uses: actions/checkout@v2 - name: Fetch all history and metadata @@ -44,7 +44,7 @@ jobs: tidy: name: "clang-tidy" runs-on: ubuntu-latest - container: wpilib/roborio-cross-ubuntu:2021-20.04 + container: wpilib/roborio-cross-ubuntu:2022-20.04 steps: - uses: actions/checkout@v2 - name: Fetch all history and metadata diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index 1f4ff8f5d2..3655f75255 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -16,7 +16,7 @@ jobs: flags: "-DCMAKE_BUILD_TYPE=Ubsan" name: "${{ matrix.name }}" runs-on: ubuntu-latest - container: wpilib/roborio-cross-ubuntu:2021-20.04 + container: wpilib/roborio-cross-ubuntu:2022-20.04 steps: - uses: actions/checkout@v2 - name: Install Dependencies diff --git a/azure-pipelines-testbench.yaml b/azure-pipelines-testbench.yaml index e0fc4a403d..e6dd9fd160 100644 --- a/azure-pipelines-testbench.yaml +++ b/azure-pipelines-testbench.yaml @@ -15,7 +15,7 @@ stages: vmImage: "Ubuntu 16.04" container: - image: wpilib/roborio-cross-ubuntu:2021-18.04 + image: wpilib/roborio-cross-ubuntu:2022-18.04 timeoutInMinutes: 0 diff --git a/build.gradle b/build.gradle index 7cc068e31a..b634785f3d 100644 --- a/build.gradle +++ b/build.gradle @@ -14,8 +14,8 @@ plugins { id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '4.1.0' id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2' id 'edu.wpi.first.NativeUtils' apply false - id 'edu.wpi.first.GradleJni' version '0.10.1' - id 'edu.wpi.first.GradleVsCode' version '0.11.0' + id 'edu.wpi.first.GradleJni' version '1.0.0' + id 'edu.wpi.first.GradleVsCode' version '1.0.0' id 'idea' id 'visual-studio' id 'net.ltgt.errorprone' version '1.1.1' apply false @@ -192,5 +192,5 @@ spotless { } wrapper { - gradleVersion = '6.0.1' + gradleVersion = '7.1.1' } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index b8e63a991a..e0d19759d2 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -5,5 +5,5 @@ repositories { } } dependencies { - implementation "edu.wpi.first:native-utils:2022.0.2" + implementation "edu.wpi.first:native-utils:2022.3.0" } diff --git a/buildSrc/src/main/groovy/JREArtifact.groovy b/buildSrc/src/main/groovy/JREArtifact.groovy deleted file mode 100644 index e57249ab38..0000000000 --- a/buildSrc/src/main/groovy/JREArtifact.groovy +++ /dev/null @@ -1,48 +0,0 @@ -import groovy.transform.CompileStatic -import javax.inject.Inject -import jaci.gradle.deploy.artifact.MavenArtifact -import jaci.gradle.deploy.context.DeployContext -import org.gradle.api.Project -import jaci.gradle.ActionWrapper - -import java.util.function.Function - -@CompileStatic -class JREArtifact extends MavenArtifact { - Function buildRequiresJre = (Function){ true } - - void setJreDependency(String dep) { - dependency = project.dependencies.add(configuration(), dep) - } - - @Inject - JREArtifact(String name, Project project) { - super(name, project) - configuration = project.configurations.create(configuration()) - - onlyIf = { DeployContext ctx -> - (buildRequiresJre.apply(ctx) && jreMissing(ctx)) || project.hasProperty("force-redeploy-jre") - } - - predeploy << new ActionWrapper({ DeployContext ctx -> - ctx.logger.log('Deploying RoboRIO JRE (this will take a while)...') - }) - - directory = '/tmp' - filename = 'frcjre.ipk' - - postdeploy << new ActionWrapper({ DeployContext ctx -> - ctx.logger.log('Installing JRE...') - ctx.execute('opkg remove frc2020-openjdk*; opkg install /tmp/frcjre.ipk; rm /tmp/frcjre.ipk') - ctx.logger.log('JRE Deployed!') - }) - } - - String configuration() { - return name + 'frcjre' - } - - boolean jreMissing(DeployContext ctx) { - return ctx.execute('if [[ -f "/usr/local/frc/JRE/bin/java" ]]; then echo OK; else echo MISSING; fi').result.contains("MISSING") - } -} diff --git a/buildSrc/src/main/groovy/SingleNativeBuild.groovy b/buildSrc/src/main/groovy/SingleNativeBuild.groovy index dfb42d1409..f316f13ca1 100644 --- a/buildSrc/src/main/groovy/SingleNativeBuild.groovy +++ b/buildSrc/src/main/groovy/SingleNativeBuild.groovy @@ -46,7 +46,7 @@ import org.gradle.platform.base.ComponentType; import org.gradle.platform.base.TypeBuilder; import org.gradle.nativeplatform.tasks.ObjectFilesToBinary; import groovy.transform.CompileStatic; -import edu.wpi.first.nativeutils.tasks.ExportsGenerationTask +import edu.wpi.first.nativeutils.exports.ExportsGenerationTask @CompileStatic class SingleNativeBuild implements Plugin { diff --git a/buildSrc/src/main/groovy/WPIJREArtifact.groovy b/buildSrc/src/main/groovy/WPIJREArtifact.groovy new file mode 100644 index 0000000000..e0a67dfe7a --- /dev/null +++ b/buildSrc/src/main/groovy/WPIJREArtifact.groovy @@ -0,0 +1,48 @@ +import groovy.transform.CompileStatic +import javax.inject.Inject +import edu.wpi.first.deployutils.deploy.artifact.MavenArtifact +import edu.wpi.first.deployutils.deploy.context.DeployContext +import org.gradle.api.Project +import edu.wpi.first.deployutils.ActionWrapper +import edu.wpi.first.deployutils.deploy.target.RemoteTarget +import edu.wpi.first.deployutils.PredicateWrapper + +import java.util.function.Function + +@CompileStatic +public class WPIJREArtifact extends MavenArtifact { + private final String configName; + + public String getConfigName() { + return configName; + } + + @Inject + public WPIJREArtifact(String name, RemoteTarget target) { + super(name, target); + String configName = name + "frcjre"; + this.configName = configName; + Project project = target.getProject(); + getConfiguration().set(project.getConfigurations().create(configName)); + getDependency().set(project.getDependencies().add(configName, "edu.wpi.first.jdk:roborio-2022:11.0.9u12-1")); + + setOnlyIf(new PredicateWrapper({ DeployContext ctx -> + return jreMissing(ctx) || project.hasProperty("force-redeploy-jre"); + })); + + getDirectory().set("/tmp"); + getFilename().set("frcjre.ipk"); + + getPostdeploy().add(new ActionWrapper({ DeployContext ctx -> + ctx.getLogger().log("Installing JRE..."); + ctx.execute("opkg remove frc2022-openjdk*; opkg install /tmp/frcjre.ipk; rm /tmp/frcjre.ipk"); + ctx.getLogger().log("JRE Deployed!"); + })); + } + + private boolean jreMissing(DeployContext ctx) { + return ctx.execute("if [[ -f \"/usr/local/frc/JRE/bin/java\" ]]; then echo OK; else echo MISSING; fi").getResult().contains("MISSING"); + } + + +} diff --git a/cmake/toolchains/arm-frc-gnueabi.toolchain.cmake b/cmake/toolchains/arm-frc-gnueabi.toolchain.cmake index c144e1dd95..7e344ad9d3 100644 --- a/cmake/toolchains/arm-frc-gnueabi.toolchain.cmake +++ b/cmake/toolchains/arm-frc-gnueabi.toolchain.cmake @@ -1,4 +1,4 @@ set(GCC_COMPILER_VERSION "" CACHE STRING "GCC Compiler version") -set(GNU_MACHINE "arm-frc2021-linux-gnueabi" CACHE STRING "GNU compiler triple") +set(GNU_MACHINE "arm-frc2022-linux-gnueabi" CACHE STRING "GNU compiler triple") set(SOFTFP yes) include("${CMAKE_CURRENT_LIST_DIR}/arm.toolchain.cmake") diff --git a/crossConnIntegrationTests/build.gradle b/crossConnIntegrationTests/build.gradle index 82373c804d..8775359b04 100644 --- a/crossConnIntegrationTests/build.gradle +++ b/crossConnIntegrationTests/build.gradle @@ -1,6 +1,7 @@ import org.gradle.language.base.internal.ProjectLayout -import jaci.gradle.toolchains.* -import jaci.gradle.nativedeps.* +import edu.wpi.first.deployutils.deploy.target.RemoteTarget +import edu.wpi.first.deployutils.deploy.target.location.SshDeployLocation +import edu.wpi.first.deployutils.deploy.artifact.* import org.gradle.internal.os.OperatingSystem apply plugin: 'cpp' @@ -8,8 +9,7 @@ apply plugin: 'visual-studio' apply plugin: 'edu.wpi.first.NativeUtils' apply plugin: ExtraTasks -apply plugin: 'edu.wpi.first.NativeUtils' -apply plugin: 'jaci.gradle.EmbeddedTools' +apply plugin: 'edu.wpi.first.DeployUtils' apply from: '../shared/config.gradle' @@ -25,6 +25,42 @@ apply from: "${rootDir}/shared/opencv.gradle" apply from: "${rootDir}/shared/googletest.gradle" +deploy { + targets { + roborio(RemoteTarget) { + directory = '/home/admin' + maxChannels = 4 + locations { + ssh(SshDeployLocation) { + address = "172.22.11.2" + user = 'admin' + password = '' + ipv6 = false + } + } + + artifacts { + all { + predeploy << { ctx -> + ctx.execute('/usr/local/frc/bin/frcKillRobot.sh -t') + } + postdeploy << { ctx -> + ctx.execute("sync") + ctx.execute("ldconfig") + } + } + + crossConnIntegrationTests(NativeExecutableArtifact) { + libraryDirectory = '/usr/local/frc/third-party/lib' + postdeploy << { ctx -> + ctx.execute('chmod +x crossConnIntegrationTests') + } + } + } + } + } +} + model { components { crossConnIntegrationTests(NativeExecutableSpec) { @@ -32,6 +68,10 @@ model { nativeUtils.useRequiredLibrary(it, 'googletest_static') binaries.all { binary -> if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (binary.buildType.name == 'debug') { + deploy.targets.roborio.artifacts.crossConnIntegrationTests.binary = binary + } + binary.sources { athenaCpp(CppSourceSet) { source { @@ -53,7 +93,7 @@ model { project(':hal').addHalJniDependency(binary) lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') } } else { binary.sources { @@ -70,45 +110,6 @@ model { } } -deploy { - targets { - target('roborio') { - directory = '/home/admin' - maxChannels = 4 - locations { - ssh { - address = "172.22.11.2" - user = 'admin' - password = '' - ipv6 = false - } - } - } - } - artifacts { - all { - targets << 'roborio' - predeploy << { ctx -> - ctx.execute('/usr/local/frc/bin/frcKillRobot.sh -t') - } - postdeploy << { ctx -> - ctx.execute("sync") - ctx.execute("ldconfig") - } - } - - nativeArtifact('crossConnIntegrationTests') { - component = 'crossConnIntegrationTests' - targetPlatform = nativeUtils.wpi.platforms.roborio - libraryDirectory = '/usr/local/frc/third-party/lib' - buildType = 'debug' - postdeploy << { ctx -> - ctx.execute('chmod +x crossConnIntegrationTests') - } - } - } -} - tasks.register('deployTests') { try { dependsOn tasks.named('deployCrossConnIntegrationTestsLibrariesRoborio') diff --git a/cscore/build.gradle b/cscore/build.gradle index d4cb383222..cd03465dcc 100644 --- a/cscore/build.gradle +++ b/cscore/build.gradle @@ -138,6 +138,10 @@ examplesTree.list(new FilenameFilter() { apply from: "${rootDir}/shared/opencv.gradle" +Action> symbolFilter = { symbols -> + symbols.removeIf({ !it.startsWith('CS_') }) +} as Action>; + nativeUtils.exportsConfigs { cscore { x86ExcludeSymbols = [ @@ -168,20 +172,12 @@ nativeUtils.exportsConfigs { ] } cscoreJNI { - x86SymbolFilter = { symbols -> - symbols.removeIf({ !it.startsWith('CS_') }) - } - x64SymbolFilter = { symbols -> - symbols.removeIf({ !it.startsWith('CS_') }) - } + x86SymbolFilter = symbolFilter + x64SymbolFilter = symbolFilter } cscoreJNICvStatic { - x86SymbolFilter = { symbols -> - symbols.removeIf({ !it.startsWith('CS_') }) - } - x64SymbolFilter = { symbols -> - symbols.removeIf({ !it.startsWith('CS_') }) - } + x86SymbolFilter = symbolFilter + x64SymbolFilter = symbolFilter } } diff --git a/docs/build.gradle b/docs/build.gradle index fa825f7687..73808d16e4 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id "org.ysb33r.doxygen" version "0.5" + id "org.ysb33r.doxygen" version "0.7.0" } evaluationDependsOn(':wpiutil') diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index cc4fdc293d..7454180f2a 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 94920145f3..05679dc3c1 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-6.0.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 2fe81a7d95..744e882ed5 100755 --- a/gradlew +++ b/gradlew @@ -72,7 +72,7 @@ case "`uname`" in Darwin* ) darwin=true ;; - MINGW* ) + MSYS* | MINGW* ) msys=true ;; NONSTOP* ) @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index 24467a141f..ac1b06f938 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/hal/build.gradle b/hal/build.gradle index 4dab4e7d3a..ed67125342 100644 --- a/hal/build.gradle +++ b/hal/build.gradle @@ -127,6 +127,10 @@ cppHeadersZip { } } +Action> symbolFilter = { symbols -> + symbols.removeIf({ !it.startsWith('HAL_') && !it.startsWith('HALSIM_') }) +} as Action>; + nativeUtils.exportsConfigs { hal { x86ExcludeSymbols = [ @@ -157,22 +161,21 @@ nativeUtils.exportsConfigs { ] } halJNI { - x86SymbolFilter = { symbols -> - symbols.removeIf({ !it.startsWith('HAL_') && !it.startsWith('HALSIM_') }) - } - x64SymbolFilter = { symbols -> - symbols.removeIf({ !it.startsWith('HAL_') && !it.startsWith('HALSIM_') }) - } + x86SymbolFilter = symbolFilter + x64SymbolFilter = symbolFilter } } model { binaries { all { + it.tasks.withType(AbstractNativeSourceCompileTask) { + it.dependsOn generateUsageReporting + } if (!(it instanceof NativeBinarySpec)) return if (it.component.name != 'hal' && it.component.name != 'halBase') return if (it.targetPlatform.name != nativeUtils.wpi.platforms.roborio) return - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries') } } } diff --git a/myRobot/build.gradle b/myRobot/build.gradle index a149c1cf00..045f827121 100644 --- a/myRobot/build.gradle +++ b/myRobot/build.gradle @@ -1,5 +1,6 @@ -import jaci.gradle.toolchains.* -import jaci.gradle.nativedeps.* +import edu.wpi.first.deployutils.deploy.target.RemoteTarget +import edu.wpi.first.deployutils.deploy.target.location.SshDeployLocation +import edu.wpi.first.deployutils.deploy.artifact.* import org.gradle.internal.os.OperatingSystem plugins { @@ -10,7 +11,7 @@ plugins { } apply plugin: 'edu.wpi.first.NativeUtils' -apply plugin: 'jaci.gradle.EmbeddedTools' +apply plugin: 'edu.wpi.first.DeployUtils' apply from: '../shared/config.gradle' @@ -30,91 +31,6 @@ ext { apply from: "${rootDir}/shared/opencv.gradle" -deploy { - targets { - target('roborio') { - directory = '/home/admin' - maxChannels = 4 - locations { - ssh { - address = "172.22.11.2" - user = 'admin' - password = '' - ipv6 = false - } - } - } - } - artifacts { - all { - targets << 'roborio' - predeploy << { ctx -> - ctx.execute('/usr/local/frc/bin/frcKillRobot.sh -t') - } - postdeploy << { ctx -> - ctx.execute("sync") - ctx.execute("ldconfig") - } - } - - artifact('jre', JREArtifact) { - jreDependency = 'edu.wpi.first.jdk:roborio-2021:11.0.9u11-1' - } - - javaArtifact('myRobotJava') { - jar = 'shadowJar' - postdeploy << { ctx -> - ctx.execute("echo '/usr/local/frc/JRE/bin/java -XX:+UseConcMarkSweepGC -Djava.library.path=/usr/local/frc/third-party/lib -Djava.lang.invoke.stringConcat=BC_SB -jar /home/admin/myRobot-all.jar' > /home/admin/myRobotJavaRun") - ctx.execute("chmod +x /home/admin/myRobotJavaRun; chown lvuser /home/admin/myRobotJavaRun") - } - } - - nativeArtifact('myRobotCpp') { - component = 'myRobotCpp' - targetPlatform = nativeUtils.wpi.platforms.roborio - libraryDirectory = '/usr/local/frc/third-party/lib' - buildType = 'debug' - postdeploy << { ctx -> - ctx.execute('chmod +x myRobotCpp') - } - } - - nativeArtifact('myRobotCppStatic') { - component = 'myRobotCppStatic' - targetPlatform = nativeUtils.wpi.platforms.roborio - buildType = 'debug' - - postdeploy << { ctx -> - ctx.execute('chmod +x myRobotCppStatic') - } - } - } -} - -tasks.register('deployJava') { - try { - dependsOn tasks.named('deployJreRoborio') - dependsOn tasks.named('deployMyRobotJavaRoborio') - dependsOn tasks.named('deployMyRobotCppLibrariesRoborio') - } catch (ignored) { - } -} - -tasks.register('deployShared') { - try { - dependsOn tasks.named('deployMyRobotCppLibrariesRoborio') - dependsOn tasks.named('deployMyRobotCppRoborio') - } catch (ignored) { - } -} - -tasks.register('deployStatic') { - try { - dependsOn tasks.named('deployMyRobotCppStaticRoborio') - } catch (ignored) { - } -} - mainClassName = 'frc.robot.Main' apply plugin: 'com.github.johnrengelman.shadow' @@ -137,6 +53,89 @@ dependencies { def simProjects = ['halsim_gui'] +deploy { + targets { + roborio(RemoteTarget) { + directory = '/home/admin' + maxChannels = 4 + locations { + ssh(SshDeployLocation) { + address = "172.22.11.2" + user = 'admin' + password = '' + ipv6 = false + } + } + + def remote = it + + artifacts.registerFactory(WPIJREArtifact) { + return objects.newInstance(WPIJREArtifact, it, remote) + } + + artifacts { + all { + predeploy << { ctx -> + ctx.execute('/usr/local/frc/bin/frcKillRobot.sh -t') + } + postdeploy << { ctx -> + ctx.execute("sync") + ctx.execute("ldconfig") + } + } + + myRobotCpp(NativeExecutableArtifact) { + libraryDirectory = '/usr/local/frc/third-party/lib' + postdeploy << { ctx -> + ctx.execute('chmod +x myRobotCpp') + } + } + + myRobotCppStatic(NativeExecutableArtifact) { + libraryDirectory = '/usr/local/frc/third-party/lib' + postdeploy << { ctx -> + ctx.execute('chmod +x myRobotCppStatic') + } + } + + jre(WPIJREArtifact) { + } + + myRobotJava(JavaArtifact) { + jarTask = shadowJar + postdeploy << { ctx -> + ctx.execute("echo '/usr/local/frc/JRE/bin/java -XX:+UseConcMarkSweepGC -Djava.library.path=/usr/local/frc/third-party/lib -Djava.lang.invoke.stringConcat=BC_SB -jar /home/admin/myRobot-all.jar' > /home/admin/myRobotJavaRun") + ctx.execute("chmod +x /home/admin/myRobotJavaRun; chown lvuser /home/admin/myRobotJavaRun") + } + } + } + } + } +} + +tasks.register('deployJava') { + try { + dependsOn tasks.named('deployjreroborio') + dependsOn tasks.named('deploymyRobotJavaroborio') + dependsOn tasks.named('deploymyRobotCpproborio') // Deploying shared C++ is how to get the Java shared libraries. + } catch (ignored) { + } +} + +tasks.register('deployShared') { + try { + dependsOn tasks.named('deploymyRobotCpproborio') + } catch (ignored) { + } +} + +tasks.register('deployStatic') { + try { + dependsOn tasks.named('deploymyRobotCppStaticroborio') + } catch (ignored) { + } +} + model { components { myRobotCpp(NativeExecutableSpec) { @@ -154,6 +153,11 @@ model { } } binaries.all { binary -> + if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (binary.buildType.name == 'debug') { + deploy.targets.roborio.artifacts.myRobotCpp.binary = binary + } + } lib project: ':wpilibOldCommands', library: 'wpilibOldCommands', linkage: 'shared' lib project: ':wpilibNewCommands', library: 'wpilibNewCommands', linkage: 'shared' lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared' @@ -167,7 +171,7 @@ model { lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') } else { def systemArch = getCurrentArch() if (binary.targetPlatform.name == systemArch) { @@ -194,6 +198,11 @@ model { } } binaries.all { binary -> + if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (binary.buildType.name == 'debug') { + deploy.targets.roborio.artifacts.myRobotCppStatic.binary = binary + } + } lib project: ':wpilibOldCommands', library: 'wpilibOldCommands', linkage: 'static' lib project: ':wpilibNewCommands', library: 'wpilibNewCommands', linkage: 'static' lib project: ':wpilibc', library: 'wpilibc', linkage: 'static' @@ -204,7 +213,7 @@ model { lib project: ':wpiutil', library: 'wpiutil', linkage: 'static' lib project: ':cameraserver', library: 'cameraserver', linkage: 'static' if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') } } } diff --git a/ntcore/build.gradle b/ntcore/build.gradle index 847ffed23a..67674c6a7a 100644 --- a/ntcore/build.gradle +++ b/ntcore/build.gradle @@ -5,6 +5,10 @@ ext { apply from: "${rootDir}/shared/jni/setupBuild.gradle" +Action> symbolFilter = { symbols -> + symbols.removeIf({ !it.startsWith('NT_') }) +} as Action>; + nativeUtils.exportsConfigs { ntcore { x86ExcludeSymbols = [ @@ -35,11 +39,7 @@ nativeUtils.exportsConfigs { ] } ntcoreJNI { - x86SymbolFilter = { symbols -> - symbols.removeIf({ !it.startsWith('NT_') }) - } - x64SymbolFilter = { symbols -> - symbols.removeIf({ !it.startsWith('NT_') }) - } + x86SymbolFilter = symbolFilter + x64SymbolFilter = symbolFilter } } diff --git a/shared/java/javacommon.gradle b/shared/java/javacommon.gradle index 677c64dfab..43e13d3eac 100644 --- a/shared/java/javacommon.gradle +++ b/shared/java/javacommon.gradle @@ -118,7 +118,7 @@ dependencies { task run(type: JavaExec) { classpath = sourceSets.dev.runtimeClasspath - main = project.devMain + mainClass = project.devMain } build.dependsOn devClasses @@ -129,7 +129,7 @@ jacoco { jacocoTestReport { reports { - xml.enabled true - html.enabled true + xml.required = true + html.required = true } } diff --git a/shared/jni/setupBuild.gradle b/shared/jni/setupBuild.gradle index a68ad598de..f89780647d 100644 --- a/shared/jni/setupBuild.gradle +++ b/shared/jni/setupBuild.gradle @@ -202,7 +202,7 @@ model { lib project: ':wpiutil', library: 'wpiutilJNIShared', linkage: 'shared' } if (nativeName == 'hal' && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries') } } } @@ -237,7 +237,7 @@ model { if (!project.hasProperty('noWpiutil')) { lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' if (nativeName == 'hal' && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries') } } } diff --git a/shared/plugins/setupBuild.gradle b/shared/plugins/setupBuild.gradle index 0c4f1acfdf..2097acecb6 100644 --- a/shared/plugins/setupBuild.gradle +++ b/shared/plugins/setupBuild.gradle @@ -62,7 +62,7 @@ if (!project.hasProperty('onlylinuxathena')) { } lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries') } } else { it.buildable = false diff --git a/simulation/gz_msgs/build.gradle b/simulation/gz_msgs/build.gradle index 6b67f29ee5..ccc933efa0 100644 --- a/simulation/gz_msgs/build.gradle +++ b/simulation/gz_msgs/build.gradle @@ -1,7 +1,7 @@ plugins { id 'cpp' id 'java' - id 'com.google.protobuf' version '0.8.8' + id 'com.google.protobuf' version '0.8.17' id 'edu.wpi.first.NativeUtils' } diff --git a/simulation/halsim_ds_socket/build.gradle b/simulation/halsim_ds_socket/build.gradle index 440e5d9abd..63c55760c3 100644 --- a/simulation/halsim_ds_socket/build.gradle +++ b/simulation/halsim_ds_socket/build.gradle @@ -49,7 +49,7 @@ model { lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib library: pluginName, linkage: 'shared' if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries') } } } diff --git a/simulation/halsim_ws_server/build.gradle b/simulation/halsim_ws_server/build.gradle index ac44bd1e52..16cb24ed6e 100644 --- a/simulation/halsim_ws_server/build.gradle +++ b/simulation/halsim_ws_server/build.gradle @@ -59,7 +59,7 @@ model { lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib library: pluginName, linkage: 'shared' if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries') } } } diff --git a/wpilibNewCommands/build.gradle b/wpilibNewCommands/build.gradle index 87b305b40c..ed81160285 100644 --- a/wpilibNewCommands/build.gradle +++ b/wpilibNewCommands/build.gradle @@ -84,7 +84,7 @@ model { lib project: ':cscore', library: 'cscore', linkage: 'shared' } if ((it instanceof NativeExecutableBinarySpec || it instanceof GoogleTestTestSuiteBinarySpec) && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries') } } } diff --git a/wpilibOldCommands/build.gradle b/wpilibOldCommands/build.gradle index 8b513f4d74..f9167eb62a 100644 --- a/wpilibOldCommands/build.gradle +++ b/wpilibOldCommands/build.gradle @@ -82,7 +82,7 @@ model { lib project: ':cscore', library: 'cscore', linkage: 'shared' } if ((it instanceof NativeExecutableBinarySpec || it instanceof GoogleTestTestSuiteBinarySpec) && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries') } } } diff --git a/wpilibc/build.gradle b/wpilibc/build.gradle index 7af6314ada..c9c2670d07 100644 --- a/wpilibc/build.gradle +++ b/wpilibc/build.gradle @@ -177,7 +177,7 @@ model { lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' nativeUtils.useRequiredLibrary(it, 'opencv_shared') if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries') } } } @@ -228,7 +228,7 @@ model { nativeUtils.useRequiredLibrary(it, 'opencv_shared') lib library: nativeName, linkage: 'shared' if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries') } } } diff --git a/wpilibcExamples/build.gradle b/wpilibcExamples/build.gradle index efd1535592..4cdadc85e7 100644 --- a/wpilibcExamples/build.gradle +++ b/wpilibcExamples/build.gradle @@ -96,7 +96,7 @@ model { lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') } if (binary.targetPlatform.name == getCurrentArch()) { simModules.each { @@ -151,7 +151,7 @@ model { } } if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') } } sources { @@ -216,7 +216,7 @@ model { lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries') } nativeUtils.useRequiredLibrary(it, 'opencv_shared') diff --git a/wpilibcIntegrationTests/build.gradle b/wpilibcIntegrationTests/build.gradle index 81f827b980..4d66667439 100644 --- a/wpilibcIntegrationTests/build.gradle +++ b/wpilibcIntegrationTests/build.gradle @@ -56,7 +56,7 @@ model { lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') } } else { binary.sources { diff --git a/wpilibj/build.gradle b/wpilibj/build.gradle index c94a74e7db..1004c2030b 100644 --- a/wpilibj/build.gradle +++ b/wpilibj/build.gradle @@ -121,7 +121,7 @@ model { project(':hal').addHalDependency(it, 'shared') project(':hal').addHalJniDependency(it) if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries') } } } diff --git a/wpilibjExamples/build.gradle b/wpilibjExamples/build.gradle index d4e755e7c3..14148eb500 100644 --- a/wpilibjExamples/build.gradle +++ b/wpilibjExamples/build.gradle @@ -48,8 +48,8 @@ jacoco { jacocoTestReport { reports { - xml.enabled true - html.enabled true + xml.required = true + html.required = true } } @@ -122,7 +122,7 @@ model { lib project: ':wpiutil', library: 'wpiutilJNI', linkage: 'shared' lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') } else { def systemArch = getCurrentArch() if (binary.targetPlatform.name == systemArch) { @@ -173,7 +173,7 @@ model { new groovy.json.JsonSlurper().parseText(exampleFile.text).each { entry -> project.tasks.create("run${entry.foldername}", JavaExec) { run -> - main = "edu.wpi.first.wpilibj.examples." + entry.foldername + ".Main" + mainClass = "edu.wpi.first.wpilibj.examples." + entry.foldername + ".Main" classpath = sourceSets.main.runtimeClasspath run.dependsOn it.tasks.install run.systemProperty 'java.library.path', filePath