|
1 |
| -apply plugin: 'java' |
2 |
| - |
| 1 | +plugins { |
| 2 | + id 'com.google.protobuf' version '0.9.1' |
| 3 | + id 'java' |
| 4 | +} |
3 | 5 | repositories {
|
4 | 6 | mavenCentral()
|
5 | 7 | }
|
| 8 | +def grpcVersion = "1.53.0" |
| 9 | +def protobufVersion = "3.21.12" |
| 10 | +def protocVersion = protobufVersion |
6 | 11 |
|
7 | 12 | dependencies {
|
| 13 | + implementation "io.grpc:grpc-protobuf:${grpcVersion}" |
| 14 | + implementation "io.grpc:grpc-stub:${grpcVersion}" |
| 15 | + compileOnly "org.apache.tomcat:annotations-api:6.0.53" |
| 16 | + |
| 17 | + implementation "com.google.protobuf:protobuf-java-util:${protobufVersion}" |
| 18 | + |
| 19 | + implementation "io.grpc:grpc-netty-shaded:${grpcVersion}" |
| 20 | + |
| 21 | + testImplementation "io.grpc:grpc-testing:${grpcVersion}" |
| 22 | + |
8 | 23 | compileOnly 'net.portswigger.burp.extender:burp-extender-api:2.3'
|
9 | 24 | implementation 'com.google.code.gson:gson:2.10.1'
|
10 | 25 | }
|
11 | 26 |
|
| 27 | +protobuf { |
| 28 | + protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" } |
| 29 | + plugins { |
| 30 | + grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" } |
| 31 | + } |
| 32 | + generateProtoTasks { |
| 33 | + all()*.plugins { |
| 34 | + grpc {} |
| 35 | + } |
| 36 | + } |
| 37 | +} |
| 38 | + |
12 | 39 | sourceSets {
|
13 | 40 | main {
|
| 41 | + proto { |
| 42 | + srcDir 'burp/dist/proto' |
| 43 | + } |
14 | 44 | java {
|
15 |
| - srcDir '.' |
| 45 | + srcDirs "burp" |
| 46 | + srcDirs 'build/generated/source/proto/main/grpc' |
| 47 | + srcDirs 'build/generated/source/proto/main/java' |
16 | 48 | }
|
17 | 49 | }
|
18 | 50 | }
|
19 | 51 |
|
20 | 52 | task fatJar(type: Jar) {
|
21 |
| - archiveBaseName = project.name + '-all' |
22 |
| - from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } } |
| 53 | + archiveClassifier = "all" |
| 54 | + from { |
| 55 | + configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } |
| 56 | + configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } |
| 57 | + } |
23 | 58 | with jar
|
| 59 | + duplicatesStrategy = DuplicatesStrategy.INCLUDE |
| 60 | +} |
| 61 | +// TODO: How can we do cross compilation here ? |
| 62 | +//task stopTomcat(type: Exec) { |
| 63 | +// workingDir '../tomcat/bin' |
| 64 | +// // on windows: |
| 65 | +// // commandLine 'cmd', '/c', 'stop.bat' |
| 66 | +// // on linux |
| 67 | +// commandLine 'cd', '..', "&&", |
| 68 | +// |
| 69 | +// //store the output instead of printing to the console: |
| 70 | +// standardOutput = new ByteArrayOutputStream() |
| 71 | +// |
| 72 | +// //extension method stopTomcat.output() can be used to obtain the output: |
| 73 | +// ext.output = { |
| 74 | +// return standardOutput.toString() |
| 75 | +// } |
| 76 | +//} |
| 77 | + |
| 78 | +task copyFiles_binaries(type: Copy) { |
| 79 | + from "../rust-common/target/release/" |
| 80 | + include "metlo-agent" |
| 81 | + into 'burp/dist/binaries' |
| 82 | +} |
| 83 | + |
| 84 | +task copyFiles_protos(type: Copy) { |
| 85 | + from "../rust-common/proto/" |
| 86 | + include "metloingest.proto" |
| 87 | + into 'burp/dist/proto' |
24 | 88 | }
|
25 | 89 |
|
| 90 | +processResources { |
| 91 | + from("burp/dist") { |
| 92 | + into "dist" |
| 93 | + } |
| 94 | +} |
| 95 | + |
| 96 | +fatJar.dependsOn(copyFiles_binaries) |
| 97 | +fatJar.dependsOn(copyFiles_protos) |
| 98 | +compileJava.dependsOn(copyFiles_binaries) |
| 99 | +compileJava.dependsOn(copyFiles_protos) |
| 100 | + |
| 101 | +processResources.dependsOn(copyFiles_binaries) |
| 102 | +processResources.dependsOn(copyFiles_protos) |
| 103 | +generateProto.dependsOn(copyFiles_binaries) |
| 104 | +generateProto.dependsOn(copyFiles_protos) |
26 | 105 |
|
27 | 106 | artifacts {
|
28 | 107 | archives fatJar
|
|
0 commit comments