mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 01:39:21 +02:00
GP-5901: Support for Gradle 9.0.0
This commit is contained in:
parent
ada4b5c4ae
commit
2180fd2851
4 changed files with 3 additions and 168 deletions
|
@ -24,7 +24,6 @@ apply plugin: 'eclipse'
|
||||||
eclipse.project.name = 'Features BSim'
|
eclipse.project.name = 'Features BSim'
|
||||||
|
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import org.gradle.util.GUtil
|
|
||||||
|
|
||||||
// NOTE: fetchDependencies.gradle must be updated if postgresql version changes
|
// NOTE: fetchDependencies.gradle must be updated if postgresql version changes
|
||||||
def postgresql_distro = "postgresql-15.13.tar.gz"
|
def postgresql_distro = "postgresql-15.13.tar.gz"
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
|
|
||||||
apply from: 'gradle/root/eclipse.gradle'
|
apply from: 'gradle/root/eclipse.gradle'
|
||||||
apply from: "gradle/support/eclipseLauncher.gradle"
|
|
||||||
apply from: "gradle/support/loadApplicationProperties.gradle"
|
apply from: "gradle/support/loadApplicationProperties.gradle"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,164 +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.
|
|
||||||
*/
|
|
||||||
import org.gradle.api.*;
|
|
||||||
import org.gradle.artifacts.*;
|
|
||||||
import org.gradle.process.JavaExecSpec;
|
|
||||||
import org.gradle.api.file.*;
|
|
||||||
import org.gradle.api.tasks.*;
|
|
||||||
import org.gradle.api.internal.file.UnionFileCollection;
|
|
||||||
|
|
||||||
import groovy.xml.MarkupBuilder;
|
|
||||||
|
|
||||||
public class WriteEclipseLauncher extends JavaExec {
|
|
||||||
@OutputFile
|
|
||||||
File dest;
|
|
||||||
|
|
||||||
@Input
|
|
||||||
boolean isRunFave = false;
|
|
||||||
|
|
||||||
@Input
|
|
||||||
boolean isDbgFave = false;
|
|
||||||
|
|
||||||
@Input
|
|
||||||
boolean useEclipseDefaultClasspath = false
|
|
||||||
|
|
||||||
public <E> E one(Collection<E> col) {
|
|
||||||
assert col.size() == 1;
|
|
||||||
return col.iterator().next();
|
|
||||||
}
|
|
||||||
|
|
||||||
void walkFileCollection(UnionFileCollection col, Set gathered) {
|
|
||||||
col.sources.each {
|
|
||||||
walkFileCollection(it, gathered);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void walkFileCollection(ConfigurableFileCollection col, Set gathered) {
|
|
||||||
col.from.each {
|
|
||||||
walkFileCollection(it, gathered);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void walkFileCollection(SourceSetOutput col, Set gathered) {
|
|
||||||
gathered.add(col);
|
|
||||||
}
|
|
||||||
|
|
||||||
void walkFileCollection(Configuration col, Set gathered) {
|
|
||||||
col.allDependencies.each {
|
|
||||||
walkDependency(it, gathered)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void walkDependency(ExternalModuleDependency dep, Set gathered) {
|
|
||||||
gathered.add(dep)
|
|
||||||
}
|
|
||||||
|
|
||||||
void walkDependency(ProjectDependency dep, Set gathered) {
|
|
||||||
gathered.add(dep)
|
|
||||||
Project project = dep.dependencyProject
|
|
||||||
String confName = dep.targetConfiguration ?: 'default'
|
|
||||||
Configuration configuration = project.configurations."$confName"
|
|
||||||
walkFileCollection(configuration, gathered)
|
|
||||||
}
|
|
||||||
|
|
||||||
String makeEntryXml(ExternalModuleDependency dep, FileCollection cp) {
|
|
||||||
def writer = new StringWriter();
|
|
||||||
def xml = new MarkupBuilder(writer);
|
|
||||||
def file = cp.find { it.name.contains(dep.name) }
|
|
||||||
xml.mkp.xmlDeclaration(version: '1.0', encoding: 'UTF-8', standalone: 'no')
|
|
||||||
xml.runtimeClasspathEntry(
|
|
||||||
externalArchive: file,
|
|
||||||
path: 5,
|
|
||||||
// TODO: Figure out source jar
|
|
||||||
type: 2
|
|
||||||
);
|
|
||||||
return writer
|
|
||||||
}
|
|
||||||
|
|
||||||
String makeEntryXml(Project proj) {
|
|
||||||
def writer = new StringWriter();
|
|
||||||
def xml = new MarkupBuilder(writer);
|
|
||||||
xml.mkp.xmlDeclaration(version: '1.0', encoding: 'UTF-8', standalone: 'no')
|
|
||||||
xml.runtimeClasspathEntry(
|
|
||||||
path: 5,
|
|
||||||
projectName: proj.eclipse.project.name,
|
|
||||||
type: 1
|
|
||||||
)
|
|
||||||
return writer
|
|
||||||
}
|
|
||||||
|
|
||||||
String makeEntryXml(ProjectDependency dep, FileCollection cp) {
|
|
||||||
return makeEntryXml(dep.dependencyProject);
|
|
||||||
}
|
|
||||||
|
|
||||||
String makeEntryXml(SourceSetOutput out, FileCollection cp) {
|
|
||||||
Task task = one(out.buildDependencies.getDependencies(null))
|
|
||||||
return makeEntryXml(task.project)
|
|
||||||
}
|
|
||||||
|
|
||||||
public File forName(String name) {
|
|
||||||
return project.file(".launch/${name}.launch")
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> getJvmArgumentsForEclipse() {
|
|
||||||
List<String> all = allJvmArgs;
|
|
||||||
int index = all.indexOf('-cp');
|
|
||||||
if (index == -1) {
|
|
||||||
return all;
|
|
||||||
}
|
|
||||||
all.remove(index);
|
|
||||||
all.remove(index);
|
|
||||||
return all;
|
|
||||||
}
|
|
||||||
|
|
||||||
@TaskAction
|
|
||||||
void exec() { // Override exec. Instead write launcher
|
|
||||||
dest.parentFile.mkdirs();
|
|
||||||
def launcher = new MarkupBuilder(new FileWriter(dest));
|
|
||||||
Set gathered = new LinkedHashSet();
|
|
||||||
if (!useEclipseDefaultClasspath) {
|
|
||||||
walkFileCollection(classpath, gathered);
|
|
||||||
}
|
|
||||||
launcher.mkp.xmlDeclaration(version: '1.0', encoding: 'UTF-8', standalone: 'no')
|
|
||||||
launcher.launchConfiguration(type: 'org.eclipse.jdt.launching.localJavaApplication') {
|
|
||||||
listAttribute(key: 'org.eclipse.debug.ui.favoriteGroups') {
|
|
||||||
if (isRunFave) {
|
|
||||||
listEntry(value: 'org.eclipse.debug.ui.launchGroup.run');
|
|
||||||
}
|
|
||||||
if (isDbgFave) {
|
|
||||||
listEntry(value: 'org.eclipse.debug.ui.launchGroup.debug');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!useEclipseDefaultClasspath) {
|
|
||||||
listAttribute(key: 'org.eclipse.jdt.launching.CLASSPATH') {
|
|
||||||
gathered.each {
|
|
||||||
listEntry(value: makeEntryXml(it, classpath))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
booleanAttribute(key: 'org.eclipse.jdt.launching.DEFAULT_CLASSPATH', value: useEclipseDefaultClasspath);
|
|
||||||
stringAttribute(key: 'org.eclipse.jdt.launching.MAIN_TYPE', value: main);
|
|
||||||
// TODO: Proper escaping of program and JVM arguments.
|
|
||||||
stringAttribute(key: 'org.eclipse.jdt.launching.PROGRAM_ARGUMENTS', value: args.join(' '));
|
|
||||||
stringAttribute(key: 'org.eclipse.jdt.launching.PROJECT_ATTR', value: project.eclipse.project.name);
|
|
||||||
stringAttribute(key: 'org.eclipse.jdt.launching.VM_ARGUMENTS', value: jvmArgumentsForEclipse.join(' '));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
ext.WriteEclipseLauncher = WriteEclipseLauncher
|
|
||||||
}
|
|
|
@ -4,9 +4,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
import java.util.jar.JarFile
|
import java.util.jar.JarFile
|
||||||
import groovy.json.JsonOutput
|
import groovy.json.JsonOutput
|
||||||
|
import groovy.xml.XmlSlurper
|
||||||
|
|
||||||
/******************************************************************************************
|
/******************************************************************************************
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue