aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
diff options
context:
space:
mode:
authorhoisie <hoisie@google.com>2021-02-17 16:39:13 -0800
committerMichael Hoisie <hoisie@google.com>2021-02-20 15:44:08 -0800
commit765e075175b9e028359238c24d41ad065fb158d0 (patch)
tree8cb47fc7daaefadd095b5659fe41f1146a5b780a /build.gradle
parent1dc12be08a351c866125d765ec703bbfe91c5b12 (diff)
downloadrobolectric-765e075175b9e028359238c24d41ad065fb158d0.tar.gz
Switch to using preinstrumented android-all jars by default
These jars are equivalent to the regular android-all jars but have already undergone default Robolectric invokedynamic instrumentation. The initial versions have been published on MavenCentral here: https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/ By using preinstrumented jars, tests can avoid having to perform the exact same bytecode instrumentation each time a Robolectric Sandbox is initialized. This process is slow and consumes a lot of CPU, especially in multi-SDK tests. From our testing it decreases the median Roboelctric test process time by approximately 10-12 seconds in a cloud environment (YMMV on workstations). For things like TDD this can really make a difference. The preinstrumented jars can be generated using: `./gradlew :preinstrumented:instrumentAll` Note, these have to be regenerated if something like AndroidInterceptors changes, but that happens approximately once every 6-12 months. When that happens we can switch CircleCI back to non-instrumented jars, or just bump the preinstrumented version. PiperOrigin-RevId: 358061119
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle8
1 files changed, 4 insertions, 4 deletions
diff --git a/build.gradle b/build.gradle
index 904ae0035..763cb29a9 100644
--- a/build.gradle
+++ b/build.gradle
@@ -139,16 +139,16 @@ afterEvaluate {
task prefetchSdks() {
AndroidSdk.ALL_SDKS.each { androidSdk ->
doLast {
- println("Prefetching ${androidSdk.coordinates}...")
+ println("Prefetching ${androidSdk.preinstrumentedCoordinates}...")
// prefetch into maven local repo...
def mvnCommand = "mvn -q dependency:get -DrepoUrl=http://maven.google.com \
- -DgroupId=${androidSdk.groupId} -DartifactId=${androidSdk.artifactId} \
- -Dversion=${androidSdk.version}"
+ -DgroupId=${androidSdk.groupId} -DartifactId=${androidSdk.preinstrumentedArtifactId} \
+ -Dversion=${androidSdk.preinstrumentedVersion}"
shellExec(mvnCommand)
// prefetch into gradle local cache...
def config = configurations.create("sdk${androidSdk.apiLevel}")
- dependencies.add("sdk${androidSdk.apiLevel}", androidSdk.coordinates)
+ dependencies.add("sdk${androidSdk.apiLevel}", androidSdk.preinstrumentedCoordinates)
// causes dependencies to be resolved:
config.files
}