GP-2677: Fix and enable tests

This commit is contained in:
Dan 2023-08-04 14:29:45 -04:00 committed by Ryan Kurtz
parent 689064b590
commit 75677b729f
31 changed files with 236 additions and 274 deletions

View file

@ -13,74 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
configurations {
pypkgInstall
}
task assemblePyPackage(type: Copy) {
from "src/main/py"
into "build/pypkg/"
}
def getGdbPython() {
def out = new ByteArrayOutputStream()
exec {
commandLine "gdb", "--batch"
args "-ex", "python import sys"
args "-ex", "python print(f'python{sys.version_info.major}.{sys.version_info.minor}')"
standardOutput = out
}
return "$out".strip()
}
def getLldbPython() {
def out = new ByteArrayOutputStream()
exec {
commandLine "lldb", "--batch"
args "-ex", "python import sys"
args "-ex", "python print(f'python{sys.version_info.major}.{sys.version_info.minor}')"
standardOutput = out
}
return "$out".strip()
}
task configureBuildPyPackage {
doLast {
def gdbPython = getGdbPython()
buildPyPackage.commandLine gdbPython, "-m", "build"
}
}
task buildPyPackage(type: Exec) {
dependsOn(configureBuildPyPackage)
ext.dist = { file("build/pypkg/dist") }
inputs.files(assemblePyPackage)
outputs.dir(dist)
workingDir { "build/pypkg" }
}
task configureInstallPyPackage {
dependsOn(configurations.pypkgInstall)
doLast {
def gdbPython = getGdbPython()
installPyPackage.commandLine gdbPython, "-m", "pip", "install", "--force-reinstall"
installPyPackage.args configurations.pypkgInstall.filter { f -> !f.name.endsWith(".jar") }
installPyPackage.args file("build/pypkg")
}
}
task installPyPackage(type: Exec) {
dependsOn(configureInstallPyPackage)
inputs.files(assemblePyPackage)
}
task phonyJarPyPackage(type: Jar) {
dependsOn(assemblePyPackage)
}
afterEvaluate {
artifacts {
pypkgInstall file("build/pypkg")
pypkgInstall phonyJarPyPackage
}
commandLine "python", "-m", "build"
}