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'
alias libs.plugins.kotlin.dsl
}
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()
jcenter()
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.ext.library.version
]
}
dependencies {
implementation gradleApi()
implementation localGroovy()
}
tasks.register("lintRelease") {
doLast {
// Do nothing. We execute the same set of tasks for all our modules in parallel on taskcluster.
// This project doesn't have a lint task. To avoid special casing our automation I just added
// an empty lint task here.
}
}
tasks.register("assembleAndroidTest") {
doLast {
// Do nothing. Like the `lint` task above this is just a dummy task so that this module
// behaves like our others and we do not need to special case it in automation.
}
}
tasks.register("assembleRelease") {
doLast {
// Do nothing. Like the `lint` task above this is just a dummy task so that this module
// behaves like our others and we do not need to special case it in automation.
}
}
tasks.register("testRelease") {
doLast {
// Do nothing. Like the `lint` task above this is just a dummy task so that this module
// behaves like our others and we do not need to special case it in automation.
}
}
tasks.register("checkMavenArtifacts") {
doLast {
// Do nothing. Like the `lint` task above this is just a dummy task so that this module
// behaves like our others and we do not need to special case it in automation.
}
}
// Must match the implementation in publish.gradle
static def getLocalPublicationTimestamp() {
def date = new Date()
return date.format('yyyyMMddHHmmss')
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
groupId = rootProject.ext.library.groupId
artifactId = archivesBaseName
description = project.ext.description
version = rootProject.ext.library.version + (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)
}