speed up android debug builds (#19335)
fixes #19081 ## Summary This PR aims to improve android build step for debug variants by ensuring we do not rebuild the android derivation for any change made to `clojurescript` code. We also do the following things : - enable `JVM` parallel garbage collector. - get rid of `dexOptions` which was deprecated in `gradle 8`. - add additional `parallel` flag to `gradle` to speed up builds. ## Review notes - `make run-clojure` - `make run-android` - ctrl + C on android terminal and edit any `cljs` file - `make run-android` ( should build almost instantly )
This commit is contained in:
parent
ebc12c36e4
commit
399da799a6
|
@ -199,10 +199,6 @@ android {
|
|||
doNotStrip '*/mips/*.so'
|
||||
doNotStrip '*/mips64/*.so'
|
||||
}
|
||||
dexOptions {
|
||||
jumboMode true
|
||||
javaMaxHeapSize "8g"
|
||||
}
|
||||
splits {
|
||||
abi {
|
||||
reset()
|
||||
|
|
|
@ -44,6 +44,23 @@ subprojects {
|
|||
defaultConfig {
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
}
|
||||
|
||||
// Speed up Tests Stage
|
||||
tasks.withType(Test).configureEach {
|
||||
// https://docs.gradle.org/current/userguide/performance.html#execute_tests_in_parallel
|
||||
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
|
||||
// https://docs.gradle.org/current/userguide/performance.html#fork_tests_into_multiple_processes
|
||||
forkEvery = 100
|
||||
// https://docs.gradle.org/current/userguide/performance.html#disable_reports
|
||||
reports.html.required = false
|
||||
reports.junitXml.required = false
|
||||
}
|
||||
// Speed up Java Compile Stage
|
||||
// https://docs.gradle.org/current/userguide/performance.html#run_the_compiler_as_a_separate_process
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.fork = true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ ANDROID_ABI_SPLIT=false
|
|||
# Some platforms are excluded though
|
||||
ANDROID_ABI_INCLUDE=armeabi-v7a;arm64-v8a;x86;x86_64
|
||||
|
||||
org.gradle.jvmargs=-Xmx8704M
|
||||
org.gradle.jvmargs=-Xmx8704M -XX:+UseParallelGC
|
||||
|
||||
versionCode=9999
|
||||
commitHash=unknown
|
||||
|
|
|
@ -26,9 +26,10 @@
|
|||
|
||||
let
|
||||
inherit (lib) toLower optionalString stringLength makeLibraryPath elem;
|
||||
notDebug = (buildType != "debug");
|
||||
|
||||
# Pass secretsFile for POKT_TOKEN to jsbundle build
|
||||
builtJsBundle = jsbundle { inherit secretsFile; };
|
||||
builtJsBundle = lib.optionals notDebug jsbundle { inherit secretsFile; };
|
||||
|
||||
# Map ANDROID_ABI_INCLUDE to status-go targets
|
||||
androidAbiIncludeSplit = lib.splitString ";" androidAbiInclude;
|
||||
|
@ -119,8 +120,10 @@ in stdenv.mkDerivation rec {
|
|||
# Export all vars from .env file
|
||||
export $(cut -d= -f1 .env)
|
||||
|
||||
${lib.optionalString notDebug ''
|
||||
# Symlink React Native entrypoint.
|
||||
cp -Lr ${builtJsBundle} ./result
|
||||
''}
|
||||
|
||||
# Copy android/ directory
|
||||
mkdir -p ./android/build
|
||||
|
@ -153,6 +156,7 @@ in stdenv.mkDerivation rec {
|
|||
--no-scan \
|
||||
--no-watch-fs \
|
||||
--no-build-cache \
|
||||
--parallel \
|
||||
-Dmaven.repo.local='${deps.gradle}' \
|
||||
assemble${gradleBuildType}
|
||||
'';
|
||||
|
|
Loading…
Reference in New Issue