ghidra/Ghidra/Features/PyGhidra/build.gradle
2025-01-30 06:35:01 -05:00

111 lines
4.6 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.
*/
apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle"
apply from: "$rootProject.projectDir/gradle/javaProject.gradle"
apply from: "$rootProject.projectDir/gradle/helpProject.gradle"
apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle"
apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle"
apply from: "$rootProject.projectDir/gradle/javadoc.gradle"
apply from: "${rootProject.projectDir}/gradle/hasPythonPackage.gradle"
apply plugin: 'eclipse'
eclipse.project.name = 'Features PyGhidra'
dependencies {
api project(':Base')
}
// NOTE: The Python package is a "Pure Python" package. Building the wheel does not
// require any dependencies except setuptools. Installing the wheel will require
// the correct os/python version of Jpype and packaging. Installing the wheel does
// not require Ghidra.
distributePyDep("jpype1-1.5.2-cp313-cp313-win_amd64.whl")
distributePyDep("jpype1-1.5.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl")
distributePyDep("jpype1-1.5.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl")
distributePyDep("jpype1-1.5.2-cp313-cp313-macosx_10_13_universal2.whl")
distributePyDep("jpype1-1.5.2-cp312-cp312-win_amd64.whl")
distributePyDep("jpype1-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl")
distributePyDep("jpype1-1.5.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl")
distributePyDep("jpype1-1.5.2-cp312-cp312-macosx_10_9_universal2.whl")
distributePyDep("jpype1-1.5.2-cp311-cp311-win_amd64.whl")
distributePyDep("jpype1-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl")
distributePyDep("jpype1-1.5.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl")
distributePyDep("jpype1-1.5.2-cp311-cp311-macosx_10_9_universal2.whl")
distributePyDep("jpype1-1.5.2-cp310-cp310-win_amd64.whl")
distributePyDep("jpype1-1.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl")
distributePyDep("jpype1-1.5.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl")
distributePyDep("jpype1-1.5.2-cp310-cp310-macosx_10_9_universal2.whl")
distributePyDep("jpype1-1.5.2-cp39-cp39-win_amd64.whl")
distributePyDep("jpype1-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl")
distributePyDep("jpype1-1.5.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl")
distributePyDep("jpype1-1.5.2-cp39-cp39-macosx_10_9_x86_64.whl")
distributePyDep("jpype1-1.5.2.tar.gz")
distributePyDep("packaging-23.2-py3-none-any.whl")
distributePyDep("setuptools-68.0.0-py3-none-any.whl")
distributePyDep("wheel-0.37.1-py2.py3-none-any.whl")
// Install JPype into the development virtual environment
task installJPype(type: Exec) {
dependsOn(":createPythonVirtualEnvironment")
File depsDir = file("${DEPS_DIR}/PyGhidra")
File binRepoDir = file("${BIN_REPO}/ExternalPyWheels")
def dir = depsDir.exists() ? depsDir : binRepoDir
doFirst {
commandLine "$PYTHON3_VENV", "-m", "pip", "install", "--no-index", "-f", "$dir", "JPype1"
}
}
// Install ghidra-stubs into the development virtual environment
task installGhidraStubs(type: Exec) {
dependsOn(":createGhidraStubsWheel")
dependsOn(":createPythonVirtualEnvironment")
File depsDir = file("${DEPS_DIR}/PyGhidra")
File binRepoDir = file("${BIN_REPO}/ExternalPyWheels")
def dir = depsDir.exists() ? depsDir : binRepoDir
doFirst {
commandLine "$PYTHON3_VENV", "-m", "pip", "install", "--no-index", "-f", "${ROOT_PROJECT_DIR}/build/typestubs/dist", "ghidra-stubs"
}
}
// Prepares PyGhidra for development by installing it in editable mode to the development virtual
// environment
task prepPyGhidra(type: Exec) {
dependsOn("installJPype")
dependsOn("installGhidraStubs")
File depsDir = file("${DEPS_DIR}/PyGhidra")
File binRepoDir = file("${BIN_REPO}/ExternalPyWheels")
def dir = depsDir.exists() ? depsDir : binRepoDir
doFirst {
commandLine "$PYTHON3_VENV", "-m", "pip", "install", "-e", "src/main/py", "--no-index", "-f", "$dir"
}
}
rootProject.assembleMarkdownToHtml {
def p = this.project
def zipPath = getZipPath(p)
from ("${p.projectDir}/src/main/py/README.md") {
into { "${zipPath}/pypkg" }
}
}