aboutsummaryrefslogtreecommitdiff
path: root/android/build.gradle
blob: 7aad5977e5850c1d68df75ee9f00261c99ef78ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
apply plugin: 'com.android.library'

group = "io.grpc"
version = "1.16.1" // CURRENT_GRPC_VERSION
description = 'gRPC: Android'

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.13"
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
    }
}

apply plugin: "net.ltgt.errorprone"
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: "signing"

android {
    compileSdkVersion 27
    defaultConfig {
        consumerProguardFiles "proguard-rules.txt"
        minSdkVersion 14
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    lintOptions { abortOnError false }
}

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    implementation 'io.grpc:grpc-core:1.16.1' // CURRENT_GRPC_VERSION

    testImplementation 'io.grpc:grpc-okhttp:1.16.1' // CURRENT_GRPC_VERSION
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.robolectric:robolectric:3.7.1'
    testImplementation 'com.google.truth:truth:0.39'
}

signing {
    required false
    sign configurations.archives
}

task javadocs(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    // TODO(ericgribkoff) Fix javadoc errors
    failOnError false
    options {
        // Disable JavaDoc doclint on Java 8.
        if (JavaVersion.current().isJava8Compatible()) {
            addStringOption('Xdoclint:none', '-quiet')
        }
    }
}

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

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

artifacts {
    archives sourcesJar
    archives javadocsJar
}

uploadArchives.repositories.mavenDeployer {
    beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
    if (rootProject.hasProperty('repositoryDir')) {
        repository(url: new File(rootProject.repositoryDir).toURI())
    } else {
        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)
    }
}

[
    install.repositories.mavenInstaller,
    uploadArchives.repositories.mavenDeployer,
]*.pom*.whenConfigured { pom ->
    pom.project {
        name "$project.group:$project.name"
        description project.description
        url 'https://conscrypt.org/'

        scm {
            connection 'scm:git:https://github.com/grpc/grpc-java.git'
            developerConnection 'scm:git:git@github.com:grpc/grpc-java.git'
            url 'https://github.com/grpc/grpc-java'
        }

        licenses {
            license {
                name 'Apache 2.0'
                url 'https://opensource.org/licenses/Apache-2.0'
            }
        }

        developers {
            developer {
                id "grpc.io"
                name "gRPC Contributors"
                email "grpc-io@googlegroups.com"
                url "https://grpc.io/"
                // https://issues.gradle.org/browse/GRADLE-2719
                organization = "gRPC Authors"
                organizationUrl "https://www.google.com"
            }
        }
    }
    def core = pom.dependencies.find {dep -> dep.artifactId == 'grpc-core'}
    if (core != null) {
        // Depend on specific version of grpc-core because internal package is unstable
        core.version = "[" + core.version + "]"
    }
}