-
Notifications
You must be signed in to change notification settings - Fork 211
/
Copy pathbuild.gradle
117 lines (102 loc) · 3.25 KB
/
build.gradle
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
// Copyright 2019-2024 Google LLC
//
// 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
//
// https://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.
// Builds the BinExport extension for a given Ghidra installation. An absolute
// path to the Ghidra installation directory must be supplied either by setting
// the GHIDRA_INSTALL_DIR environment variable or Gradle project property.
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
apply plugin: 'eclipse'
apply plugin: 'idea'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
buildscript {
repositories {
maven {
url "https://maven-central.storage-download.googleapis.com/maven2/"
}
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.4'
}
}
configurations {
// Configuration that holds jars to include in the jar.
extraLibs
}
dependencies {
extraLibs 'com.google.protobuf:protobuf-java:3.25.1'
configurations.implementation.extendsFrom(configurations.extraLibs)
}
protobuf {
// Configure the protoc executable
protoc {
artifact = 'com.google.protobuf:protoc:3.25.1'
}
// Make generator tasks visible in Eclipse.
generateProtoTasks {
all().each {
it.group = 'generate proto'
}
}
}
// Required for IDEs to find the generated sources.
eclipse {
classpath {
file {
whenMerged {
def source = entries.find {
it.path == 'build/generated/source/proto/main/java' ||
it.path == 'build/extracted-include-protos/main'
}
source.entryAttributes['ignore_optional_problems'] = 'true'
}
}
}
}
// Extend jar task to collect extra dependencies.
jar {
from {
configurations.extraLibs.collect { it.isDirectory() ? it : zipTree(it) }
}
}
// Standard Ghidra extension Gradle code follows.
//----------------------START "DO NOT MODIFY" SECTION------------------------------
def ghidraInstallDir
if (System.env.GHIDRA_INSTALL_DIR) {
ghidraInstallDir = System.env.GHIDRA_INSTALL_DIR
}
else if (project.hasProperty("GHIDRA_INSTALL_DIR")) {
ghidraInstallDir = project.getProperty("GHIDRA_INSTALL_DIR")
}
if (ghidraInstallDir) {
apply from: new File(ghidraInstallDir).getCanonicalPath() + "/support/buildExtension.gradle"
}
else {
throw new GradleException("GHIDRA_INSTALL_DIR is not defined!")
}
//----------------------END "DO NOT MODIFY" SECTION-------------------------------
// Fix for newer Gradle versions that do not allow undeclared dependencies
tasks.named("extractIncludeProto").configure {
dependsOn("copyDependencies")
}
tasks.named("extractIncludeTestProto").configure {
dependsOn("copyDependencies")
}