mirror of
https://github.com/bitwarden/android.git
synced 2026-04-29 20:38:41 -05:00
Optimize build times (#6418)
This commit is contained in:
@@ -299,16 +299,16 @@ dependencies {
|
|||||||
testImplementation(libs.square.turbine)
|
testImplementation(libs.square.turbine)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks.withType<Test>().configureEach {
|
||||||
withType<Test> {
|
useJUnitPlatform()
|
||||||
useJUnitPlatform()
|
@Suppress("MagicNumber")
|
||||||
maxHeapSize = "2g"
|
forkEvery = 100
|
||||||
maxParallelForks = Runtime.getRuntime().availableProcessors()
|
maxHeapSize = "2g"
|
||||||
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
|
||||||
// Explicitly setting the user Country and Language because tests assume en-US
|
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
|
||||||
"-Duser.country=US" +
|
// Explicitly setting the user Country and Language because tests assume en-US
|
||||||
"-Duser.language=en"
|
"-Duser.country=US" +
|
||||||
}
|
"-Duser.language=en"
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
|
|||||||
@@ -260,10 +260,16 @@ protobuf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks.withType<Test>().configureEach {
|
||||||
withType<Test> {
|
useJUnitPlatform()
|
||||||
useJUnitPlatform()
|
@Suppress("MagicNumber")
|
||||||
}
|
forkEvery = 100
|
||||||
|
maxHeapSize = "2g"
|
||||||
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
|
||||||
|
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
|
||||||
|
// Explicitly setting the user Country and Language because tests assume en-US
|
||||||
|
"-Duser.country=US" +
|
||||||
|
"-Duser.language=en"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renameFile(path: String, newName: String) {
|
private fun renameFile(path: String, newName: String) {
|
||||||
|
|||||||
@@ -76,8 +76,14 @@ dependencies {
|
|||||||
testImplementation(libs.square.turbine)
|
testImplementation(libs.square.turbine)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks.withType<Test>().configureEach {
|
||||||
withType<Test> {
|
useJUnitPlatform()
|
||||||
useJUnitPlatform()
|
@Suppress("MagicNumber")
|
||||||
}
|
forkEvery = 100
|
||||||
|
maxHeapSize = "2g"
|
||||||
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
|
||||||
|
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
|
||||||
|
// Explicitly setting the user Country and Language because tests assume en-US
|
||||||
|
"-Duser.country=US" +
|
||||||
|
"-Duser.language=en"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,6 +179,12 @@ fun Project.getGitStagedFiles(rootDir: File): Provider<List<File>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subprojects {
|
||||||
|
tasks.withType<JavaCompile>().configureEach {
|
||||||
|
options.isFork = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
tasks.withType(Detekt::class.java).configureEach {
|
tasks.withType(Detekt::class.java).configureEach {
|
||||||
val typeResolutionEnabled = !classpath.isEmpty
|
val typeResolutionEnabled = !classpath.isEmpty
|
||||||
|
|||||||
@@ -69,11 +69,14 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks.withType<Test>().configureEach {
|
||||||
withType<Test> {
|
useJUnitPlatform()
|
||||||
useJUnitPlatform()
|
@Suppress("MagicNumber")
|
||||||
maxHeapSize = "2g"
|
forkEvery = 100
|
||||||
maxParallelForks = Runtime.getRuntime().availableProcessors()
|
maxHeapSize = "2g"
|
||||||
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC"
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
|
||||||
}
|
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
|
||||||
|
// Explicitly setting the user Country and Language because tests assume en-US
|
||||||
|
"-Duser.country=US" +
|
||||||
|
"-Duser.language=en"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,11 +64,14 @@ dependencies {
|
|||||||
testImplementation(libs.mockk.mockk)
|
testImplementation(libs.mockk.mockk)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks.withType<Test>().configureEach {
|
||||||
withType<Test> {
|
useJUnitPlatform()
|
||||||
useJUnitPlatform()
|
@Suppress("MagicNumber")
|
||||||
maxHeapSize = "2g"
|
forkEvery = 100
|
||||||
maxParallelForks = Runtime.getRuntime().availableProcessors()
|
maxHeapSize = "2g"
|
||||||
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC"
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
|
||||||
}
|
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
|
||||||
|
// Explicitly setting the user Country and Language because tests assume en-US
|
||||||
|
"-Duser.country=US" +
|
||||||
|
"-Duser.language=en"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,11 +74,14 @@ dependencies {
|
|||||||
testFixturesImplementation(libs.kotlinx.coroutines.test)
|
testFixturesImplementation(libs.kotlinx.coroutines.test)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks.withType<Test>().configureEach {
|
||||||
withType<Test> {
|
useJUnitPlatform()
|
||||||
useJUnitPlatform()
|
@Suppress("MagicNumber")
|
||||||
maxHeapSize = "2g"
|
forkEvery = 100
|
||||||
maxParallelForks = Runtime.getRuntime().availableProcessors()
|
maxHeapSize = "2g"
|
||||||
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC"
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
|
||||||
}
|
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
|
||||||
|
// Explicitly setting the user Country and Language because tests assume en-US
|
||||||
|
"-Duser.country=US" +
|
||||||
|
"-Duser.language=en"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,13 @@ kotlin.code.style=official
|
|||||||
kotlin.compilerArgs=-Xjspecify-annotations=strict, -Xtype-enhancement-improvements-strict-mode
|
kotlin.compilerArgs=-Xjspecify-annotations=strict, -Xtype-enhancement-improvements-strict-mode
|
||||||
|
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
|
org.gradle.configuration-cache=true
|
||||||
|
org.gradle.configuration-cache.parallel=true
|
||||||
org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC -Dfile.encoding=UTF-8
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
|
# Disable build features that are enabled by default and we do not need
|
||||||
|
# developer.android.com/reference/tools/gradle-api/7.4/com/android/build/api/dsl/BuildFeatures
|
||||||
|
android.defaults.buildfeatures.renderscript=false
|
||||||
|
android.defaults.buildfeatures.resvalues=false
|
||||||
|
android.defaults.buildfeatures.shaders=false
|
||||||
|
|||||||
@@ -79,11 +79,14 @@ dependencies {
|
|||||||
testFixturesImplementation(libs.square.okhttp.mockwebserver)
|
testFixturesImplementation(libs.square.okhttp.mockwebserver)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks.withType<Test>().configureEach {
|
||||||
withType<Test> {
|
useJUnitPlatform()
|
||||||
useJUnitPlatform()
|
@Suppress("MagicNumber")
|
||||||
maxHeapSize = "2g"
|
forkEvery = 100
|
||||||
maxParallelForks = Runtime.getRuntime().availableProcessors()
|
maxHeapSize = "2g"
|
||||||
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC"
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
|
||||||
}
|
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
|
||||||
|
// Explicitly setting the user Country and Language because tests assume en-US
|
||||||
|
"-Duser.country=US" +
|
||||||
|
"-Duser.language=en"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,10 +118,14 @@ dependencies {
|
|||||||
testImplementation(testFixtures(project(":ui")))
|
testImplementation(testFixtures(project(":ui")))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks.withType<Test>().configureEach {
|
||||||
withType<Test> {
|
useJUnitPlatform()
|
||||||
useJUnitPlatform()
|
@Suppress("MagicNumber")
|
||||||
maxHeapSize = "2g"
|
forkEvery = 100
|
||||||
maxParallelForks = Runtime.getRuntime().availableProcessors()
|
maxHeapSize = "2g"
|
||||||
}
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
|
||||||
|
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
|
||||||
|
// Explicitly setting the user Country and Language because tests assume en-US
|
||||||
|
"-Duser.country=US" +
|
||||||
|
"-Duser.language=en"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,13 +114,15 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks.withType<Test>().configureEach {
|
||||||
withType<Test> {
|
useJUnitPlatform()
|
||||||
useJUnitPlatform()
|
@Suppress("MagicNumber")
|
||||||
maxHeapSize = "2g"
|
forkEvery = 100
|
||||||
maxParallelForks = Runtime.getRuntime().availableProcessors()
|
maxHeapSize = "2g"
|
||||||
@Suppress("UselessCallOnNotNull")
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
|
||||||
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC"
|
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
|
||||||
android.sourceSets["main"].res.srcDirs("src/test/res")
|
// Explicitly setting the user Country and Language because tests assume en-US
|
||||||
}
|
"-Duser.country=US" +
|
||||||
|
"-Duser.language=en"
|
||||||
|
android.sourceSets["main"].res.srcDirs("src/test/res")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user