summaryrefslogtreecommitdiffstats
path: root/pkgs/tools/security/ghidra/0001-Use-protobuf-gradle-plugin.patch
blob: f88b70781ff71e58d5d49b142f42785efe79931f (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
diff --git a/Ghidra/Debug/Debugger-isf/build.gradle b/Ghidra/Debug/Debugger-isf/build.gradle
index 2db94ed67e..925f394cf0 100644
--- a/Ghidra/Debug/Debugger-isf/build.gradle
+++ b/Ghidra/Debug/Debugger-isf/build.gradle
@@ -18,11 +18,17 @@ apply from: "${rootProject.projectDir}/gradle/javaProject.gradle"
 apply from: "${rootProject.projectDir}/gradle/jacocoProject.gradle"
 apply from: "${rootProject.projectDir}/gradle/javaTestProject.gradle"
 apply from: "${rootProject.projectDir}/gradle/distributableGhidraModule.gradle"
-apply from: "${rootProject.projectDir}/gradle/hasProtobuf.gradle"
 
+apply plugin: 'com.google.protobuf'
 apply plugin: 'eclipse'
 eclipse.project.name = 'Debug Debugger-isf'
 
+buildscript {
+	dependencies {
+		classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
+	}
+}
+
 dependencies {
 	api project(':ProposedUtils')
 }
diff --git a/Ghidra/Debug/Debugger-rmi-trace/build.gradle b/Ghidra/Debug/Debugger-rmi-trace/build.gradle
index 4fa3b9a539..2663aeaeb0 100644
--- a/Ghidra/Debug/Debugger-rmi-trace/build.gradle
+++ b/Ghidra/Debug/Debugger-rmi-trace/build.gradle
@@ -20,12 +20,17 @@ apply from: "${rootProject.projectDir}/gradle/jacocoProject.gradle"
 apply from: "${rootProject.projectDir}/gradle/javaTestProject.gradle"
 apply from: "${rootProject.projectDir}/gradle/distributableGhidraModule.gradle"
 apply from: "${rootProject.projectDir}/gradle/javadoc.gradle"
-apply from: "${rootProject.projectDir}/gradle/hasProtobuf.gradle"
 apply from: "${rootProject.projectDir}/gradle/hasPythonPackage.gradle"
-
+apply plugin: 'com.google.protobuf'
 apply plugin: 'eclipse'
 eclipse.project.name = 'Debug Debugger-rmi-trace'
 
+buildscript {
+	dependencies {
+		classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
+	}
+}
+
 dependencies {
 	api project(':ProposedUtils')
 	api project(':Pty')
@@ -38,13 +43,10 @@ dependencies {
 }
 
 task configureGenerateProtoPy {
-	dependsOn(configurations.protocArtifact)
+	dependsOn(protobuf.generateProtoTasks.all())
 
-	doLast {
-		def exe = configurations.protocArtifact.first()
-		if (!isCurrentWindows()) {
-			exe.setExecutable(true)
-		}
+ 	doLast {
+		def exe = protobuf.tools.protoc.path
 		generateProtoPy.commandLine exe
 		generateProtoPy.args "--python_out=${generateProtoPy.outdir}"
 		generateProtoPy.args "--pyi_out=${generateProtoPy.stubsOutdir}"
diff --git a/build.gradle b/build.gradle
index 159eb7dd7b..ef4add1ad8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -79,6 +79,12 @@ if (flatRepo.isDirectory()) {
 			mavenCentral()
 			flatDir name: "flat", dirs:["$flatRepo"]
 		}
+		buildscript {
+			repositories {
+				mavenLocal()
+				mavenCentral()
+			}
+		}
 	}
 }
 else {	
diff --git a/gradle/hasProtobuf.gradle b/gradle/hasProtobuf.gradle
deleted file mode 100644
index a8c176bcbe..0000000000
--- a/gradle/hasProtobuf.gradle
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ###
- * IP: GHIDRA
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*plugins {
-	id 'com.google.protobuf' version '0.8.10'
-}*/
-
-configurations {
-	allProtocArtifacts
-	protocArtifact
-}
-
-def platform = getCurrentPlatformName()
-
-def version = getProperty('ghidra.protobuf.java.version')
-
-
-dependencies {
-	allProtocArtifacts "com.google.protobuf:protoc:${version}:windows-x86_64@exe"
-	allProtocArtifacts "com.google.protobuf:protoc:${version}:linux-x86_64@exe"
-	allProtocArtifacts "com.google.protobuf:protoc:${version}:linux-aarch_64@exe"
-	allProtocArtifacts "com.google.protobuf:protoc:${version}:osx-x86_64@exe"
-	allProtocArtifacts "com.google.protobuf:protoc:${version}:osx-aarch_64@exe"
-
-	if (isCurrentWindows()) {
-		protocArtifact "com.google.protobuf:protoc:${version}:windows-x86_64@exe"
-	}
-	if (isCurrentLinux()) {
-		if (platform.endsWith("x86_64")) {
-			protocArtifact "com.google.protobuf:protoc:${version}:linux-x86_64@exe"
-		}
-		else {
-			protocArtifact "com.google.protobuf:protoc:${version}:linux-aarch_64@exe"
-		}
-	}
-	if (isCurrentMac()) {
-		if (platform.endsWith("x86_64")) {
-			protocArtifact "com.google.protobuf:protoc:${version}:osx-x86_64@exe"
-		}
-		else {
-			protocArtifact "com.google.protobuf:protoc:${version}:osx-aarch_64@exe"
-		}
-	}
-}
-
-/*protobuf {
-	protoc {
-		artifact = 'com.google.protobuf:protoc:${version}'
-	}
-}*/
-
-task configureGenerateProto {
-	dependsOn(configurations.protocArtifact)
-
-	doLast {
-		def exe = configurations.protocArtifact.first()
-		if (!isCurrentWindows()) {
-			exe.setExecutable(true)
-		}
-		generateProto.commandLine exe, "--java_out=${generateProto.outdir}", "-I${generateProto.srcdir}"
-		generateProto.args generateProto.src
-	}
-}
-
-// Can't use providers.exec, or else we see no output
-task generateProto(type:Exec) {
-	dependsOn(configureGenerateProto)
-	ext.srcdir = file("src/main/proto")
-	ext.src = fileTree(srcdir) {
-		include "**/*.proto"
-	}
-	ext.outdir = file("build/generated/source/proto/main/java")
-	outputs.dir(outdir)
-	inputs.files(src)
-}
-
-tasks.compileJava.dependsOn(tasks.generateProto)
-tasks.eclipse.dependsOn(tasks.generateProto)
-rootProject.tasks.prepDev.dependsOn(tasks.generateProto)
-
-sourceSets {
-	main {
-		java {
-			srcDir tasks.generateProto.outdir
-		}
-	}
-}
-zipSourceSubproject.dependsOn generateProto