mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
GP-0: Moving hasPythonPackage.gradle and hasProtobuf.gradle.
They are generic and non-debugger things want to use them.
This commit is contained in:
parent
29ff4609ca
commit
4c7c6015d9
8 changed files with 7 additions and 10 deletions
80
gradle/hasPythonPackage.gradle
Normal file
80
gradle/hasPythonPackage.gradle
Normal file
|
@ -0,0 +1,80 @@
|
|||
/* ###
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: Supported Python3 command is established by root project build.gradle
|
||||
*/
|
||||
|
||||
ext.findPyDep = { name ->
|
||||
File inDeps = file("${DEPS_DIR}/${project.name}/${name}")
|
||||
File inRepo = file("${BIN_REPO}/${getGhidraRelativePath(project)}/${name}")
|
||||
if (inDeps.exists()) {
|
||||
return inDeps
|
||||
}
|
||||
if (inRepo.exists()) {
|
||||
return inRepo
|
||||
}
|
||||
println("Warning: Could not find '${name}' for ${project.name}")
|
||||
return inDeps
|
||||
}
|
||||
|
||||
task assemblePyPackage(type: Copy) {
|
||||
from "src/main/py"
|
||||
into "build/pypkg/"
|
||||
}
|
||||
|
||||
task buildPyPackage {
|
||||
ext.dist = { file("build/pypkg/dist") }
|
||||
inputs.files(assemblePyPackage)
|
||||
outputs.dir(dist)
|
||||
|
||||
doLast {
|
||||
File setuptools = project(":Debugger-rmi-trace").findPyDep(".")
|
||||
exec {
|
||||
workingDir { "build/pypkg" }
|
||||
commandLine rootProject.PYTHON3, "-m", "pip"
|
||||
args "wheel", "-w", "dist/", "--no-index", "--no-deps"
|
||||
args "-f", setuptools
|
||||
args "."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// At the moment, any module with a python package also distributes it.
|
||||
// We can separate this into `distributePythonPackage` later, if necessary.
|
||||
|
||||
rootProject.assembleDistribution {
|
||||
dependsOn(buildPyPackage)
|
||||
def p = this.project
|
||||
def zipPath = getZipPath(p)
|
||||
from (p.assemblePyPackage) {
|
||||
exclude '**/*.pyc'
|
||||
exclude '**/*.pyo'
|
||||
exclude '**/__pycache__/**'
|
||||
exclude 'dist/*.tar.gz'
|
||||
into { zipPath + "/pypkg" }
|
||||
}
|
||||
}
|
||||
|
||||
ext.distributePyDep = { name ->
|
||||
File dep = findPyDep(name)
|
||||
def zipPath = getZipPath(project)
|
||||
rootProject.assembleDistribution {
|
||||
into ("${zipPath}/pypkg/dist") {
|
||||
from dep
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue