diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index c122c5d..7d931d7 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -14,15 +14,15 @@ jobs: name: "wpiformat" runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Fetch all history and metadata run: | git fetch --prune --unshallow git checkout -b pr git branch -f main origin/main - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v6 with: - python-version: 3.11 + python-version: 3.14 - name: Install wpiformat run: pip3 install wpiformat==2025.79 - name: Run diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9dcb731..eb4baaf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,7 +32,7 @@ jobs: name: "mrcal-jni - Build - ${{ matrix.arch-name }}" steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: submodules: 'true' fetch-depth: 0 @@ -92,7 +92,7 @@ jobs: - run: find # Push to dev release on pushes to master - - uses: pyTooling/Actions/releaser@r0 + - uses: pyTooling/Actions/releaser@r6 with: token: ${{ secrets.GITHUB_TOKEN }} tag: 'Dev' diff --git a/.wpiformat b/.wpiformat index 364ed3f..0caf54b 100644 --- a/.wpiformat +++ b/.wpiformat @@ -1,24 +1,8 @@ cppHeaderFileInclude { \.h$ - \.hpp$ - \.inc$ - \.inl$ -} - -cppSrcFileInclude { - \.cpp$ } modifiableFileExclude { - \.jpg$ - \.jpeg$ - \.png$ - \.gif$ - \.so$ - \.dll$ - \.webp$ - \.ico$ - gradlew mrcal/ libdogleg/ vnlog/ diff --git a/CMakeLists.txt b/CMakeLists.txt index a46ab1e..0072bc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.18) +cmake_minimum_required(VERSION 3.24) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) project(mrcal_jni LANGUAGES C CXX VERSION 1.0.0) @@ -62,6 +62,13 @@ set(USE_LOCKING ON) set(USE_THREAD OFF) set(NOFORTRAN ON) +# ARMv8 is what our coprocessors run, but not the CI machines. Ensure we don't accidentally include ARMv9 instructions +if( + CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64" + AND CMAKE_SYSTEM_NAME STREQUAL "Linux" +) + set(TARGET ARMV8) +endif() # We need PIC for this to work as a shared library set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -83,28 +90,6 @@ if(NOT APPLE) elseif(TARGET OpenBLAS) set(OPENBLAS_TARGET OpenBLAS) message(STATUS "Using OpenBLAS target") - elseif(TARGET libopenblas) - set(OPENBLAS_TARGET libopenblas) - message(STATUS "Using libopenblas target") - else() - # Fallback: find the library file manually - find_library( - OPENBLAS_LIB - NAMES openblas libopenblas - PATHS - ${openblas_external_BINARY_DIR} - ${openblas_external_BINARY_DIR}/lib - ${openblas_external_BINARY_DIR}/lib/Release - NO_DEFAULT_PATH - REQUIRED - ) - message(STATUS "Using OpenBLAS library file: ${OPENBLAS_LIB}") - add_library(openblas_imported STATIC IMPORTED) - set_target_properties( - openblas_imported - PROPERTIES IMPORTED_LOCATION ${OPENBLAS_LIB} - ) - set(OPENBLAS_TARGET openblas_imported) endif() else() set(BLA_VENDOR Apple) @@ -142,12 +127,7 @@ else() endif() # And pull in JNI -find_package(JNI) -if(JNI_FOUND) - # Fixes odd AWT dependency - set(JNI_INCLUDE_DIRS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) - message(STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") -endif() +find_package(JNI REQUIRED COMPONENTS JVM) # headers and sources set(INCLUDE_HPP) diff --git a/build.gradle b/build.gradle index 115d671..151fe7f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ plugins { id "java" - id 'edu.wpi.first.WpilibTools' version '1.3.0' + id 'org.photonvision.tools.WpilibTools' version '2.3.1-photon' id "edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin" version "2020.2" - id "com.diffplug.spotless" version "6.22.0" + id "com.diffplug.spotless" version "8.1.0" } allprojects { @@ -24,8 +24,8 @@ ext { } java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } dependencies { @@ -57,10 +57,7 @@ test { useJUnitPlatform() } -ext.nativeName = wpilibTools.platformMapper.wpilibClassifier - .replace('windows', 'windows/') - .replace('osx', 'osx/') - .replace('linux', 'linux/') +def nativeName = wpilibTools.platformMapper.platformPath ext.outputsFolder = file("$buildDir/outputs") println("Building for $nativeName") diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135..1b33c55 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 1058752..d4081da 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME -distributionPath=permwrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=permwrapper/dists +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1aa94a4..23d15a9 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -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/. @@ -84,7 +86,7 @@ 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\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -203,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. @@ -211,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..db3a6ac 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -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 ########################################################################## @@ -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 @@ -57,22 +59,22 @@ 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 :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/publish.gradle b/publish.gradle index ff28e54..36bd69c 100644 --- a/publish.gradle +++ b/publish.gradle @@ -25,14 +25,14 @@ publishing { mavenJava(MavenPublication) { groupId = artifactGroupId artifactId = "${baseArtifactId}-java" - version = pubVersion;// + "-" + nativeName; + version = pubVersion; from components.java } mavenJNI(MavenPublication) { groupId = artifactGroupId artifactId = "${baseArtifactId}-jni" - version = pubVersion;// + "-" + nativeName; + version = pubVersion; artifact nativeLibraryJar } diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..2cb82b7 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,11 @@ +pluginManagement { + repositories { + maven { url = "https://frcmaven.wpi.edu/artifactory/ex-mvn/" } + mavenCentral() + gradlePluginPortal() + maven { + url = uri('https://maven.photonvision.org/releases') + } + mavenLocal() + } +}