1 apply plugin: 'com.android.library' 2 3 group = "io.grpc" 4 version = "1.16.0-SNAPSHOT" // CURRENT_GRPC_VERSION 5 description = 'gRPC: Android' 6 7 buildscript { 8 repositories { 9 google() 10 jcenter() 11 mavenCentral() 12 maven { url "https://plugins.gradle.org/m2/" } 13 } 14 dependencies { 15 classpath 'com.android.tools.build:gradle:3.0.1' 16 classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.13" 17 classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' 18 } 19 } 20 21 apply plugin: "net.ltgt.errorprone" 22 apply plugin: 'com.github.dcendents.android-maven' 23 apply plugin: "signing" 24 25 android { 26 compileSdkVersion 27 27 defaultConfig { 28 consumerProguardFiles "proguard-rules.txt" 29 minSdkVersion 14 30 targetSdkVersion 27 31 versionCode 1 32 versionName "1.0" 33 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 34 } 35 lintOptions { abortOnError false } 36 } 37 38 repositories { 39 mavenCentral() 40 mavenLocal() 41 } 42 43 dependencies { 44 implementation 'io.grpc:grpc-core:1.16.0-SNAPSHOT' // CURRENT_GRPC_VERSION 45 46 testImplementation 'io.grpc:grpc-okhttp:1.16.0-SNAPSHOT' // CURRENT_GRPC_VERSION 47 testImplementation 'junit:junit:4.12' 48 testImplementation 'org.robolectric:robolectric:3.7.1' 49 testImplementation 'com.google.truth:truth:0.39' 50 } 51 52 signing { 53 required false 54 sign configurations.archives 55 } 56 57 task javadocs(type: Javadoc) { 58 source = android.sourceSets.main.java.srcDirs 59 // TODO(ericgribkoff) Fix javadoc errors 60 failOnError false 61 options { 62 // Disable JavaDoc doclint on Java 8. 63 if (JavaVersion.current().isJava8Compatible()) { 64 addStringOption('Xdoclint:none', '-quiet') 65 } 66 } 67 } 68 69 task javadocsJar(type: Jar, dependsOn: javadocs) { 70 classifier = 'javadoc' 71 from javadocs.destinationDir 72 } 73 74 task sourcesJar(type: Jar) { 75 classifier = 'sources' 76 from android.sourceSets.main.java.srcDirs 77 } 78 79 artifacts { 80 archives sourcesJar 81 archives javadocsJar 82 } 83 84 uploadArchives.repositories.mavenDeployer { 85 beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 86 if (rootProject.hasProperty('repositoryDir')) { 87 repository(url: new File(rootProject.repositoryDir).toURI()) 88 } else { 89 String stagingUrl 90 if (rootProject.hasProperty('repositoryId')) { 91 stagingUrl = 'https://oss.sonatype.org/service/local/staging/deployByRepositoryId/' + 92 rootProject.repositoryId 93 } else { 94 stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' 95 } 96 def configureAuth = { 97 if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) { 98 authentication(userName: rootProject.ossrhUsername, password: rootProject.ossrhPassword) 99 } 100 } 101 repository(url: stagingUrl, configureAuth) 102 snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/', configureAuth) 103 } 104 } 105 106 [ 107 install.repositories.mavenInstaller, 108 uploadArchives.repositories.mavenDeployer, 109 ]*.pom*.whenConfigured { pom -> 110 pom.project { 111 name "$project.group:$project.name" 112 description project.description 113 url 'https://conscrypt.org/' 114 115 scm { 116 connection 'scm:git:https://github.com/grpc/grpc-java.git' 117 developerConnection 'scm:git:git (a] github.com:grpc/grpc-java.git' 118 url 'https://github.com/grpc/grpc-java' 119 } 120 121 licenses { 122 license { 123 name 'Apache 2.0' 124 url 'https://opensource.org/licenses/Apache-2.0' 125 } 126 } 127 128 developers { 129 developer { 130 id "grpc.io" 131 name "gRPC Contributors" 132 email "grpc-io (a] googlegroups.com" 133 url "https://grpc.io/" 134 // https://issues.gradle.org/browse/GRADLE-2719 135 organization = "gRPC Authors" 136 organizationUrl "https://www.google.com" 137 } 138 } 139 } 140 def core = pom.dependencies.find {dep -> dep.artifactId == 'grpc-core'} 141 if (core != null) { 142 // Depend on specific version of grpc-core because internal package is unstable 143 core.version = "[" + core.version + "]" 144 } 145 } 146