mirror of https://github.com/grpc/grpc-java.git
152 lines
4.2 KiB
Groovy
152 lines
4.2 KiB
Groovy
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
mavenLocal()
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:1.3.+'
|
|
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
|
|
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
|
}
|
|
}
|
|
apply plugin: 'android-sdk-manager'
|
|
apply plugin: 'com.android.library'
|
|
apply plugin: 'com.github.dcendents.android-maven'
|
|
apply plugin: 'signing'
|
|
|
|
def properties = new Properties()
|
|
properties.load(new FileInputStream(file('../version.properties')))
|
|
|
|
description = 'gRPC: Android'
|
|
group = "io.grpc"
|
|
version = "${properties.version}"
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
mavenLocal()
|
|
}
|
|
|
|
// Need to override to ensure maven artifact is generated with correct name
|
|
// Must match uploadTask.repositories.mavenDeployer.pom.artifactId
|
|
project.archivesBaseName = "grpc-android"
|
|
|
|
android {
|
|
// Matches preinstalled on travis to keep CI build times down
|
|
compileSdkVersion 21
|
|
buildToolsVersion '21.1.1'
|
|
|
|
defaultConfig {
|
|
minSdkVersion 9
|
|
targetSdkVersion 21
|
|
versionCode 1
|
|
versionName "1.0"
|
|
}
|
|
lintOptions {
|
|
disable 'InvalidPackage', 'HardcodedText'
|
|
}
|
|
}
|
|
|
|
// Disable JavaDoc doclint on Java 8. It's annoying.
|
|
if (JavaVersion.current().isJava8Compatible()) {
|
|
allprojects {
|
|
tasks.withType(Javadoc) {
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
}
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
javadocDeps
|
|
}
|
|
|
|
dependencies {
|
|
compile "io.grpc:grpc-okhttp:${properties.version}"
|
|
javadocDeps "io.grpc:grpc-okhttp:${properties.version}"
|
|
|
|
testCompile 'junit:junit:4.12'
|
|
testCompile 'org.mockito:mockito-core:1.9.5'
|
|
}
|
|
|
|
signing {
|
|
required false
|
|
sign configurations.archives
|
|
}
|
|
|
|
uploadArchives.repositories.mavenDeployer {
|
|
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
|
String stagingUrl
|
|
if (rootProject.hasProperty('repositoryId')) {
|
|
stagingUrl = 'https://oss.sonatype.org/service/local/staging/deployByRepositoryId/' +
|
|
rootProject.repositoryId
|
|
} else {
|
|
stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
|
|
}
|
|
def configureAuth = {
|
|
if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) {
|
|
authentication(userName: rootProject.ossrhUsername, password: rootProject.ossrhPassword)
|
|
}
|
|
}
|
|
repository(url: stagingUrl, configureAuth)
|
|
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/', configureAuth)
|
|
pom.artifactId = 'grpc-android'
|
|
}
|
|
|
|
[
|
|
install.repositories.mavenInstaller,
|
|
uploadArchives.repositories.mavenDeployer,
|
|
]*.pom*.whenConfigured { pom ->
|
|
pom.project {
|
|
name "$project.group:grpc-android"
|
|
description project.description
|
|
packaging 'aar'
|
|
url 'https://github.com/grpc/grpc-java'
|
|
|
|
scm {
|
|
connection 'scm:svn:https://github.com/grpc/grpc-java.git'
|
|
developerConnection 'scm:svn:git@github.com:grpc/grpc-java.git'
|
|
url 'https://github.com/grpc/grpc-java'
|
|
}
|
|
|
|
licenses {
|
|
license {
|
|
name 'BSD 3-Clause'
|
|
url 'http://opensource.org/licenses/BSD-3-Clause'
|
|
}
|
|
}
|
|
|
|
developers {
|
|
developer {
|
|
id "grpc.io"
|
|
name "gRPC Contributors"
|
|
email "grpc-io@googlegroups.com"
|
|
url "http://grpc.io/"
|
|
// https://issues.gradle.org/browse/GRADLE-2719
|
|
organization = "Google, Inc."
|
|
organizationUrl "https://www.google.com"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
task sourcesJar(type: Jar) {
|
|
from android.sourceSets.main.java.srcDirs
|
|
classifier = 'sources'
|
|
}
|
|
|
|
task javadoc(type: Javadoc) {
|
|
source = android.sourceSets.main.java.srcDirs
|
|
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
|
classpath += configurations.javadocDeps
|
|
destinationDir = file("../javadoc/")
|
|
}
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
classifier = 'javadoc'
|
|
from javadoc.destinationDir
|
|
}
|
|
|
|
artifacts {
|
|
archives javadocJar
|
|
archives sourcesJar
|
|
}
|