From 7d38e60798ded268c4bcc3f31eb13124b767f127 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 16 Aug 2024 20:07:07 +0200 Subject: [PATCH 1/3] fix: oom builds --- scripts/e2e.mjs | 3 ++- test/react-native/rn.patch.gradle.properties.js | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/e2e.mjs b/scripts/e2e.mjs index 4d3e358bf..e73ecb105 100755 --- a/scripts/e2e.mjs +++ b/scripts/e2e.mjs @@ -160,7 +160,8 @@ if (actions.includes('build')) { appProduct = `${appDir}/ios/DerivedData/Build/Products/${buildType}-iphonesimulator/${appName}.app`; } else if (platform == 'android') { - execSync(`./gradlew assemble${buildType} -PreactNativeArchitectures=x86`, { stdio: 'inherit', cwd: `${appDir}/android`, env: env }); + execSync(`./gradlew assemble${buildType} -PreactNativeArchitectures=x86 --no-daemon`, + { stdio: 'inherit', cwd: `${appDir}/android`, env: env }); appProduct = `${appDir}/android/app/build/outputs/apk/release/app-release.apk`; } diff --git a/test/react-native/rn.patch.gradle.properties.js b/test/react-native/rn.patch.gradle.properties.js index 8795c7ed3..028d68e23 100755 --- a/test/react-native/rn.patch.gradle.properties.js +++ b/test/react-native/rn.patch.gradle.properties.js @@ -22,21 +22,22 @@ if (enableHermes === null) { } logger.info('Patching gradle.properties', args['gradle-properties']); -const content = fs.readFileSync(args['gradle-properties'], 'utf8'); +let content = fs.readFileSync(args['gradle-properties'], 'utf8'); const isHermesEnabled = content.includes('hermesEnabled=true'); -const shouldPatch = enableHermes !== isHermesEnabled; -if (shouldPatch) { +if (enableHermes !== isHermesEnabled) { const patch = enableHermes ? 'hermesEnabled=true' : 'hermesEnabled=false'; - const patched = content.match(/hermesEnabled=.*/) - ? content.replace(/hermesEnabled=.*/, patch) + const content = content.match(/hermesEnabled=.*/) + ? content.replace(/hermesEnabled=.*/g, patch) : content.concat(`\n${patch}`); if (enableHermes) { logger.info('Patching gradle.properties for Hermes'); } else { logger.info('Patching gradle.properties for JSC'); } - fs.writeFileSync(args['gradle-properties'], patched); -} else { - logger.info('gradle.properties is already patched!'); } + +content = content.replace(/reactNativeArchitectures=.*/g, 'reactNativeArchitectures=x86'); +content = content.replace(/org.gradle.jvmargs=.*/g, 'org.gradle.jvmargs=-Xmx3072m -XX:MaxMetaspaceSize=512m'); + +fs.writeFileSync(args['gradle-properties'], content); From c2213cb21fa1c0522319f49655e281b552037cf0 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 16 Aug 2024 21:00:17 +0200 Subject: [PATCH 2/3] fixup --- test/react-native/rn.patch.gradle.properties.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/react-native/rn.patch.gradle.properties.js b/test/react-native/rn.patch.gradle.properties.js index 028d68e23..f968c15cc 100755 --- a/test/react-native/rn.patch.gradle.properties.js +++ b/test/react-native/rn.patch.gradle.properties.js @@ -27,7 +27,7 @@ let content = fs.readFileSync(args['gradle-properties'], 'utf8'); const isHermesEnabled = content.includes('hermesEnabled=true'); if (enableHermes !== isHermesEnabled) { const patch = enableHermes ? 'hermesEnabled=true' : 'hermesEnabled=false'; - const content = content.match(/hermesEnabled=.*/) + content = content.match(/hermesEnabled=.*/) ? content.replace(/hermesEnabled=.*/g, patch) : content.concat(`\n${patch}`); if (enableHermes) { From 5a8159284bf948b3ef98496e96de14f189acf274 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 19 Aug 2024 17:23:52 +0200 Subject: [PATCH 3/3] bump memory in other gradle files --- RNSentryAndroidTester/gradle.properties | 4 ++-- samples/react-native/android/gradle.properties | 2 +- test/perf/TestAppPlain/android/gradle.properties | 2 +- test/perf/TestAppSentry/android/gradle.properties | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/RNSentryAndroidTester/gradle.properties b/RNSentryAndroidTester/gradle.properties index 3c5031eb7..34d08a3f8 100644 --- a/RNSentryAndroidTester/gradle.properties +++ b/RNSentryAndroidTester/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx3072m -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects @@ -20,4 +20,4 @@ kotlin.code.style=official # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true diff --git a/samples/react-native/android/gradle.properties b/samples/react-native/android/gradle.properties index 756ff5b09..7c2c6c745 100644 --- a/samples/react-native/android/gradle.properties +++ b/samples/react-native/android/gradle.properties @@ -10,7 +10,7 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m -org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m +org.gradle.jvmargs=-Xmx3072m -XX:MaxMetaspaceSize=512m org.gradle.logging.level=lifecycle # When configured, Gradle will run in incubating parallel mode. diff --git a/test/perf/TestAppPlain/android/gradle.properties b/test/perf/TestAppPlain/android/gradle.properties index 9500894a1..78bb32e88 100644 --- a/test/perf/TestAppPlain/android/gradle.properties +++ b/test/perf/TestAppPlain/android/gradle.properties @@ -10,7 +10,7 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m -org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m +org.gradle.jvmargs=-Xmx3072m -XX:MaxMetaspaceSize=512m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/test/perf/TestAppSentry/android/gradle.properties b/test/perf/TestAppSentry/android/gradle.properties index 9500894a1..78bb32e88 100644 --- a/test/perf/TestAppSentry/android/gradle.properties +++ b/test/perf/TestAppSentry/android/gradle.properties @@ -10,7 +10,7 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m -org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m +org.gradle.jvmargs=-Xmx3072m -XX:MaxMetaspaceSize=512m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit