From e22fc0c95291554d4ece1bd142cf8b927ae49ce9 Mon Sep 17 00:00:00 2001 From: langsmith Date: Mon, 22 Apr 2019 17:20:14 -0700 Subject: [PATCH] initial additions --- Makefile | 23 +++--- build.gradle | 14 +++- circle.yml | 12 ++-- gradle.properties | 30 +------- gradle/artifact-settings.gradle | 21 ++++++ gradle/dependencies.gradle | 12 +++- gradle/gradle-bintray.gradle | 92 ++++++++++++++++++++++++ gradle/mvn-push.gradle | 124 -------------------------------- services-core/build.gradle | 2 +- services-core/gradle.properties | 2 +- 10 files changed, 157 insertions(+), 175 deletions(-) create mode 100644 gradle/artifact-settings.gradle create mode 100644 gradle/gradle-bintray.gradle delete mode 100644 gradle/mvn-push.gradle diff --git a/Makefile b/Makefile index e2affa97e..51671335b 100644 --- a/Makefile +++ b/Makefile @@ -28,17 +28,24 @@ javadoc: ./gradlew :services:javadoc; mv services/build/docs/javadoc/ ./documentation/services/javadoc/ ; \ publish: - export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-core:uploadArchives ; \ - export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-geojson:uploadArchives ; \ - export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services:uploadArchives ; \ - export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-turf:uploadArchives ; \ + export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-core:bintrayUpload ; \ + export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-geojson:bintrayUpload ; \ + export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services:bintrayUpload ; \ + export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-turf:bintrayUpload ; \ + +publish-snapshot: + export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-core:artifactoryPublish ; \ + export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-geojson:artifactoryPublish ; \ + export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services:artifactoryPublish ; \ + export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-turf:artifactoryPublish ; \ + publish-local: # This publishes to ~/.m2/repository/com/mapbox/mapboxsdk - export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services-core:uploadArchives ; \ - export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services-geojson:uploadArchives ; \ - export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services:uploadArchives ; \ - export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services-turf:uploadArchives ; \ + export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services-core: bintrayUpload ; \ + export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services-geojson: bintrayUpload ; \ + export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services: bintrayUpload ; \ + export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services-turf: bintrayUpload ; \ graphs: ./gradlew :services-core:generateDependencyGraphMapboxLibraries diff --git a/build.gradle b/build.gradle index 9dafb0bd3..4c1d98a2a 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ buildscript { repositories { maven { url 'https://plugins.gradle.org/m2' } + maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' } google() mavenCentral() jcenter() @@ -17,6 +18,11 @@ buildscript { classpath pluginDependencies.errorprone classpath pluginDependencies.buildConfig classpath pluginDependencies.jacoco + + // These plugins are for publishing to Bintray + classpath pluginDependencies.bintray + classpath pluginDependencies.maven + classpath pluginDependencies.artifactory } } @@ -31,9 +37,9 @@ allprojects { google() mavenCentral() jcenter() + // For publishing to Bintray + maven { url 'https://mapbox.bintray.com/mapbox' } } - group = GROUP - version = VERSION_NAME } subprojects { @@ -97,7 +103,8 @@ subprojects { subproject -> } if (RELEASE_MODULES.contains(subproject.name)) { - subproject.apply from: "${rootDir}/gradle/mvn-push.gradle" + subproject.apply from: "${rootDir}/gradle/artifact-settings.gradle" + subproject.apply from: "${rootDir}/gradle/gradle-bintray.gradle" subproject.apply from: "${rootDir}/gradle/dependencies-graph.gradle" } } @@ -106,3 +113,4 @@ task clean(type: Delete) { delete rootProject.buildDir } +apply plugin: "com.jfrog.artifactory" \ No newline at end of file diff --git a/circle.yml b/circle.yml index 6a9fa8f37..08ada3b92 100644 --- a/circle.yml +++ b/circle.yml @@ -58,14 +58,12 @@ jobs: - checkout - run: name: Generate Maven credentials - shell: /bin/bash -euo pipefail command: | - aws s3 cp s3://mapbox/android/signing-credentials/secring.gpg secring.gpg - echo "NEXUS_USERNAME=$PUBLISH_NEXUS_USERNAME - NEXUS_PASSWORD=$PUBLISH_NEXUS_PASSWORD - signing.keyId=$SIGNING_KEYID - signing.password=$SIGNING_PASSWORD - signing.secretKeyRingFile=../secring.gpg" >> gradle.properties + if [ -n "${BINTRAY_USER}" ]; then + echo "BINTRAY_USER=$BINTRAY_USER + BINTRAY_API_KEY=$BINTRAY_API_KEY + GPG_PASSPHRASE=$GPG_PASSPHRASE" + fi - run: name: Build Java libraries command: make build-release diff --git a/gradle.properties b/gradle.properties index 5c8122ee9..356a9e8a1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,32 +1,6 @@ # Project-wide Gradle settings. -VERSION_NAME=4.9.0-SNAPSHOT -GROUP=com.mapbox.mapboxsdk - -POM_URL=https://github.com/mapbox/mapbox-java -POM_SCM_URL=https://github.com/mapbox/mapbox-java -POM_SCM_CONNECTION=scm:git@github.com:mapbox/mapbox-java.git -POM_SCM_DEV_CONNECTION=scm:git@github.com:mapbox/mapbox-java.git - -POM_LICENCE_NAME=The Apache Software License, Version 2.0 -POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt -POM_LICENCE_DIST=repo - -POM_DEVELOPER_ID=mapbox -POM_DEVELOPER_NAME=Mapbox +VERSION_NAME=4.8.0-SNAPSHOT # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048M - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true - -# Publishing -#NEXUS_USERNAME= -#NEXUS_PASSWORD= -#signing.keyId= -#signing.password= -#signing.secretKeyRingFile= - +org.gradle.jvmargs=-Xmx2048M \ No newline at end of file diff --git a/gradle/artifact-settings.gradle b/gradle/artifact-settings.gradle new file mode 100644 index 000000000..c89a4d830 --- /dev/null +++ b/gradle/artifact-settings.gradle @@ -0,0 +1,21 @@ +ext { + + mapboxArtifactGroupId = 'com.mapbox.mapboxsdk' + mapboxArtifactId = project.hasProperty('POM_ARTIFACT_ID') ? project.property('POM_ARTIFACT_ID') : System.getenv('POM_ARTIFACT_ID') + mapboxArtifactTitle = 'Mapbox Java SDK' + mapboxArtifactDescription = project.hasProperty('POM_DESCRIPTION') ? project.property('POM_DESCRIPTION') : System.getenv('POM_DESCRIPTION') + mapboxDeveloperName = 'Mapbox' + mapboxDeveloperId = 'mapbox' + mapboxArtifactUrl = 'https://github.com/mapbox/mapbox-java' + mapboxArtifactVcsUrl = 'https://github.com/mapbox/mapbox-java.git' + mapboxArtifactScmUrl = 'scm:git@github.com:mapbox/mapbox-java.git' + mapboxArtifactLicenseName = 'Apache-2.0' + mapboxArtifactLicenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + versionName = project.hasProperty('VERSION_NAME') ? project.property('VERSION_NAME') : System.getenv('VERSION_NAME') + + mapboxBintrayUserOrg = 'mapbox' + mapboxBintrayRepoName = 'mapbox' + mapboxBintrayUser = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER') + mapboxBintrayApiKey = project.hasProperty('BINTRAY_API_KEY') ? project.property('BINTRAY_API_KEY') : System.getenv('BINTRAY_API_KEY') + mapboxGpgPassphrase = project.hasProperty('GPG_PASSPHRASE') ? project.property('GPG_PASSPHRASE') : System.getenv('GPG_PASSPHRASE') +} \ No newline at end of file diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 55f1a4c4f..a785850b0 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -19,9 +19,12 @@ ext { errorprone : '0.0.14', spotbugs : '1.3', buildConfig: '1.1.8', - dependencyGraph: '0.4.0' - + dependencyGraph: '0.4.0', + bintray : '1.8.4', + maven : '3.6.2', + artifactory: '4.9.3', ] + dependenciesList = [ autoValue : "com.google.auto.value:auto-value:${version.autoValue}", autoValueGson : "com.ryanharter.auto.value:auto-value-gson:${version.autoValueGson}", @@ -45,6 +48,9 @@ ext { errorprone : "net.ltgt.gradle:gradle-errorprone-plugin:${pluginVersion.errorprone}", buildConfig: "gradle.plugin.de.fuerstenau:BuildConfigPlugin:${pluginVersion.buildConfig}", dependencyGraph: "com.vanniktech:gradle-dependency-graph-generator-plugin:${pluginVersion.dependencyGraph}", - jacoco : "com.vanniktech:gradle-android-junit-jacoco-plugin:${pluginVersion.jacoco}" + jacoco : "com.vanniktech:gradle-android-junit-jacoco-plugin:${pluginVersion.jacoco}", + bintray : "com.jfrog.bintray.gradle:gradle-bintray-plugin:${pluginVersion.bintray}", + maven : "digital.wup:android-maven-publish:${pluginVersion.maven}", + artifactory: "org.jfrog.buildinfo:build-info-extractor-gradle:${pluginVersion.artifactory}", ] } \ No newline at end of file diff --git a/gradle/gradle-bintray.gradle b/gradle/gradle-bintray.gradle new file mode 100644 index 000000000..522dd32ab --- /dev/null +++ b/gradle/gradle-bintray.gradle @@ -0,0 +1,92 @@ +apply plugin: 'digital.wup.android-maven-publish' +apply plugin: 'java' +apply plugin: 'maven-publish' +apply plugin: 'com.jfrog.bintray' +apply plugin: 'com.jfrog.artifactory' +apply from: file('../gradle/artifact-settings.gradle') + +publishing { + publications { + MapboxJavaSDKPublication(MavenPublication) { + from components.java + groupId project.ext.mapboxArtifactGroupId + artifactId + version project.ext.versionName + + afterEvaluate { + artifact("$buildDir/outputs/aar/${project.ext.mapboxArtifactId}-release.aar") + artifact sourcesJar + artifact javadocJar + } + + pom.withXml { + final mainNode = asNode() + mainNode.appendNode('name', project.ext.mapboxArtifactTitle) + mainNode.appendNode('description', project.ext.mapboxArtifactTitle) + mainNode.appendNode('url', project.ext.mapboxArtifactUrl) + + final licenseNode = mainNode.appendNode('licenses').appendNode('license') + licenseNode.appendNode('name', project.ext.mapboxArtifactLicenseName) + licenseNode.appendNode('url', project.ext.mapboxArtifactLicenseUrl) + licenseNode.appendNode('distribution', "repo") + + final developerNode = mainNode.appendNode('developers').appendNode('developer') + developerNode.appendNode('id', project.ext.mapboxDeveloperId) + developerNode.appendNode('name', project.ext.mapboxDeveloperName) + + final scmNode = mainNode.appendNode("scm") + scmNode.appendNode("connection", project.ext.mapboxArtifactScmUrl) + scmNode.appendNode("developerConnection", project.ext.mapboxArtifactScmUrl) + scmNode.appendNode("url", project.ext.mapboxArtifactUrl) + } + + } + } +} + +bintray { + user = mapboxBintrayUser + key = mapboxBintrayApiKey + publications = ['MapboxJavaSDKPublication'] + pkg { + repo = project.ext.mapboxBintrayRepoName + name = project.ext.mapboxArtifactId + userOrg = project.ext.mapboxBintrayUserOrg + licenses = [project.ext.mapboxArtifactLicenseName] + vcsUrl = project.ext.mapboxArtifactVcsUrl + publish = false + version { + name = project.ext.versionName + desc = project.ext.mapboxArtifactDescription + released = new Date() + gpg { + sign = true + passphrase = mapboxGpgPassphrase + } + mavenCentralSync { + sync = false + } + } + } +} + +artifactory { + contextUrl = 'http://oss.jfrog.org' + publish { + repository { + repoKey = 'oss-snapshot-local' + username = mapboxBintrayUser + password = mapboxBintrayApiKey + } + defaults { + publications('MapboxJavaSDKPublication') + } + } +} + + +tasks.withType(Javadoc) { + options.addStringOption('encoding', 'UTF-8') + options.addStringOption('docencoding', 'UTF-8') + options.addStringOption('charset', 'UTF-8') +} diff --git a/gradle/mvn-push.gradle b/gradle/mvn-push.gradle deleted file mode 100644 index 176e437f6..000000000 --- a/gradle/mvn-push.gradle +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2013 Chris Banes - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'maven' -apply plugin: 'signing' - -def isReleaseBuild() { - return VERSION_NAME.contains("SNAPSHOT") == false -} - -def isLocalBuild() { - if (System.getenv('IS_LOCAL_DEVELOPMENT') != null) { - return System.getenv('IS_LOCAL_DEVELOPMENT').toBoolean() - } - return true -} - -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 obtainMavenLocalUrl() { - return getRepositories().mavenLocal().getUrl() -} - -def getRepositoryUsername() { - return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" -} - -def getRepositoryPassword() { - return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" -} - -afterEvaluate { project -> - uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = VERSION_NAME - - if (isLocalBuild()) { - repository(url: obtainMavenLocalUrl()) - } else { - repository(url: getReleaseRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - snapshotRepository(url: getSnapshotRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - } - - 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_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST - } - } - - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - } - } - } - } - } - } - - signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign configurations.archives - } - - task coreJavadocsJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir - } - - task coreSourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allSource - } - - artifacts { - archives coreSourcesJar - archives coreJavadocsJar - } -} \ No newline at end of file diff --git a/services-core/build.gradle b/services-core/build.gradle index 13d415504..e7d8afaf1 100644 --- a/services-core/build.gradle +++ b/services-core/build.gradle @@ -51,4 +51,4 @@ dependencies { // Test Dependencies testOutput sourceSets.test.output -} \ No newline at end of file +} diff --git a/services-core/gradle.properties b/services-core/gradle.properties index 284d14d35..8880a185e 100644 --- a/services-core/gradle.properties +++ b/services-core/gradle.properties @@ -1,5 +1,5 @@ VERSION_NAME=4.9.0-SNAPSHOT POM_ARTIFACT_ID=mapbox-sdk-core POM_NAME=Mapbox Services SDK -POM_DESCRIPTION=Mapbox Services SDK (core module) +POM_DESCRIPTION=Mapbox Services SDK (Core module) POM_PACKAGING=jar \ No newline at end of file