diff --git a/.circleci/config.yml b/.circleci/config.yml index 222119d6b..a95659ea3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,19 +23,6 @@ jobs: yes | sdkmanager "platforms;android-27" || true /tmp/retry -m 3 ./gradlew :android:assembleRelease /tmp/retry -m 3 scripts/publish-android-snapshot.sh - release: - executor: default-executor - steps: - - checkout - - run: - name: install retry - command: scripts/install-retry.sh - - run: - name: build and deploy - command: | - yes | sdkmanager "platforms;android-27" || true - /tmp/retry -m 3 ./gradlew :android:assembleRelease - /tmp/retry -m 3 scripts/publish-android-release.sh workflows: version: 2 build-and-deploy: @@ -44,9 +31,3 @@ workflows: filters: branches: only: master - - release: - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ diff --git a/android/build.gradle b/android/build.gradle index 471187407..e458edcc7 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -82,7 +82,7 @@ android { preBuild.dependsOn(tasks.getByPath(':third-party:prepare')) -apply from: rootProject.file('gradle/release.gradle') +apply plugin: 'com.vanniktech.maven.publish' task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs diff --git a/android/gradle.properties b/android/gradle.properties index b53bb5b75..ad2b48738 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -9,4 +9,3 @@ POM_NAME=Flipper POM_DESCRIPTION=Flipper SDK for Android POM_ARTIFACT_ID=flipper POM_PACKAGING=aar - diff --git a/android/no-op/build.gradle b/android/no-op/build.gradle index 9191049be..0b2f48520 100644 --- a/android/no-op/build.gradle +++ b/android/no-op/build.gradle @@ -30,7 +30,7 @@ android { } } -apply from: rootProject.file('gradle/release.gradle') +apply plugin: 'com.vanniktech.maven.publish' task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs diff --git a/android/plugins/fresco/build.gradle b/android/plugins/fresco/build.gradle index ab768d263..f949f673b 100644 --- a/android/plugins/fresco/build.gradle +++ b/android/plugins/fresco/build.gradle @@ -30,4 +30,4 @@ android { } } -apply from: rootProject.file('gradle/release.gradle') +apply plugin: 'com.vanniktech.maven.publish' diff --git a/android/plugins/leakcanary/build.gradle b/android/plugins/leakcanary/build.gradle index 89fb38a40..a61c42d8e 100644 --- a/android/plugins/leakcanary/build.gradle +++ b/android/plugins/leakcanary/build.gradle @@ -24,4 +24,4 @@ android { } } -apply from: rootProject.file('gradle/release.gradle') +apply plugin: 'com.vanniktech.maven.publish' diff --git a/android/plugins/litho/build.gradle b/android/plugins/litho/build.gradle index 89a8d3190..4c5c30515 100644 --- a/android/plugins/litho/build.gradle +++ b/android/plugins/litho/build.gradle @@ -36,4 +36,4 @@ android { } } -apply from: rootProject.file('gradle/release.gradle') +apply plugin: 'com.vanniktech.maven.publish' diff --git a/android/plugins/network/build.gradle b/android/plugins/network/build.gradle index c74830c6c..bb56d9760 100644 --- a/android/plugins/network/build.gradle +++ b/android/plugins/network/build.gradle @@ -24,4 +24,4 @@ android { } } -apply from: rootProject.file('gradle/release.gradle') +apply plugin: 'com.vanniktech.maven.publish' diff --git a/build.gradle b/build.gradle index e48133136..e2a711f42 100644 --- a/build.gradle +++ b/build.gradle @@ -8,10 +8,12 @@ buildscript { repositories { google() + mavenCentral() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:4.0.0' + classpath 'com.vanniktech:gradle-maven-publish-plugin:0.13.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION" } } @@ -37,6 +39,11 @@ subprojects { maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } } } + + // We don't build Javadoc at this time. + tasks.withType(Javadoc).all { + enabled = false + } } ext { diff --git a/gradle.properties b/gradle.properties index fdfc8380e..889e6bfcc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,6 +6,7 @@ # POM publishing constants VERSION_NAME=0.74.1-SNAPSHOT GROUP=com.facebook.flipper +SONATYPE_STAGING_PROFILE=comfacebook POM_URL=https://github.com/facebook/flipper POM_SCM_URL=https://github.com/facebook/flipper.git POM_SCM_CONNECTION=scm:git:https://github.com/facebook/flipper.git diff --git a/gradle/android-maven-install.gradle b/gradle/android-maven-install.gradle deleted file mode 100644 index a5e7b823c..000000000 --- a/gradle/android-maven-install.gradle +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// Configure the Android maven publication - -apply plugin: 'com.github.dcendents.android-maven' - -version = VERSION_NAME -group = GROUP -// Set the .aar / .jar base file name to match the artifact ID -// in case the module has a different name -project.archivesBaseName = POM_ARTIFACT_ID - -install { - repositories.mavenInstaller { - // This generates POM.xml with proper parameters - pom.project { - name POM_NAME - artifactId POM_ARTIFACT_ID - packaging POM_PACKAGING - description POM_DESCRIPTION - url projectUrl - - scm { - url scmUrl - connection scmConnection - developerConnection scmDeveloperConnection - } - - licenses projectLicenses - - developers { - developer { - id developerId - name developerName - } - } - } - } -} diff --git a/gradle/android-tasks.gradle b/gradle/android-tasks.gradle deleted file mode 100644 index 8ecbab9a7..000000000 --- a/gradle/android-tasks.gradle +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import java.nio.file.Files -import java.nio.file.Paths -import java.io.FileOutputStream -import java.util.zip.ZipFile - -// Android tasks for Javadoc and sources.jar generation - -afterEvaluate { project -> - if (POM_PACKAGING == 'aar') { - task androidJavadoc(type: Javadoc, dependsOn: assembleDebug) { - source += files(android.sourceSets.main.java.srcDirs) - failOnError false - // This task will try to compile *everything* it finds in the above directory and - // will choke on text files it doesn't understand. - exclude '**/BUCK' - exclude '**/*.md' - } - - task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { - archiveClassifier.set('javadoc') - from androidJavadoc.destinationDir - } - - task androidSourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs - } - - android.libraryVariants.all { variant -> - def name = variant.name.capitalize() - task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider) { - from variant.javaCompileProvider.get().destinationDir - } - - androidJavadoc.doFirst { - classpath += files(android.bootClasspath) - classpath += files(variant.javaCompileProvider.get().classpath.files) - // This is generated by `assembleDebug` and holds the JARs generated by the APT. - classpath += fileTree(dir: "$buildDir/intermediates/bundles/debug/", include: '**/*.jar') - - // Process AAR dependencies - def aarDependencies = classpath.filter { it.name.endsWith('.aar') } - classpath -= aarDependencies - aarDependencies.each { aar -> - // Extract classes.jar from the AAR dependency, and add it to the javadoc classpath - def outputPath = "$buildDir/tmp/aarJar/${aar.name.replace('.aar', '.jar')}" - classpath += files(outputPath) - - // Use a task so the actual extraction only happens before the javadoc task is run - dependsOn task(name: "extract ${aar.name}").doLast { - extractEntry(aar, 'classes.jar', outputPath) - } - } - } - } - - artifacts.add('archives', androidJavadocJar) - artifacts.add('archives', androidSourcesJar) - } - - if (POM_PACKAGING == 'jar') { - task javadocJar(type: Jar, dependsOn: javadoc) { - archiveClassifier.set('javadoc') - from javadoc.destinationDir - } - - task sourcesJar(type: Jar, dependsOn: classes) { - archiveClassifier.set('sources') - from sourceSets.main.allSource - } - - artifacts.add('archives', javadocJar) - artifacts.add('archives', sourcesJar) - } -} - -// Utility method to extract only one entry in a zip file -private def extractEntry(archive, entryPath, outputPath) { - if (!archive.exists()) { - throw new GradleException("archive $archive not found") - } - - def zip = new ZipFile(archive) - zip.entries().each { - if (it.name == entryPath) { - def path = Paths.get(outputPath) - if (!Files.exists(path)) { - Files.createDirectories(path.getParent()) - Files.copy(zip.getInputStream(it), path) - } - } - } - zip.close() -} diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle deleted file mode 100644 index 20262c13f..000000000 --- a/gradle/bintray.gradle +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// Upload to Bintray -apply plugin: 'com.jfrog.bintray' - -def getBintrayUsername() { - return project.hasProperty('bintrayUsername') ? property('bintrayUsername') : System.getenv('BINTRAY_USERNAME') -} - -def getBintrayApiKey() { - return project.hasProperty('bintrayApiKey') ? property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') -} - -def getBintrayGpgPassword() { - return project.hasProperty('bintrayGpgPassword') ? property('bintrayGpgPassword') : System.getenv('BINTRAY_GPG_PASSWORD') -} - -def getMavenCentralUsername() { - return project.hasProperty('mavenCentralUsername') ? property('mavenCentralUsername') : System.getenv('MAVEN_CENTRAL_USERNAME') -} - -def getMavenCentralPassword() { - return project.hasProperty('mavenCentralPassword') ? property('mavenCentralPassword') : System.getenv('MAVEN_CENTRAL_PASSWORD') -} - -def shouldSyncWithMavenCentral() { - return project.hasProperty('syncWithMavenCentral') ? property('syncWithMavenCentral').toBoolean() : false -} - -def dryRunOnly() { - return project.hasProperty('dryRun') ? property('dryRun').toBoolean() : false -} - -bintray { - user = getBintrayUsername() - key = getBintrayApiKey() - configurations = ['archives'] - pkg { - repo = bintrayRepo - userOrg = bintrayUserOrg - name = bintrayName - desc = bintrayDescription - websiteUrl = projectUrl - issueTrackerUrl = issuesUrl - vcsUrl = scmUrl - licenses = projectLicenses - dryRun = dryRunOnly() - override = true - publish = true - publicDownloadNumbers = true - version { - desc = bintrayDescription - gpg { - sign = true - passphrase = getBintrayGpgPassword() - } - mavenCentralSync { - sync = shouldSyncWithMavenCentral() - user = getMavenCentralUsername() - password = getMavenCentralPassword() - close = '1' // If set to 0, you have to manually click release - } - } - } -} diff --git a/gradle/gradle-mvn-push.gradle b/gradle/gradle-mvn-push.gradle deleted file mode 100644 index 690d7dd07..000000000 --- a/gradle/gradle-mvn-push.gradle +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its 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: 'signing' - -version = VERSION_NAME -group = GROUP - -def isReleaseBuild() { - return !VERSION_NAME.contains('SNAPSHOT') -} - -def getReleaseRepositoryUrl() { - return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL - : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" -} - -def getSnapshotRepositoryUrl() { - return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL - : "https://oss.sonatype.org/content/repositories/snapshots/" -} - -def getRepositoryUsername() { - return hasProperty('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : "" -} - -def getRepositoryPassword() { - return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : "" -} - -def applyProxy(repo) { - def host = System.getProperty('https.proxyHost') - def port = (System.getProperty('https.proxyPort') ?: '-1').toInteger() - - if (host != null && port > 0) { - repo.proxy(host: host, port: port, type: 'http') - repo.proxy(host: host, port: port, type: 'https') - } -} - -afterEvaluate { project -> - uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = VERSION_NAME - - repository(url: getReleaseRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - applyProxy(it) - } - snapshotRepository(url: getSnapshotRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - applyProxy(it) - } - - pom.project { - name POM_NAME - packaging POM_PACKAGING - description POM_DESCRIPTION - url POM_URL - - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION - } - - licenses { - license { - name POM_LICENSE_NAME - url POM_LICENSE_URL - distribution POM_LICENSE_DIST - } - } - - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - } - } - } - } - } - } - - signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask('uploadArchives') } - sign configurations.archives - } -} diff --git a/gradle/release-bintray.gradle b/gradle/release-bintray.gradle deleted file mode 100644 index e03809743..000000000 --- a/gradle/release-bintray.gradle +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// Set up everything required for releasing on Bintray -ext { - bintrayRepo = 'maven' - bintrayUserOrg = 'facebook' - bintrayName = "${GROUP}:${POM_ARTIFACT_ID}" - bintrayDescription = POM_DESCRIPTION - projectUrl = POM_URL - issuesUrl = POM_ISSUES_URL - scmUrl = POM_SCM_URL - scmConnection = POM_SCM_CONNECTION - scmDeveloperConnection = POM_SCM_DEV_CONNECTION - - publishedGroupId = GROUP - - developerId = POM_DEVELOPER_ID - developerName = POM_DEVELOPER_NAME - - projectLicenses = { - license { - name = POM_LICENSE_NAME - url = POM_LICENSE_URL - distribution = POM_LICENSE_DIST - } - } -} - -// Set up the Android Maven publication (POM etc.) -apply from: rootProject.file('gradle/android-maven-install.gradle') - -// Upload to Bintray -apply from: rootProject.file('gradle/bintray.gradle') diff --git a/gradle/release.gradle b/gradle/release.gradle deleted file mode 100644 index b63d0f2ed..000000000 --- a/gradle/release.gradle +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// Common Android tasks for all releases that generate Javadocs, sources, etc. -apply from: rootProject.file('gradle/android-tasks.gradle') - -// Upload to Bintray -apply from: rootProject.file('gradle/release-bintray.gradle') - -// Upload directly to standard Maven Central (for SNAPSHOTs) -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/scripts/publish-android-release.sh b/scripts/publish-android-release.sh deleted file mode 100755 index afa70e0ec..000000000 --- a/scripts/publish-android-release.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -set -e - -BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" -IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties" || echo "")" - -if [ "$ANDROID_PUBLISH_KEY" == "" ]; then - echo "No encryption key. Skipping snapshot deployment." - exit -elif [ "$IS_SNAPSHOT" != "" ]; then - echo "Build appears to be a SNAPSHOT release, but this is a script for building stable releases. Skipping ..." - exit 1 -else - openssl aes-256-cbc -d -in scripts/bintray-publish-keys.enc -k "$ANDROID_PUBLISH_KEY" >> "$BASEDIR/gradle.properties" - # Need to list the projects individually here because of a bug in the gradle-bintray-plugin that - # tries to upload projects not meant for distribution (like our root project) and throws an NPE - # in that case. - "$BASEDIR"/gradlew :android:bintrayUpload :noop:bintrayUpload :fresco-plugin:bintrayUpload :network-plugin:bintrayUpload :litho-plugin:bintrayUpload :leakcanary-plugin:bintrayUpload -PdryRun=false -fi