Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions .github/workflows/allInOne.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on: [push]

env:
SWIG_VERSION: 4.0.2
LLVM_MINGW_VERSION: 20260616

jobs:
validate-gradle-wrapper:
Expand All @@ -15,7 +16,7 @@ jobs:
swig:
strategy:
matrix:
os: [ubuntu-20.04, macos-12, macos-14]
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-26-intel, macos-26]
runs-on: ${{ matrix.os }}
steps:
- name: SWIG from cache
Expand All @@ -24,11 +25,13 @@ jobs:
with:
path: ${{ github.workspace }}/swig
key: ${{ runner.os }}-${{ runner.arch }}-swig-${{ env.SWIG_VERSION }}
- name: Install SWIG build dependencies
if: steps.cache-swig.outputs.cache-hit != 'true'
- name: Install SWIG dependencies
# Always install, even on a cache hit: this also provides the pcre runtime
# library the cached swig binary is linked against, which isn't persisted
# across runner VMs by the actions/cache step above.
run: |
if [ "${{ runner.os }}" == 'Linux' ]; then
sudo apt-get install -y autoconf automake libtool
sudo apt-get install -y autoconf automake libtool libpcre3-dev
elif [ "${{ runner.os }}" == 'macOS' ]; then
brew install autoconf automake libtool pcre
else
Expand All @@ -45,16 +48,12 @@ jobs:
./configure --prefix=$GITHUB_WORKSPACE/swig
make
make install
- name: Install SWIG runtime dependencies
if: runner.os == 'macOs'
run: |
brew install pcre
- name: Check SWIG version
run: $GITHUB_WORKSPACE/swig/bin/swig -version
build:
strategy:
matrix:
os: [ubuntu-20.04, macos-12, macos-14]
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-26-intel, macos-26]
runs-on: ${{ matrix.os }}
needs: [validate-gradle-wrapper, swig]
steps:
Expand All @@ -69,9 +68,20 @@ jobs:
fail-on-cache-miss: true
- name: Add SWIG to $PATH
run: echo "${{ github.workspace }}/swig/bin" >> $GITHUB_PATH
- name: Install libpcre3
if: runner.os == 'Linux'
run: sudo apt-get install -y libpcre3-dev
- name: Install MinGW-w64
if: runner.os == 'Linux'
run: sudo apt-get install -y mingw-w64
- name: Install llvm-mingw (Windows arm64 cross-compiler)
# Classic mingw-w64 (GCC) has no Windows/ARM64 target; only needed on the job
# that actually builds linux_windows_arm64_llvm_mingw32, see build.gradle.
if: runner.os == 'Linux' && runner.arch == 'X64'
run: |
curl -fL -o llvm-mingw.tar.xz "https://github.com/mstorsjo/llvm-mingw/releases/download/${{ env.LLVM_MINGW_VERSION }}/llvm-mingw-${{ env.LLVM_MINGW_VERSION }}-ucrt-ubuntu-22.04-x86_64.tar.xz"
tar xf llvm-mingw.tar.xz
echo "$PWD/llvm-mingw-${{ env.LLVM_MINGW_VERSION }}-ucrt-ubuntu-22.04-x86_64/bin" >> $GITHUB_PATH
- name: Install pcre
if: runner.os == 'macOS'
run: brew install pcre
Expand All @@ -80,7 +90,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
Expand All @@ -95,7 +105,7 @@ jobs:
build/natives/*/*.dll
build/natives/*/*.dylib
publish:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
needs: [validate-gradle-wrapper, swig, build]
if: github.ref == 'refs/heads/master'
steps:
Expand All @@ -110,12 +120,14 @@ jobs:
fail-on-cache-miss: true
- name: Add SWIG to $PATH
run: echo "${{ github.workspace }}/swig/bin" >> $GITHUB_PATH
- name: Install libpcre3
run: sudo apt-get install -y libpcre3-dev
- name: Check SWIG version
run: swig -version
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
Expand Down
29 changes: 22 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,25 @@ ext {
natives = ["macosx_amd64_clang"]
}
} else if (Os.isFamily(Os.FAMILY_UNIX)) {
// Cross-compilation with MinGW-w64 allows us to also build the Windows target on Linux
natives = ["linux_amd64_gcc","linux_windows_amd64_mingw32"]
if (Os.isArch("aarch64")) {
// No MinGW-w64 cross target here: the Windows amd64 build is unrelated to and
// not reliably available when cross-compiling from an aarch64 host.
natives = ["linux_aarch64_gcc"]
} else {
// Cross-compilation with MinGW-w64 allows us to also build the Windows amd64 target
// on Linux, and with llvm-mingw (must be on PATH, see toolchains/linux_windows_arm64_llvm_mingw32.cmake)
// the Windows arm64 target too.
natives = ["linux_amd64_gcc","linux_windows_amd64_mingw32","linux_windows_arm64_llvm_mingw32"]
}
} else {
throw new GradleException("This script only works on Linux or Mac")
}

