普通文本  |  90行  |  3.24 KB

apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'

android {
    sourceSets {
        main {
            java {
                srcDirs += "${projectDir}/../../interop-testing/src/main/java/"
                setIncludes(["io/grpc/android/integrationtest/**",
                             "io/grpc/testing/integration/AbstractInteropTest.java",
                             "io/grpc/testing/integration/TestServiceImpl.java",
                             "io/grpc/testing/integration/Util.java"])
            }
            proto {
                srcDirs += "${projectDir}/../../interop-testing/src/main/proto/"
            }
        }
    }
    compileSdkVersion 26

    defaultConfig {
        applicationId "io.grpc.android.integrationtest"
        // API level 14+ is required for TLS since Google Play Services v10.2
        minSdkVersion 14
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        debug { minifyEnabled false }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions { disable 'InvalidPackage', 'HardcodedText' }
}

protobuf {
    protoc { artifact = 'com.google.protobuf:protoc:3.5.1-1' }
    plugins {
        javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
        grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.16.0-SNAPSHOT' // CURRENT_GRPC_VERSION
        }
    }
    generateProtoTasks {
        all().each { task ->
            task.plugins {
                javalite {}
                grpc {
                    // Options added to --grpc_out
                    option 'lite'
                }
            }
        }
    }
}

dependencies {
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:support-annotations:27.1.1'
    implementation 'com.google.android.gms:play-services-base:15.0.1'
    implementation ('com.google.auth:google-auth-library-oauth2-http:0.9.0') {
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'
    }
    implementation 'com.google.truth:truth:0.36'
    implementation 'javax.annotation:javax.annotation-api:1.2'
    implementation 'junit:junit:4.12'

    // You need to build grpc-java to obtain the grpc libraries below.
    implementation 'io.grpc:grpc-auth:1.16.0-SNAPSHOT' // CURRENT_GRPC_VERSION
    implementation 'io.grpc:grpc-okhttp:1.16.0-SNAPSHOT' // CURRENT_GRPC_VERSION
    implementation 'io.grpc:grpc-protobuf-lite:1.16.0-SNAPSHOT' // CURRENT_GRPC_VERSION
    implementation 'io.grpc:grpc-stub:1.16.0-SNAPSHOT' // CURRENT_GRPC_VERSION
    implementation 'io.grpc:grpc-testing:1.16.0-SNAPSHOT' // CURRENT_GRPC_VERSION

    // workaround for https://github.com/google/protobuf/issues/1889
    protobuf 'com.google.protobuf:protobuf-java:3.0.2'

    androidTestImplementation 'androidx.test:rules:1.1.0-alpha1'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha1'
}

gradle.projectsEvaluated {
    tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:deprecation" }
}