diff --git a/GPL/DemanglerGnu/build.gradle b/GPL/DemanglerGnu/build.gradle index 7a56684947..4b079cce79 100644 --- a/GPL/DemanglerGnu/build.gradle +++ b/GPL/DemanglerGnu/build.gradle @@ -35,8 +35,8 @@ def srcVersion24 = "src/demangler_gnu_v2_24" */ task zipBuildableSource(type:Zip) { - group 'private' - description "Collects the source files needed to build this module." + group = 'private' + description = "Collects the source files needed to build this module." archiveBaseName = project.name + "-src-for-build" archiveExtension = 'zip' diff --git a/GPL/GnuDisassembler/buildGdis.gradle b/GPL/GnuDisassembler/buildGdis.gradle index 5ae37406b4..a3e601ee81 100644 --- a/GPL/GnuDisassembler/buildGdis.gradle +++ b/GPL/GnuDisassembler/buildGdis.gradle @@ -76,8 +76,8 @@ gradle.taskGraph.whenReady { * Task to unpack the standard binutils zip file *******************************************************************************************/ task binutilsUnpack { - description "Unpack binutils (for building gdis)" - group "Native Build Dependencies" + description = "Unpack binutils (for building gdis)" + group = "Native Build Dependencies" outputs.file { binutilsUnpackDir } onlyIf { !binutilsUnpackDir.exists() } @@ -104,8 +104,8 @@ supportedPlatforms.each { platform -> def artifactsDir = file("build/binutils/${platform}") task(buildName) { - description "Configure and make binutils for $platform (for building gdis)" - group "Native Prebuild Dependencies" + description ="Configure and make binutils for $platform (for building gdis)" + group = "Native Prebuild Dependencies" onlyIf { !configDir.exists() } @@ -122,21 +122,21 @@ supportedPlatforms.each { platform -> println "Configuring binutils - config directory: $configDir" println "${binutilsDir}/configure --prefix=\"${configDir}\" --enable-targets=all --with-zlib=no --disable-nls --disable-werror" configDir.mkdirs(); - exec { + providers.exec { workingDir configDir commandLine "${binutilsDir}/configure", "--prefix=${configDir}", "--enable-targets=all", "--with-zlib=no", "--disable-nls", "--disable-werror" - } + }.result.get() println "Building binutils - config directory: $configDir" - exec { + providers.exec { commandLine "make", "-C", "${configDir}", "all" - } + }.result.get() } } task(postBuildName, type: Copy) { - description "Copy binutil artifcacts for $platform (for building gdis)" - group "Native Prebuild Dependencies" + description = "Copy binutil artifcacts for $platform (for building gdis)" + group = "Native Prebuild Dependencies" dependsOn buildName diff --git a/GPL/nativeBuildProperties.gradle b/GPL/nativeBuildProperties.gradle index a4cb4cb77b..24464f6cd5 100644 --- a/GPL/nativeBuildProperties.gradle +++ b/GPL/nativeBuildProperties.gradle @@ -66,7 +66,7 @@ model { // specify installDir because Gradle doesn't find VS Build Tools. // See https://github.com/gradle/gradle-native/issues/617#issuecomment-575735288 visualCpp(VisualCpp) { - installDir VISUAL_STUDIO_INSTALL_DIR + installDir = VISUAL_STUDIO_INSTALL_DIR } } } diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/build.gradle b/Ghidra/Debug/Debugger-agent-dbgeng/build.gradle index dc540b1026..8387e35ad7 100644 --- a/Ghidra/Debug/Debugger-agent-dbgeng/build.gradle +++ b/Ghidra/Debug/Debugger-agent-dbgeng/build.gradle @@ -19,7 +19,6 @@ apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" apply from: "$rootProject.projectDir/gradle/nativeProject.gradle" apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/hasPythonPackage.gradle" -apply from: "$rootProject.projectDir/gradle/debugger/hasNodepJar.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Debug Debugger-agent-dbgeng' diff --git a/Ghidra/Debug/Debugger-agent-gdb/build.gradle b/Ghidra/Debug/Debugger-agent-gdb/build.gradle index 79d29ae2ef..d99e067a0c 100644 --- a/Ghidra/Debug/Debugger-agent-gdb/build.gradle +++ b/Ghidra/Debug/Debugger-agent-gdb/build.gradle @@ -19,7 +19,6 @@ apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" apply from: "$rootProject.projectDir/gradle/nativeProject.gradle" apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/hasPythonPackage.gradle" -apply from: "$rootProject.projectDir/gradle/debugger/hasExecutableJar.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Debug Debugger-agent-gdb' diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/main/sh/execjar.sh b/Ghidra/Debug/Debugger-agent-gdb/src/main/sh/execjar.sh deleted file mode 100644 index 26738bd11d..0000000000 --- a/Ghidra/Debug/Debugger-agent-gdb/src/main/sh/execjar.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/bash -## ### -# 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. -## -# This clever bit can be prepended to a JAR to make it self-executable - -set -e - -java -jar "$0" ${@:1} -exit diff --git a/Ghidra/Debug/Debugger-agent-lldb/build.gradle b/Ghidra/Debug/Debugger-agent-lldb/build.gradle index e8884c1a7d..b49387b2b1 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/build.gradle +++ b/Ghidra/Debug/Debugger-agent-lldb/build.gradle @@ -19,7 +19,6 @@ apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" apply from: "$rootProject.projectDir/gradle/nativeProject.gradle" apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/hasPythonPackage.gradle" -apply from: "$rootProject.projectDir/gradle/debugger/hasExecutableJar.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Debug Debugger-agent-lldb' diff --git a/Ghidra/Debug/Debugger-rmi-trace/build.gradle b/Ghidra/Debug/Debugger-rmi-trace/build.gradle index 8b6589f035..16b55b66af 100644 --- a/Ghidra/Debug/Debugger-rmi-trace/build.gradle +++ b/Ghidra/Debug/Debugger-rmi-trace/build.gradle @@ -50,10 +50,10 @@ task generateProtoPy { if (!isCurrentWindows()) { exe.setExecutable(true) } - exec { + providers.exec { commandLine exe, "--python_out=$outdir", "-I$srcdir" args src - } + }.result.get() } } diff --git a/Ghidra/Extensions/BSimElasticPlugin/build.gradle b/Ghidra/Extensions/BSimElasticPlugin/build.gradle index 9e8166ca32..b0ee3f42a9 100755 --- a/Ghidra/Extensions/BSimElasticPlugin/build.gradle +++ b/Ghidra/Extensions/BSimElasticPlugin/build.gradle @@ -89,7 +89,7 @@ task elasticPluginJar(type: Jar) { task elasticPluginZip(type: Zip) { from 'build/ziplayout' archiveBaseName = 'lsh' - destinationDirectory = file("build/data") + destinationDirectory = file("build/data") } // Currently targeting elasticsearch-8.8.1 which by default runs with java 20 diff --git a/Ghidra/Extensions/bundle_examples/build.gradle b/Ghidra/Extensions/bundle_examples/build.gradle index 1bf09d2822..eb0b31dc45 100644 --- a/Ghidra/Extensions/bundle_examples/build.gradle +++ b/Ghidra/Extensions/bundle_examples/build.gradle @@ -4,9 +4,9 @@ * 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. @@ -112,7 +112,7 @@ task zipExtensions(type: Zip, dependsOn:jarTasks) { archiveFileName = "${rootProject.ext.ZIP_NAME_PREFIX}_${p.name}.zip" destinationDirectory = rootProject.ext.DISTRIBUTION_DIR - duplicatesStrategy 'exclude' + duplicatesStrategy = 'exclude' from '.' diff --git a/Ghidra/Features/BSim/build.gradle b/Ghidra/Features/BSim/build.gradle index 93c6c8b4d1..a33346aab3 100755 --- a/Ghidra/Features/BSim/build.gradle +++ b/Ghidra/Features/BSim/build.gradle @@ -107,7 +107,7 @@ task buildBSimHelpPdf(type: Exec) { """ // Allows doLast block regardless of exit value. - ignoreExitValue true + ignoreExitValue = true // Store the output instead of printing to the console. standardOutput = new ByteArrayOutputStream() @@ -168,7 +168,7 @@ task buildBSimHelpHtml(type: Exec) { """ // Allows doLast block regardless of exit value. - ignoreExitValue true + ignoreExitValue = true // Store the output instead of printing to the console. standardOutput = new ByteArrayOutputStream() diff --git a/Ghidra/Features/Base/build.gradle b/Ghidra/Features/Base/build.gradle index 57fa777292..43d646d8cd 100644 --- a/Ghidra/Features/Base/build.gradle +++ b/Ghidra/Features/Base/build.gradle @@ -76,8 +76,8 @@ sourceSets { } task buildCParser(type: JavaExec) { - group 'private' - description " Compiles the JavaCC files for the C parser\n" + group = 'private' + description = " Compiles the JavaCC files for the C parser\n" def inputFile = "C.jj" def packagePath = 'ghidra/app/util/cparser/C' @@ -96,8 +96,8 @@ task buildCParser(type: JavaExec) { } task buildCPPParser(type: JavaExec) { - group 'private' - description " Compiles the JavaCC files for the CPP parser\n" + group = 'private' + description = " Compiles the JavaCC files for the CPP parser\n" def inputFile = "CPP.jj" def packagePath = 'ghidra/app/util/cparser/CPP' @@ -119,15 +119,15 @@ task buildCPPParser(type: JavaExec) { // A public task to tie together private sub-tasks task buildJavacc { dependsOn buildCParser, buildCPPParser - group rootProject.GHIDRA_GROUP - description " Compiles the JavaCC files\n" + group = rootProject.GHIDRA_GROUP + description = " Compiles the JavaCC files\n" } // Note: this must happen before the standard buildHelp for Base tasks.register('generateExtraHelpFiles') { group = 'private' - description " Creates any extra help files for Base not covered by the standard build help system" + description = " Creates any extra help files for Base not covered by the standard build help system" def rawTipsFile = file('src/main/resources/ghidra/app/plugin/core/totd/tips.txt') inputs.file(rawTipsFile) diff --git a/Ghidra/Features/Decompiler/build.gradle b/Ghidra/Features/Decompiler/build.gradle index db7ca6b223..9c5671fa5b 100644 --- a/Ghidra/Features/Decompiler/build.gradle +++ b/Ghidra/Features/Decompiler/build.gradle @@ -4,9 +4,9 @@ * 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. @@ -140,7 +140,7 @@ task buildDecompilerHelpHtml(type: Exec) { """ // Allows doLast block regardless of exit value. - ignoreExitValue true + ignoreExitValue = true // Store the output instead of printing to the console. standardOutput = new ByteArrayOutputStream() @@ -213,7 +213,7 @@ task buildDecompilerHelpPdf(type: Exec) { """ // Allows doLast block regardless of exit value. Task does not fail if bash command fails. - ignoreExitValue true + ignoreExitValue = true // Store the output instead of printing to the console. standardOutput = new ByteArrayOutputStream() @@ -283,7 +283,7 @@ task buildDecompilerDocumentationPdfs(type: Exec) { """ // Allows doLast block regardless of exit value. Task does not fail if bash command fails. - ignoreExitValue true + ignoreExitValue = true // Store the output instead of printing to the console. standardOutput = new ByteArrayOutputStream() @@ -357,7 +357,7 @@ task buildDecompilerDocumentationHtml(type: Exec) { """ // Allows doLast block regardless of exit value. - ignoreExitValue true + ignoreExitValue = true // Store the output instead of printing to the console. standardOutput = new ByteArrayOutputStream() diff --git a/Ghidra/Features/Decompiler/src/decompile/build.gradle b/Ghidra/Features/Decompiler/src/decompile/build.gradle index 7ed460d20c..0fe6e0f031 100644 --- a/Ghidra/Features/Decompiler/src/decompile/build.gradle +++ b/Ghidra/Features/Decompiler/src/decompile/build.gradle @@ -4,9 +4,9 @@ * 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. @@ -15,7 +15,7 @@ */ apply plugin: 'eclipse' eclipse.project { - name '_Decompiler' + name = '_Decompiler' buildCommand 'org.eclipse.cdt.managedbuilder.core.genmakebuilder' buildCommand 'org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder' natures 'org.eclipse.cdt.core.cnature' diff --git a/Ghidra/Features/FunctionID/build.gradle b/Ghidra/Features/FunctionID/build.gradle index 73471b1c3d..51c575ded4 100644 --- a/Ghidra/Features/FunctionID/build.gradle +++ b/Ghidra/Features/FunctionID/build.gradle @@ -4,9 +4,9 @@ * 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. @@ -38,12 +38,13 @@ def fidDbFiles = fileTree(depsDir.exists() ? depsDir : binRepoDir) { } task unpackFidDatabases { + def p = project.file('build/data') doLast { fidDbFiles.each { file -> // TODO: Preserve subdir path def destName = file.name.replaceAll(/\.fidb$/, ".fidbf") - def destFile = new File(project.file('build/data'), destName) + def destFile = new File(p, destName) if (!destFile.exists() || destFile.length() == 0 || destFile.lastModified() < file.lastModified()) { logger.info("FIDB: ${file} -> ${destFile}"); @@ -102,7 +103,7 @@ task buildFidHelpPdf(type: Exec) { """ // Allows doLast block regardless of exit value. - ignoreExitValue true + ignoreExitValue = true // Store the output instead of printing to the console. standardOutput = new ByteArrayOutputStream() @@ -167,7 +168,7 @@ task buildFidHelpHtml(type: Exec) { """ // Allows doLast block regardless of exit value. - ignoreExitValue true + ignoreExitValue = true // Store the output instead of printing to the console. standardOutput = new ByteArrayOutputStream() diff --git a/Ghidra/Features/GhidraServer/build.gradle b/Ghidra/Features/GhidraServer/build.gradle index abfa67a369..eef2f6ad4b 100644 --- a/Ghidra/Features/GhidraServer/build.gradle +++ b/Ghidra/Features/GhidraServer/build.gradle @@ -54,11 +54,11 @@ CopySpec yajswCopySpec = copySpec { } // Unpack YAJSW archive into build/data for development use task yajswDevUnpack(type:Copy) { - description "Unpack YAJSW archive for development use" - group "Development Preparation" + description = "Unpack YAJSW archive for development use" + group = "Development Preparation" with yajswCopySpec - destinationDir file("build/data") + destinationDir = file("build/data") } /********************************************************************************* * CLASSPATH FRAGMENT FILE: Production @@ -76,7 +76,7 @@ task yajswDevUnpack(type:Copy) { * 3. Put the path in the output file. *********************************************************************************/ task generateGhidraServerClasspath { - description "Generate a configuration fragment for the Ghidra Server's classpath (release)" + description = "Generate a configuration fragment for the Ghidra Server's classpath (release)" File outfile = file("${buildDir}/classpath.frag") outputs.file outfile @@ -84,6 +84,8 @@ task generateGhidraServerClasspath { // Force the task to be executed every time by setting to false. outputs.upToDateWhen { false } + def p = project + doLast { outfile.parentFile.mkdirs() outfile.withPrintWriter { out -> @@ -91,8 +93,8 @@ task generateGhidraServerClasspath { configurations.runGhidraServer.each { jarFile -> File distPath = file("/") String resPath - for (Configuration conf : project.getConfigurations()) { - resPath = findJarInDistribution(project, conf, jarFile) + for (Configuration conf : p.getConfigurations()) { + resPath = findJarInDistribution(p, conf, jarFile) if (resPath != null) { out.println("wrapper.java.classpath.${++idx}=\${ghidra_home}/${resPath}") break @@ -136,7 +138,7 @@ rootProject.assembleDistribution { * *********************************************************************************/ task generateDevGhidraServerClasspath { - description "Generate a configuration fragment for the Ghidra Server's classpath (development)" + description = "Generate a configuration fragment for the Ghidra Server's classpath (development)" File outfile = file("${buildDir}/dev-meta/classpath.frag") outputs.file outfile @@ -260,8 +262,7 @@ def String searchFilesForJar (proj, conf, jar) { String resolution = null if (conf.isCanBeResolved()) { - ResolvedConfiguration rc = conf.getResolvedConfiguration() - rc.getFiles().each { f -> + conf.getFiles().each { f -> if (jar.equals(f)) { resolution = rootProject.relativePath(proj.projectDir) + "/lib/" + f.name } @@ -287,7 +288,9 @@ def String searchDependenciesForJar (proj, conf, jarFile) { Set projectDependencies = conf.getAllDependencies().withType(ProjectDependency) for (ProjectDependency dependency : projectDependencies) { - Project dependencyProject = dependency.getDependencyProject() + Project dependencyProject = dependency.metaClass.respondsTo(dependency, "getPath") + ? proj.project(dependency.path) + : dependency.getDependencyProject() // Remove this case after upgrading to 8.11 or later Configuration depProjectConf = dependencyProject.getConfigurations().getByName(conf.getName()) relPath = findJarInDistribution(dependencyProject, depProjectConf, jarFile); if (relPath != null) { diff --git a/Ghidra/Features/Jython/build.gradle b/Ghidra/Features/Jython/build.gradle index c4aa01b1d2..6ec5fa7c01 100644 --- a/Ghidra/Features/Jython/build.gradle +++ b/Ghidra/Features/Jython/build.gradle @@ -38,7 +38,7 @@ dependencies { } task jythonUnpack(type: Copy) { - description "Unpack Jython Lib" + description = "Unpack Jython Lib" // Without this, the copyTask will unzip the file to check for "up to date" onlyIf { @@ -48,15 +48,15 @@ task jythonUnpack(type: Copy) { from zipTree(configurations.jython.singleFile) include "Lib/**" - destinationDir file("build/data/${JYTHON_DIR}") + destinationDir = file("build/data/${JYTHON_DIR}") } task jythonSrcCopy(type: Copy) { - description "Copy jython-src directory (for Feature Jython)" + description = "Copy jython-src directory (for Feature Jython)" from(file("jython-src")) - destinationDir file("build/data/jython-src") + destinationDir = file("build/data/jython-src") } // Ensure that Jython is usable in development xx diff --git a/Ghidra/RuntimeScripts/Common/support/buildExtension.gradle b/Ghidra/RuntimeScripts/Common/support/buildExtension.gradle index 72b2368916..1ed35d1aa2 100644 --- a/Ghidra/RuntimeScripts/Common/support/buildExtension.gradle +++ b/Ghidra/RuntimeScripts/Common/support/buildExtension.gradle @@ -43,7 +43,7 @@ file(ghidraDir + "/application.properties").withReader { reader -> checkGradleVersion() task copyDependencies(type: Copy) { - group "Ghidra Private" + group = "Ghidra Private" from configurations.runtimeClasspath into "lib" exclude { fileTreeElement -> @@ -77,7 +77,7 @@ def DISTRIBUTION_DIR = file("dist") def pathInZip = "${project.name}" task zipSource (type: Zip) { - group "Ghidra Private" + group = "Ghidra Private" // Define some metadata about the zip (name, location, version, etc....) it.archiveBaseName = project.name + "-src" @@ -91,7 +91,7 @@ task zipSource (type: Zip) { } task buildExtension (type: Zip) { - group "Ghidra Private" + group = "Ghidra Private" archiveBaseName = "${ZIP_NAME_PREFIX}_${project.name}" archiveExtension = 'zip' @@ -100,7 +100,7 @@ task buildExtension (type: Zip) { // Make sure that we don't try to copy the same file with the same path into the // zip (this can happen!) - duplicatesStrategy 'exclude' + duplicatesStrategy = 'exclude' // This filtered property file copy must appear before the general // copy to ensure that it is prefered over the unmodified file @@ -302,7 +302,7 @@ def hasJarHelp(File file) { } tasks.register('cleanHelp') { - group "Ghidra Private" + group = "Ghidra Private" File helpOutput = file('build/help/main/help') doFirst { @@ -312,7 +312,7 @@ tasks.register('cleanHelp') { // Task for calling the java help indexer, which creates a searchable index of the help contents tasks.register('indexHelp', JavaExec) { - group "Ghidra Private" + group = "Ghidra Private" File helpRootDir = file('src/main/help/help') File outputFile = file("build/help/main/help/${project.name}_JavaHelpSearch") @@ -362,7 +362,7 @@ tasks.register('indexHelp', JavaExec) { // - the files generated will be placed in a diretory usable during development mode and will // eventually be placed in the .jar file tasks.register('buildHelp', JavaExec) { - group "Ghidra Private" + group = "Ghidra Private" dependsOn 'indexHelp' @@ -436,7 +436,7 @@ tasks.register('buildHelp', JavaExec) { // include the help into the module's jar jar { - duplicatesStrategy 'exclude' + duplicatesStrategy = 'exclude' from "build/help/main" // include the generated help index files from "src/main/help" // include the help source files archiveVersion = "" diff --git a/Ghidra/Test/DebuggerIntegrationTest/build.gradle b/Ghidra/Test/DebuggerIntegrationTest/build.gradle index 8858c9450e..f2f2b24c5d 100644 --- a/Ghidra/Test/DebuggerIntegrationTest/build.gradle +++ b/Ghidra/Test/DebuggerIntegrationTest/build.gradle @@ -104,10 +104,10 @@ task testSpecimenLinux_x86_64 { dependsOn 'expTraceableSleepExecutable'//Linux_x86_64Executable' doLast { - exec { + providers.exec { workingDir "build/os/linux_x86_64" commandLine "strip", "-o", "expSpin.stripped", "expSpin" - } + }.result.get() } } diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build.gradle b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build.gradle index 9b4e22453e..960fa77d3c 100644 --- a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build.gradle +++ b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build.gradle @@ -59,20 +59,24 @@ compileJava.enabled = false jar.enabled = false task utilityJar(type:Copy) { - destinationDir file("build/data") + destinationDir = file("build/data") - from { project(':Utility').jar } // using closure to delay until all projects evaluated + def utilityProject = project(':Utility') + + from { utilityProject.jar } // using closure to delay until all projects evaluated } task launchSupportJar(type:Copy) { - destinationDir file("build/data") + destinationDir = file("build/data") - from { project(':LaunchSupport').jar } // using closure to delay until all projects evaluated + def launchSupportProject = project(':LaunchSupport') + + from { launchSupportProject.jar } // using closure to delay until all projects evaluated } task pyDevUnpack(type:Copy) { - description "Unpack PyDev plugin archive for development use" - group "Development Preparation" + description = "Unpack PyDev plugin archive for development use" + group = "Development Preparation" File pyDevDestDir = file("build/data/buildDependencies/pydev") @@ -90,12 +94,12 @@ task pyDevUnpack(type:Copy) { from pyDevZipTree exclude "**/.project", "**/.pydevproject" - destinationDir pyDevDestDir + destinationDir = pyDevDestDir } task cdtUnpack(type:Copy) { - description "Unpack CDT plugin archive for development use" - group "Development Preparation" + description = "Unpack CDT plugin archive for development use" + group = "Development Preparation" File cdtDestDir = file("build/data/buildDependencies/cdt") @@ -112,7 +116,7 @@ task cdtUnpack(type:Copy) { from cdtZipTree - destinationDir cdtDestDir + destinationDir = cdtDestDir } task prepGhidraDev { diff --git a/GhidraBuild/Skeleton/buildTemplate.gradle b/GhidraBuild/Skeleton/buildTemplate.gradle index 63365e84f3..a3a305cb99 100644 --- a/GhidraBuild/Skeleton/buildTemplate.gradle +++ b/GhidraBuild/Skeleton/buildTemplate.gradle @@ -43,7 +43,7 @@ else { } task distributeExtension { - group "Ghidra" + group = "Ghidra" apply from: new File(ghidraInstallDir).getCanonicalPath() + "/support/buildExtension.gradle" dependsOn ':buildExtension' diff --git a/build.gradle b/build.gradle index 65d028f0c4..a2323707c3 100644 --- a/build.gradle +++ b/build.gradle @@ -160,14 +160,10 @@ def checkGradleVersion() { *********************************************************************************/ def checkPythonVersion(List pyCmd) { try { - def stdout = new ByteArrayOutputStream() - exec { + return providers.exec { commandLine pyCmd args "-c", "import sys; print('{0}.{1}'.format(*sys.version_info))" - standardOutput = stdout - errorOutput = OutputStream.nullOutputStream() - } - return "$stdout".strip() + }.standardOutput.asText.get().strip() } catch (Exception e) { return "ABSENT" @@ -176,14 +172,10 @@ def checkPythonVersion(List pyCmd) { def getPythonExecutable(List pyCmd) { try { - def stdout = new ByteArrayOutputStream() - exec { + return providers.exec { commandLine pyCmd args "-c", "import sys; print(sys.executable)" - standardOutput = stdout - errorOutput = OutputStream.nullOutputStream() - } - return "$stdout".strip() + }.standardOutput.asText.get().strip() } catch (Exception e) { return "ABSENT" @@ -192,14 +184,10 @@ def getPythonExecutable(List pyCmd) { def checkPip(List pyCmd, boolean shouldPrint) { try { - def stdout = new ByteArrayOutputStream() - exec { + def version = providers.exec { commandLine pyCmd args "-c", "import pip; print(pip.__version__)" - standardOutput = stdout - errorOutput = OutputStream.nullOutputStream() - } - def version = "$stdout".strip(); + }.standardOutput.asText.get().strip() if (shouldPrint) { if (version.length() == 0) { println("Warning: Python3 pip not installed (required for build)") diff --git a/gradle/debugger/hasExecutableJar.gradle b/gradle/debugger/hasExecutableJar.gradle deleted file mode 100644 index 6252610960..0000000000 --- a/gradle/debugger/hasExecutableJar.gradle +++ /dev/null @@ -1,41 +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. - */ -apply from: "$rootProject.projectDir/gradle/debugger/hasNodepJar.gradle" - - -task executableJar { - ext.execsh = file("src/main/sh/execjar.sh") - ext.jarfile = nodepJar.archiveFile - ext.outjar = file("${buildDir}/bin/run") - dependsOn(nodepJar) - inputs.file { execsh } - inputs.file { jarfile } - outputs.file { outjar } - doLast { - outjar.parentFile.mkdirs() - outjar.withOutputStream { output -> - execsh.withInputStream { input -> - output << input - } - jarfile.withInputStream { input -> - output << input - } - } - exec { - commandLine("chmod", "+x", outjar) - } - } -} diff --git a/gradle/debugger/hasNodepJar.gradle b/gradle/debugger/hasNodepJar.gradle deleted file mode 100644 index 4824f2f189..0000000000 --- a/gradle/debugger/hasNodepJar.gradle +++ /dev/null @@ -1,61 +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. - */ -def boolean filterJar(File jarfile) { - if (jarfile.name.contains("gradle-api")) { - return false - } else if (jarfile.name.contains("groovy-all")) { - return false - } else if (jarfile.name.contains("gradle-installation-beacon")) { - return false - } - return true -} - -task configureNodepJar { - dependsOn(configurations.runtimeClasspath) - doLast { - configurations.runtimeClasspath.files.forEach { jar -> - if (filterJar(jar)) { - nodepJar.from(zipTree(jar)) { - // The real solution here is probably to sort out the dependency graph - // Still, I imagine some of the excludes will be necessary - exclude "help/**" - exclude "images/**" - exclude "OSGI-OPT/**" - exclude "org/osgi/**" - exclude "aQute/**" - // Duplicate. And signature breaks nodep jar - exclude "META-INF/*.SF" - exclude "META-INF/*.DSA" - exclude "META-INF/*.RSA" - // Ensure all LICENSES are included, by renaming to avoid collisions - rename("((LICENSE)|(AL2\\.0)|(LGPL2\\.1)|(NOTICE)|(NOTICE.txt)|(DEPENDENCIES))", "${jar.name}-\$1") - } - } - } - } -} - -task nodepJar(type: Jar) { - inputs.file(jar.archiveFile) - dependsOn(configureNodepJar) - dependsOn(jar) - - archiveAppendix = 'nodep' - - from(zipTree(jar.archiveFile)) - duplicatesStrategy = 'exclude' -} diff --git a/gradle/hasProtobuf.gradle b/gradle/hasProtobuf.gradle index 23b4ce74bb..10148a0419 100644 --- a/gradle/hasProtobuf.gradle +++ b/gradle/hasProtobuf.gradle @@ -4,9 +4,9 @@ * 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. @@ -73,10 +73,10 @@ task generateProto { if (!isCurrentWindows()) { exe.setExecutable(true) } - exec { + providers.exec { commandLine exe, "--java_out=$outdir", "-I$srcdir" args src - } + }.result.get() } } diff --git a/gradle/hasPythonPackage.gradle b/gradle/hasPythonPackage.gradle index b88c8bb85a..14516ce0b0 100644 --- a/gradle/hasPythonPackage.gradle +++ b/gradle/hasPythonPackage.gradle @@ -47,17 +47,24 @@ task buildPyPackage { inputs.files(assemblePyPackage) outputs.dir(dist) + def debuggerRmiTraceProject = project(":Debugger-rmi-trace") + doLast { if (rootProject.PYTHON3 == null) { throw new GradleException("A supported version of Python [${PYTHON_SUPPORTED}] was not found!") } - File setuptools = project(":Debugger-rmi-trace").findPyDep(".") - exec { + File setuptools = debuggerRmiTraceProject.findPyDep(".") + + def exec = providers.exec { workingDir { file("build/pypkg") } + ignoreExitValue = true commandLine rootProject.PYTHON3 args "-m", "pip", "wheel", "-w", "dist/", "--no-index", "--no-deps", "-f", setuptools, "." } + if (exec.result.get().exitValue != 0) { + throw new GradleException(exec.standardError.asText.get().strip()) + } } } diff --git a/gradle/helpProject.gradle b/gradle/helpProject.gradle index 6ec5d8cd77..5fd5576032 100644 --- a/gradle/helpProject.gradle +++ b/gradle/helpProject.gradle @@ -229,8 +229,8 @@ tasks.register('cleanHelp') { // Task for calling the java help indexer, which creates a searchable index of the help contents tasks.register('indexHelp', JavaExec) { - group "private" - description "indexes the helps files for this module. [gradle/helpProject.gradle]" + group = "private" + description = "indexes the helps files for this module. [gradle/helpProject.gradle]" File helpRootDir = file('src/main/help/help') File outputFile = file("build/help/main/help/${project.name}_JavaHelpSearch") @@ -287,7 +287,7 @@ tasks.register('indexHelp', JavaExec) { // Task for building Markdown in src/global/docs to HTML // - the files generated will be placed in a build directory usable during development mode tasks.register('buildGlobalMarkdown') { - group "private" + group = "private" dependsOn ':MarkdownSupport:classes' FileTree markdownFiles = this.project.fileTree('src/global/docs') { @@ -298,15 +298,17 @@ tasks.register('buildGlobalMarkdown') { inputs.files markdownFiles + def markdownProject = project(':MarkdownSupport') + doFirst { markdownFiles.each { f -> def htmlName = f.name[0..-3] + "html" - javaexec { - classpath = project(':MarkdownSupport').sourceSets.main.runtimeClasspath + providers.javaexec { + classpath = markdownProject.sourceSets.main.runtimeClasspath mainClass = 'ghidra.markdown.MarkdownToHtml' args f args file("build/src/global/docs/${htmlName}") - } + }.result.get() } } } @@ -320,7 +322,7 @@ tasks.register('buildGlobalMarkdown') { // - the -help.jar file in development mode tasks.register('buildHelpFiles', JavaExec) { - group "private" + group = "private" dependsOn 'indexHelp' @@ -423,12 +425,12 @@ tasks.register('buildHelpFiles', JavaExec) { */ tasks.register('buildHelp', Jar) { - group rootProject.GHIDRA_GROUP - description " Builds the help for this module. [gradle/helpProject.gradle]\n" + group = rootProject.GHIDRA_GROUP + description = " Builds the help for this module. [gradle/helpProject.gradle]\n" dependsOn tasks.named('buildHelpFiles') dependsOn tasks.named('buildGlobalMarkdown') - duplicatesStrategy 'exclude' + duplicatesStrategy = 'exclude' from "build/help/main" // include the generated help and index files from "src/main/help" // include the help source files @@ -441,8 +443,8 @@ tasks.register('buildHelp', Jar) { // Task for finding unused images that are not referenced from Ghidra help files tasks.register('findUnusedHelp', JavaExec) { - group "private" - description " Finds unused help images for this module. [gradle/helpProject.gradle]\n" + group = "private" + description = " Finds unused help images for this module. [gradle/helpProject.gradle]\n" File helpRootDir = file('src/main/help/help') inputs.dir helpRootDir @@ -465,7 +467,7 @@ tasks.register('findUnusedHelp', JavaExec) { // include the help into the module's jar jar { - duplicatesStrategy 'exclude' + duplicatesStrategy = 'exclude' from "build/help/main" // include the generated help and index files from "src/main/help" // include the help source files } diff --git a/gradle/javaTestProject.gradle b/gradle/javaTestProject.gradle index 09a5ddbe4f..bfe455092f 100644 --- a/gradle/javaTestProject.gradle +++ b/gradle/javaTestProject.gradle @@ -25,7 +25,7 @@ test { t -> - forkEvery 1 + forkEvery = 1 initTestJVM(t, rootProject.ext.testRootDirName) // WARNING! WATCH OUT !! @@ -52,7 +52,7 @@ test { t -> } task integrationTest (type: Test) { t -> - group "test" + group = "test" dependsOn { project(":FunctionID").unpackFidDatabases } testClassesDirs = files sourceSets.integrationTest.output.classesDirs @@ -63,7 +63,7 @@ task integrationTest (type: Test) { t -> excludes = ['**/*Suite*'] // Enable if you want to force Gradle to launch a new JVM for each test. - forkEvery 1 + forkEvery = 1 initTestJVM(t, rootProject.ext.testRootDirName) @@ -76,13 +76,13 @@ task integrationTest (type: Test) { t -> } task pcodeTest (type: Test) { t -> - group "pcodeTest" + group = "pcodeTest" dependsOn { project(":FunctionID").unpackFidDatabases } testClassesDirs = files sourceSets.pcodeTest.output.classesDirs classpath = sourceSets.pcodeTest.runtimeClasspath // Enable if you want to force Gradle to launch a new JVM for each test. - forkEvery 1 + forkEvery = 1 initTestJVM(t, rootProject.ext.pcodeTestRootDirName) @@ -130,7 +130,7 @@ def initTestJVM(Task task, String rootDirName) { mkdir testOutputDir } // If false, testing will halt when an error is found. - task.ignoreFailures true + task.ignoreFailures = true // If false, then tests are re-run every time, even if no code has changed. task.outputs.upToDateWhen {false} @@ -139,8 +139,8 @@ def initTestJVM(Task task, String rootDirName) { task.testLogging.showStandardStreams = true // Min/Max heap size. These are passed in. - task.minHeapSize xms - task.maxHeapSize xmx + task.minHeapSize = xms + task.maxHeapSize = xmx task.doFirst { task.jvmArgs '-DupgradeProgramErrorMessage=' + upgradeProgramErrorMessage, diff --git a/gradle/processorProject.gradle b/gradle/processorProject.gradle index 3c2ecbd012..dab7a51560 100644 --- a/gradle/processorProject.gradle +++ b/gradle/processorProject.gradle @@ -4,9 +4,9 @@ * 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. @@ -123,10 +123,14 @@ clean { *****************************************************************************************/ task writeSleighDevBuild { def templateFilePath = project(':BuildFiles').projectDir.toString() + "/sleighDevBuild.template" + def softwareModelingProject = project(':SoftwareModeling') doLast { // Generate build.xml with injected classpath for running sleigh compiler - def sleighDevClasspath = project(':SoftwareModeling').sourceSets.main.runtimeClasspath.collect { it.absolutePath }.join(':') + def sleighDevClasspath = softwareModelingProject.sourceSets.main.runtimeClasspath.collect { + it.absolutePath + }.join(':') + copy { into "data" from (templateFilePath) { @@ -160,7 +164,7 @@ rootProject.assembleDistribution { task sleighCompile (type: JavaExec) { dependsOn saveSleighArgs group = rootProject.GHIDRA_GROUP - description " Compiles all the sleigh languages. [gradle/processorProject.gradle]\n" + description = " Compiles all the sleigh languages. [gradle/processorProject.gradle]\n" // define standard parameters for JavaExec classpath configurations.sleighConfig @@ -195,8 +199,8 @@ rootProject.allSleighCompile.dependsOn sleighCompile * *****************************************************************************************/ task cleanSleigh { - group rootProject.GHIDRA_GROUP - description "Removes all the compile sleigh language files (*.sla). [gradle/processorProject.gradle]\n" + group = rootProject.GHIDRA_GROUP + description = "Removes all the compile sleigh language files (*.sla). [gradle/processorProject.gradle]\n" doLast { def deleteTree = fileTree(dir: "data/languages", include: "*.sla") deleteTree.each { File file -> diff --git a/gradle/root/distribution.gradle b/gradle/root/distribution.gradle index 7ddf0673f7..046e2fec84 100644 --- a/gradle/root/distribution.gradle +++ b/gradle/root/distribution.gradle @@ -60,8 +60,6 @@ ext.ghidraPath = files() * string will be returned. */ def getGitRev(repoPath) { - - println("getting git commit for $repoPath") // If the path doesn't exist, the exec command will fail before it can // even run the 'git' command, so short-circuit the whole thing here. @@ -81,22 +79,19 @@ def getGitRev(repoPath) { // 'ignoreExitValue' attribute only applies to the return value of the // command being executed (eg: git); it doesn't apply to the return value of // the exec command itself. - def stdout = new ByteArrayOutputStream() try { - exec { + def stdout = providers.exec { ignoreExitValue = true workingDir repoPath commandLine 'git', 'rev-parse', 'HEAD' - standardOutput = stdout - } + }.standardOutput.asText.get().trim() + + return stdout } catch (Exception e) { println("ERROR: gradle exec failed to run 'git rev-parse': is git installed on this system?") + return "" } - - // Return the commit hash - println(stdout) - return stdout.toString().trim() } /********************************************************************************* @@ -110,9 +105,9 @@ def getGitRev(repoPath) { *********************************************************************************/ task createJavadocs(type: Javadoc, description: 'Generate javadocs for all projects', group: 'Documentation') { - destinationDir file(rootProject.projectDir.toString() + "/build/tmp/javadoc") + destinationDir = file(rootProject.projectDir.toString() + "/build/tmp/javadoc") - failOnError false + failOnError = false // the "source" property must be set in individual project's build.gradle files. // projects that want to be included in the Jsondocs should add the following to @@ -123,7 +118,7 @@ task createJavadocs(type: Javadoc, description: 'Generate javadocs for all proje // Must add classpath for main and test source sets. Javadoc will fail if it cannot // find referenced classes. - classpath = rootProject.ext.ghidraPath + classpath = rootProject.ext.ghidraPath // generate documentation using html5 options.addBooleanOption("html5", true) @@ -158,17 +153,17 @@ dependencies { task createJsondocs(type: Javadoc, description: 'Generate JSON docs for all projects', group: 'Documentation') { - group 'private' + group = 'private' String ROOT_PROJECT_DIR = rootProject.projectDir.toString() - destinationDir file(ROOT_PROJECT_DIR + "/build/tmp/jsondoc") + destinationDir = file(ROOT_PROJECT_DIR + "/build/tmp/jsondoc") - failOnError false + failOnError = false // Must add classpath for main and test source sets. Javadoc will fail if it cannot // find referenced classes. - classpath = rootProject.ext.ghidraPath + classpath = rootProject.ext.ghidraPath // the "source" property must be set in individual project's build.gradle files. // projects that want to be included in the Jsondocs should add the following to @@ -196,18 +191,17 @@ task createJsondocs(type: Javadoc, description: 'Generate JSON docs for all proj task createPythonTypeStubs(type: Javadoc, description: 'Generate pyi stubs for all projects', group: 'Documentation') { - group 'private' + group = 'private' String ROOT_PROJECT_DIR = rootProject.projectDir.toString() - destinationDir file(ROOT_PROJECT_DIR + "/build/typestubs/src") + destinationDir = file(ROOT_PROJECT_DIR + "/build/typestubs/src") - failOnError false + failOnError = false // Must add classpath for main and test source sets. Javadoc will fail if it cannot // find referenced classes. - classpath = rootProject.ext.ghidraPath - + classpath = rootProject.ext.ghidraPath // Generate at package level because user may try to get help directly on an object they have // rather than its public interface. @@ -231,8 +225,8 @@ task createPythonTypeStubs(type: Javadoc, description: 'Generate pyi stubs for a task createGhidraStubsWheel { - group 'private' - description "Creates the ghidra-stubs wheel for the Ghidra api. [gradle/root/distribution.gradle]" + group = 'private' + description = "Creates the ghidra-stubs wheel for the Ghidra api. [gradle/root/distribution.gradle]" dependsOn("createPythonTypeStubs") @@ -240,6 +234,9 @@ task createGhidraStubsWheel { def distDir = file("${typestubsDir}/dist").getAbsolutePath() it.outputs.file("${distDir}/ghidra_stubs-${project.version}-py3-none-any.whl") + + def p = project + def debuggerRmiTraceProject = project(":Debugger-rmi-trace") doFirst { copy { @@ -258,7 +255,7 @@ task createGhidraStubsWheel { [project] name = "ghidra-stubs" - version = "${project.version}" + version = "${p.version}" classifiers = [ "License :: OSI Approved :: Apache Software License", "Typing :: Stubs Only", @@ -268,17 +265,21 @@ task createGhidraStubsWheel { } doLast { - File setuptools = project(":Debugger-rmi-trace").findPyDep(".") + File setuptools = debuggerRmiTraceProject.findPyDep(".") if (PYTHON3 == null) { throw new GradleException("A supported version of Python [${PYTHON_SUPPORTED}] was not found!") } - exec { + def exec = providers.exec { workingDir { typestubsDir } + ignoreExitValue = true commandLine PYTHON3 args "-m", "pip", "wheel", "-w", distDir, "--no-index", "-f", setuptools, "." } + if (exec.result.get().exitValue != 0) { + throw new GradleException(exec.standardError.asText.get().strip()) + } } } @@ -292,7 +293,7 @@ task createGhidraStubsWheel { * *********************************************************************************/ task zipJavadocs(type: Zip) { - group 'private' + group = 'private' archiveFileName = 'GhidraAPI_javadoc.zip' destinationDirectory = file(rootProject.projectDir.toString() + "/build/tmp") @@ -304,7 +305,7 @@ task zipJavadocs(type: Zip) { into "api" } - description "Zips javadocs for Ghidra api. [gradle/root/distribution.gradle]" + description = "Zips javadocs for Ghidra api. [gradle/root/distribution.gradle]" } @@ -321,12 +322,12 @@ task assembleDistribution (type: Copy) { // every other time it is run even though in both cases the output directory has been removed outputs.upToDateWhen {false} - group 'private' - description "Copies core files/folders to the distribution location." - destinationDir file(DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX) + group = 'private' + description = "Copies core files/folders to the distribution location." + destinationDir = file(DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX) // Make sure that we don't try to copy the same file with the same path. - duplicatesStrategy 'exclude' + duplicatesStrategy = 'exclude' exclude "**/certification.manifest" exclude "**/certification.local.manifest" @@ -485,13 +486,13 @@ project.PLATFORMS.each { platform -> delete rootProject.file("build/tmp/expandedArchives") - group 'private' - description "Copies the platform-dependent files/folders to the distribution location." - destinationDir file(DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX) + group = 'private' + description = "Copies the platform-dependent files/folders to the distribution location." + destinationDir = file(DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX) // Make sure that we don't try to copy the same file with the same path into the // zip (this can happen!) - duplicatesStrategy 'exclude' + duplicatesStrategy = 'exclude' } } @@ -501,9 +502,9 @@ project.PLATFORMS.each { platform -> * **********************************************************************************/ task assembleSource (type: Copy) { - group 'private' - description "Copies source zips for all core projects to the distribution folder" - destinationDir DISTRIBUTION_DIR + group = 'private' + description = "Copies source zips for all core projects to the distribution folder" + destinationDir = DISTRIBUTION_DIR } @@ -513,23 +514,25 @@ task assembleSource (type: Copy) { * ************************************************************************************/ task assembleMarkdownToHtml (type: Copy) { - group 'private' - description "Copies a markdown file and a generaterated html file into the distribution folder" + group = 'private' + description = "Copies a markdown file and a generaterated html file into the distribution folder" dependsOn ':MarkdownSupport:classes' outputs.upToDateWhen {false} - destinationDir file(DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX) + destinationDir = file(DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX) + + def markdownSuppportProject = project(':MarkdownSupport') eachFile { f -> def htmlName = f.sourceName[0..-3] + "html" def htmlPath = f.relativePath.replaceLastName(htmlName).pathString - javaexec { - classpath = project(':MarkdownSupport').sourceSets.main.runtimeClasspath + providers.javaexec { + classpath = markdownSuppportProject.sourceSets.main.runtimeClasspath mainClass = 'ghidra.markdown.MarkdownToHtml' args f.file args file("${destinationDir.path}/${htmlPath}") - } + }.result.get() } } @@ -540,15 +543,15 @@ task assembleMarkdownToHtml (type: Copy) { **********************************************************************************/ task createExternalExtensions(type: Copy) { - group 'private' - description "Creates directory of extensions that are external to the installation zip (does not clean up artifacts) [gradle/root/distribution.gradle]" + group = 'private' + description = "Creates directory of extensions that are external to the installation zip (does not clean up artifacts) [gradle/root/distribution.gradle]" dependsOn assembleSource - destinationDir new File(DISTRIBUTION_DIR.getPath(), "external_extensions") + destinationDir = new File(DISTRIBUTION_DIR.getPath(), "external_extensions") // Make sure that we don't try to copy the same file with the same path. - duplicatesStrategy 'exclude' + duplicatesStrategy = 'exclude' } @@ -598,7 +601,7 @@ def updateSlaFilesTimestamp(String distributionDirectoryPath, int timeOffsetMinu } } - println "updateSlaFilesTimestamp: Updated timestamps to $numFilesAdded .sla files." + //println "updateSlaFilesTimestamp: Updated timestamps to $numFilesAdded .sla files." } /********************************************************************************* @@ -608,8 +611,8 @@ def updateSlaFilesTimestamp(String distributionDirectoryPath, int timeOffsetMinu **********************************************************************************/ task assembleAll() { - group 'private' - description "Assembles all targets to one installation directory (does not clean up artifacts) [gradle/root/distribution.gradle]" + group = 'private' + description = "Assembles all targets to one installation directory (does not clean up artifacts) [gradle/root/distribution.gradle]" dependsOn assembleDistribution dependsOn assembleSource @@ -645,8 +648,8 @@ task assembleAll() { **********************************************************************************/ task createInstallationZip(type: Zip) { t -> - group 'private' - description "Creates local installation zip (does not clean up artifacts) [gradle/root/distribution.gradle]" + group = 'private' + description = "Creates local installation zip (does not clean up artifacts) [gradle/root/distribution.gradle]" dependsOn assembleAll @@ -659,7 +662,7 @@ task createInstallationZip(type: Zip) { t -> destinationDirectory = DISTRIBUTION_DIR // Make sure that we don't try to copy the same file with the same path. - duplicatesStrategy 'exclude' + duplicatesStrategy = 'exclude' from (DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX) { into ZIP_DIR_PREFIX @@ -677,7 +680,7 @@ task createInstallationZip(type: Zip) { t -> * **********************************************************************************/ task buildGhidra() { - description "Builds Ghidra for the current platform. The resulting zip will be in build/dist" + description = "Builds Ghidra for the current platform. The resulting zip will be in build/dist" if (project.hasProperty("externalExtensions")) { dependsOn createExternalExtensions diff --git a/gradle/root/prepDev.gradle b/gradle/root/prepDev.gradle index 6c25a46106..a6bc21faaa 100644 --- a/gradle/root/prepDev.gradle +++ b/gradle/root/prepDev.gradle @@ -4,9 +4,9 @@ * 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. @@ -20,8 +20,8 @@ *******************************************************************************************/ task prepDev { - group rootProject.GHIDRA_GROUP - description " Prepares a fresh clone of Ghidra for developing in eclipse. [gradle/root/prepDev.gradle]\n" + group = rootProject.GHIDRA_GROUP + description= " Prepares a fresh clone of Ghidra for developing in eclipse. [gradle/root/prepDev.gradle]\n" // the GhidraLauncher depends on this file to build the classpath in dev mode dependsOn { generateLibraryDependencyMapping } diff --git a/gradle/root/svg.gradle b/gradle/root/svg.gradle index 3eb608ca64..e561a1683c 100644 --- a/gradle/root/svg.gradle +++ b/gradle/root/svg.gradle @@ -4,9 +4,9 @@ * 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. @@ -29,8 +29,8 @@ * *********************************************************************************/ task rasterizeSvg(type: JavaExec) { - group rootProject.GHIDRA_GROUP - description " Converts .svg files to .png files. [gradle/root/svg.gradle]\n" + group = rootProject.GHIDRA_GROUP + description = " Converts .svg files to .png files. [gradle/root/svg.gradle]\n" subprojects { p -> diff --git a/gradle/root/test.gradle b/gradle/root/test.gradle index 0e0d1b88ca..6eb7ce0b2d 100644 --- a/gradle/root/test.gradle +++ b/gradle/root/test.gradle @@ -4,9 +4,9 @@ * 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. @@ -368,7 +368,7 @@ def initTestJVM(Task task, String rootDirName) { * *********************************************************************************/ task parallelCombinedTestReport(type: TestReport) { t -> - group "test" + group = "test" destinationDirectory = file("$reportDir") logger.debug("parallelCombinedTestReport: Using destinationDir = $reportDir") dependsOn ":deleteTestTempAndReportDirs" @@ -383,8 +383,8 @@ task parallelCombinedTestReport(type: TestReport) { t -> * *********************************************************************************/ task unitTestReport(type: TestReport) { t -> - group "test" - description "Run unit tests and save HTML report." + group = "test" + description = "Run unit tests and save HTML report." destinationDirectory = file("$reportDir/unitTests") outputs.upToDateWhen {false} } @@ -396,8 +396,8 @@ task unitTestReport(type: TestReport) { t -> * *********************************************************************************/ task integrationTestReport(type: TestReport) { t -> - group "test" - description "Run integration tests and save HTML report." + group = "test" + description = "Run integration tests and save HTML report." destinationDirectory = file("$reportDir/integrationTests") outputs.upToDateWhen {false} } @@ -414,8 +414,8 @@ task integrationTestReport(type: TestReport) { t -> * *********************************************************************************/ task targetedTestReport(type: TestReport) { t -> - group "test" - description "Run unit tests against a specific set of projects." + group = "test" + description = "Run unit tests against a specific set of projects." destinationDirectory = file("$reportDir/unitTests") outputs.upToDateWhen {false} dependsOn ":deleteTestTempAndReportDirs" @@ -451,7 +451,7 @@ def createTestTask(Project subproject, String testType, String bucketName, int t int classesListPosition, int numMaxParallelForks) { subproject.task(testType+"_$taskNameCounter"+"_$bucketName", type: Test) { t -> - group "test" + group = "test" testClassesDirs = files subproject.sourceSets["$testType"].output.classesDirs classpath = subproject.sourceSets["$testType"].runtimeClasspath @@ -559,7 +559,7 @@ configure(subprojects.findAll {parallelMode == true}) { subproject -> * *********************************************************************************/ task combinedTestReport(type: TestReport) { t -> - group "test" + group = "test" destinationDirectory = file("$reportDir") dependsOn ":deleteTestTempAndReportDirs" @@ -573,7 +573,7 @@ task combinedTestReport(type: TestReport) { t -> * *********************************************************************************/ task pcodeTestReport(type: TestReport) { t -> - group "pcodeTest" + group = "pcodeTest" destinationDirectory = file("$pcodeTestShareDir" + "/reports") } @@ -585,7 +585,7 @@ task pcodeTestReport(type: TestReport) { t -> * *********************************************************************************/ task pcodeConsolidatedTestReport(type: Copy) { - group "pcodeTest" + group = "pcodeTest" dependsOn ':pcodeTestReport' into (pcodeTestShareDir + "/reports") from (testOutputDir + "/test-output") { diff --git a/gradle/support/distributionCommon.gradle b/gradle/support/distributionCommon.gradle index e355a8ce9b..0356418ab9 100644 --- a/gradle/support/distributionCommon.gradle +++ b/gradle/support/distributionCommon.gradle @@ -4,9 +4,9 @@ * 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. @@ -24,14 +24,14 @@ plugins.withType(JavaPlugin) { task zipSourceSubproject (type: Zip) { t -> // Define some metadata about the zip (name, location, version, etc....) - t.group 'private' - t.description "Creates the source zips for java modules" + t.group = 'private' + t.description = "Creates the source zips for java modules" t.archiveFileName = project.name + "-src.zip" t.destinationDirectory = file(projectDir.path + "/build/tmp/src") // Without this we get duplicate files but it's unclear why. It doesn't seem that this // task is being executed multiple times, and sourceSets.main.java contains the // correct elements. Whatever the cause, this fixes the problem. - duplicatesStrategy 'exclude' + duplicatesStrategy = 'exclude' from sourceSets.main.java } diff --git a/gradle/support/extensionCommon.gradle b/gradle/support/extensionCommon.gradle index ffaae7c2fa..e355a64841 100644 --- a/gradle/support/extensionCommon.gradle +++ b/gradle/support/extensionCommon.gradle @@ -20,14 +20,14 @@ task zipExtensions (type: Zip) { def p = this.project - it.group 'private' - it.description "Creates a zip file for an extension module. [gradle/support/extensionCommon.gradle]" + it.group = 'private' + it.description = "Creates a zip file for an extension module. [gradle/support/extensionCommon.gradle]" it.archiveFileName = "${rootProject.ext.ZIP_NAME_PREFIX}_${p.name}.zip" it.destinationDirectory = rootProject.ext.DISTRIBUTION_DIR // Make sure that we don't try to copy the same file with the same path into the // zip (this can happen!) - duplicatesStrategy 'exclude' + duplicatesStrategy = 'exclude' // Exclude any files that contain "delete.me" in the path; this is a convention we used // at one time that should be removed. diff --git a/gradle/support/ip.gradle b/gradle/support/ip.gradle index b7639bf87b..be221a90d9 100644 --- a/gradle/support/ip.gradle +++ b/gradle/support/ip.gradle @@ -31,23 +31,25 @@ /********************************************************************************* * Defines the main ip task for each subproject *********************************************************************************/ -task ip { +task ip { + def p = project + doLast { // scans all the files in the module, reads ip from header, verifies ip, and creates mapping - def ipToFileMap = getIpForModule(project) + def ipToFileMap = getIpForModule(p) // reads the ip info from the Module.manifest file and verifies each ip - def moduleManifestIpMap = getModuleManifestIp(project) + def moduleManifestIpMap = getModuleManifestIp(p) // gets the external libs from gradle and verifies they are accounted for in the Module.manifest file - checkExternalLibsInMap(moduleManifestIpMap, project) + checkExternalLibsInMap(moduleManifestIpMap, p) // adds the ip info from the Module.manifest file to the map generated from scanning the module files. addModuleManifestIp(ipToFileMap, moduleManifestIpMap) // writes the LICENSE.txt file for the module - writeLicenseInfo(project, ipToFileMap) + writeLicenseInfo(p, ipToFileMap) } } rootProject.assembleDistribution.dependsOn ip @@ -177,6 +179,7 @@ def isCSourceFile(File file) { return filename.endsWith(".java") || filename.endsWith(".c") || filename.endsWith(".gradle") || + filename.endsWith(".gradle.kts") || filename.endsWith(".groovy") || filename.endsWith(".cpp") || filename.endsWith(".cc") ||