Skip to content
This repository has been archived by the owner on Sep 2, 2020. It is now read-only.

Commit

Permalink
Update Gradle configs
Browse files Browse the repository at this point in the history
There are now three Maven artifacts:
* bolts-android - Android, No sources, dependencies on bolts-tasks and bolts-applinks for backwards compatibility
* bolts-tasks - Java, contains TPL
* bolts-applinks - Android, contains AppLinks
  • Loading branch information
grantland committed Oct 15, 2015
1 parent 3028046 commit 1c6b689
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 39 deletions.
42 changes: 4 additions & 38 deletions bolts-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import com.android.builder.core.BuilderConstants
apply plugin: 'com.android.library'
apply plugin: 'com.github.kt3k.coveralls'

group = 'com.parse.bolts'
version = '1.2.2-SNAPSHOT'
group = GROUP_NAME
version = VERSION_NAME

android {
compileSdkVersion rootProject.ext.compileSdkVersion
Expand Down Expand Up @@ -54,6 +54,8 @@ android.libraryVariants.all { variant ->
}
}

//region Maven

apply plugin: 'maven'
apply plugin: 'signing'

Expand Down Expand Up @@ -129,40 +131,4 @@ artifacts {
archives androidJavadocsJar
}

//region Code Coverage

apply plugin: 'jacoco'

task jacocoTestReport(type:JacocoReport, dependsOn: "testDebugUnitTest") {
group = "Verification"
description = "Creates unit test coverage reports for the debug variant."

classDirectories = fileTree(
dir: "${buildDir}/intermediates/classes/debug",
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/BuildConfig.*',
'**/Manifest*.*']
)

sourceDirectories = files("${buildDir.parent}/src/main/java")
additionalSourceDirs = files([
"${buildDir}/generated/source/buildConfig/debug",
"${buildDir}/generated/source/r/debug"
])
executionData = files("${buildDir}/jacoco/testDebugUnitTest.exec")

reports {
xml.enabled = true
html.enabled = true
}
}

//endregion

//region Coveralls

coveralls.jacocoReportPath = "${buildDir}/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"

//endregion
109 changes: 109 additions & 0 deletions bolts-applinks/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import com.android.builder.core.BuilderConstants

apply plugin: 'com.android.library'

group = GROUP_NAME
version = VERSION_NAME

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
Expand All @@ -25,3 +30,107 @@ dependencies {

androidTestCompile 'com.android.support:support-v4:23.0.1'
}

android.libraryVariants.all { variant ->
def name = variant.buildType.name
def task = project.tasks.create(name: "jar${name.capitalize()}", type: Jar) {
dependsOn variant.javaCompile
from variant.javaCompile.destinationDir

manifest {
attributes(
"Bundle-Name": 'bolts-applinks',
"Bundle-Version": project.version
)
}

exclude '**/R.class'
exclude '**/R\$*.class'
exclude '**/Manifest.class'
exclude '**/Manifest\$*.class'
exclude '**/BuildConfig.class'
}

if (name.equals(BuilderConstants.RELEASE)) {
artifacts.add('archives', task);
}
}

//region Maven

apply plugin: 'maven'
apply plugin: 'signing'

def isSnapshot = version.endsWith('-SNAPSHOT')
def ossrhUsername = hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : System.getenv('CI_NEXUS_USERNAME')
def ossrhPassword = hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : System.getenv('CI_NEXUS_PASSWORD')

uploadArchives {
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name 'Bolts-AppLinks'
artifactId = 'bolts-applinks'
packaging 'jar'
description 'Bolts is a collection of low-level libraries designed to make developing mobile apps easier.'
url 'https://github.com/BoltsFramework/Bolts-Android'

scm {
connection 'scm:[email protected]:BoltsFramework/Bolts-Android.git'
developerConnection 'scm:[email protected]:BoltsFramework/Bolts-Android.git'
url 'https://github.com/BoltsFramework/Bolts-Android'
}

licenses {
license {
name 'BSD 2-Clause License'
url 'https://github.com/BoltsFramework/Bolts-Android/blob/master/LICENSE'
distribution 'repo'
}
}

developers {
developer {
id 'parse'
name 'Parse'
}
}
}
}
}

signing {
required { !isSnapshot && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}

artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}

//endregion
69 changes: 68 additions & 1 deletion bolts-tasks/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: 'java'
apply plugin: 'jacoco'

group = GROUP_NAME
version = VERSION_NAME

configurations {
provided
Expand All @@ -17,6 +19,69 @@ dependencies {
testCompile 'junit:junit:4.12'
}

//region Maven

apply plugin: 'maven'
apply plugin: 'signing'

def isSnapshot = version.endsWith('-SNAPSHOT')
def ossrhUsername = hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : System.getenv('CI_NEXUS_USERNAME')
def ossrhPassword = hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : System.getenv('CI_NEXUS_PASSWORD')

uploadArchives {
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name 'Bolts-Tasks'
artifactId = 'bolts-tasks'
packaging 'jar'
description 'Bolts is a collection of low-level libraries designed to make developing mobile apps easier.'
url 'https://github.com/BoltsFramework/Bolts-Android'

scm {
connection 'scm:[email protected]:BoltsFramework/Bolts-Android.git'
developerConnection 'scm:[email protected]:BoltsFramework/Bolts-Android.git'
url 'https://github.com/BoltsFramework/Bolts-Android'
}

licenses {
license {
name 'BSD 2-Clause License'
url 'https://github.com/BoltsFramework/Bolts-Android/blob/master/LICENSE'
distribution 'repo'
}
}

developers {
developer {
id 'parse'
name 'Parse'
}
}
}
}
}

signing {
required { !isSnapshot && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

//endregion

//region Code Coverage

apply plugin: 'jacoco'

jacoco {
toolVersion = '0.7.1.201405082137'
}
Expand All @@ -29,3 +94,5 @@ jacocoTestReport {
html.enabled true
}
}

//endregion
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GROUP_NAME=com.parse.bolts
VERSION_NAME=1.2.2-SNAPSHOT

This comment has been minimized.

Copy link
@wangmengyan95

wangmengyan95 Oct 16, 2015

nit, newline

0 comments on commit 1c6b689

Please sign in to comment.