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

Add installDir project property detection #651

Merged
merged 5 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 6 additions & 1 deletion src/main/groovy/io/openliberty/tools/gradle/Liberty.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ class Liberty implements Plugin<Project> {
}

private static File getInstallDir(Project project) {
if (project.liberty.installDir == null) {
if (project.hasProperty('liberty.installDir')) {
dshimo marked this conversation as resolved.
Show resolved Hide resolved
File installDirPropertyFile = new File(project.projectDir, project.getProperties().get('liberty.installDir'))
project.getLogger().info(MessageFormat.format("installDir project property detected. Using {0}.", installDirPropertyFile.getCanonicalPath()))
return installDirPropertyFile
} else if (project.liberty.installDir == null) {
if (project.liberty.baseDir == null) {
return new File(project.buildDir, 'wlp')
} else {
Expand All @@ -192,4 +196,5 @@ class Liberty implements Plugin<Project> {
return new File(installDir, 'wlp').toString()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,16 @@ class InstallLiberty_installDir_missing_wlp_Test extends AbstractIntegrationTest
String output = result.getOutput()
assert output.contains("path does not reference a wlp folder") : "Expected warning about installDir path not containing wlp"
}

@Test
void test_installLiberty_installDir__cli_property() {
BuildResult result = GradleRunner.create()
.withProjectDir(buildDir)
.forwardOutput()
.withArguments('installLiberty', '-Pliberty.installDir=installDir-valid-install/build/wlp', '-i', '-s')
dshimo marked this conversation as resolved.
Show resolved Hide resolved
.build()

String output = result.getOutput()
assert output.contains("installDir project property detected")
}
}