From ffb6777d58f068db7e14372415154cd93f77766e Mon Sep 17 00:00:00 2001 From: roblabla Date: Wed, 31 Jan 2024 13:19:55 +0100 Subject: [PATCH] Use com.google.protobuf:protobuf-gradle-plugin --- Ghidra/Debug/Debugger-gadp/build.gradle | 7 +- Ghidra/Debug/Debugger-isf/build.gradle | 8 +- Ghidra/Debug/Debugger-rmi-trace/build.gradle | 14 +-- build.gradle | 6 ++ gradle/debugger/hasProtobuf.gradle | 94 -------------------- 5 files changed, 26 insertions(+), 103 deletions(-) diff --git a/Ghidra/Debug/Debugger-gadp/build.gradle b/Ghidra/Debug/Debugger-gadp/build.gradle index 9e1c57faf..3a3242eb5 100644 --- a/Ghidra/Debug/Debugger-gadp/build.gradle +++ b/Ghidra/Debug/Debugger-gadp/build.gradle @@ -18,11 +18,16 @@ 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/debugger/hasProtobuf.gradle" +apply plugin: 'com.google.protobuf' apply plugin: 'eclipse' eclipse.project.name = 'Debug Debugger-gadp' +buildscript { + dependencies { + classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18' + } +} dependencies { api project(':Framework-AsyncComm') api project(':Framework-Debugging') diff --git a/Ghidra/Debug/Debugger-isf/build.gradle b/Ghidra/Debug/Debugger-isf/build.gradle index d135294a0..785681ca2 100644 --- a/Ghidra/Debug/Debugger-isf/build.gradle +++ b/Ghidra/Debug/Debugger-isf/build.gradle @@ -18,11 +18,15 @@ 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/debugger/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(':Framework-AsyncComm') api project(':Framework-Debugging') diff --git a/Ghidra/Debug/Debugger-rmi-trace/build.gradle b/Ghidra/Debug/Debugger-rmi-trace/build.gradle index 40fbc17ab..7517ffe6e 100644 --- a/Ghidra/Debug/Debugger-rmi-trace/build.gradle +++ b/Ghidra/Debug/Debugger-rmi-trace/build.gradle @@ -18,12 +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/debugger/hasProtobuf.gradle" +apply plugin: 'com.google.protobuf' apply from: "${rootProject.projectDir}/gradle/debugger/hasPythonPackage.gradle" 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(':Pty') api project(':Debugger') @@ -44,12 +49,9 @@ task generateProtoPy { ext.outdir = file("build/generated/source/proto/main/py") outputs.dir(outdir) inputs.files(src) - dependsOn(configurations.protocArtifact) + dependsOn(protobuf.generateProtoTasks.all()) doLast { - def exe = configurations.protocArtifact.first() - if (!isCurrentWindows()) { - exe.setExecutable(true) - } + def exe = protobuf.tools.protoc.path exec { commandLine exe, "--python_out=$outdir", "-I$srcdir" args src diff --git a/build.gradle b/build.gradle index b0c717fb1..5f56506a5 100644 --- a/build.gradle +++ b/build.gradle @@ -74,6 +74,12 @@ if (flatRepo.isDirectory()) { jcenter() flatDir name: "flat", dirs:["$flatRepo"] } + buildscript { + repositories { + mavenLocal() + mavenCentral() + } + } } } else { diff --git a/gradle/debugger/hasProtobuf.gradle b/gradle/debugger/hasProtobuf.gradle index 23b4ce74b..e69de29bb 100644 --- a/gradle/debugger/hasProtobuf.gradle +++ b/gradle/debugger/hasProtobuf.gradle @@ -1,94 +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() - - -dependencies { - allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:windows-x86_64@exe' - allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:linux-x86_64@exe' - allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:linux-aarch_64@exe' - allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:osx-x86_64@exe' - allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:osx-aarch_64@exe' - - if (isCurrentWindows()) { - protocArtifact 'com.google.protobuf:protoc:3.21.8:windows-x86_64@exe' - } - if (isCurrentLinux()) { - if (platform.endsWith("x86_64")) { - protocArtifact 'com.google.protobuf:protoc:3.21.8:linux-x86_64@exe' - } - else { - protocArtifact 'com.google.protobuf:protoc:3.21.8:linux-aarch_64@exe' - } - } - if (isCurrentMac()) { - if (platform.endsWith("x86_64")) { - protocArtifact 'com.google.protobuf:protoc:3.21.8:osx-x86_64@exe' - } - else { - protocArtifact 'com.google.protobuf:protoc:3.21.8:osx-aarch_64@exe' - } - } -} - -/*protobuf { - protoc { - artifact = 'com.google.protobuf:protoc:3.21.8' - } -}*/ - -task generateProto { - 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) - dependsOn(configurations.protocArtifact) - doLast { - def exe = configurations.protocArtifact.first() - if (!isCurrentWindows()) { - exe.setExecutable(true) - } - exec { - commandLine exe, "--java_out=$outdir", "-I$srcdir" - args 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 -- 2.42.0