Skip to content

Commit

Permalink
improve gradle build script
Browse files Browse the repository at this point in the history
  • Loading branch information
xunliu committed Apr 3, 2024
1 parent 411b40c commit dae2848
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
10 changes: 10 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ licenseReport {
repositories { mavenCentral() }

allprojects {
// Gravitino Python client project didn't need to apply the Spotless plugin
if (project.name == "client-python") {
return@allprojects
}

apply(plugin = "com.diffplug.spotless")
repositories {
mavenCentral()
Expand Down Expand Up @@ -218,6 +223,11 @@ dependencies {
}

subprojects {
// Gravitino Python client project didn't need to apply the java plugin
if (project.name == "client-python") {
return@subprojects
}

apply(plugin = "jacoco")
apply(plugin = "maven-publish")
apply(plugin = "java")
Expand Down
25 changes: 3 additions & 22 deletions clients/client-python/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,22 @@ fun deleteCacheDir(targetDir: String) {
}

tasks {
register<VenvTask>("condaInfo") {
venvExec = "conda"
args = listOf("info")
}

val pipInstall by registering(VenvTask::class) {
venvExec = "pip"
args = listOf("install", "-e", ".")
}

val runPyTests by registering(VenvTask::class) {
val test by registering(VenvTask::class) {
dependsOn(pipInstall)
venvExec = "python"
args = listOf("-m", "unittest")
workingDir = projectDir.resolve(".")
}

// https://github.com/datastrato/gravitino/issues/2770
// Improved Gradle Build Scripts for Python Module
compileTestJava {
dependsOn(runPyTests)
}

compileJava {
dependsOn(runPyTests)
}

test {
val skipPythonITs = project.hasProperty("skipPythonITs")
if (!skipPythonITs) {
dependsOn(runPyTests)
}
val build by registering(VenvTask::class) {
}

clean {
val clean by registering(Delete::class) {
delete("build")
delete("gravitino.egg-info")

Expand Down

0 comments on commit dae2848

Please sign in to comment.