@@ -9,7 +9,7 @@ repositories {
9
9
}
10
10
11
11
dependencies {
12
- implementation group : ' com.google.protobuf' , name : ' protobuf-java' , version : ' 3.24.3 '
12
+ implementation group : ' com.google.protobuf' , name : ' protobuf-java' , version : ' 4.26.1 '
13
13
implementation group : ' org.apache.commons' , name : ' commons-lang3' , version : ' 3.13.0'
14
14
15
15
implementation group : ' io.netty' , name : ' netty-handler' , version : ' 4.1.100.Final'
@@ -31,8 +31,29 @@ dependencies {
31
31
testImplementation group : ' org.mockito' , name : ' mockito-junit-jupiter' , version : ' 3.12.4'
32
32
}
33
33
34
+ ext {
35
+ checkProtocVersion = { String output ->
36
+ // Line in format like: libprotoc 26.1
37
+ int majorVersion = Integer . parseInt(output. split(" " )[1 ]. split(" \\ ." )[0 ]. trim());
38
+ int minorVersion = Integer . parseInt(output. split(" " )[1 ]. split(" \\ ." )[1 ]. trim());
39
+ if (majorVersion < 26 || (majorVersion == 26 && minorVersion < 1 )) {
40
+ throw new GradleException (" Use Protoc version 26.1 or later" );
41
+ }
42
+ return output. split(" " )[1 ]
43
+ }
44
+ }
45
+
34
46
tasks. register(' protobuf' , Exec ) {
35
47
doFirst {
48
+ new ByteArrayOutputStream (). withStream { os ->
49
+ exec {
50
+ commandLine ' protoc' , ' --version'
51
+ workingDir Paths . get(project. rootDir. path, ' ..' ). toFile()
52
+ standardOutput = os
53
+ }
54
+ checkProtocVersion(os. toString())
55
+ }
56
+
36
57
project. mkdir(Paths . get(project. projectDir. path, ' src/main/java/glide/models/protobuf' ). toString())
37
58
}
38
59
commandLine ' protoc' ,
@@ -127,3 +148,7 @@ tasks.withType(Test) {
127
148
}
128
149
jvmArgs " -Djava.library.path=${ projectDir} /../target/debug"
129
150
}
151
+
152
+ jar {
153
+ archiveBaseName = " glide-client"
154
+ }
0 commit comments