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/. */
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'groovy'
id 'maven-publish'
id 'groovy-gradle-plugin'
}
gradlePlugin {
plugins.register("org.mozilla.appservices.nimbus-gradle-plugin") {
id = "org.mozilla.appservices.nimbus-gradle-plugin"
implementationClass = "org.mozilla.appservices.tooling.nimbus.NimbusPlugin"
}
}
repositories {
google()
mavenCentral()
maven {
name "Mozilla"
content {
// Improve performance: only check moz maven for mozilla deps.
includeGroupByRegex "org\\.mozilla\\..*"
}
}
}
// This processes the files in the resources folder and moves them into the target folder. This
// happens automatically, but has been updated to replace tokens in the resource files. It replaces
// any tokens (values wrapped in `@`s) with the value for that key in the tokens object.
processResources {
filter ReplaceTokens, tokens: [
'project.version': rootProject.config.componentsVersion
]
}
dependencies {
implementation gradleApi()
implementation localGroovy()
}
// In app-services, we need all these tasks, which do nothing, so this module behaves like
// our others and we do not need to special case it in automation.
if (!gradle.root.hasProperty("mozconfig")) {
tasks.register("lintRelease") {
doLast {}
}
tasks.register("assembleAndroidTest") {
doLast {}
}
tasks.register("assembleRelease") {
doLast {}
}
tasks.register("testRelease") {
doLast {}
}
tasks.register("checkMavenArtifacts") {
doLast {}
}
// publish only makes sense in app-services.
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
groupId = rootProject.config.componentsGroupId
artifactId = archivesBaseName
description = project.ext.description
version = rootProject.config.componentsVersion + (rootProject.hasProperty('local') ? '-' + rootProject.property('local') : '')
licenses {
license {
name = properties.libLicense
url = properties.libLicenseUrl
}
}
developers {
developer {
name = 'Mozilla Nimbus Team'
email = 'nimbus-team@mozilla.com'
}
}
scm {
connection = properties.libVcsUrl
developerConnection = properties.libVcsUrl
url = properties.libUrl
}
}
}
}
if (it.hasProperty('android')) {
android {
singleVariant('release') {
withSourcesJar()
}
}
}
repositories {
maven {
url = "$buildDir/maven"
}
}
}
publishing.publications.withType(MavenPublication).each {publication ->
def checkFileSizeTask = task "checkLibSizeForMavenArtifact-${publication.artifactId}"(type: Exec) {
commandLine "${rootProject.projectDir}/automation/check_artifact_size.sh", project.buildDir, publication.artifactId
}
checkMavenArtifacts.dependsOn(checkFileSizeTask)
}
}