Skip to content

Commit

Permalink
CI: fix OOM builds (#4032)
Browse files Browse the repository at this point in the history
* fix: oom builds

* fixup

* bump memory in other gradle files
  • Loading branch information
vaind authored Aug 19, 2024
1 parent baa882f commit 0abe24e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions RNSentryAndroidTester/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
android.nonTransitiveRClass=true
2 changes: 1 addition & 1 deletion samples/react-native/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion scripts/e2e.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
}

Expand Down
2 changes: 1 addition & 1 deletion test/perf/TestAppPlain/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/perf/TestAppSentry/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 9 additions & 8 deletions test/react-native/rn.patch.gradle.properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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);

0 comments on commit 0abe24e

Please sign in to comment.