Skip to content
Snippets Groups Projects
Commit a7360dc4 authored by Agi Sferro's avatar Agi Sferro
Browse files

Bug 1513395 - Ask gradle to download all dependencies. r=nalexander

This adds a task to each project called `downloadDependencies`. This task will
go through each configuration and resolve every dependency so that the gradle
cache contains a copy of every file needed for building and running tests. This
is intended to be used together with our nexus oss database but it can be used
locally too.

Note: `downloadDependencies` does not download dependencies added a runtime,
e.g. by plugins like apilint, checkstyle, findbugs... so we still need to run
those tasks to collect their dependencies.

Depends on D14516

Differential Revision: https://phabricator.services.mozilla.com/D14622

--HG--
extra : moz-landing-system : lando
parent 46d5e9f8
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,31 @@ allprojects {
url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
}
}
task downloadDependencies() {
description 'Download all dependencies to the Gradle cache'
doLast {
configurations.each { configuration ->
if (configuration.canBeResolved) {
configuration.allDependencies.each { dependency ->
try {
configuration.files(dependency)
} catch(e) {
println("Could not resolve ${configuration.name} -> ${dependency.name}")
println(" > ${e.message}")
if (e.cause) {
println(" >> ${e.cause}")
if (e.cause.cause) {
println(" >> ${e.cause.cause}")
}
}
println("")
}
}
}
}
}
}
}
buildDir "${topobjdir}/gradle/build"
......
......@@ -306,18 +306,20 @@ def gradle_android_install_geckoview_example_tasks(build_config):
set_config('GRADLE_ANDROID_INSTALL_GECKOVIEW_EXAMPLE_TASKS', gradle_android_install_geckoview_example_tasks)
@dependable
def gradle_android_dependencies():
'''Gradle tasks that download all dependencies.'''
# These tasks download most dependencies from each configuration, the
# notable exception is dependencies added at runtime by gradle plugins
return [
'downloadDependencies',
]
@depends(
gradle_android_app_tasks,
gradle_android_api_lint_tasks,
gradle_android_test_tasks,
gradle_android_lint_tasks,
gradle_android_checkstyle_tasks,
gradle_android_findbugs_tasks,
gradle_android_archive_geckoview_tasks,
gradle_android_generate_sdk_bindings_tasks,
gradle_android_generate_generated_jni_wrappers_tasks,
gradle_android_generate_fennec_jni_wrappers_tasks,
gradle_android_archive_coverage_artifacts_tasks,
gradle_android_dependencies,
)
@imports(_from='itertools', _import='imap')
@imports(_from='itertools', _import='chain')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment