-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
build.gradle
46 lines (42 loc) · 1.55 KB
/
build.gradle
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
plugins {
id "maven-publish"
}
description = 'gRPC: BOM'
publishing {
publications {
maven(MavenPublication) {
// remove all other artifacts since BOM doesn't generates any Jar
artifacts = []
pom.withXml {
// Generate bom using subprojects
def internalProjects = [
project.name,
'grpc-compiler',
]
def dependencyManagement = asNode().appendNode('dependencyManagement')
def dependencies = dependencyManagement.appendNode('dependencies')
rootProject.subprojects.each { subproject ->
if (internalProjects.contains(subproject.name)) {
return
}
if (!subproject.hasProperty('publishMavenPublicationToMavenRepository')) {
return
}
if (!subproject.publishMavenPublicationToMavenRepository.enabled) {
return
}
def dependencyNode = dependencies.appendNode('dependency')
dependencyNode.appendNode('groupId', subproject.group)
dependencyNode.appendNode('artifactId', subproject.name)
dependencyNode.appendNode('version', subproject.version)
}
// add protoc gen (produced by grpc-compiler with different artifact name)
def dependencyNode = dependencies.appendNode('dependency')
dependencyNode.appendNode('groupId', project.group)
dependencyNode.appendNode('artifactId', 'protoc-gen-grpc-java')
dependencyNode.appendNode('version', project.version)
dependencyNode.appendNode('type', 'pom')
}
}
}
}