blob: 1eb6c212d063e0b17561659c2681c3f83bc06148 [file] [log] [blame]
Ashitha Santhosh1b880652022-02-14 07:10:18 -08001plugins {
2 id "java-library"
3 id "maven-publish"
4
5 id "com.github.johnrengelman.shadow"
6 id "com.google.protobuf"
7 id "ru.vyarus.animalsniffer"
8}
9
10description = "gRPC: Authorization"
11
12dependencies {
13 implementation project(':grpc-protobuf'),
Eric Anderson1551cc72023-04-13 08:52:20 -070014 project(':grpc-core'),
15 libraries.guava.jre // JRE required by transitive protobuf-java-util
Ashitha Santhosh1b880652022-02-14 07:10:18 -080016
Eric Andersonb06942d2022-06-13 12:09:30 -070017 annotationProcessor libraries.auto.value
18 compileOnly libraries.javax.annotation
Ashitha Santhosh1b880652022-02-14 07:10:18 -080019
20 testImplementation project(':grpc-testing'),
Ashitha Santhoshb43ddc22023-04-19 10:50:19 -070021 project(':grpc-testing-proto'),
Eric Anderson29b84832023-05-16 12:10:13 -070022 testFixtures(project(':grpc-core'))
Eric Andersonb06942d2022-06-13 12:09:30 -070023 testImplementation (libraries.guava.testlib) {
Ashitha Santhosh1b880652022-02-14 07:10:18 -080024 exclude group: 'junit', module: 'junit'
25 }
26
27 def xdsDependency = implementation project(':grpc-xds')
28 shadow configurations.implementation.getDependencies().minus([xdsDependency])
29 shadow project(path: ':grpc-xds', configuration: 'shadow')
30
Eric Anderson61f19d72022-08-10 12:41:57 -070031 signature libraries.signature.java
Ashitha Santhosh1b880652022-02-14 07:10:18 -080032}
33
Eric Anderson0ff9f372022-07-01 15:48:38 -070034tasks.named("jar").configure {
Eric Anderson8dbc88f2023-05-08 10:46:10 -070035 archiveClassifier = 'original'
Ashitha Santhosh1b880652022-02-14 07:10:18 -080036}
37
Eric Anderson0ff9f372022-07-01 15:48:38 -070038tasks.named("shadowJar").configure {
Eric Anderson8dbc88f2023-05-08 10:46:10 -070039 archiveClassifier = null
Ashitha Santhosh1b880652022-02-14 07:10:18 -080040 dependencies {
41 exclude(dependency {true})
42 }
43 relocate 'io.grpc.xds', 'io.grpc.xds.shaded.io.grpc.xds'
44 relocate 'udpa.annotations', 'io.grpc.xds.shaded.udpa.annotations'
45 relocate 'com.github.udpa', 'io.grpc.xds.shaded.com.github.udpa'
46 relocate 'envoy.annotations', 'io.grpc.xds.shaded.envoy.annotations'
47 relocate 'io.envoyproxy', 'io.grpc.xds.shaded.io.envoyproxy'
48 relocate 'com.google.api.expr', 'io.grpc.xds.shaded.com.google.api.expr'
49}
50
Ashitha Santhosh0194ae92022-12-21 15:30:42 -080051tasks.named("compileJava").configure {
52 it.options.compilerArgs += [
53 "-Xlint:-processing",
54 ]
55}
56
Ashitha Santhosh1b880652022-02-14 07:10:18 -080057publishing {
58 publications {
59 maven(MavenPublication) {
60 // We want this to throw an exception if it isn't working
61 def originalJar = artifacts.find { dep -> dep.classifier == 'original'}
62 artifacts.remove(originalJar)
63
64 pom.withXml {
65 def dependenciesNode = new Node(null, 'dependencies')
66 project.configurations.shadow.allDependencies.each { dep ->
67 def dependencyNode = dependenciesNode.appendNode('dependency')
68 dependencyNode.appendNode('groupId', dep.group)
69 dependencyNode.appendNode('artifactId', dep.name)
70 dependencyNode.appendNode('version', dep.version)
71 dependencyNode.appendNode('scope', 'compile')
72 }
73 asNode().dependencies[0].replaceNode(dependenciesNode)
74 }
75 }
76 }
77}
78
Eric Anderson0ff9f372022-07-01 15:48:38 -070079tasks.named("publishMavenPublicationToMavenRepository").configure {
80 enabled = false
81}