Skip to content
Closed
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
7 changes: 6 additions & 1 deletion .github/actions/build-android/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,17 @@ runs:
- name: Build and publish all the Android Artifacts to /tmp/maven-local
shell: bash
run: |
GRADLE_ARGS=()
if [[ "${{ inputs.release-type }}" == "dry-run" ]]; then
# dry-run: we only build ARM64 to save time/resources. Android E2E
# runs this APK on an x86_64 API 35 image using NDK translation.
# For release/nightlies the default is to build all architectures.
export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a"
export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true"
GRADLE_ARGS=(
--init-script
"$GITHUB_WORKSPACE/.github/workflow-scripts/legacy-jni-packaging.gradle"
)
TASKS="publishAllToMavenTempLocal build"
elif [[ "${{ inputs.release-type }}" == "nightly" ]]; then
# nightly: we set isSnapshot to true so artifacts are sent to the right repository on Maven Central.
Expand All @@ -69,7 +74,7 @@ runs:
export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesStable=true"
TASKS="publishAllToMavenTempLocal publishAndroidToSonatype closeSonatypeStagingRepository build"
fi
env "$HERMES_PREBUILT_FLAG" ./gradlew $TASKS -PenableWarningsAsErrors=true
env "$HERMES_PREBUILT_FLAG" ./gradlew "${GRADLE_ARGS[@]}" $TASKS -PenableWarningsAsErrors=true
- name: Save Android ccache
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }}
uses: actions/cache/save@v5
Expand Down
14 changes: 14 additions & 0 deletions .github/workflow-scripts/legacy-jni-packaging.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

// Extract native libraries when installing ARM64-only APKs on x86_64 emulators. This lets Android's
// native bridge select the translated ABI without relying on SoLoader's direct-from-APK ABI lookup.
allprojects { project ->
project.pluginManager.withPlugin("com.android.application") {
project.extensions.getByName("android").packaging.jniLibs.useLegacyPackaging = true
}
}
5 changes: 4 additions & 1 deletion .github/workflows/e2e-android-templateapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ jobs:
# Build
cd android
CAPITALIZED_FLAVOR=$(echo "${{ matrix.flavor }}" | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}')
./gradlew assemble$CAPITALIZED_FLAVOR --no-daemon -PreactNativeArchitectures=arm64-v8a
./gradlew --no-daemon \
--init-script "$GITHUB_WORKSPACE/.github/workflow-scripts/legacy-jni-packaging.gradle" \
assemble$CAPITALIZED_FLAVOR \
-PreactNativeArchitectures=arm64-v8a

- name: Download previous per-flow test state
if: ${{ inputs.retry-attempt > 0 }}
Expand Down
Loading