Revision control

Copy as Markdown

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// This script is designed to be used by consuming apps that want to support locally-published
// development versions of Glean. A build that `apply from`'s this script
// will be configured to look for development versions published to the local maven repository.
//
// There is a companion gradle command `autoPublishForLocalDevelopment` that can be used to publish
// the local development versions that are targetted by this script.
logger.lifecycle("[local-glean] adjusting ${project} to use locally published Glean module")
// Inject mavenLocal repository. This is where we're expected to publish modules.
repositories {
mavenLocal()
}
configurations.all { config ->
if (config.isCanBeResolved()) {
config.resolutionStrategy { strategy ->
dependencySubstitution {
all { dependency ->
// We only care about substituting for a module, not a project.
if (!(dependency.requested instanceof ModuleComponentSelector)) {
return
}
// For every org.mozilla.telemetry.* module, substitute its version for one
// formatted like `0.0.1-SNAPSHOT-*`. This syntax will pick the latest such version
// published locally by the `autoPublishForLocalDevelopment` command.
def group = dependency.requested.group
if (group == 'org.mozilla.telemetry') {
def name = dependency.requested.module
dependency.useTarget([group: group, name: name, version: '0.0.1-SNAPSHOT-+'])
}
}
}
}
}
}