allNatives = [
"linux_amd64_gcc",
"linux_aarch64_gcc",
"linux_windows_amd64_mingw32",
"linux_windows_arm64_llvm_mingw32",
"macosx_aarch64_clang",
"macosx_amd64_clang"
]
Expand All @@ -31,8 +41,8 @@ ext {
}

java {
sourceCompatibility(JavaVersion.VERSION_1_8)
targetCompatibility(JavaVersion.VERSION_1_8)
sourceCompatibility(JavaVersion.VERSION_17)
targetCompatibility(JavaVersion.VERSION_17)
}

// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on
Expand Down Expand Up @@ -108,9 +118,14 @@ natives.each { module ->
mkdir "$rootDir/build/natives/${module}"
}
doLast {
exec {
workingDir "$rootDir/build/natives/${module}"
commandLine 'make', "-j${Runtime.runtime.availableProcessors()}"
def process = new ProcessBuilder('make', "-j${Runtime.runtime.availableProcessors()}")
.directory(file("$rootDir/build/natives/${module}"))
.redirectErrorStream(true)
.start()
process.inputStream.eachLine { println it }
def exitCode = process.waitFor()
if (exitCode != 0) {
throw new GradleException("make failed with exit code ${exitCode}")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is acceptable for now, however, it would be better if you split this into a another task that is finalizedBy the outer task instead, long-term.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted change. Filed by agent driven by @soloturn via GDD.

Agreed this is the cleaner shape long-term. Leaving the inline ProcessBuilder as-is for now rather than splitting it into a finalizedBy task, since I can't verify a Gradle task-graph change to the Linux-only native build path from this (macOS) environment - no aarch64-linux cmake/gcc toolchain here to actually run native_${module} and confirm the refactor behaves correctly. Happy to pick this up as a follow-up where it can be tested end-to-end.

}
}
Expand Down
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.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
Comment thread
coderabbitai[bot] marked this conversation as resolved.
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion toolchains/android_armeabi_gcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# toolchain for linux: https://github.com/staticlibs/android-ndk-r9d-arm-linux-androideabi-4.8

cmake_minimum_required ( VERSION 2.8.12 )
cmake_minimum_required ( VERSION 3.5 )

# default to Debug
set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" )
Expand Down
26 changes: 26 additions & 0 deletions toolchains/linux_aarch64_gcc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2015, alex at staticlibs.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required ( VERSION 3.5 )

# default to Debug
set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" )

set ( CMAKE_SYSTEM_NAME Linux )
set ( CMAKE_SYSTEM_ARCH aarch64 )

set ( CMAKE_C_COMPILER gcc )
set ( CMAKE_CXX_COMPILER g++ )

set(CMAKE_CXX_FLAGS_RELEASE "-O3")
2 changes: 1 addition & 1 deletion toolchains/linux_amd64_gcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required ( VERSION 2.8.12 )
cmake_minimum_required ( VERSION 3.5 )

# default to Debug
set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" )
Expand Down
2 changes: 1 addition & 1 deletion toolchains/linux_i686_gcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required ( VERSION 2.8.12 )
cmake_minimum_required ( VERSION 3.5 )

set ( CMAKE_SYSTEM_NAME Linux )
set ( CMAKE_SYSTEM_ARCH i686)
Expand Down
13 changes: 13 additions & 0 deletions toolchains/linux_windows_arm64_llvm_mingw32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)
set ( CMAKE_SYSTEM_ARCH aarch64)

# Classic mingw-w64 (GCC) has no Windows/ARM64 target; this uses the LLVM-based
# llvm-mingw toolchain instead (https://github.com/mstorsjo/llvm-mingw), which
# must be on PATH providing these compiler names.
set(COMPILER_PREFIX "aarch64-w64-mingw32")

SET(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc)
SET(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-g++)

set(CMAKE_CXX_FLAGS_RELEASE "-O3")
2 changes: 1 addition & 1 deletion toolchains/macosx_aarch64_clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required ( VERSION 2.8.12 )
cmake_minimum_required ( VERSION 3.5 )

# default to Debug
set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" )
Expand Down
2 changes: 1 addition & 1 deletion toolchains/macosx_amd64_clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required ( VERSION 2.8.12 )
cmake_minimum_required ( VERSION 3.5 )

# default to Debug
set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" )
Expand Down
2 changes: 1 addition & 1 deletion toolchains/windows_amd64_msvc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required ( VERSION 2.8.12 )
cmake_minimum_required ( VERSION 3.5 )

# default to Debug
set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" )
Expand Down
2 changes: 1 addition & 1 deletion toolchains/windows_i686_msvc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required ( VERSION 2.8.12 )
cmake_minimum_required ( VERSION 3.5 )

# default to Debug
set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" )
Expand Down
Loading