forked from grpc/grpc-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
146 lines (130 loc) · 5.42 KB
/
Copy pathbuild.gradle
File metadata and controls
146 lines (130 loc) · 5.42 KB
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
146
plugins {
id "com.android.application"
id "com.google.protobuf"
}
description = 'gRPC: Android Integration Testing'
repositories {
google()
}
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"
minSdkVersion 23
targetSdkVersion 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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 libraries.androidx.annotation
implementation 'com.google.android.gms:play-services-base:18.0.1'
implementation project(':grpc-android'),
project(':grpc-api'),
project(':grpc-core'),
project(':grpc-census'),
project(':grpc-okhttp'),
project(':grpc-protobuf-lite'),
project(':grpc-stub'),
project(':grpc-testing'),
libraries.junit,
libraries.truth,
libraries.androidx.test.rules,
libraries.androidx.test.core,
libraries.opencensus.contrib.grpc.metrics
implementation (project(':grpc-services')) {
exclude group: 'com.google.protobuf'
exclude group: 'com.google.guava'
}
androidTestImplementation libraries.androidx.test.ext.junit,
libraries.androidx.test.runner
}
// 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",
]
appendToProperty(it.options.errorprone.excludedPaths, ".*/R.java", "|")
appendToProperty(
it.options.errorprone.excludedPaths,
".*/src/generated/.*",
"|")
}
// Workaround error seen with Gradle 8.14.3 and AGP 7.4.1 when building:
// ./gradlew clean :grpc-android-interop-testing:build -PskipAndroid=false \
// -Pandroid.useAndroidX=true --no-build-cache
//
// Error message:
//
// Execution failed for task ':grpc-android-interop-testing:mergeExtDexDebug'.
// > Could not resolve all files for configuration ':grpc-android-interop-testing:debugRuntimeClasspath'.
// > Failed to transform opencensus-contrib-grpc-metrics-0.31.1.jar (io.opencensus:opencensus-contrib-grpc-metrics:0.31.1) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
// > Could not resolve all files for configuration ':grpc-android-interop-testing:debugRuntimeClasspath'.
// > Failed to transform grpc-api-1.81.0-SNAPSHOT.jar (project :grpc-api) to match attributes {artifactType=android-classes-jar, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=8, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
// > Execution failed for IdentityTransform: grpc-java/api/build/libs/grpc-api-1.81.0-SNAPSHOT.jar.
// > File/directory does not exist: grpc-java/api/build/libs/grpc-api-1.81.0-SNAPSHOT.jar
tasks.configureEach { task ->
if (task.name.equals("mergeExtDexDebug")) {
dependsOn(':grpc-api:jar')
}
}
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()