diff --git a/.github/actions/build-macos-x86_64/action.yml b/.github/actions/build-macos-x86_64/action.yml
index 81f1a44e..816ac11f 100644
--- a/.github/actions/build-macos-x86_64/action.yml
+++ b/.github/actions/build-macos-x86_64/action.yml
@@ -52,22 +52,36 @@ runs:
key: maven-${{ inputs.platform-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-${{ inputs.platform-name }}-
- - name: Set up JDK
+ # The runner is Apple Silicon. The build runs natively and cross compiles
+ # for Intel; only the tests need an Intel JVM, to load what was built, and
+ # that one runs under Rosetta.
+ - id: jdk-x64
+ name: Set up JDK (x64, for the tests)
uses: actions/setup-java@v5
with:
architecture: 'x64'
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
+ overwrite-settings: false
+
+ # Set up last, so that it is the JAVA_HOME the build runs with and the one
+ # whose settings.xml carries the deploy credentials.
+ - name: Set up JDK (arm64, for the build)
+ uses: actions/setup-java@v5
+ with:
+ architecture: 'aarch64'
+ java-version: ${{ inputs.java-version }}
+ distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_TOKEN
- name: Build
- run: arch -x86_64 mvn package -DskipTests -Pmacos-cross-x86_64
+ run: mvn package -DskipTests -Pmacos-cross-x86_64
shell: bash
- name: Test
- run: arch -x86_64 mvn -B jar:jar surefire:test -Pmacos-cross-x86_64
+ run: JAVA_HOME="${{ steps.jdk-x64.outputs.path }}" mvn -B jar:jar surefire:test -Pmacos-cross-x86_64
shell: bash
- name: Deploy
@@ -75,5 +89,5 @@ runs:
env:
MAVEN_USERNAME: ${{ inputs.maven-username }}
MAVEN_TOKEN: ${{ inputs.maven-password }}
- run: arch -x86_64 mvn deploy -DskipTests -Pmacos-cross-x86_64
+ run: mvn deploy -DskipTests -Pmacos-cross-x86_64
shell: bash
diff --git a/.github/actions/release-macos-x86_64/action.yml b/.github/actions/release-macos-x86_64/action.yml
index 9e77fbfd..25244cf4 100644
--- a/.github/actions/release-macos-x86_64/action.yml
+++ b/.github/actions/release-macos-x86_64/action.yml
@@ -44,19 +44,31 @@ runs:
key: maven-${{ inputs.platform-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-${{ inputs.platform-name }}-
- - name: Set up JDK ${{ inputs.java-version }}
+ # The runner is Apple Silicon. The build runs natively and cross compiles
+ # for Intel; only the tests need an Intel JVM, to load what was built, and
+ # that one runs under Rosetta.
+ - id: jdk-x64
+ name: Set up JDK ${{ inputs.java-version }} (x64, for the tests)
uses: actions/setup-java@v5
with:
architecture: 'x64'
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
+ # Set up last, so that it is the JAVA_HOME the build runs with.
+ - name: Set up JDK ${{ inputs.java-version }} (arm64, for the build)
+ uses: actions/setup-java@v5
+ with:
+ architecture: 'aarch64'
+ java-version: ${{ inputs.java-version }}
+ distribution: 'temurin'
+
- name: Build
- run: arch -x86_64 mvn package -DskipTests -Pmacos-cross-x86_64
+ run: mvn package -DskipTests -Pmacos-cross-x86_64
shell: bash
- name: Test
- run: arch -x86_64 mvn -B jar:jar surefire:test -Pmacos-cross-x86_64
+ run: JAVA_HOME="${{ steps.jdk-x64.outputs.path }}" mvn -B jar:jar surefire:test -Pmacos-cross-x86_64
shell: bash
# Maven Central publishes a version as one atomic bundle, so this job must not
diff --git a/pom.xml b/pom.xml
index 90d3a69d..29978171 100644
--- a/pom.xml
+++ b/pom.xml
@@ -355,6 +355,16 @@
webrtc.macos.aarch64
+
+
+ macos-cross-x86_64
+
+ macos-x86_64
+ webrtc.macos.x86_64
+
+
diff --git a/webrtc-java-media/pom.xml b/webrtc-java-media/pom.xml
index d2ba8c2c..4e33fd74 100644
--- a/webrtc-java-media/pom.xml
+++ b/webrtc-java-media/pom.xml
@@ -42,8 +42,8 @@
same glibc floor. On Linux that also means compiling with
-nostdinc++ and taking the C++ standard library from where
webrtc-jni takes it, which is what webrtc.install.dir is for
- below. macOS builds for the architecture Maven runs as and needs
- no file. -->
+ below. A native macOS build needs no file; the Intel build made on
+ Apple Silicon takes webrtc-jni's cross one. -->
${project.basedir}/../webrtc-jni/src/main/cpp/toolchain
+
+
macos-cross-x86_64
+
+ ${jni.toolchain.dir}/x86_64-macos-cross.cmake
+