Optimize (cache downloads for) Cordova build (Android)

android

#1

I have a build process which involves a Cordova build for Android. I am on 1.0. I see the following on every build:

Downloading https://services.gradle.org/distributions/gradle-3.3-all.zip
Unzipping /home/ubuntu/.gradle/wrapper/dists/gradle-3.3-all/2n0i7hqatcbtk57vvql575dbap/gradle-3.3-all.zip to /home/ubuntu/.gradle/wrapper/dists/gradle-3.3-all/2n0i7hqatcbtk57vvql575dbap
Set executable permissions for: /home/ubuntu/.gradle/wrapper/dists/gradle-3.3-all/2n0i7hqatcbtk57vvql575dbap/gradle-3.3/bin/gradle
Starting a Gradle Daemon (subsequent builds will be faster)
Download https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
Download https://jcenter.bintray.com/com/android/tools/build/gradle-core/2.2.3/gradle-core-2.2.3.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder/2.2.3/builder-2.2.3.pom
Download https://jcenter.bintray.com/com/android/tools/lint/lint/25.2.3/lint-25.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.pom
Download https://jcenter.bintray.com/com/android/tools/build/gradle-api/2.2.3/gradle-api-2.2.3.pom
Download https://jcenter.bintray.com/com/android/databinding/compilerCommon/2.2.3/compilerCommon-2.2.3.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm/5.0.4/asm-5.0.4.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-parent/5.0.4/asm-parent-5.0.4.pom
Download https://repo1.maven.org/maven2/org/ow2/ow2/1.3/ow2-1.3.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-commons/5.0.4/asm-commons-5.0.4.pom
Download https://repo1.maven.org/maven2/net/sf/proguard/proguard-gradle/5.2.1/proguard-gradle-5.2.1.pom

followed by a hundred or more similar lines.

What is the right approach to cache these downloads?


#2

In addition, I would like to figure out how to cache the plugins, which currently are laboriously downloaded from somewhere on every build.


#3

I’m riffing here, but I wonder if there is a bit of software that:

  • Could act as an HTTP cache for this dependency system
  • Could be Dockerised
  • Could update its own cache store when you increment the version numbers to use
  • Could be installed in your primary CircleCI machine

I’m thinking that a couple of containers in Docker Compose (one cache system, one data volume) would do this. The cache data would have to be pulled from a registry for every build, but pulling a few hundred MB in a single file can be done quickly (I pull nearly a G of images in ~50 sec for DC tests).


#4

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.