diff --git a/build.gradle b/build.gradle index 7765e2b..38322ef 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:7.2.0' classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.28.3" } } diff --git a/gradle.properties b/gradle.properties index 403883a..c3bed4b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,3 @@ VERSION_NAME=1.0.0 GROUP=com.facebook.battery +android.useAndroidX=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aef565f..e2b029e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip diff --git a/metrics/build.gradle b/metrics/build.gradle index c874fc0..28cbc2f 100644 --- a/metrics/build.gradle +++ b/metrics/build.gradle @@ -45,8 +45,6 @@ dependencies { testImplementation 'org.powermock:powermock-module-junit4:2.0.2' } -apply from: rootProject.file('release.gradle') - ext.versionName = { -> def currentTag = 'git tag --points-at HEAD'.execute().in.text.toString().trim() def currentBranch = 'git rev-parse --abbrev-ref HEAD'.execute().in.text.toString().trim() diff --git a/release.gradle b/release.gradle deleted file mode 100644 index 46ef14e..0000000 --- a/release.gradle +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -apply plugin: 'maven' -apply plugin: 'signing' - -def isReleaseBuild() { - return VERSION_NAME.contains("SNAPSHOT") == false -} - -def getMavenRepositoryUrl() { - return hasProperty('repositoryUrl') ? property('repositoryUrl') : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" -} - -def getMavenRepositoryUsername() { - return hasProperty('repositoryUsername') ? property('repositoryUsername') : "" -} - -def getMavenRepositoryPassword() { - return hasProperty('repositoryPassword') ? property('repositoryPassword') : "" -} - -def configureBatteryMetricsPom(def pom) { - pom.whenConfigured { - applyOptionalDeps it, getOptionalDeps() - } - pom.project { - name POM_NAME - artifactId POM_ARTIFACT_ID - packaging POM_PACKAGING - description 'BatteryMetrics Battery instrumentation for Android' - url 'https://github.com/facebookincubator/Battery-Metrics' - - scm { - url 'https://github.com/facebookincubator/Battery-Metrics.git' - connection 'scm:git:https://github.com/facebookincubator/Battery-Metrics.git' - developerConnection 'scm:git:git@github.com:facebookincubator/Battery-Metrics.git' - } - - licenses { - license { - name 'MIT License' - url 'https://github.com/facebookincubator/Battery-Metrics/blob/master/LICENSE' - distribution 'repo' - } - } - - developers { - developer { - id 'facebook' - name 'Facebook' - } - } - } -} - -// Hack to modify the resulting pom's dependencies to use -// true where appropriate. -def applyOptionalDeps(def pom, def optionalDeps) { - pom.dependencies.each { dep -> - def artifactLabel = dep.groupId + ':' + dep.artifactId - if (optionalDeps.contains(artifactLabel)) { - dep.optional = true - } - } -} - -def getOptionalDeps() { - if (hasProperty('POM_OPTIONAL_DEPS')) { - return property('POM_OPTIONAL_DEPS').split(',') as Set - } else { - return [] - } -} - -afterEvaluate { project -> - task androidJavadoc(type: Javadoc) { - failOnError false - source = android.sourceSets.main.java.srcDirs - exclude("**/BUCK") - - classpath += files(android.bootClasspath) - if (JavaVersion.current().isJava8Compatible()) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } - - task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { - classifier = 'javadoc' - from androidJavadoc.destinationDir - } - - task androidSourcesJar1(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.srcDirs - } - - android.libraryVariants.all { variant -> - def name = variant.name.capitalize() - task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) { - from variant.javaCompile.destinationDir - } - } - - artifacts { - archives androidJavadocJar - archives androidSourcesJar1 - } - - version = VERSION_NAME - group = GROUP - - signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign configurations.archives - } - - uploadArchives { - configuration = configurations.archives - repositories.mavenDeployer { - beforeDeployment { - MavenDeployment deployment -> signing.signPom(deployment) - } - - repository(url: getMavenRepositoryUrl()) { - authentication( - userName: getMavenRepositoryUsername(), - password: getMavenRepositoryPassword()) - - } - - configureBatteryMetricsPom pom - } - } - - task installArchives(type: Upload) { - configuration = configurations.archives - repositories { - mavenDeployer { - repository url: "file://${System.properties['user.home']}/.m2/repository" - configureBatteryMetricsPom pom - } - } - } -} diff --git a/reporters/build.gradle b/reporters/build.gradle index 6425b2d..f48b65e 100644 --- a/reporters/build.gradle +++ b/reporters/build.gradle @@ -46,4 +46,3 @@ dependencies { testImplementation 'org.robolectric:robolectric:4.4' } -apply from: rootProject.file('release.gradle') diff --git a/serializers/build.gradle b/serializers/build.gradle index be8ded9..51c6702 100644 --- a/serializers/build.gradle +++ b/serializers/build.gradle @@ -45,4 +45,3 @@ dependencies { testImplementation 'org.robolectric:robolectric:4.4' } -apply from: rootProject.file('release.gradle')