0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +02:00

Make Travis build toggles into generic CI toggles

This makes the build settings that change in virtualized / CI environments
generic across any CI provider

Needed for port to Github Actions
This commit is contained in:
Mike Hardy 2020-12-20 12:47:37 -05:00
parent 0196da1a5d
commit e696f3a58a
2 changed files with 5 additions and 5 deletions

View File

@ -137,8 +137,8 @@ android {
}
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
// Skip pre-dexing when running in a CI environment or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !ciBuild
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8

View File

@ -51,16 +51,16 @@ ext {
println "\n\n\n"
System.exit(1)
}
travisBuild = System.getenv("TRAVIS") == "true"
ciBuild = System.getenv("CI") == "true" // works for Travis CI or Github Actions
// allows for -Dpre-dex=false to be set
preDexEnabled = "true" == System.getProperty("pre-dex", "true")
// allows for universal APKs to be generated
universalApkEnabled = "true" == System.getProperty("universal-apk", "false")
// Travis may report host CPU counts vs guest, but runs 2 cores everywhere
// Virtualized Environment like CI may report host CPU counts vs guest, but runs 2 cores
// everyone else gets 50% of cores to account for SMT which doesn't help this workload
gradleTestMaxParallelForks = 1
if (!travisBuild) {
if (!ciBuild) {
gradleTestMaxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}
}