How do I set up a fully self-contained build of Cordova?

I created a test project in Cordova using cordova create hello com.example.hello HelloWorld ; cd hello ; cordova platform add android

.

The first time I build it with cordova build

it downloads Gradle and then I think it's a bunch of Maven files, almost 200 of them. They seem to be installed in ~/.gradle

, but I'm not sure if this is the only location. Output example:

$ cordova build
ANDROID_HOME=/opt/android
JAVA_HOME=/usr/lib/jvm/java-8-oracle/
Subproject Path: CordovaLib
Downloading https://services.gradle.org/distributions/gradle-3.3-all.zip
...............
Unzipping /home/ubuntu/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3-all.zip to /home/ubuntu/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9
Set executable permissions for: /home/ubuntu/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/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
(skip about 180 more lines here)
Download https://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar
Download https://repo1.maven.org/maven2/nekohtml/xercesMinimal/1.9.6.2/xercesMinimal-1.9.6.2.jar
Download https://repo1.maven.org/maven2/nekohtml/nekohtml/1.9.6.2/nekohtml-1.9.6.2.jar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:preBuild UP-TO-DATE
(build continues normally here)

      

Now this may be convenient, but completely undesirable in terms of having a reproducible build environment.

How do I configure Cordova for fully self-contained builds? Will it do offline builds after the first one, or is it still checking (for example) Gradle updates?

How (and where) do I pre-install whatever I'm looking for cordova build

? Is there a way to get Cordova to install everything as a separate step from building the build and make the build as a separate step from that install?

Is it possible to archive the content one day ~/.gradle/

and then unpack it before running a build (either on the same machine or on a different one) and run that build offline? How do I move ~/.gradle/

to (for example) a subdirectory of a Cordova project?

This is a clean install of Ubuntu 16.04, with node and npm installed from nodeource. Versions:

$ cordova --version
7.0.1
$ npm --version
3.10.10
$ node --version
v6.10.3

      

+3


source to share





All Articles