Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngr: Fix Gradle test runner by only _conditionally_ invoking gradle wrapper #27

Merged
merged 3 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Dependencies (extras): Remove "ngr", add "notebook", link "test" to "testing"
- ngr: Gradle test runner failed to invoke `./gradlew install` because such a
target did not exist.
- ngr: Fix Gradle test runner by only conditionally invoking `gradle wrapper`

## 2023-11-06 v0.0.3
- ngr: Fix `contextlib.chdir` only available on Python 3.11 and newer
Expand Down
4 changes: 2 additions & 2 deletions pueblo/ngr/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
if self.has_pom_xml:
run_command("mvn install")
elif self.has_gradle_files:
if shutil.which("gradle"):
if not (self.path / "gradlew").exists():

Check warning on line 238 in pueblo/ngr/runner.py

View check run for this annotation

Codecov / codecov/patch

pueblo/ngr/runner.py#L238

Added line #L238 was not covered by tests
run_command("gradle wrapper")
else:
raise NotImplementedError("Unable to invoke target: install")
Expand All @@ -249,7 +249,7 @@
elif self.has_pom_xml:
run_command("mvn test")
elif self.has_gradle_files:
run_command("./gradlew check")
run_command("./gradlew check --info")

Check warning on line 252 in pueblo/ngr/runner.py

View check run for this annotation

Codecov / codecov/patch

pueblo/ngr/runner.py#L252

Added line #L252 was not covered by tests
else:
raise NotImplementedError("Unable to invoke target: test")

Expand Down
2 changes: 2 additions & 0 deletions tests/ngr/java-gradle-wrapper/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.gradle
/build
43 changes: 43 additions & 0 deletions tests/ngr/java-gradle-wrapper/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Test project for `pueblo.ngr`.
*/

buildscript {
repositories {
mavenCentral()
}
}

plugins {
id 'application'
id 'java'
}

repositories {
mavenCentral()
mavenLocal()
}

dependencies {
testImplementation 'junit:junit:4.13.2'
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

jar {
archiveBaseName = 'pyveci-ngr-testdrive'
archiveVersion = '0.0.1-SNAPSHOT'
}

application {
}

check {
}

processResources.destinationDir = compileJava.destinationDir
compileJava.dependsOn processResources
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
File renamed without changes.