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

Improve upToDate check for installLiberty #826

Merged
merged 1 commit into from
May 31, 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2014, 2021.
* (C) Copyright IBM Corporation 2014, 2023.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,7 +50,9 @@ class InstallLibertyTask extends AbstractLibertyTask {
group 'Liberty'
})
outputs.upToDateWhen {
getInstallDir(project).exists() && project.buildDir.exists() && new File(project.buildDir, 'liberty-plugin-config.xml').exists()
// ensure a Liberty installation exists at the install directory
getInstallDir(project).exists() && new File(getInstallDir(project), 'lib/ws-launch.jar').exists() &&
project.buildDir.exists() && new File(project.buildDir, 'liberty-plugin-config.xml').exists()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class InstallLiberty_runtimeDep_upToDate_Test extends AbstractIntegrationTest{
static File resourceDir = new File("build/resources/test/liberty-test")
static File buildDir = new File(integTestDir, "/InstallLiberty_upToDate_Test")
static String runTimeDep_UpToDate_buildFilename = "installLiberty_upToDate_runtimeDep_Test.gradle"
static File wsLaunchJar = new File(buildDir, "build/wlp/lib/ws-launch.jar")

@BeforeClass
public static void setup() {
Expand All @@ -41,7 +42,18 @@ class InstallLiberty_runtimeDep_upToDate_Test extends AbstractIntegrationTest{

@Test
public void test_installLiberty_upToDate() {
// same version as installed in the setup method, so upToDate check should return true
assert runTaskCheckForUpToDate(buildDir, 'installLiberty', "-PlibertyVersion=21.0.0.1")

// changing the libertyVersion causes the upToDate check to return false
assertFalse runTaskCheckForUpToDate(buildDir, 'installLiberty', "-PlibertyVersion=21.0.0.2")

// verify upToDate check returns true for same libertyVersion
assert runTaskCheckForUpToDate(buildDir, 'installLiberty', "-PlibertyVersion=21.0.0.2")

// now delete the ws-launch.jar from the installation and ensure the upToDate check returns false even though the libertyVersion did not change
wsLaunchJar.delete()
assertFalse runTaskCheckForUpToDate(buildDir, 'installLiberty', "-PlibertyVersion=21.0.0.2")

}
}