GP-5257: Fixing Gradle warnings

This commit is contained in:
Ryan Kurtz 2025-01-10 13:51:33 -05:00
parent eaa2a5c6b3
commit 44fb13b292
36 changed files with 234 additions and 346 deletions

View file

@ -35,8 +35,8 @@ def srcVersion24 = "src/demangler_gnu_v2_24"
*/ */
task zipBuildableSource(type:Zip) { task zipBuildableSource(type:Zip) {
group 'private' group = 'private'
description "Collects the source files needed to build this module." description = "Collects the source files needed to build this module."
archiveBaseName = project.name + "-src-for-build" archiveBaseName = project.name + "-src-for-build"
archiveExtension = 'zip' archiveExtension = 'zip'

View file

@ -76,8 +76,8 @@ gradle.taskGraph.whenReady {
* Task to unpack the standard binutils zip file * Task to unpack the standard binutils zip file
*******************************************************************************************/ *******************************************************************************************/
task binutilsUnpack { task binutilsUnpack {
description "Unpack binutils (for building gdis)" description = "Unpack binutils (for building gdis)"
group "Native Build Dependencies" group = "Native Build Dependencies"
outputs.file { binutilsUnpackDir } outputs.file { binutilsUnpackDir }
onlyIf { !binutilsUnpackDir.exists() } onlyIf { !binutilsUnpackDir.exists() }
@ -104,8 +104,8 @@ supportedPlatforms.each { platform ->
def artifactsDir = file("build/binutils/${platform}") def artifactsDir = file("build/binutils/${platform}")
task(buildName) { task(buildName) {
description "Configure and make binutils for $platform (for building gdis)" description ="Configure and make binutils for $platform (for building gdis)"
group "Native Prebuild Dependencies" group = "Native Prebuild Dependencies"
onlyIf { !configDir.exists() } onlyIf { !configDir.exists() }
@ -122,21 +122,21 @@ supportedPlatforms.each { platform ->
println "Configuring binutils - config directory: $configDir" println "Configuring binutils - config directory: $configDir"
println "${binutilsDir}/configure --prefix=\"${configDir}\" --enable-targets=all --with-zlib=no --disable-nls --disable-werror" println "${binutilsDir}/configure --prefix=\"${configDir}\" --enable-targets=all --with-zlib=no --disable-nls --disable-werror"
configDir.mkdirs(); configDir.mkdirs();
exec { providers.exec {
workingDir configDir workingDir configDir
commandLine "${binutilsDir}/configure", "--prefix=${configDir}", "--enable-targets=all", "--with-zlib=no", "--disable-nls", "--disable-werror" commandLine "${binutilsDir}/configure", "--prefix=${configDir}", "--enable-targets=all", "--with-zlib=no", "--disable-nls", "--disable-werror"
} }.result.get()
println "Building binutils - config directory: $configDir" println "Building binutils - config directory: $configDir"
exec { providers.exec {
commandLine "make", "-C", "${configDir}", "all" commandLine "make", "-C", "${configDir}", "all"
} }.result.get()
} }
} }
task(postBuildName, type: Copy) { task(postBuildName, type: Copy) {
description "Copy binutil artifcacts for $platform (for building gdis)" description = "Copy binutil artifcacts for $platform (for building gdis)"
group "Native Prebuild Dependencies" group = "Native Prebuild Dependencies"
dependsOn buildName dependsOn buildName

View file

@ -66,7 +66,7 @@ model {
// specify installDir because Gradle doesn't find VS Build Tools. // specify installDir because Gradle doesn't find VS Build Tools.
// See https://github.com/gradle/gradle-native/issues/617#issuecomment-575735288 // See https://github.com/gradle/gradle-native/issues/617#issuecomment-575735288
visualCpp(VisualCpp) { visualCpp(VisualCpp) {
installDir VISUAL_STUDIO_INSTALL_DIR installDir = VISUAL_STUDIO_INSTALL_DIR
} }
} }
} }

View file

@ -19,7 +19,6 @@ apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle"
apply from: "$rootProject.projectDir/gradle/nativeProject.gradle" apply from: "$rootProject.projectDir/gradle/nativeProject.gradle"
apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle"
apply from: "$rootProject.projectDir/gradle/hasPythonPackage.gradle" apply from: "$rootProject.projectDir/gradle/hasPythonPackage.gradle"
apply from: "$rootProject.projectDir/gradle/debugger/hasNodepJar.gradle"
apply plugin: 'eclipse' apply plugin: 'eclipse'
eclipse.project.name = 'Debug Debugger-agent-dbgeng' eclipse.project.name = 'Debug Debugger-agent-dbgeng'

View file

@ -19,7 +19,6 @@ apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle"
apply from: "$rootProject.projectDir/gradle/nativeProject.gradle" apply from: "$rootProject.projectDir/gradle/nativeProject.gradle"
apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle"
apply from: "$rootProject.projectDir/gradle/hasPythonPackage.gradle" apply from: "$rootProject.projectDir/gradle/hasPythonPackage.gradle"
apply from: "$rootProject.projectDir/gradle/debugger/hasExecutableJar.gradle"
apply plugin: 'eclipse' apply plugin: 'eclipse'
eclipse.project.name = 'Debug Debugger-agent-gdb' eclipse.project.name = 'Debug Debugger-agent-gdb'

View file

@ -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

View file

@ -19,7 +19,6 @@ apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle"
apply from: "$rootProject.projectDir/gradle/nativeProject.gradle" apply from: "$rootProject.projectDir/gradle/nativeProject.gradle"
apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle"
apply from: "$rootProject.projectDir/gradle/hasPythonPackage.gradle" apply from: "$rootProject.projectDir/gradle/hasPythonPackage.gradle"
apply from: "$rootProject.projectDir/gradle/debugger/hasExecutableJar.gradle"
apply plugin: 'eclipse' apply plugin: 'eclipse'
eclipse.project.name = 'Debug Debugger-agent-lldb' eclipse.project.name = 'Debug Debugger-agent-lldb'

View file

@ -50,10 +50,10 @@ task generateProtoPy {
if (!isCurrentWindows()) { if (!isCurrentWindows()) {
exe.setExecutable(true) exe.setExecutable(true)
} }
exec { providers.exec {
commandLine exe, "--python_out=$outdir", "-I$srcdir" commandLine exe, "--python_out=$outdir", "-I$srcdir"
args src args src
} }.result.get()
} }
} }

View file

@ -89,7 +89,7 @@ task elasticPluginJar(type: Jar) {
task elasticPluginZip(type: Zip) { task elasticPluginZip(type: Zip) {
from 'build/ziplayout' from 'build/ziplayout'
archiveBaseName = 'lsh' archiveBaseName = 'lsh'
destinationDirectory = file("build/data") destinationDirectory = file("build/data")
} }
// Currently targeting elasticsearch-8.8.1 which by default runs with java 20 // Currently targeting elasticsearch-8.8.1 which by default runs with java 20

View file

@ -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.
@ -112,7 +112,7 @@ task zipExtensions(type: Zip, dependsOn:jarTasks) {
archiveFileName = "${rootProject.ext.ZIP_NAME_PREFIX}_${p.name}.zip" archiveFileName = "${rootProject.ext.ZIP_NAME_PREFIX}_${p.name}.zip"
destinationDirectory = rootProject.ext.DISTRIBUTION_DIR destinationDirectory = rootProject.ext.DISTRIBUTION_DIR
duplicatesStrategy 'exclude' duplicatesStrategy = 'exclude'
from '.' from '.'

View file

@ -107,7 +107,7 @@ task buildBSimHelpPdf(type: Exec) {
""" """
// Allows doLast block regardless of exit value. // Allows doLast block regardless of exit value.
ignoreExitValue true ignoreExitValue = true
// Store the output instead of printing to the console. // Store the output instead of printing to the console.
standardOutput = new ByteArrayOutputStream() standardOutput = new ByteArrayOutputStream()
@ -168,7 +168,7 @@ task buildBSimHelpHtml(type: Exec) {
""" """
// Allows doLast block regardless of exit value. // Allows doLast block regardless of exit value.
ignoreExitValue true ignoreExitValue = true
// Store the output instead of printing to the console. // Store the output instead of printing to the console.
standardOutput = new ByteArrayOutputStream() standardOutput = new ByteArrayOutputStream()

View file

@ -76,8 +76,8 @@ sourceSets {
} }
task buildCParser(type: JavaExec) { task buildCParser(type: JavaExec) {
group 'private' group = 'private'
description " Compiles the JavaCC files for the C parser\n" description = " Compiles the JavaCC files for the C parser\n"
def inputFile = "C.jj" def inputFile = "C.jj"
def packagePath = 'ghidra/app/util/cparser/C' def packagePath = 'ghidra/app/util/cparser/C'
@ -96,8 +96,8 @@ task buildCParser(type: JavaExec) {
} }
task buildCPPParser(type: JavaExec) { task buildCPPParser(type: JavaExec) {
group 'private' group = 'private'
description " Compiles the JavaCC files for the CPP parser\n" description = " Compiles the JavaCC files for the CPP parser\n"
def inputFile = "CPP.jj" def inputFile = "CPP.jj"
def packagePath = 'ghidra/app/util/cparser/CPP' def packagePath = 'ghidra/app/util/cparser/CPP'
@ -119,15 +119,15 @@ task buildCPPParser(type: JavaExec) {
// A public task to tie together private sub-tasks // A public task to tie together private sub-tasks
task buildJavacc { task buildJavacc {
dependsOn buildCParser, buildCPPParser dependsOn buildCParser, buildCPPParser
group rootProject.GHIDRA_GROUP group = rootProject.GHIDRA_GROUP
description " Compiles the JavaCC files\n" description = " Compiles the JavaCC files\n"
} }
// Note: this must happen before the standard buildHelp for Base // Note: this must happen before the standard buildHelp for Base
tasks.register('generateExtraHelpFiles') { tasks.register('generateExtraHelpFiles') {
group = 'private' 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') def rawTipsFile = file('src/main/resources/ghidra/app/plugin/core/totd/tips.txt')
inputs.file(rawTipsFile) inputs.file(rawTipsFile)

View file

@ -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.
@ -140,7 +140,7 @@ task buildDecompilerHelpHtml(type: Exec) {
""" """
// Allows doLast block regardless of exit value. // Allows doLast block regardless of exit value.
ignoreExitValue true ignoreExitValue = true
// Store the output instead of printing to the console. // Store the output instead of printing to the console.
standardOutput = new ByteArrayOutputStream() 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. // 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. // Store the output instead of printing to the console.
standardOutput = new ByteArrayOutputStream() 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. // 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. // Store the output instead of printing to the console.
standardOutput = new ByteArrayOutputStream() standardOutput = new ByteArrayOutputStream()
@ -357,7 +357,7 @@ task buildDecompilerDocumentationHtml(type: Exec) {
""" """
// Allows doLast block regardless of exit value. // Allows doLast block regardless of exit value.
ignoreExitValue true ignoreExitValue = true
// Store the output instead of printing to the console. // Store the output instead of printing to the console.
standardOutput = new ByteArrayOutputStream() standardOutput = new ByteArrayOutputStream()

View file

@ -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,7 +15,7 @@
*/ */
apply plugin: 'eclipse' apply plugin: 'eclipse'
eclipse.project { eclipse.project {
name '_Decompiler' name = '_Decompiler'
buildCommand 'org.eclipse.cdt.managedbuilder.core.genmakebuilder' buildCommand 'org.eclipse.cdt.managedbuilder.core.genmakebuilder'
buildCommand 'org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder' buildCommand 'org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder'
natures 'org.eclipse.cdt.core.cnature' natures 'org.eclipse.cdt.core.cnature'

View file

@ -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.
@ -38,12 +38,13 @@ def fidDbFiles = fileTree(depsDir.exists() ? depsDir : binRepoDir) {
} }
task unpackFidDatabases { task unpackFidDatabases {
def p = project.file('build/data')
doLast { doLast {
fidDbFiles.each { file -> fidDbFiles.each { file ->
// TODO: Preserve subdir path // TODO: Preserve subdir path
def destName = file.name.replaceAll(/\.fidb$/, ".fidbf") 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()) { if (!destFile.exists() || destFile.length() == 0 || destFile.lastModified() < file.lastModified()) {
logger.info("FIDB: ${file} -> ${destFile}"); logger.info("FIDB: ${file} -> ${destFile}");
@ -102,7 +103,7 @@ task buildFidHelpPdf(type: Exec) {
""" """
// Allows doLast block regardless of exit value. // Allows doLast block regardless of exit value.
ignoreExitValue true ignoreExitValue = true
// Store the output instead of printing to the console. // Store the output instead of printing to the console.
standardOutput = new ByteArrayOutputStream() standardOutput = new ByteArrayOutputStream()
@ -167,7 +168,7 @@ task buildFidHelpHtml(type: Exec) {
""" """
// Allows doLast block regardless of exit value. // Allows doLast block regardless of exit value.
ignoreExitValue true ignoreExitValue = true
// Store the output instead of printing to the console. // Store the output instead of printing to the console.
standardOutput = new ByteArrayOutputStream() standardOutput = new ByteArrayOutputStream()

View file

@ -54,11 +54,11 @@ CopySpec yajswCopySpec = copySpec {
} }
// Unpack YAJSW archive into build/data for development use // Unpack YAJSW archive into build/data for development use
task yajswDevUnpack(type:Copy) { task yajswDevUnpack(type:Copy) {
description "Unpack YAJSW archive for development use" description = "Unpack YAJSW archive for development use"
group "Development Preparation" group = "Development Preparation"
with yajswCopySpec with yajswCopySpec
destinationDir file("build/data") destinationDir = file("build/data")
} }
/********************************************************************************* /*********************************************************************************
* CLASSPATH FRAGMENT FILE: Production * CLASSPATH FRAGMENT FILE: Production
@ -76,7 +76,7 @@ task yajswDevUnpack(type:Copy) {
* 3. Put the path in the output file. * 3. Put the path in the output file.
*********************************************************************************/ *********************************************************************************/
task generateGhidraServerClasspath { 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") File outfile = file("${buildDir}/classpath.frag")
outputs.file outfile outputs.file outfile
@ -84,6 +84,8 @@ task generateGhidraServerClasspath {
// Force the task to be executed every time by setting to false. // Force the task to be executed every time by setting to false.
outputs.upToDateWhen { false } outputs.upToDateWhen { false }
def p = project
doLast { doLast {
outfile.parentFile.mkdirs() outfile.parentFile.mkdirs()
outfile.withPrintWriter { out -> outfile.withPrintWriter { out ->
@ -91,8 +93,8 @@ task generateGhidraServerClasspath {
configurations.runGhidraServer.each { jarFile -> configurations.runGhidraServer.each { jarFile ->
File distPath = file("/") File distPath = file("/")
String resPath String resPath
for (Configuration conf : project.getConfigurations()) { for (Configuration conf : p.getConfigurations()) {
resPath = findJarInDistribution(project, conf, jarFile) resPath = findJarInDistribution(p, conf, jarFile)
if (resPath != null) { if (resPath != null) {
out.println("wrapper.java.classpath.${++idx}=\${ghidra_home}/${resPath}") out.println("wrapper.java.classpath.${++idx}=\${ghidra_home}/${resPath}")
break break
@ -136,7 +138,7 @@ rootProject.assembleDistribution {
* *
*********************************************************************************/ *********************************************************************************/
task generateDevGhidraServerClasspath { 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") File outfile = file("${buildDir}/dev-meta/classpath.frag")
outputs.file outfile outputs.file outfile
@ -260,8 +262,7 @@ def String searchFilesForJar (proj, conf, jar) {
String resolution = null String resolution = null
if (conf.isCanBeResolved()) { if (conf.isCanBeResolved()) {
ResolvedConfiguration rc = conf.getResolvedConfiguration() conf.getFiles().each { f ->
rc.getFiles().each { f ->
if (jar.equals(f)) { if (jar.equals(f)) {
resolution = rootProject.relativePath(proj.projectDir) + "/lib/" + f.name resolution = rootProject.relativePath(proj.projectDir) + "/lib/" + f.name
} }
@ -287,7 +288,9 @@ def String searchDependenciesForJar (proj, conf, jarFile) {
Set<ProjectDependency> projectDependencies = conf.getAllDependencies().withType(ProjectDependency) Set<ProjectDependency> projectDependencies = conf.getAllDependencies().withType(ProjectDependency)
for (ProjectDependency dependency : projectDependencies) { 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()) Configuration depProjectConf = dependencyProject.getConfigurations().getByName(conf.getName())
relPath = findJarInDistribution(dependencyProject, depProjectConf, jarFile); relPath = findJarInDistribution(dependencyProject, depProjectConf, jarFile);
if (relPath != null) { if (relPath != null) {

View file

@ -38,7 +38,7 @@ dependencies {
} }
task jythonUnpack(type: Copy) { 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" // Without this, the copyTask will unzip the file to check for "up to date"
onlyIf { onlyIf {
@ -48,15 +48,15 @@ task jythonUnpack(type: Copy) {
from zipTree(configurations.jython.singleFile) from zipTree(configurations.jython.singleFile)
include "Lib/**" include "Lib/**"
destinationDir file("build/data/${JYTHON_DIR}") destinationDir = file("build/data/${JYTHON_DIR}")
} }
task jythonSrcCopy(type: Copy) { task jythonSrcCopy(type: Copy) {
description "Copy jython-src directory (for Feature Jython)" description = "Copy jython-src directory (for Feature Jython)"
from(file("jython-src")) from(file("jython-src"))
destinationDir file("build/data/jython-src") destinationDir = file("build/data/jython-src")
} }
// Ensure that Jython is usable in development xx // Ensure that Jython is usable in development xx

View file

@ -43,7 +43,7 @@ file(ghidraDir + "/application.properties").withReader { reader ->
checkGradleVersion() checkGradleVersion()
task copyDependencies(type: Copy) { task copyDependencies(type: Copy) {
group "Ghidra Private" group = "Ghidra Private"
from configurations.runtimeClasspath from configurations.runtimeClasspath
into "lib" into "lib"
exclude { fileTreeElement -> exclude { fileTreeElement ->
@ -77,7 +77,7 @@ def DISTRIBUTION_DIR = file("dist")
def pathInZip = "${project.name}" def pathInZip = "${project.name}"
task zipSource (type: Zip) { task zipSource (type: Zip) {
group "Ghidra Private" group = "Ghidra Private"
// Define some metadata about the zip (name, location, version, etc....) // Define some metadata about the zip (name, location, version, etc....)
it.archiveBaseName = project.name + "-src" it.archiveBaseName = project.name + "-src"
@ -91,7 +91,7 @@ task zipSource (type: Zip) {
} }
task buildExtension (type: Zip) { task buildExtension (type: Zip) {
group "Ghidra Private" group = "Ghidra Private"
archiveBaseName = "${ZIP_NAME_PREFIX}_${project.name}" archiveBaseName = "${ZIP_NAME_PREFIX}_${project.name}"
archiveExtension = 'zip' 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 // Make sure that we don't try to copy the same file with the same path into the
// zip (this can happen!) // zip (this can happen!)
duplicatesStrategy 'exclude' duplicatesStrategy = 'exclude'
// This filtered property file copy must appear before the general // This filtered property file copy must appear before the general
// copy to ensure that it is prefered over the unmodified file // copy to ensure that it is prefered over the unmodified file
@ -302,7 +302,7 @@ def hasJarHelp(File file) {
} }
tasks.register('cleanHelp') { tasks.register('cleanHelp') {
group "Ghidra Private" group = "Ghidra Private"
File helpOutput = file('build/help/main/help') File helpOutput = file('build/help/main/help')
doFirst { doFirst {
@ -312,7 +312,7 @@ tasks.register('cleanHelp') {
// Task for calling the java help indexer, which creates a searchable index of the help contents // Task for calling the java help indexer, which creates a searchable index of the help contents
tasks.register('indexHelp', JavaExec) { tasks.register('indexHelp', JavaExec) {
group "Ghidra Private" group = "Ghidra Private"
File helpRootDir = file('src/main/help/help') File helpRootDir = file('src/main/help/help')
File outputFile = file("build/help/main/help/${project.name}_JavaHelpSearch") 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 // - the files generated will be placed in a diretory usable during development mode and will
// eventually be placed in the <Module>.jar file // eventually be placed in the <Module>.jar file
tasks.register('buildHelp', JavaExec) { tasks.register('buildHelp', JavaExec) {
group "Ghidra Private" group = "Ghidra Private"
dependsOn 'indexHelp' dependsOn 'indexHelp'
@ -436,7 +436,7 @@ tasks.register('buildHelp', JavaExec) {
// include the help into the module's jar // include the help into the module's jar
jar { jar {
duplicatesStrategy 'exclude' duplicatesStrategy = 'exclude'
from "build/help/main" // include the generated help index files from "build/help/main" // include the generated help index files
from "src/main/help" // include the help source files from "src/main/help" // include the help source files
archiveVersion = "" archiveVersion = ""

View file

@ -104,10 +104,10 @@ task testSpecimenLinux_x86_64 {
dependsOn 'expTraceableSleepExecutable'//Linux_x86_64Executable' dependsOn 'expTraceableSleepExecutable'//Linux_x86_64Executable'
doLast { doLast {
exec { providers.exec {
workingDir "build/os/linux_x86_64" workingDir "build/os/linux_x86_64"
commandLine "strip", "-o", "expSpin.stripped", "expSpin" commandLine "strip", "-o", "expSpin.stripped", "expSpin"
} }.result.get()
} }
} }

View file

@ -59,20 +59,24 @@ compileJava.enabled = false
jar.enabled = false jar.enabled = false
task utilityJar(type:Copy) { 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) { 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) { task pyDevUnpack(type:Copy) {
description "Unpack PyDev plugin archive for development use" description = "Unpack PyDev plugin archive for development use"
group "Development Preparation" group = "Development Preparation"
File pyDevDestDir = file("build/data/buildDependencies/pydev") File pyDevDestDir = file("build/data/buildDependencies/pydev")
@ -90,12 +94,12 @@ task pyDevUnpack(type:Copy) {
from pyDevZipTree from pyDevZipTree
exclude "**/.project", "**/.pydevproject" exclude "**/.project", "**/.pydevproject"
destinationDir pyDevDestDir destinationDir = pyDevDestDir
} }
task cdtUnpack(type:Copy) { task cdtUnpack(type:Copy) {
description "Unpack CDT plugin archive for development use" description = "Unpack CDT plugin archive for development use"
group "Development Preparation" group = "Development Preparation"
File cdtDestDir = file("build/data/buildDependencies/cdt") File cdtDestDir = file("build/data/buildDependencies/cdt")
@ -112,7 +116,7 @@ task cdtUnpack(type:Copy) {
from cdtZipTree from cdtZipTree
destinationDir cdtDestDir destinationDir = cdtDestDir
} }
task prepGhidraDev { task prepGhidraDev {

View file

@ -43,7 +43,7 @@ else {
} }
task distributeExtension { task distributeExtension {
group "Ghidra" group = "Ghidra"
apply from: new File(ghidraInstallDir).getCanonicalPath() + "/support/buildExtension.gradle" apply from: new File(ghidraInstallDir).getCanonicalPath() + "/support/buildExtension.gradle"
dependsOn ':buildExtension' dependsOn ':buildExtension'

View file

@ -160,14 +160,10 @@ def checkGradleVersion() {
*********************************************************************************/ *********************************************************************************/
def checkPythonVersion(List<String> pyCmd) { def checkPythonVersion(List<String> pyCmd) {
try { try {
def stdout = new ByteArrayOutputStream() return providers.exec {
exec {
commandLine pyCmd commandLine pyCmd
args "-c", "import sys; print('{0}.{1}'.format(*sys.version_info))" args "-c", "import sys; print('{0}.{1}'.format(*sys.version_info))"
standardOutput = stdout }.standardOutput.asText.get().strip()
errorOutput = OutputStream.nullOutputStream()
}
return "$stdout".strip()
} }
catch (Exception e) { catch (Exception e) {
return "ABSENT" return "ABSENT"
@ -176,14 +172,10 @@ def checkPythonVersion(List<String> pyCmd) {
def getPythonExecutable(List<String> pyCmd) { def getPythonExecutable(List<String> pyCmd) {
try { try {
def stdout = new ByteArrayOutputStream() return providers.exec {
exec {
commandLine pyCmd commandLine pyCmd
args "-c", "import sys; print(sys.executable)" args "-c", "import sys; print(sys.executable)"
standardOutput = stdout }.standardOutput.asText.get().strip()
errorOutput = OutputStream.nullOutputStream()
}
return "$stdout".strip()
} }
catch (Exception e) { catch (Exception e) {
return "ABSENT" return "ABSENT"
@ -192,14 +184,10 @@ def getPythonExecutable(List<String> pyCmd) {
def checkPip(List<String> pyCmd, boolean shouldPrint) { def checkPip(List<String> pyCmd, boolean shouldPrint) {
try { try {
def stdout = new ByteArrayOutputStream() def version = providers.exec {
exec {
commandLine pyCmd commandLine pyCmd
args "-c", "import pip; print(pip.__version__)" args "-c", "import pip; print(pip.__version__)"
standardOutput = stdout }.standardOutput.asText.get().strip()
errorOutput = OutputStream.nullOutputStream()
}
def version = "$stdout".strip();
if (shouldPrint) { if (shouldPrint) {
if (version.length() == 0) { if (version.length() == 0) {
println("Warning: Python3 pip not installed (required for build)") println("Warning: Python3 pip not installed (required for build)")

View file

@ -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)
}
}
}

View file

@ -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'
}

View file

@ -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.
@ -73,10 +73,10 @@ task generateProto {
if (!isCurrentWindows()) { if (!isCurrentWindows()) {
exe.setExecutable(true) exe.setExecutable(true)
} }
exec { providers.exec {
commandLine exe, "--java_out=$outdir", "-I$srcdir" commandLine exe, "--java_out=$outdir", "-I$srcdir"
args src args src
} }.result.get()
} }
} }

View file

@ -47,17 +47,24 @@ task buildPyPackage {
inputs.files(assemblePyPackage) inputs.files(assemblePyPackage)
outputs.dir(dist) outputs.dir(dist)
def debuggerRmiTraceProject = project(":Debugger-rmi-trace")
doLast { doLast {
if (rootProject.PYTHON3 == null) { if (rootProject.PYTHON3 == null) {
throw new GradleException("A supported version of Python [${PYTHON_SUPPORTED}] was not found!") throw new GradleException("A supported version of Python [${PYTHON_SUPPORTED}] was not found!")
} }
File setuptools = project(":Debugger-rmi-trace").findPyDep(".") File setuptools = debuggerRmiTraceProject.findPyDep(".")
exec {
def exec = providers.exec {
workingDir { file("build/pypkg") } workingDir { file("build/pypkg") }
ignoreExitValue = true
commandLine rootProject.PYTHON3 commandLine rootProject.PYTHON3
args "-m", "pip", "wheel", "-w", "dist/", "--no-index", "--no-deps", "-f", setuptools, "." 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())
}
} }
} }

View file

@ -229,8 +229,8 @@ tasks.register('cleanHelp') {
// Task for calling the java help indexer, which creates a searchable index of the help contents // Task for calling the java help indexer, which creates a searchable index of the help contents
tasks.register('indexHelp', JavaExec) { tasks.register('indexHelp', JavaExec) {
group "private" group = "private"
description "indexes the helps files for this module. [gradle/helpProject.gradle]" description = "indexes the helps files for this module. [gradle/helpProject.gradle]"
File helpRootDir = file('src/main/help/help') File helpRootDir = file('src/main/help/help')
File outputFile = file("build/help/main/help/${project.name}_JavaHelpSearch") 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 // Task for building Markdown in src/global/docs to HTML
// - the files generated will be placed in a build directory usable during development mode // - the files generated will be placed in a build directory usable during development mode
tasks.register('buildGlobalMarkdown') { tasks.register('buildGlobalMarkdown') {
group "private" group = "private"
dependsOn ':MarkdownSupport:classes' dependsOn ':MarkdownSupport:classes'
FileTree markdownFiles = this.project.fileTree('src/global/docs') { FileTree markdownFiles = this.project.fileTree('src/global/docs') {
@ -298,15 +298,17 @@ tasks.register('buildGlobalMarkdown') {
inputs.files markdownFiles inputs.files markdownFiles
def markdownProject = project(':MarkdownSupport')
doFirst { doFirst {
markdownFiles.each { f -> markdownFiles.each { f ->
def htmlName = f.name[0..-3] + "html" def htmlName = f.name[0..-3] + "html"
javaexec { providers.javaexec {
classpath = project(':MarkdownSupport').sourceSets.main.runtimeClasspath classpath = markdownProject.sourceSets.main.runtimeClasspath
mainClass = 'ghidra.markdown.MarkdownToHtml' mainClass = 'ghidra.markdown.MarkdownToHtml'
args f args f
args file("build/src/global/docs/${htmlName}") args file("build/src/global/docs/${htmlName}")
} }.result.get()
} }
} }
} }
@ -320,7 +322,7 @@ tasks.register('buildGlobalMarkdown') {
// - the <Module>-help.jar file in development mode // - the <Module>-help.jar file in development mode
tasks.register('buildHelpFiles', JavaExec) { tasks.register('buildHelpFiles', JavaExec) {
group "private" group = "private"
dependsOn 'indexHelp' dependsOn 'indexHelp'
@ -423,12 +425,12 @@ tasks.register('buildHelpFiles', JavaExec) {
*/ */
tasks.register('buildHelp', Jar) { tasks.register('buildHelp', Jar) {
group rootProject.GHIDRA_GROUP group = rootProject.GHIDRA_GROUP
description " Builds the help for this module. [gradle/helpProject.gradle]\n" description = " Builds the help for this module. [gradle/helpProject.gradle]\n"
dependsOn tasks.named('buildHelpFiles') dependsOn tasks.named('buildHelpFiles')
dependsOn tasks.named('buildGlobalMarkdown') dependsOn tasks.named('buildGlobalMarkdown')
duplicatesStrategy 'exclude' duplicatesStrategy = 'exclude'
from "build/help/main" // include the generated help and index files from "build/help/main" // include the generated help and index files
from "src/main/help" // include the help source 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 // Task for finding unused images that are not referenced from Ghidra help files
tasks.register('findUnusedHelp', JavaExec) { tasks.register('findUnusedHelp', JavaExec) {
group "private" group = "private"
description " Finds unused help images for this module. [gradle/helpProject.gradle]\n" description = " Finds unused help images for this module. [gradle/helpProject.gradle]\n"
File helpRootDir = file('src/main/help/help') File helpRootDir = file('src/main/help/help')
inputs.dir helpRootDir inputs.dir helpRootDir
@ -465,7 +467,7 @@ tasks.register('findUnusedHelp', JavaExec) {
// include the help into the module's jar // include the help into the module's jar
jar { jar {
duplicatesStrategy 'exclude' duplicatesStrategy = 'exclude'
from "build/help/main" // include the generated help and index files from "build/help/main" // include the generated help and index files
from "src/main/help" // include the help source files from "src/main/help" // include the help source files
} }

View file

@ -25,7 +25,7 @@
test { t -> test { t ->
forkEvery 1 forkEvery = 1
initTestJVM(t, rootProject.ext.testRootDirName) initTestJVM(t, rootProject.ext.testRootDirName)
// WARNING! WATCH OUT !! // WARNING! WATCH OUT !!
@ -52,7 +52,7 @@ test { t ->
} }
task integrationTest (type: Test) { t -> task integrationTest (type: Test) { t ->
group "test" group = "test"
dependsOn { project(":FunctionID").unpackFidDatabases } dependsOn { project(":FunctionID").unpackFidDatabases }
testClassesDirs = files sourceSets.integrationTest.output.classesDirs testClassesDirs = files sourceSets.integrationTest.output.classesDirs
@ -63,7 +63,7 @@ task integrationTest (type: Test) { t ->
excludes = ['**/*Suite*'] excludes = ['**/*Suite*']
// Enable if you want to force Gradle to launch a new JVM for each test. // Enable if you want to force Gradle to launch a new JVM for each test.
forkEvery 1 forkEvery = 1
initTestJVM(t, rootProject.ext.testRootDirName) initTestJVM(t, rootProject.ext.testRootDirName)
@ -76,13 +76,13 @@ task integrationTest (type: Test) { t ->
} }
task pcodeTest (type: Test) { t -> task pcodeTest (type: Test) { t ->
group "pcodeTest" group = "pcodeTest"
dependsOn { project(":FunctionID").unpackFidDatabases } dependsOn { project(":FunctionID").unpackFidDatabases }
testClassesDirs = files sourceSets.pcodeTest.output.classesDirs testClassesDirs = files sourceSets.pcodeTest.output.classesDirs
classpath = sourceSets.pcodeTest.runtimeClasspath classpath = sourceSets.pcodeTest.runtimeClasspath
// Enable if you want to force Gradle to launch a new JVM for each test. // Enable if you want to force Gradle to launch a new JVM for each test.
forkEvery 1 forkEvery = 1
initTestJVM(t, rootProject.ext.pcodeTestRootDirName) initTestJVM(t, rootProject.ext.pcodeTestRootDirName)
@ -130,7 +130,7 @@ def initTestJVM(Task task, String rootDirName) {
mkdir testOutputDir mkdir testOutputDir
} }
// If false, testing will halt when an error is found. // 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. // If false, then tests are re-run every time, even if no code has changed.
task.outputs.upToDateWhen {false} task.outputs.upToDateWhen {false}
@ -139,8 +139,8 @@ def initTestJVM(Task task, String rootDirName) {
task.testLogging.showStandardStreams = true task.testLogging.showStandardStreams = true
// Min/Max heap size. These are passed in. // Min/Max heap size. These are passed in.
task.minHeapSize xms task.minHeapSize = xms
task.maxHeapSize xmx task.maxHeapSize = xmx
task.doFirst { task.doFirst {
task.jvmArgs '-DupgradeProgramErrorMessage=' + upgradeProgramErrorMessage, task.jvmArgs '-DupgradeProgramErrorMessage=' + upgradeProgramErrorMessage,

View file

@ -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.
@ -123,10 +123,14 @@ clean {
*****************************************************************************************/ *****************************************************************************************/
task writeSleighDevBuild { task writeSleighDevBuild {
def templateFilePath = project(':BuildFiles').projectDir.toString() + "/sleighDevBuild.template" def templateFilePath = project(':BuildFiles').projectDir.toString() + "/sleighDevBuild.template"
def softwareModelingProject = project(':SoftwareModeling')
doLast { doLast {
// Generate build.xml with injected classpath for running sleigh compiler // 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 { copy {
into "data" into "data"
from (templateFilePath) { from (templateFilePath) {
@ -160,7 +164,7 @@ rootProject.assembleDistribution {
task sleighCompile (type: JavaExec) { task sleighCompile (type: JavaExec) {
dependsOn saveSleighArgs dependsOn saveSleighArgs
group = rootProject.GHIDRA_GROUP 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 // define standard parameters for JavaExec
classpath configurations.sleighConfig classpath configurations.sleighConfig
@ -195,8 +199,8 @@ rootProject.allSleighCompile.dependsOn sleighCompile
* *
*****************************************************************************************/ *****************************************************************************************/
task cleanSleigh { task cleanSleigh {
group rootProject.GHIDRA_GROUP group = rootProject.GHIDRA_GROUP
description "Removes all the compile sleigh language files (*.sla). [gradle/processorProject.gradle]\n" description = "Removes all the compile sleigh language files (*.sla). [gradle/processorProject.gradle]\n"
doLast { doLast {
def deleteTree = fileTree(dir: "data/languages", include: "*.sla") def deleteTree = fileTree(dir: "data/languages", include: "*.sla")
deleteTree.each { File file -> deleteTree.each { File file ->

View file

@ -60,8 +60,6 @@ ext.ghidraPath = files()
* string will be returned. * string will be returned.
*/ */
def getGitRev(repoPath) { def getGitRev(repoPath) {
println("getting git commit for $repoPath")
// If the path doesn't exist, the exec command will fail before it can // 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. // 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 // 'ignoreExitValue' attribute only applies to the return value of the
// command being executed (eg: git); it doesn't apply to the return value of // command being executed (eg: git); it doesn't apply to the return value of
// the exec command itself. // the exec command itself.
def stdout = new ByteArrayOutputStream()
try { try {
exec { def stdout = providers.exec {
ignoreExitValue = true ignoreExitValue = true
workingDir repoPath workingDir repoPath
commandLine 'git', 'rev-parse', 'HEAD' commandLine 'git', 'rev-parse', 'HEAD'
standardOutput = stdout }.standardOutput.asText.get().trim()
}
return stdout
} }
catch (Exception e) { catch (Exception e) {
println("ERROR: gradle exec failed to run 'git rev-parse': is git installed on this system?") 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') { 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. // 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 // 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 // Must add classpath for main and test source sets. Javadoc will fail if it cannot
// find referenced classes. // find referenced classes.
classpath = rootProject.ext.ghidraPath classpath = rootProject.ext.ghidraPath
// generate documentation using html5 // generate documentation using html5
options.addBooleanOption("html5", true) options.addBooleanOption("html5", true)
@ -158,17 +153,17 @@ dependencies {
task createJsondocs(type: Javadoc, description: 'Generate JSON docs for all projects', group: 'Documentation') { task createJsondocs(type: Javadoc, description: 'Generate JSON docs for all projects', group: 'Documentation') {
group 'private' group = 'private'
String ROOT_PROJECT_DIR = rootProject.projectDir.toString() 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 // Must add classpath for main and test source sets. Javadoc will fail if it cannot
// find referenced classes. // find referenced classes.
classpath = rootProject.ext.ghidraPath classpath = rootProject.ext.ghidraPath
// the "source" property must be set in individual project's build.gradle files. // 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 // 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') { task createPythonTypeStubs(type: Javadoc, description: 'Generate pyi stubs for all projects', group: 'Documentation') {
group 'private' group = 'private'
String ROOT_PROJECT_DIR = rootProject.projectDir.toString() 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 // Must add classpath for main and test source sets. Javadoc will fail if it cannot
// find referenced classes. // 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 // Generate at package level because user may try to get help directly on an object they have
// rather than its public interface. // rather than its public interface.
@ -231,8 +225,8 @@ task createPythonTypeStubs(type: Javadoc, description: 'Generate pyi stubs for a
task createGhidraStubsWheel { task createGhidraStubsWheel {
group 'private' group = 'private'
description "Creates the ghidra-stubs wheel for the Ghidra api. [gradle/root/distribution.gradle]" description = "Creates the ghidra-stubs wheel for the Ghidra api. [gradle/root/distribution.gradle]"
dependsOn("createPythonTypeStubs") dependsOn("createPythonTypeStubs")
@ -240,6 +234,9 @@ task createGhidraStubsWheel {
def distDir = file("${typestubsDir}/dist").getAbsolutePath() def distDir = file("${typestubsDir}/dist").getAbsolutePath()
it.outputs.file("${distDir}/ghidra_stubs-${project.version}-py3-none-any.whl") it.outputs.file("${distDir}/ghidra_stubs-${project.version}-py3-none-any.whl")
def p = project
def debuggerRmiTraceProject = project(":Debugger-rmi-trace")
doFirst { doFirst {
copy { copy {
@ -258,7 +255,7 @@ task createGhidraStubsWheel {
[project] [project]
name = "ghidra-stubs" name = "ghidra-stubs"
version = "${project.version}" version = "${p.version}"
classifiers = [ classifiers = [
"License :: OSI Approved :: Apache Software License", "License :: OSI Approved :: Apache Software License",
"Typing :: Stubs Only", "Typing :: Stubs Only",
@ -268,17 +265,21 @@ task createGhidraStubsWheel {
} }
doLast { doLast {
File setuptools = project(":Debugger-rmi-trace").findPyDep(".") File setuptools = debuggerRmiTraceProject.findPyDep(".")
if (PYTHON3 == null) { if (PYTHON3 == null) {
throw new GradleException("A supported version of Python [${PYTHON_SUPPORTED}] was not found!") throw new GradleException("A supported version of Python [${PYTHON_SUPPORTED}] was not found!")
} }
exec { def exec = providers.exec {
workingDir { typestubsDir } workingDir { typestubsDir }
ignoreExitValue = true
commandLine PYTHON3 commandLine PYTHON3
args "-m", "pip", "wheel", "-w", distDir, "--no-index", "-f", setuptools, "." 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) { task zipJavadocs(type: Zip) {
group 'private' group = 'private'
archiveFileName = 'GhidraAPI_javadoc.zip' archiveFileName = 'GhidraAPI_javadoc.zip'
destinationDirectory = file(rootProject.projectDir.toString() + "/build/tmp") destinationDirectory = file(rootProject.projectDir.toString() + "/build/tmp")
@ -304,7 +305,7 @@ task zipJavadocs(type: Zip) {
into "api" 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 // every other time it is run even though in both cases the output directory has been removed
outputs.upToDateWhen {false} outputs.upToDateWhen {false}
group 'private' group = 'private'
description "Copies core files/folders to the distribution location." description = "Copies core files/folders to the distribution location."
destinationDir file(DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX) destinationDir = file(DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX)
// Make sure that we don't try to copy the same file with the same path. // 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.manifest"
exclude "**/certification.local.manifest" exclude "**/certification.local.manifest"
@ -485,13 +486,13 @@ project.PLATFORMS.each { platform ->
delete rootProject.file("build/tmp/expandedArchives") delete rootProject.file("build/tmp/expandedArchives")
group 'private' group = 'private'
description "Copies the platform-dependent files/folders to the distribution location." description = "Copies the platform-dependent files/folders to the distribution location."
destinationDir file(DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX) 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 // Make sure that we don't try to copy the same file with the same path into the
// zip (this can happen!) // zip (this can happen!)
duplicatesStrategy 'exclude' duplicatesStrategy = 'exclude'
} }
} }
@ -501,9 +502,9 @@ project.PLATFORMS.each { platform ->
* *
**********************************************************************************/ **********************************************************************************/
task assembleSource (type: Copy) { task assembleSource (type: Copy) {
group 'private' group = 'private'
description "Copies source zips for all core projects to the distribution folder" description = "Copies source zips for all core projects to the distribution folder"
destinationDir DISTRIBUTION_DIR destinationDir = DISTRIBUTION_DIR
} }
@ -513,23 +514,25 @@ task assembleSource (type: Copy) {
* *
************************************************************************************/ ************************************************************************************/
task assembleMarkdownToHtml (type: Copy) { task assembleMarkdownToHtml (type: Copy) {
group 'private' group = 'private'
description "Copies a markdown file and a generaterated html file into the distribution folder" description = "Copies a markdown file and a generaterated html file into the distribution folder"
dependsOn ':MarkdownSupport:classes' dependsOn ':MarkdownSupport:classes'
outputs.upToDateWhen {false} 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 -> eachFile { f ->
def htmlName = f.sourceName[0..-3] + "html" def htmlName = f.sourceName[0..-3] + "html"
def htmlPath = f.relativePath.replaceLastName(htmlName).pathString def htmlPath = f.relativePath.replaceLastName(htmlName).pathString
javaexec { providers.javaexec {
classpath = project(':MarkdownSupport').sourceSets.main.runtimeClasspath classpath = markdownSuppportProject.sourceSets.main.runtimeClasspath
mainClass = 'ghidra.markdown.MarkdownToHtml' mainClass = 'ghidra.markdown.MarkdownToHtml'
args f.file args f.file
args file("${destinationDir.path}/${htmlPath}") args file("${destinationDir.path}/${htmlPath}")
} }.result.get()
} }
} }
@ -540,15 +543,15 @@ task assembleMarkdownToHtml (type: Copy) {
**********************************************************************************/ **********************************************************************************/
task createExternalExtensions(type: Copy) { task createExternalExtensions(type: Copy) {
group 'private' group = 'private'
description "Creates directory of extensions that are external to the installation zip (does not clean up artifacts) [gradle/root/distribution.gradle]" description = "Creates directory of extensions that are external to the installation zip (does not clean up artifacts) [gradle/root/distribution.gradle]"
dependsOn assembleSource 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. // 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() { task assembleAll() {
group 'private' group = 'private'
description "Assembles all targets to one installation directory (does not clean up artifacts) [gradle/root/distribution.gradle]" description = "Assembles all targets to one installation directory (does not clean up artifacts) [gradle/root/distribution.gradle]"
dependsOn assembleDistribution dependsOn assembleDistribution
dependsOn assembleSource dependsOn assembleSource
@ -645,8 +648,8 @@ task assembleAll() {
**********************************************************************************/ **********************************************************************************/
task createInstallationZip(type: Zip) { t -> task createInstallationZip(type: Zip) { t ->
group 'private' group = 'private'
description "Creates local installation zip (does not clean up artifacts) [gradle/root/distribution.gradle]" description = "Creates local installation zip (does not clean up artifacts) [gradle/root/distribution.gradle]"
dependsOn assembleAll dependsOn assembleAll
@ -659,7 +662,7 @@ task createInstallationZip(type: Zip) { t ->
destinationDirectory = DISTRIBUTION_DIR destinationDirectory = DISTRIBUTION_DIR
// Make sure that we don't try to copy the same file with the same path. // 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) { from (DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX) {
into ZIP_DIR_PREFIX into ZIP_DIR_PREFIX
@ -677,7 +680,7 @@ task createInstallationZip(type: Zip) { t ->
* *
**********************************************************************************/ **********************************************************************************/
task buildGhidra() { 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")) { if (project.hasProperty("externalExtensions")) {
dependsOn createExternalExtensions dependsOn createExternalExtensions

View file

@ -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.
@ -20,8 +20,8 @@
*******************************************************************************************/ *******************************************************************************************/
task prepDev { task prepDev {
group rootProject.GHIDRA_GROUP group = rootProject.GHIDRA_GROUP
description " Prepares a fresh clone of Ghidra for developing in eclipse. [gradle/root/prepDev.gradle]\n" 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 // the GhidraLauncher depends on this file to build the classpath in dev mode
dependsOn { generateLibraryDependencyMapping } dependsOn { generateLibraryDependencyMapping }

View file

@ -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.
@ -29,8 +29,8 @@
* *
*********************************************************************************/ *********************************************************************************/
task rasterizeSvg(type: JavaExec) { task rasterizeSvg(type: JavaExec) {
group rootProject.GHIDRA_GROUP group = rootProject.GHIDRA_GROUP
description " Converts .svg files to .png files. [gradle/root/svg.gradle]\n" description = " Converts .svg files to .png files. [gradle/root/svg.gradle]\n"
subprojects { p -> subprojects { p ->

View file

@ -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.
@ -368,7 +368,7 @@ def initTestJVM(Task task, String rootDirName) {
* *
*********************************************************************************/ *********************************************************************************/
task parallelCombinedTestReport(type: TestReport) { t -> task parallelCombinedTestReport(type: TestReport) { t ->
group "test" group = "test"
destinationDirectory = file("$reportDir") destinationDirectory = file("$reportDir")
logger.debug("parallelCombinedTestReport: Using destinationDir = $reportDir") logger.debug("parallelCombinedTestReport: Using destinationDir = $reportDir")
dependsOn ":deleteTestTempAndReportDirs" dependsOn ":deleteTestTempAndReportDirs"
@ -383,8 +383,8 @@ task parallelCombinedTestReport(type: TestReport) { t ->
* *
*********************************************************************************/ *********************************************************************************/
task unitTestReport(type: TestReport) { t -> task unitTestReport(type: TestReport) { t ->
group "test" group = "test"
description "Run unit tests and save HTML report." description = "Run unit tests and save HTML report."
destinationDirectory = file("$reportDir/unitTests") destinationDirectory = file("$reportDir/unitTests")
outputs.upToDateWhen {false} outputs.upToDateWhen {false}
} }
@ -396,8 +396,8 @@ task unitTestReport(type: TestReport) { t ->
* *
*********************************************************************************/ *********************************************************************************/
task integrationTestReport(type: TestReport) { t -> task integrationTestReport(type: TestReport) { t ->
group "test" group = "test"
description "Run integration tests and save HTML report." description = "Run integration tests and save HTML report."
destinationDirectory = file("$reportDir/integrationTests") destinationDirectory = file("$reportDir/integrationTests")
outputs.upToDateWhen {false} outputs.upToDateWhen {false}
} }
@ -414,8 +414,8 @@ task integrationTestReport(type: TestReport) { t ->
* *
*********************************************************************************/ *********************************************************************************/
task targetedTestReport(type: TestReport) { t -> task targetedTestReport(type: TestReport) { t ->
group "test" group = "test"
description "Run unit tests against a specific set of projects." description = "Run unit tests against a specific set of projects."
destinationDirectory = file("$reportDir/unitTests") destinationDirectory = file("$reportDir/unitTests")
outputs.upToDateWhen {false} outputs.upToDateWhen {false}
dependsOn ":deleteTestTempAndReportDirs" dependsOn ":deleteTestTempAndReportDirs"
@ -451,7 +451,7 @@ def createTestTask(Project subproject, String testType, String bucketName, int t
int classesListPosition, int numMaxParallelForks) { int classesListPosition, int numMaxParallelForks) {
subproject.task(testType+"_$taskNameCounter"+"_$bucketName", type: Test) { t -> subproject.task(testType+"_$taskNameCounter"+"_$bucketName", type: Test) { t ->
group "test" group = "test"
testClassesDirs = files subproject.sourceSets["$testType"].output.classesDirs testClassesDirs = files subproject.sourceSets["$testType"].output.classesDirs
classpath = subproject.sourceSets["$testType"].runtimeClasspath classpath = subproject.sourceSets["$testType"].runtimeClasspath
@ -559,7 +559,7 @@ configure(subprojects.findAll {parallelMode == true}) { subproject ->
* *
*********************************************************************************/ *********************************************************************************/
task combinedTestReport(type: TestReport) { t -> task combinedTestReport(type: TestReport) { t ->
group "test" group = "test"
destinationDirectory = file("$reportDir") destinationDirectory = file("$reportDir")
dependsOn ":deleteTestTempAndReportDirs" dependsOn ":deleteTestTempAndReportDirs"
@ -573,7 +573,7 @@ task combinedTestReport(type: TestReport) { t ->
* *
*********************************************************************************/ *********************************************************************************/
task pcodeTestReport(type: TestReport) { t -> task pcodeTestReport(type: TestReport) { t ->
group "pcodeTest" group = "pcodeTest"
destinationDirectory = file("$pcodeTestShareDir" + "/reports") destinationDirectory = file("$pcodeTestShareDir" + "/reports")
} }
@ -585,7 +585,7 @@ task pcodeTestReport(type: TestReport) { t ->
* *
*********************************************************************************/ *********************************************************************************/
task pcodeConsolidatedTestReport(type: Copy) { task pcodeConsolidatedTestReport(type: Copy) {
group "pcodeTest" group = "pcodeTest"
dependsOn ':pcodeTestReport' dependsOn ':pcodeTestReport'
into (pcodeTestShareDir + "/reports") into (pcodeTestShareDir + "/reports")
from (testOutputDir + "/test-output") { from (testOutputDir + "/test-output") {

View file

@ -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.
@ -24,14 +24,14 @@ plugins.withType(JavaPlugin) {
task zipSourceSubproject (type: Zip) { t -> task zipSourceSubproject (type: Zip) { t ->
// Define some metadata about the zip (name, location, version, etc....) // Define some metadata about the zip (name, location, version, etc....)
t.group 'private' t.group = 'private'
t.description "Creates the source zips for java modules" t.description = "Creates the source zips for java modules"
t.archiveFileName = project.name + "-src.zip" t.archiveFileName = project.name + "-src.zip"
t.destinationDirectory = file(projectDir.path + "/build/tmp/src") 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 // 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 // task is being executed multiple times, and sourceSets.main.java contains the
// correct elements. Whatever the cause, this fixes the problem. // correct elements. Whatever the cause, this fixes the problem.
duplicatesStrategy 'exclude' duplicatesStrategy = 'exclude'
from sourceSets.main.java from sourceSets.main.java
} }

View file

@ -20,14 +20,14 @@ task zipExtensions (type: Zip) {
def p = this.project def p = this.project
it.group 'private' it.group = 'private'
it.description "Creates a zip file for an extension module. [gradle/support/extensionCommon.gradle]" 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.archiveFileName = "${rootProject.ext.ZIP_NAME_PREFIX}_${p.name}.zip"
it.destinationDirectory = rootProject.ext.DISTRIBUTION_DIR it.destinationDirectory = rootProject.ext.DISTRIBUTION_DIR
// Make sure that we don't try to copy the same file with the same path into the // Make sure that we don't try to copy the same file with the same path into the
// zip (this can happen!) // zip (this can happen!)
duplicatesStrategy 'exclude' duplicatesStrategy = 'exclude'
// Exclude any files that contain "delete.me" in the path; this is a convention we used // Exclude any files that contain "delete.me" in the path; this is a convention we used
// at one time that should be removed. // at one time that should be removed.

View file

@ -31,23 +31,25 @@
/********************************************************************************* /*********************************************************************************
* Defines the main ip task for each subproject * Defines the main ip task for each subproject
*********************************************************************************/ *********************************************************************************/
task ip { task ip {
def p = project
doLast { doLast {
// scans all the files in the module, reads ip from header, verifies ip, and creates mapping // 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 // 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 // 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. // adds the ip info from the Module.manifest file to the map generated from scanning the module files.
addModuleManifestIp(ipToFileMap, moduleManifestIpMap) addModuleManifestIp(ipToFileMap, moduleManifestIpMap)
// writes the LICENSE.txt file for the module // writes the LICENSE.txt file for the module
writeLicenseInfo(project, ipToFileMap) writeLicenseInfo(p, ipToFileMap)
} }
} }
rootProject.assembleDistribution.dependsOn ip rootProject.assembleDistribution.dependsOn ip
@ -177,6 +179,7 @@ def isCSourceFile(File file) {
return filename.endsWith(".java") || return filename.endsWith(".java") ||
filename.endsWith(".c") || filename.endsWith(".c") ||
filename.endsWith(".gradle") || filename.endsWith(".gradle") ||
filename.endsWith(".gradle.kts") ||
filename.endsWith(".groovy") || filename.endsWith(".groovy") ||
filename.endsWith(".cpp") || filename.endsWith(".cpp") ||
filename.endsWith(".cc") || filename.endsWith(".cc") ||