mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-24 21:21:56 +00:00
67 lines
2.7 KiB
Groovy
67 lines
2.7 KiB
Groovy
/* ###
|
|
* 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.
|
|
*/
|
|
/**************************************************************************************
|
|
* Method to add a single project to this gradle build.
|
|
*
|
|
* Param name: The name of the project.
|
|
* Param path: The path relative to the root project directory
|
|
* Param mustExist: True if the project directory must exist for the project to be included
|
|
* (ex: devtools exists pre-extraction but not post-extraction but still
|
|
* must be created for gradle to compile)
|
|
*
|
|
*
|
|
* Example: if name is 'Utility' and path is "Ghidra/Framework', then this is equal to
|
|
*
|
|
* include 'Utility'
|
|
* project(":Utility").projectDir = new File(rootProject.projectDir, "Ghidra/Framework/Utility")
|
|
*
|
|
* NOTE: if the project name is in the excludeProjects set, then that project will be skipped.
|
|
*
|
|
**************************************************************************************/
|
|
ext.includeProject = { name, path, mustExist ->
|
|
includeProjectNamed(name, name, path, mustExist);
|
|
}
|
|
|
|
ext.includeProjectNamed = { name, dirName, path, mustExist ->
|
|
File projectDir = new File(rootProject.projectDir, "$path/$dirName")
|
|
if (projectDir.exists() || mustExist) {
|
|
include name;
|
|
project(":$name").projectDir = projectDir;
|
|
}
|
|
}
|
|
|
|
/**************************************************************************************
|
|
* Method to add all projects in a single directory to this gradle build. It looks
|
|
* for all the directories (one leve down only) under the given path that contain a build.gradle
|
|
* file. Then for each of those, it call includeProject() to include that project.
|
|
*
|
|
* Param path: The path relative to the root project directory
|
|
*
|
|
* Example: if path is 'Ghidra/Framework', it will create projects for Utility, Generic, DB, etc.
|
|
*
|
|
**************************************************************************************/
|
|
ext.includeProjects = { path ->
|
|
|
|
FileTree fileTree = fileTree(rootProject.projectDir.absolutePath + "/" + path) {
|
|
include '*/build.gradle'
|
|
}
|
|
|
|
fileTree.each { gradleBuildFile ->
|
|
String projectName = gradleBuildFile.parentFile.name
|
|
includeProject(projectName, path, true);
|
|
}
|
|
}
|