From 8538e24ae7280888aa53e09aad5c75a38117b529 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 12 Feb 2025 11:32:24 +0530 Subject: [PATCH 1/4] changes to support variable resolution for predefined variables Signed-off-by: Arun Venmany --- .github/workflows/gradle.yml | 5 +++-- .../tools/gradle/tasks/AbstractServerTask.groovy | 5 +++-- .../io/openliberty/tools/gradle/tasks/DevTask.groovy | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 21e07bd3..25a26ca3 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -39,8 +39,9 @@ jobs: - name: Checkout ci.common uses: actions/checkout@v3 with: - repository: OpenLiberty/ci.common + repository: arunvenmany-ibm/ci.common path: ci.common + ref: variable_resolution_fix - name: Checkout ci.ant uses: actions/checkout@v3 with: @@ -124,7 +125,7 @@ jobs: - name: Clone ci.ant, ci.common, ci.gradle repos to C drive run: | cp -r D:/a/ci.gradle/ci.gradle C:/ci.gradle - git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common + git clone https://github.com/arunvenmany-ibm/ci.common.git --branch variable_resolution_fix --single-branch C:/ci.common git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant # Cache mvn/gradle packages - name: Cache Maven packages diff --git a/src/main/groovy/io/openliberty/tools/gradle/tasks/AbstractServerTask.groovy b/src/main/groovy/io/openliberty/tools/gradle/tasks/AbstractServerTask.groovy index 1a9e3b06..779e95ea 100644 --- a/src/main/groovy/io/openliberty/tools/gradle/tasks/AbstractServerTask.groovy +++ b/src/main/groovy/io/openliberty/tools/gradle/tasks/AbstractServerTask.groovy @@ -510,7 +510,7 @@ abstract class AbstractServerTask extends AbstractLibertyTask { if (scd == null || !scd.getOriginalServerXMLFile().getCanonicalPath().equals(serverXML.getCanonicalPath())) { try { - scd = new ServerConfigDocument(log, serverXML, getInstallDir(project), getUserDir(project), getServerDir(project)); + scd = new ServerConfigDocument(log, serverXML, getInstallDir(project), getUserDir(project), getServerDir(project), new File(getOutputDir(project), server.name)); } catch (PluginExecutionException e) { throw new GradleException(e.getMessage()); } @@ -1149,8 +1149,9 @@ abstract class AbstractServerTask extends AbstractLibertyTask { } File wlpInstallDir = getInstallDir(project) File wlpUserDir = getUserDir(project, wlpInstallDir) + File serverOutputDir= new File(getOutputDir(project), server.name) - return LibertyPropFilesUtility.getLibertyDirectoryPropertyFiles(new CommonLogger(project), wlpInstallDir, wlpUserDir, serverConfigDir) + return LibertyPropFilesUtility.getLibertyDirectoryPropertyFiles(new CommonLogger(project), wlpInstallDir, wlpUserDir, serverConfigDir, serverOutputDir) } // Return the loose application configuration xml file diff --git a/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy b/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy index d81ac070..a172299c 100644 --- a/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy +++ b/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy @@ -379,7 +379,7 @@ class DevTask extends AbstractFeatureTask { boolean libertyDebug, boolean pollingTest, boolean container, File containerfile, File containerBuildContext, String containerRunOpts, int containerBuildTimeout, boolean skipDefaultPorts, boolean keepTempContainerfile, String mavenCacheLocation, String packagingType, File buildFile, boolean generateFeatures, List webResourceDirs, - List projectModuleList, Map> parentBuildGradle + List projectModuleList, Map> parentBuildGradle, File serverOutputDir ) throws IOException, PluginExecutionException { super(buildDir, serverDirectory, sourceDirectory, testSourceDirectory, configDirectory, projectDirectory, /* multi module project directory */ projectDirectory, resourceDirs, changeOnDemandTestsAction, hotTests, skipTests, false /* skipUTs */, false /* skipITs */, skipInstallFeature, artifactId, serverStartTimeout, @@ -388,7 +388,7 @@ class DevTask extends AbstractFeatureTask { null /* compileOptions not needed since useBuildRecompile is true */, keepTempContainerfile, mavenCacheLocation, projectModuleList /* multi module upstream projects */, projectModuleList.size() > 0 /* recompileDependencies as true for multi module */, packagingType, buildFile, parentBuildGradle /* parent build files */, generateFeatures, null /* compileArtifactPaths */, null /* testArtifactPaths */, webResourceDirs /* webResources */ ); - this.libertyDirPropertyFiles = LibertyPropFilesUtility.getLibertyDirectoryPropertyFiles(new CommonLogger(project), installDirectory, userDirectory, serverDirectory); + this.libertyDirPropertyFiles = LibertyPropFilesUtility.getLibertyDirectoryPropertyFiles(new CommonLogger(project), installDirectory, userDirectory, serverDirectory, serverOutputDir); ServerFeatureUtil servUtil = getServerFeatureUtil(true, libertyDirPropertyFiles); FeaturesPlatforms fp = servUtil.getServerFeatures(serverDirectory, libertyDirPropertyFiles); @@ -1247,6 +1247,7 @@ class DevTask extends AbstractFeatureTask { File configDirectory = server.configDirectory; // getOutputDir returns a string File serverOutputDir = new File(getOutputDir(project)); + File serverOutputDirectory= new File(serverOutputDir, serverName) if (!container) { if (serverDirectory.exists()) { @@ -1292,7 +1293,7 @@ class DevTask extends AbstractFeatureTask { verifyAppStartTimeout.intValue(), verifyAppStartTimeout.intValue(), compileWait.doubleValue(), libertyDebug.booleanValue(), pollingTest.booleanValue(), container.booleanValue(), containerfile, containerBuildContext, containerRunOpts, containerBuildTimeout, skipDefaultPorts.booleanValue(), keepTempContainerfile.booleanValue(), localMavenRepoForFeatureUtility, - DevTaskHelper.getPackagingType(project), buildFile, generateFeatures.booleanValue(), webResourceDirs, projectModules, parentBuildGradle + DevTaskHelper.getPackagingType(project), buildFile, generateFeatures.booleanValue(), webResourceDirs, projectModules, parentBuildGradle, serverOutputDirectory ); } catch (IOException | PluginExecutionException e) { throw new GradleException("Error initializing dev mode.", e) From 83a9781aa55a9921dd2a7f3ffb40e2ca3abcf102 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Thu, 13 Feb 2025 09:57:57 +0530 Subject: [PATCH 2/4] changes based on review comments Signed-off-by: Arun Venmany --- .../groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy b/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy index a172299c..964d7cfa 100644 --- a/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy +++ b/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy @@ -1247,7 +1247,6 @@ class DevTask extends AbstractFeatureTask { File configDirectory = server.configDirectory; // getOutputDir returns a string File serverOutputDir = new File(getOutputDir(project)); - File serverOutputDirectory= new File(serverOutputDir, serverName) if (!container) { if (serverDirectory.exists()) { @@ -1293,7 +1292,7 @@ class DevTask extends AbstractFeatureTask { verifyAppStartTimeout.intValue(), verifyAppStartTimeout.intValue(), compileWait.doubleValue(), libertyDebug.booleanValue(), pollingTest.booleanValue(), container.booleanValue(), containerfile, containerBuildContext, containerRunOpts, containerBuildTimeout, skipDefaultPorts.booleanValue(), keepTempContainerfile.booleanValue(), localMavenRepoForFeatureUtility, - DevTaskHelper.getPackagingType(project), buildFile, generateFeatures.booleanValue(), webResourceDirs, projectModules, parentBuildGradle, serverOutputDirectory + DevTaskHelper.getPackagingType(project), buildFile, generateFeatures.booleanValue(), webResourceDirs, projectModules, parentBuildGradle, new File(serverOutputDir, serverName) ); } catch (IOException | PluginExecutionException e) { throw new GradleException("Error initializing dev mode.", e) From a2f472f8658afcbfef77558e9744d0d71ab70ac2 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Thu, 13 Feb 2025 10:18:55 +0530 Subject: [PATCH 3/4] rolling back workflow yaml Signed-off-by: Arun Venmany --- .github/workflows/gradle.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 25a26ca3..21e07bd3 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -39,9 +39,8 @@ jobs: - name: Checkout ci.common uses: actions/checkout@v3 with: - repository: arunvenmany-ibm/ci.common + repository: OpenLiberty/ci.common path: ci.common - ref: variable_resolution_fix - name: Checkout ci.ant uses: actions/checkout@v3 with: @@ -125,7 +124,7 @@ jobs: - name: Clone ci.ant, ci.common, ci.gradle repos to C drive run: | cp -r D:/a/ci.gradle/ci.gradle C:/ci.gradle - git clone https://github.com/arunvenmany-ibm/ci.common.git --branch variable_resolution_fix --single-branch C:/ci.common + git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant # Cache mvn/gradle packages - name: Cache Maven packages From 48c3990c0c1766bb31fab038b85e779d8c3def04 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 19 Feb 2025 08:36:55 +0530 Subject: [PATCH 4/4] changes for variable names Signed-off-by: Arun Venmany --- .../groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy b/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy index 964d7cfa..1dc8d8fc 100644 --- a/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy +++ b/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy @@ -1246,11 +1246,11 @@ class DevTask extends AbstractFeatureTask { initializeConfigDirectory(); File configDirectory = server.configDirectory; // getOutputDir returns a string - File serverOutputDir = new File(getOutputDir(project)); + File outputDir = new File(getOutputDir(project)); if (!container) { if (serverDirectory.exists()) { - if (ServerStatusUtil.isServerRunning(serverInstallDir, serverOutputDir, serverName)) { + if (ServerStatusUtil.isServerRunning(serverInstallDir, outputDir, serverName)) { throw new Exception("The server " + serverName + " is already running. Terminate all instances of the server before starting dev mode." + " You can stop a server instance with the command 'gradle libertyStop'."); @@ -1292,7 +1292,7 @@ class DevTask extends AbstractFeatureTask { verifyAppStartTimeout.intValue(), verifyAppStartTimeout.intValue(), compileWait.doubleValue(), libertyDebug.booleanValue(), pollingTest.booleanValue(), container.booleanValue(), containerfile, containerBuildContext, containerRunOpts, containerBuildTimeout, skipDefaultPorts.booleanValue(), keepTempContainerfile.booleanValue(), localMavenRepoForFeatureUtility, - DevTaskHelper.getPackagingType(project), buildFile, generateFeatures.booleanValue(), webResourceDirs, projectModules, parentBuildGradle, new File(serverOutputDir, serverName) + DevTaskHelper.getPackagingType(project), buildFile, generateFeatures.booleanValue(), webResourceDirs, projectModules, parentBuildGradle, new File(outputDir, serverName) ); } catch (IOException | PluginExecutionException e) { throw new GradleException("Error initializing dev mode.", e)