Update Maven release scripts
Summary: Reuse the gradle setup we've built for Litho which allows for parallel publishing to Bintray and Maven Central in addition to Sonatype Snapshots. This appears not to break the existing jcenter deploy script which is pretty great. Reviewed By: emilsjolander Differential Revision: D5020576 fbshipit-source-id: 3ef163ccbfe91c6858b051d39dcf237ca388e18d
This commit is contained in:
committed by
Facebook Github Bot
parent
bcd68b997f
commit
ae33c6c19c
@@ -3,8 +3,8 @@ apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '1.4.1'
|
||||
group = 'com.facebook.yoga.android'
|
||||
version = VERSION_NAME
|
||||
group = GROUP
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.compileSdkVersion
|
||||
@@ -42,8 +42,4 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
ext {
|
||||
bintrayName = 'com.facebook.yoga.android:yoga-layout'
|
||||
}
|
||||
|
||||
apply from: rootProject.file('gradle/android-jcenter-install.gradle')
|
||||
apply from: rootProject.file('gradle/release.gradle')
|
||||
|
5
android/gradle.properties
Normal file
5
android/gradle.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
GROUP=com.facebook.yoga.android
|
||||
POM_NAME=YogaLayout
|
||||
POM_DESCRIPTION=YogaLayout
|
||||
POM_ARTIFACT_ID=yoga-layout
|
||||
POM_PACKAGING=aar
|
@@ -1,4 +1,14 @@
|
||||
bintrayUsername=
|
||||
bintrayApiKey=
|
||||
bintrayGpgPassword=
|
||||
dryRun=false
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
|
||||
VERSION_NAME=1.4.3-SNAPSHOT
|
||||
POM_URL=https://github.com/facebook/yoga
|
||||
POM_SCM_URL=https://github.com/facebook/yoga.git
|
||||
POM_SCM_CONNECTION=scm:git:https://github.com/facebook/yoga.git
|
||||
POM_SCM_DEV_CONNECTION=scm:git:git@github.com:facebook/yoga.git
|
||||
POM_LICENSE_NAME=BSD License
|
||||
POM_LICENSE_URL=https://github.com/facebook/yoga/blob/master/LICENSE
|
||||
POM_LICENSE_DIST=repo
|
||||
POM_DEVELOPER_ID=facebook
|
||||
POM_DEVELOPER_NAME=facebook
|
||||
|
@@ -1,92 +0,0 @@
|
||||
ext {
|
||||
bintrayUserOrg = 'facebook'
|
||||
bintrayRepo = 'maven'
|
||||
siteURL = "https://facebook.github.io/yoga/"
|
||||
projectLicenses = {
|
||||
license {
|
||||
name 'BSD License'
|
||||
url 'https://github.com/facebook/yoga/blob/master/LICENSE'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def getBintrayUsername() {
|
||||
return property('bintrayUsername') || System.getenv('BINTRAY_USERNAME')
|
||||
}
|
||||
|
||||
def getBintrayApiKey() {
|
||||
return property('bintrayApiKey') || System.getenv('BINTRAY_API_KEY')
|
||||
}
|
||||
|
||||
def getBintrayGpgPassword() {
|
||||
return property('bintrayGpgPassword') || System.getenv('BINTRAY_GPG_PASSWORD')
|
||||
}
|
||||
|
||||
def dryRunOnly() {
|
||||
return hasProperty('dryRun') ? property('dryRun').toBoolean() : false
|
||||
}
|
||||
|
||||
def pomConfig = {
|
||||
licenses {
|
||||
// TODO Can we grab this from above?
|
||||
license {
|
||||
name 'BSD License'
|
||||
url 'https://github.com/facebook/yoga/blob/master/LICENSE'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
primaryPublication(MavenPublication) {
|
||||
groupId group
|
||||
artifact(sourcesJar)
|
||||
artifact(javadocJar)
|
||||
pom.packaging='aar'
|
||||
pom.withXml {
|
||||
def root = asNode()
|
||||
root.appendNode('name', 'Yoga')
|
||||
root.appendNode('url', siteURL)
|
||||
root.children().last() + pomConfig
|
||||
def dependenciesNode = root.appendNode('dependencies')
|
||||
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
|
||||
configurations.compile.allDependencies.each {
|
||||
if(it.group != null && (it.name != null || "unspecified".equals(it.name)) && it.version != null) {
|
||||
def dependencyNode = dependenciesNode.appendNode('dependency')
|
||||
dependencyNode.appendNode('groupId', it.group)
|
||||
dependencyNode.appendNode('artifactId', it.name)
|
||||
dependencyNode.appendNode('version', it.version)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bintray {
|
||||
user = getBintrayUsername()
|
||||
key = getBintrayApiKey()
|
||||
publications = ['primaryPublication']
|
||||
configurations = ['archives']
|
||||
pkg {
|
||||
repo = bintrayRepo
|
||||
userOrg = bintrayUserOrg
|
||||
name = project.bintrayName
|
||||
dryRun = dryRunOnly()
|
||||
licenses = projectLicenses
|
||||
override = true
|
||||
publish = true
|
||||
publicDownloadNumbers = true
|
||||
version {
|
||||
name = project.version
|
||||
released = new Date()
|
||||
gpg {
|
||||
sign = true
|
||||
passphrase = getBintrayGpgPassword()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
gradle/android-maven-install.gradle
Normal file
37
gradle/android-maven-install.gradle
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
47
gradle/android-tasks.gradle
Normal file
47
gradle/android-tasks.gradle
Normal file
@@ -0,0 +1,47 @@
|
||||
// Android tasks for Javadoc and sources.jar generation
|
||||
|
||||
afterEvaluate { project ->
|
||||
if (POM_PACKAGING == 'aar') {
|
||||
task androidJavadoc(type: Javadoc) {
|
||||
source = android.sourceSets.main.java.srcDirs
|
||||
exclude '**/pom.xml'
|
||||
exclude '**/proguard_annotations.pro'
|
||||
classpath += files(android.bootClasspath)
|
||||
}
|
||||
|
||||
task androidJavadocJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
from androidJavadoc.destinationDir
|
||||
}
|
||||
|
||||
task androidSourcesJar(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.add('archives', androidJavadocJar)
|
||||
artifacts.add('archives', androidSourcesJar)
|
||||
}
|
||||
|
||||
if (POM_PACKAGING == 'jar') {
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
artifacts.add('archives', javadocJar)
|
||||
artifacts.add('archives', sourcesJar)
|
||||
}
|
||||
}
|
63
gradle/bintray.gradle
Normal file
63
gradle/bintray.gradle
Normal file
@@ -0,0 +1,63 @@
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
96
gradle/gradle-mvn-push.gradle
Normal file
96
gradle/gradle-mvn-push.gradle
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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: 'signing'
|
||||
|
||||
version = VERSION_NAME
|
||||
group = GROUP
|
||||
|
||||
def isReleaseBuild() {
|
||||
return VERSION_NAME.contains('SNAPSHOT') == false
|
||||
}
|
||||
|
||||
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 : ""
|
||||
}
|
||||
|
||||
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())
|
||||
}
|
||||
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_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
|
||||
}
|
||||
}
|
33
gradle/release-bintray.gradle
Normal file
33
gradle/release-bintray.gradle
Normal file
@@ -0,0 +1,33 @@
|
||||
// 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 = 'https://github.com/facebook/yoga/issues'
|
||||
scmUrl = POM_SCM_URL
|
||||
scmConnection = POM_SCM_CONNECTION
|
||||
scmDeveloperConnection = POM_SCM_DEV_CONNECTION
|
||||
|
||||
publishedGroupId = GROUP
|
||||
libraryName = 'yoga'
|
||||
artifact = 'yoga'
|
||||
|
||||
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')
|
8
gradle/release.gradle
Normal file
8
gradle/release.gradle
Normal file
@@ -0,0 +1,8 @@
|
||||
// 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')
|
@@ -3,8 +3,8 @@ apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '1.4.2'
|
||||
group = 'com.facebook.yoga'
|
||||
group = GROUP
|
||||
version = VERSION_NAME
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.compileSdkVersion
|
||||
@@ -73,4 +73,4 @@ ext {
|
||||
bintrayName = 'com.facebook.yoga:yoga'
|
||||
}
|
||||
|
||||
apply from: rootProject.file('gradle/android-jcenter-install.gradle')
|
||||
apply from: rootProject.file('gradle/release.gradle')
|
||||
|
5
java/gradle.properties
Normal file
5
java/gradle.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
GROUP=com.facebook.yoga
|
||||
POM_NAME=Yoga
|
||||
POM_DESCRIPTION=Java bindings to libyoga
|
||||
POM_ARTIFACT_ID=yoga
|
||||
POM_PACKAGING=aar
|
Reference in New Issue
Block a user