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
22 changes: 18 additions & 4 deletions .github/actions/build-macos-x86_64/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,42 @@ 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
if: ${{ github.event_name != 'pull_request' && github.repository == 'devopvoid/webrtc-java' }}
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
18 changes: 15 additions & 3 deletions .github/actions/release-macos-x86_64/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,16 @@
<platform.module>webrtc.macos.aarch64</platform.module>
</properties>
</profile>
<!-- Builds for Intel Macs on an Apple Silicon one. The macos-aarch64
profile above is still activated there by the host, so this one has
to be declared after it for its properties to win. -->
<profile>
<id>macos-cross-x86_64</id>
<properties>
<platform.classifier>macos-x86_64</platform.classifier>
<platform.module>webrtc.macos.x86_64</platform.module>
</properties>
</profile>
</profiles>

<dependencies>
Expand Down
13 changes: 8 additions & 5 deletions webrtc-java-media/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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. -->
<cmake.toolchain.file />
<jni.toolchain.dir>${project.basedir}/../webrtc-jni/src/main/cpp/toolchain</jni.toolchain.dir>
<!-- Where webrtc-jni installed WebRTC, and with it the libc++ that its
Expand Down Expand Up @@ -250,12 +250,15 @@
<arch>aarch64</arch>
</os>
</activation>
<!-- Both macOS targets build for the architecture Maven itself is
running as, the Intel one under "arch -x86_64", so neither is a
cross build and neither needs a toolchain file. -->
<!-- Builds for the architecture Maven itself is running as, so it
needs no toolchain file. -->
</profile>
<!-- The Intel build, made on an Apple Silicon host. -->
<profile>
<id>macos-cross-x86_64</id>
<properties>
<cmake.toolchain.file>${jni.toolchain.dir}/x86_64-macos-cross.cmake</cmake.toolchain.file>
</properties>
</profile>

<!-- Reruns the tests under -Xcheck:jni, which turns a JNI reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,11 @@ else()
# make install strips what it installs, with whichever strip is on
# the PATH, and the host's cannot read a binary built for another
# architecture: "unable to recognise the format of the input file".
# Shipping unstripped costs a little size and nothing else.
list(APPEND FFMPEG_CONFIGURE_ARGS --disable-stripping)
# Shipping unstripped costs a little size and nothing else. Apple's
# strip reads Mach-O of every architecture, so there it stays on.
if(NOT APPLE)
list(APPEND FFMPEG_CONFIGURE_ARGS --disable-stripping)
endif()

# An assembler for a foreign architecture is a build prerequisite of
# its own, and this module is not fast enough to need one yet.
Expand Down