1
1
plugins {
2
- id ' org.jetbrains.kotlin.jvm' version' 1.3.61'
3
- id ' com.google.protobuf' version ' 0.8.8'
4
- id ' org.jetbrains.dokka' version ' 0.10.1'
5
-
6
- // Generate IntelliJ IDEA's .idea & .iml project files
7
- // Starting with 0.8.4 of protobuf-gradle-plugin, *.proto and the gen output files are added
8
- // to IntelliJ as sources. It is no longer necessary to add them manually to the idea {} block
9
- // to jump to definitions from Java and Kotlin files.
10
- // For best results, install the Protobuf and Kotlin plugins for IntelliJ.
11
- id ' idea'
12
-
13
- // Provide convenience executables for trying out the examples.
14
- id ' application'
15
- id ' maven-publish'
2
+ id ' org.jetbrains.kotlin.jvm' version' 1.3.61' apply false
16
3
}
17
4
18
- mainClassName = ' io.grpc.kotlin.generator.GeneratorRunner'
19
- applicationName = ' grpc-kotlin'
20
-
21
- repositories {
22
- google()
23
- jcenter()
24
- mavenCentral()
25
- mavenLocal()
5
+ ext {
6
+ grpcVersion = ' 1.28.0' // CURRENT_GRPC_VERSION
7
+ protobufVersion = ' 3.11.0'
8
+ coroutinesVersion = ' 1.3.3'
26
9
}
27
10
28
- // Feel free to delete the comment at the next line. It is just for safely
29
- // updating the version in our release process.
30
- def grpcVersion = ' 1.26.0' // CURRENT_GRPC_VERSION
31
- def coroutinesVersion = ' 1.3.3'
32
- def kotlinVersion = ' 1.3.61'
33
-
34
- dependencies {
35
- // Kotlin
36
- compile " org.jetbrains.kotlinx:kotlinx-coroutines-core:${ coroutinesVersion} "
11
+ subprojects {
12
+ apply plugin : ' org.jetbrains.kotlin.jvm'
37
13
38
- // Grpc and Protobuf
39
- compile ' com.google.protobuf:protobuf-java:3.11.0'
40
- compile " io.grpc:grpc-netty-shaded:${ grpcVersion} "
41
- compile " io.grpc:grpc-protobuf:${ grpcVersion} "
42
- compile " io.grpc:grpc-stub:${ grpcVersion} "
14
+ group = " io.grpc"
15
+ version = " 0.1.0" // CURRENT_GRPC_KOTLIN_VERSION
43
16
44
- // Java
45
- compile " javax.annotation:javax.annotation-api:1.2"
17
+ plugins. withId(" org.jetbrains.dokka" ) {
18
+ dokka {
19
+ outputFormat = ' html'
20
+ outputDirectory = " $buildDir /dokka"
21
+ configuration {
22
+ externalDocumentationLink {
23
+ url = new URL (" http://grpc.github.io/grpc-java/javadoc/" )
24
+ }
25
+ externalDocumentationLink {
26
+ url = new URL (" http://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/" )
27
+ }
28
+ perPackageOption {
29
+ prefix = " io.grpc.testing"
30
+ suppress = true
31
+ }
32
+ perPackageOption {
33
+ prefix = " io.grpc.kotlin.generator"
34
+ suppress = true
35
+ }
36
+ }
37
+ }
38
+ }
46
39
47
- // Misc
48
- compile ' com.squareup:kotlinpoet:1.5.0'
49
- compile " org.jetbrains.kotlin:kotlin-reflect:1.3.61"
50
- compile " com.google.truth:truth:1.0.1"
40
+ plugins. withId(" maven-publish" ) {
41
+ publishing {
42
+ publications {
43
+ maven(MavenPublication ) {
44
+ pom {
45
+ name = project. group + " :" + project. name
46
+ url = ' https://github.com/grpc/grpc-kotlin'
47
+ afterEvaluate {
48
+ // description is not available until evaluated.
49
+ description = project. description
50
+ }
51
+
52
+ scm {
53
+ connection = ' scm:git:https://github.com/grpc/grpc-kotlin.git'
54
+ developerConnection
= ' scm:git:[email protected] :grpc/grpc-kotlin.git'
55
+ url = ' https://github.com/grpc/grpc-kotlin'
56
+ }
57
+
58
+ licenses {
59
+ license {
60
+ name = ' Apache 2.0'
61
+ url = ' https://opensource.org/licenses/Apache-2.0'
62
+ }
63
+ }
64
+
65
+ developers {
66
+ developer {
67
+ id = " grpc.io"
68
+ name = " gRPC Contributors"
69
+
70
+ url = " https://grpc.io/"
71
+ organization = " gRPC Authors"
72
+ organizationUrl = " https://www.google.com"
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
51
79
52
- // Testing
53
- testImplementation " com.google.guava:guava:28.2-jre"
54
- testImplementation " com.google.jimfs:jimfs:1.1"
55
- testImplementation ' com.google.protobuf:protobuf-gradle-plugin:0.8.11'
56
- testImplementation " com.google.truth.extensions:truth-proto-extension:1.0"
57
- testImplementation " com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
58
- testImplementation " io.grpc:grpc-testing:${ grpcVersion} " // gRCP testing utilities
59
- testImplementation " junit:junit:4.12"
60
- testImplementation " org.junit.jupiter:junit-jupiter-engine:5.5.2"
61
- testImplementation ' org.jetbrains.kotlinx:kotlinx-coroutines-debug:1.3.2'
62
- testImplementation " org.jetbrains.kotlin:kotlin-android-extensions:$kotlinVersion "
63
- testImplementation " org.mockito:mockito-core:2.28.2"
64
- }
80
+ plugins. withId(" java" ) {
81
+ task javadocJar(type : Jar ) {
82
+ classifier = ' javadoc'
83
+ from javadoc
84
+ }
65
85
66
- protobuf {
67
- protoc { artifact = ' com.google.protobuf:protoc:3.11.0' }
68
- plugins {
69
- // Specify protoc to generate using kotlin protobuf plugin
70
- grpc {
71
- artifact = ' io.grpc:protoc-gen-grpc-java:1.27.0'
72
- }
73
- // Specify protoc to generate using our grpc kotlin plugin
74
- grpckt {
75
- path = ' build/install/grpc-kotlin/bin/grpc-kotlin'
76
- }
77
- }
78
- generateProtoTasks {
79
- all(). each { task ->
80
- if (task. name. startsWith(' generateTestProto' )) {
81
- task. dependsOn { installDist }
86
+ task sourcesJar(type : Jar ) {
87
+ classifier = ' sources'
88
+ from sourceSets. main. allSource
82
89
}
83
- task. plugins {
84
- // Generate Java gRPC classes
85
- grpc { }
86
- // Generate Kotlin gRPC using the custom plugin from library
87
- grpckt { }
90
+
91
+ // Generate the jar file to be used by our custom plugin
92
+ task protocJar(type : Jar ) {
93
+ classifier " protoc"
94
+ manifest {
95
+ attributes ' Main-Class' : ' io.grpc.kotlin.generator.GeneratorRunner'
96
+ }
97
+ baseName = project. name
98
+ from { configurations. compile. collect { it. isDirectory() ? it : zipTree(it) } }
99
+ with jar
88
100
}
89
- }
90
- }
91
- }
92
101
93
- dokka {
94
- outputFormat = ' html'
95
- outputDirectory = " $buildDir /dokka"
96
- configuration {
97
- externalDocumentationLink {
98
- url = new URL (" http://grpc.github.io/grpc-java/javadoc/" )
99
- }
100
- externalDocumentationLink {
101
- url = new URL (" http://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/" )
102
- }
103
- perPackageOption {
104
- prefix = " io.grpc.testing"
105
- suppress = true
106
- }
107
- perPackageOption {
108
- prefix = " io.grpc.kotlin.generator"
109
- suppress = true
102
+ publishing {
103
+ publications {
104
+ maven {
105
+ from components. java
106
+
107
+ artifact javadocJar
108
+ artifact sourcesJar
109
+
110
+ if (project. name == ' protoc-gen-grpc-kotlin' ) {
111
+ // Generate the artifacts expected by protobuf-gradle-plugin
112
+ artifact protocJar
113
+ artifactForGradlePlugin(it, ' linux' , ' aarch_64' )
114
+ artifactForGradlePlugin(it, ' linux' , ' x86_32' )
115
+ artifactForGradlePlugin(it, ' linux' , ' x86_64' )
116
+ artifactForGradlePlugin(it, ' osx' , ' x86_64' )
117
+ artifactForGradlePlugin(it, ' windows' , ' x86_32' )
118
+ artifactForGradlePlugin(it, ' windows' , ' x86_64' )
119
+ }
120
+ }
121
+ }
122
+ }
110
123
}
111
124
}
112
125
}
@@ -124,88 +137,3 @@ def artifactForGradlePlugin(MavenPublication pub, String os, String arch) {
124
137
}
125
138
}
126
139
}
127
-
128
- // Generate the jar file to be used by our custom plugin
129
- task protocJar (type : Jar ) {
130
- classifier " protoc"
131
- manifest {
132
- attributes ' Main-Class' : mainClassName
133
- }
134
- baseName = ' protoc-gen-grpc-kotlin'
135
- from { configurations. compile. collect { it. isDirectory() ? it : zipTree(it) } }
136
- with jar
137
- }
138
-
139
- task javadocJar (type : Jar ) {
140
- classifier = ' javadoc'
141
- from javadoc
142
- }
143
-
144
- task sourcesJar (type : Jar ) {
145
- classifier = ' sources'
146
- from sourceSets. main. allSource
147
- }
148
-
149
- publishing {
150
- publications {
151
- maven(MavenPublication ) {
152
- pom {
153
- name = ' grpc.io:grpc-kotlin'
154
- url = ' https://github.com/grpc/grpc-kotlin'
155
- afterEvaluate {
156
- // description is not available until evaluated.
157
- description = ' The protoc plugin for gRPC Kotlin'
158
- }
159
-
160
- scm {
161
- connection = ' scm:git:https://github.com/grpc/grpc-kotlin.git'
162
- developerConnection
= ' scm:git:[email protected] :grpc/grpc-kotlin.git'
163
- url = ' https://github.com/grpc/grpc-kotlin'
164
- }
165
-
166
- licenses {
167
- license {
168
- name = ' Apache 2.0'
169
- url = ' https://opensource.org/licenses/Apache-2.0'
170
- }
171
- }
172
-
173
- developers {
174
- developer {
175
- id = " grpc.io"
176
- name = " gRPC Contributors"
177
-
178
- url = " https://grpc.io/"
179
- organization = " gRPC Authors"
180
- organizationUrl = " https://www.google.com"
181
- }
182
- }
183
- }
184
-
185
- groupId = ' io.grpc'
186
- artifactId = ' grpc-kotlin'
187
- version = ' 0.1.0'
188
- from components. java
189
-
190
- // Add a Fat JAR for the protoc plugin
191
- artifact protocJar
192
- artifact javadocJar
193
- artifact sourcesJar
194
-
195
- // Generate the artifacts expected by protobuf-gradle-plugin
196
- artifactForGradlePlugin(it, ' linux' , ' aarch_64' )
197
- artifactForGradlePlugin(it, ' linux' , ' x86_32' )
198
- artifactForGradlePlugin(it, ' linux' , ' x86_64' )
199
- artifactForGradlePlugin(it, ' osx' , ' x86_64' )
200
- artifactForGradlePlugin(it, ' windows' , ' x86_32' )
201
- artifactForGradlePlugin(it, ' windows' , ' x86_64' )
202
- }
203
- }
204
- }
205
-
206
- test {
207
- useJUnitPlatform()
208
- testLogging {
209
- showStandardStreams = true
210
- }
211
- }
0 commit comments