-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chore: copy github gradle properties #22356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1593581
07e84e6
f1fb899
a90ee02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -553,15 +553,10 @@ generateAndroidBinary() { | |
|
|
||
| echo "Generating Android binary for ($flavor) flavor with ($configuration) configuration" | ||
| if [ "$configuration" = "Release" ] ; then | ||
| # Check if this is an E2E build | ||
| if [ "$METAMASK_ENVIRONMENT" = "e2e" ] || [ "$E2E" = "true" ] ; then | ||
| buildAndroidReleaseE2E | ||
| else | ||
| # Generate Android binary only | ||
| ./gradlew $flavorConfiguration --build-cache --parallel | ||
| fi | ||
| # Generate Android binary only | ||
| ./gradlew $flavorConfiguration --build-cache --parallel | ||
|
|
||
| # Generate AAB bundle | ||
| # Generate AAB bundle (not needed for E2E) | ||
| bundleConfiguration="bundle${flavor}Release" | ||
| echo "Generating AAB bundle for ($flavor) flavor with ($configuration) configuration" | ||
| ./gradlew $bundleConfiguration | ||
|
|
@@ -603,15 +598,59 @@ buildIosReleaseE2E(){ | |
| } | ||
|
|
||
| buildAndroidReleaseE2E(){ | ||
| local flavor="${1:-Prod}" | ||
| local lowerFlavor=$(echo "$flavor" | tr '[:upper:]' '[:lower:]') | ||
|
|
||
| prebuild_android | ||
| cd android && ./gradlew assembleProdRelease app:assembleProdReleaseAndroidTest -PminSdkVersion=26 -DtestBuildType=release | ||
| # Use GitHub CI gradle properties for E2E builds (x86_64 only, optimized memory settings) | ||
| cp android/gradle.properties.github android/gradle.properties | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Builds Leave Repository in Modified StateThe |
||
| # E2E builds only need x86_64 for emulator testing, reducing build time and memory usage | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "Building E2E APKs for $flavor flavor..." | ||
| cd android | ||
|
|
||
| # Try building with optimized settings | ||
| if ! ./gradlew assemble${flavor}Release app:assemble${flavor}ReleaseAndroidTest -PminSdkVersion=26 -DtestBuildType=release; then | ||
| echo "⚠️ Build failed, retrying with reduced parallelism..." | ||
| # Kill any remaining daemon | ||
| ./gradlew --stop || true | ||
| # Retry with no parallel builds to reduce memory pressure | ||
| ./gradlew assemble${flavor}Release app:assemble${flavor}ReleaseAndroidTest -PminSdkVersion=26 -DtestBuildType=release --no-parallel --max-workers=2 | ||
| fi | ||
|
|
||
| # Verify APK files were created | ||
| echo "" | ||
| echo "📦 Verifying E2E APK outputs..." | ||
| local appApkPath="app/build/outputs/apk/${lowerFlavor}/release/app-${lowerFlavor}-release.apk" | ||
| local testApkPath="app/build/outputs/apk/androidTest/${lowerFlavor}/release/app-${lowerFlavor}-release-androidTest.apk" | ||
|
|
||
| if [ -f "$appApkPath" ]; then | ||
| echo "✅ App APK found: $appApkPath ($(du -h "$appApkPath" | cut -f1))" | ||
| else | ||
| echo "❌ App APK NOT found at: $appApkPath" | ||
| cd .. | ||
| return 1 | ||
| fi | ||
|
|
||
| if [ -f "$testApkPath" ]; then | ||
| echo "✅ Test APK found: $testApkPath ($(du -h "$testApkPath" | cut -f1))" | ||
| else | ||
| echo "❌ Test APK NOT found at: $testApkPath" | ||
| cd .. | ||
| return 1 | ||
| fi | ||
| echo "" | ||
|
|
||
| cd .. | ||
| } | ||
|
|
||
| buildAndroid() { | ||
| echo "Build Android $METAMASK_BUILD_TYPE started..." | ||
| if [ "$METAMASK_BUILD_TYPE" == "release" ] || [ "$METAMASK_BUILD_TYPE" == "main" ] ; then | ||
| if [ "$IS_LOCAL" = true ] ; then | ||
| buildAndroidMainLocal | ||
| elif [ "$METAMASK_ENVIRONMENT" = "e2e" ] || [ "$E2E" = "true" ] ; then | ||
| # E2E builds use a separate function | ||
| buildAndroidReleaseE2E "Prod" | ||
| else | ||
| # Prepare Android dependencies | ||
| prebuild_android | ||
|
|
@@ -623,6 +662,9 @@ buildAndroid() { | |
| elif [ "$METAMASK_BUILD_TYPE" == "flask" ] ; then | ||
| if [ "$IS_LOCAL" = true ] ; then | ||
| buildAndroidFlaskLocal | ||
| elif [ "$METAMASK_ENVIRONMENT" = "e2e" ] || [ "$E2E" = "true" ] ; then | ||
| # E2E builds use a separate function | ||
| buildAndroidReleaseE2E "Flask" | ||
| else | ||
| # Prepare Android dependencies | ||
| prebuild_android | ||
|
|
@@ -643,7 +685,8 @@ buildAndroid() { | |
| generateAndroidBinary "Qa" | ||
| fi | ||
| elif [ "$METAMASK_BUILD_TYPE" == "releaseE2E" ] ; then | ||
| buildAndroidReleaseE2E | ||
| # Legacy E2E build type, defaults to Prod | ||
| buildAndroidReleaseE2E "Prod" | ||
| else | ||
| printError "METAMASK_BUILD_TYPE '${METAMASK_BUILD_TYPE}' is not recognized." | ||
| exit 1 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Unbacked Overwrites Cause Local Data Loss
The
cpcommand overwritesandroid/gradle.propertieswithout backing it up first. When developers run E2E builds locally, their custom gradle properties are permanently lost since the original file is never restored. This differs from CI where the file system is ephemeral. Consider backing up the original file before overwriting or checking if running in CI before copying.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would I need to back it up if I don't use it after?