|
1 | | -import com.google.protobuf.gradle.id |
| 1 | +import net.infumia.gradle.applyProtobuf |
| 2 | +import net.infumia.gradle.publish |
| 3 | +import net.infumia.gradle.spotless |
2 | 4 |
|
3 | | -plugins { |
4 | | - java |
5 | | - `java-library` |
6 | | - `maven-publish` |
7 | | - alias(libs.plugins.protobuf) |
8 | | -} |
9 | | - |
10 | | -repositories { |
11 | | - mavenCentral() |
12 | | -} |
13 | | - |
14 | | -dependencies { |
15 | | - compileOnlyApi(libs.protobuf) |
16 | | - compileOnlyApi(libs.grpc.protobuf) |
17 | | - compileOnlyApi(libs.grpc.stub) |
18 | | - compileOnlyApi(libs.annotationsapi) |
19 | | -} |
20 | | - |
21 | | -sourceSets { |
22 | | - main { |
23 | | - java { |
24 | | - srcDirs("build/generated/source/proto/main/java") |
25 | | - } |
26 | | - resources { |
27 | | - srcDir("src/main/proto") |
28 | | - } |
29 | | - } |
30 | | -} |
| 5 | +plugins { java } |
31 | 6 |
|
32 | | -protobuf { |
33 | | - protoc { artifact = libs.protoc.get().toString() } |
| 7 | +publish() |
34 | 8 |
|
35 | | - plugins { |
36 | | - id("grpc") { |
37 | | - artifact = "io.grpc:protoc-gen-grpc-java:${libs.versions.grpc.get()}" |
38 | | - } |
39 | | - } |
| 9 | +applyProtobuf() |
40 | 10 |
|
41 | | - generateProtoTasks { |
42 | | - all().forEach { |
43 | | - it.plugins { |
44 | | - id("grpc") { |
45 | | - outputSubDir = "java" |
46 | | - } |
47 | | - } |
48 | | - } |
49 | | - } |
50 | | -} |
51 | | - |
52 | | -tasks { |
53 | | - compileJava { |
54 | | - options.encoding = Charsets.UTF_8.name() |
55 | | - } |
56 | | - |
57 | | - javadoc { |
58 | | - options.encoding = Charsets.UTF_8.name() |
59 | | - (options as StandardJavadocDocletOptions).tags("todo") |
60 | | - exclude("**/allocation/**") |
61 | | - exclude("**/agones/**") |
62 | | - exclude("**/com/google/api/**") |
63 | | - exclude("**/grpc/**") |
64 | | - } |
65 | | - |
66 | | - val javadocJar by creating(Jar::class) { |
67 | | - dependsOn("javadoc") |
68 | | - archiveClassifier.set("javadoc") |
69 | | - from(javadoc) |
70 | | - } |
| 11 | +spotless() |
71 | 12 |
|
72 | | - val sourcesJar by creating(Jar::class) { |
73 | | - dependsOn("classes") |
74 | | - archiveClassifier.set("sources") |
75 | | - duplicatesStrategy = DuplicatesStrategy.INCLUDE |
76 | | - from(sourceSets["main"].allSource) |
77 | | - } |
78 | | - |
79 | | - processResources { |
80 | | - duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
81 | | - } |
82 | | -} |
83 | | - |
84 | | -publishing { |
85 | | - publications { |
86 | | - create<MavenPublication>("mavenJava") { |
87 | | - groupId = project.group.toString() |
88 | | - artifactId = "agones4j" |
89 | | - version = project.version.toString() |
90 | | - from(components["java"]) |
91 | | - artifact(tasks["sourcesJar"]) |
92 | | - artifact(tasks["javadocJar"]) |
93 | | - pom { |
94 | | - name.set("Agones4J") |
95 | | - description.set("Java wrapper for Agones client SDK.") |
96 | | - url.set("https://infumia.com.tr/") |
97 | | - licenses { |
98 | | - license { |
99 | | - name.set("MIT License") |
100 | | - url.set("https://mit-license.org/license.txt") |
101 | | - } |
102 | | - } |
103 | | - developers { |
104 | | - developer { |
105 | | - id.set("portlek") |
106 | | - name.set("Hasan Demirtaş") |
107 | | - email.set("utsukushihito@outlook.com") |
108 | | - } |
109 | | - } |
110 | | - scm { |
111 | | - connection.set("scm:git:git://github.com/infumia/agones4j.git") |
112 | | - developerConnection.set("scm:git:ssh://github.com/infumia/agones4j.git") |
113 | | - url.set("https://github.com/infumia/agones4j") |
114 | | - } |
115 | | - } |
116 | | - } |
117 | | - } |
| 13 | +dependencies { |
| 14 | + compileOnly(libs.protobuf) |
| 15 | + compileOnly(libs.grpc.protobuf) |
| 16 | + compileOnly(libs.grpc.stub) |
| 17 | + compileOnly(libs.annotationsapi) |
118 | 18 | } |
0 commit comments