blob: fe19ef73c044acc4590ca95fa813574f7e955040 (
plain) (
blame)
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
|
import com.google.protobuf.gradle.*
val buildProtoDir = File("${buildDir}", "__proto__")
plugins {
id("java-library")
id("com.google.protobuf") version "0.8.19"
{% if targets|selectattr('publish') -%}
`maven-publish`
`signing`
{% endif -%}
}
{% if targets|selectattr('publish') -%}
group = "{{ targets[0].publish_group }}"
version = project.properties["version"]
{% endif -%}
repositories {
mavenCentral()
}
java {
withSourcesJar()
withJavadocJar()
}
dependencies {
{% for library in targets[0].consumer_classpath -%}
api({{ library }})
{% endfor -%}
{% if targets[0].proto_namespace is defined -%}
protobuf(files(File(buildProtoDir, "{{ targets[0].proto_namespace }}")))
{% else -%}
protobuf(files(buildProtoDir))
{% endif -%}
}
{% if targets[0].proto_grpc is defined -%}
protobuf {
plugins {
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:1.45.0"
}
}
generateProtoTasks {
ofSourceSet("main").forEach {
it.plugins {
id("grpc")
}
}
}
}
{% endif -%}
val prepareProto = tasks.register<Copy>("prepareProto") {
from(rootDir) {
{% for proto in targets[0].proto_files -%}
include("{{ proto }}")
{% endfor -%}
}
into(buildProtoDir)
}
afterEvaluate {
tasks.getByName("extractProto").dependsOn(prepareProto)
}
{% if targets|selectattr('publish') -%}
{% include 'publish.gradle.kts' -%}
{% endif -%}
|