Skip to content

Commit

Permalink
Run r8 out of process, try generational ZGC.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed Nov 11, 2023
1 parent a2dc150 commit 8b6ebc7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:

env:
CI: true
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xms4g -Xmx4g -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError"
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xms4g -Xmx4g -XX:+UseZGC -XX:+ZGenerational -XX:+HeapDumpOnOutOfMemoryError"
TERM: dumb

jobs:
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
gradle-home-cache-cleanup: true

- name: Assemble dev debug APK and signed release App Bundle
run: ./gradlew app:assembleDevDebug app:bundleProdRelease
run: ./gradlew app:assembleDevDebug app:bundleProdRelease -Pandroid.experimental.settings.executionProfile=ci

- name: Cleanup secrets
if: always()
Expand Down
31 changes: 28 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import com.android.build.api.dsl.SettingsExtension

pluginManagement {
includeBuild("build-logic")
repositories {
Expand All @@ -16,19 +18,21 @@ pluginManagement {
mavenCentral()
}

val gradleToolchainsResolverVersion = file("$rootDir/gradle/libs.versions.toml")
fun extractVersionFromCatalog(key: String) = file("$rootDir/gradle/libs.versions.toml")
.readLines()
.first { it.contains("gradle-toolchainsResolverPlugin") }
.first { it.contains(key) }
.substringAfter("=")
.trim()
.removeSurrounding("\"")

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version gradleToolchainsResolverVersion
id("org.gradle.toolchains.foojay-resolver-convention") version extractVersionFromCatalog("gradle-toolchainsResolverPlugin")
id("com.android.settings") version extractVersionFromCatalog("androidGradlePlugin")
}
}

dependencyResolutionManagement {
@Suppress("UnstableApiUsage")
repositories {
google {
content {
Expand All @@ -49,6 +53,7 @@ dependencyResolutionManagement {

plugins {
id("org.gradle.toolchains.foojay-resolver-convention")
id("com.android.settings")
}

rootProject.name = "kstreamlined-mobile"
Expand All @@ -72,3 +77,23 @@ fun includeProject(name: String, filePath: String) {
include(name)
project(name).projectDir = File(filePath)
}

settings.extensions.configure<SettingsExtension> {
execution {
profiles {
create("local") {
r8 {
r8.jvmOptions += "-Xms8g -Xmx8g -XX:+UseZGC -XX:+ZGenerational -XX:+HeapDumpOnOutOfMemoryError".split(" ")
r8.runInSeparateProcess = true
}
}
create("ci") {
r8 {
r8.jvmOptions += "-Xms8g -Xmx8g -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError".split(" ")
r8.runInSeparateProcess = true
}
}
defaultProfile = "local"
}
}
}

0 comments on commit 8b6ebc7

Please sign in to comment.