mirror of https://github.com/grpc/grpc-java.git
141 lines
4.4 KiB
Groovy
141 lines
4.4 KiB
Groovy
plugins {
|
|
id "com.android.application"
|
|
id "com.google.protobuf"
|
|
}
|
|
|
|
description = 'gRPC: Android Integration Testing'
|
|
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
|
|
android {
|
|
namespace 'io.grpc.android.integrationtest'
|
|
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/"
|
|
}
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
compileSdkVersion 34
|
|
|
|
defaultConfig {
|
|
applicationId "io.grpc.android.integrationtest"
|
|
// Held back to 20 as Gradle fails to build at the 21 level. This is
|
|
// presumably a Gradle bug that can be revisited later.
|
|
// Maybe this issue: https://github.com/gradle/gradle/issues/20778
|
|
minSdkVersion 20
|
|
targetSdkVersion 33
|
|
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', 'UsingOnClickInXml',
|
|
'MissingClass' // https://github.com/grpc/grpc-java/issues/8799
|
|
}
|
|
packagingOptions {
|
|
exclude 'META-INF/INDEX.LIST'
|
|
exclude 'META-INF/io.netty.versions.properties'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'androidx.appcompat:appcompat:1.3.0'
|
|
implementation 'androidx.multidex:multidex:2.0.0'
|
|
implementation libraries.androidx.annotation
|
|
implementation 'com.google.android.gms:play-services-base:18.0.1'
|
|
|
|
implementation project(':grpc-android'),
|
|
project(':grpc-core'),
|
|
project(':grpc-auth'),
|
|
project(':grpc-census'),
|
|
project(':grpc-okhttp'),
|
|
project(':grpc-protobuf-lite'),
|
|
project(':grpc-stub'),
|
|
project(':grpc-testing'),
|
|
libraries.hdrhistogram,
|
|
libraries.junit,
|
|
libraries.truth,
|
|
libraries.androidx.test.rules,
|
|
libraries.opencensus.contrib.grpc.metrics
|
|
|
|
implementation (libraries.google.auth.oauth2Http) {
|
|
exclude group: 'org.apache.httpcomponents'
|
|
}
|
|
|
|
implementation (project(':grpc-services')) {
|
|
exclude group: 'com.google.protobuf'
|
|
exclude group: 'com.google.guava'
|
|
}
|
|
|
|
compileOnly libraries.javax.annotation
|
|
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3',
|
|
'androidx.test:runner:1.4.0'
|
|
}
|
|
|
|
// Checkstyle doesn't run automatically with android
|
|
task checkStyleMain(type: Checkstyle) {
|
|
source 'src/main/java'
|
|
include '**/*.java'
|
|
classpath = files()
|
|
}
|
|
|
|
task checkStyleTest(type: Checkstyle) {
|
|
source 'src/androidTest/java'
|
|
include '**/*.java'
|
|
classpath = files()
|
|
}
|
|
|
|
project.tasks['check'].dependsOn checkStyleMain, checkStyleTest
|
|
|
|
import net.ltgt.gradle.errorprone.CheckSeverity
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.compilerArgs += [
|
|
"-Xlint:-cast",
|
|
"-Xlint:-deprecation", // https://github.com/grpc/grpc-java/issues/10298
|
|
]
|
|
appendToProperty(it.options.errorprone.excludedPaths, ".*/R.java", "|")
|
|
appendToProperty(
|
|
it.options.errorprone.excludedPaths,
|
|
".*/src/generated/.*",
|
|
"|")
|
|
}
|
|
|
|
afterEvaluate {
|
|
// Hack to workaround "Task ':grpc-android-interop-testing:extractIncludeDebugProto' uses this
|
|
// output of task ':grpc-context:jar' without declaring an explicit or implicit dependency." The
|
|
// issue started when grpc-context became empty.
|
|
tasks.named('extractIncludeDebugProto').configure {
|
|
dependsOn project(':grpc-context').tasks.named('jar')
|
|
}
|
|
tasks.named('extractIncludeReleaseProto').configure {
|
|
dependsOn project(':grpc-context').tasks.named('jar')
|
|
}
|
|
}
|
|
|
|
configureProtoCompilation()
|