From 3dc590ec75d932cd589f85438a208da474ee3b36 Mon Sep 17 00:00:00 2001 From: Cheryl King Date: Fri, 7 Apr 2023 16:04:34 -0500 Subject: [PATCH 1/2] Handle more variable resolution for locations --- .github/workflows/gradle.yml | 17 +++++++++-------- .../gradle/tasks/AbstractFeatureTask.groovy | 15 ++++++++------- .../tools/gradle/tasks/DevTask.groovy | 10 +++++----- .../gradle/tasks/GenerateFeaturesTask.groovy | 4 ++-- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 2dbfe5a7..10617c26 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -18,13 +18,13 @@ jobs: matrix: # test against latest update of each major Java version, as well as specific updates of LTS versions: RUNTIME: [ol, wlp] - RUNTIME_VERSION: [22.0.0.12, 22.0.0.9] + RUNTIME_VERSION: [22.0.0.12, 23.0.0.3] java: [17, 11, 8] exclude: - java: 8 - RUNTIME_VERSION: 22.0.0.9 + RUNTIME_VERSION: 22.0.0.12 - java: 17 - RUNTIME_VERSION: 22.0.0.9 + RUNTIME_VERSION: 22.0.0.12 name: ${{ matrix.RUNTIME }} ${{ matrix.RUNTIME_VERSION }}, Java ${{ matrix.java }}, Linux steps: # Checkout repos @@ -39,7 +39,8 @@ jobs: - name: Checkout ci.common uses: actions/checkout@v3 with: - repository: OpenLiberty/ci.common + repository: cherylking/ci.common + ref: includeLocationVarResolution path: ci.common - name: Checkout ci.ant uses: actions/checkout@v3 @@ -98,15 +99,15 @@ jobs: matrix: # test against latest update of each major Java version, as well as specific updates of LTS versions: RUNTIME: [ol, wlp] - RUNTIME_VERSION: [22.0.0.12, 22.0.0.9] + RUNTIME_VERSION: [22.0.0.12, 23.0.0.3] java: [17, 11, 8] exclude: - java: 8 - RUNTIME_VERSION: 22.0.0.9 + RUNTIME_VERSION: 22.0.0.12 - java: 8 RUNTIME: wlp - java: 17 - RUNTIME_VERSION: 22.0.0.9 + RUNTIME_VERSION: 22.0.0.12 name: ${{ matrix.RUNTIME }} ${{ matrix.RUNTIME_VERSION }}, Java ${{ matrix.java }}, Windows steps: # Checkout repos @@ -122,7 +123,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/cherylking/ci.common.git --branch includeLocationVarResolution --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/AbstractFeatureTask.groovy b/src/main/groovy/io/openliberty/tools/gradle/tasks/AbstractFeatureTask.groovy index 5ea5aa44..151d0f20 100644 --- a/src/main/groovy/io/openliberty/tools/gradle/tasks/AbstractFeatureTask.groovy +++ b/src/main/groovy/io/openliberty/tools/gradle/tasks/AbstractFeatureTask.groovy @@ -62,33 +62,33 @@ public class AbstractFeatureTask extends AbstractServerTask { } @Override - void debug(String msg) { + public void debug(String msg) { if (isDebugEnabled()) { logger.debug(msg); } } @Override - void error(String msg, Throwable throwable) { + public void error(String msg, Throwable throwable) { logger.error(msg, e); } @Override - void debug(String msg, Throwable throwable) { + public void debug(String msg, Throwable throwable) { if (isDebugEnabled()) { logger.debug(msg, (Throwable) e); } } @Override - void debug(Throwable throwable) { + public void debug(Throwable throwable) { if (isDebugEnabled()) { logger.debug("Throwable exception received: " + e.getMessage(), (Throwable) e); } } @Override - void warn(String msg) { + public void warn(String msg) { if (!suppressLogs) { logger.warn(msg); } else { @@ -97,7 +97,7 @@ public class AbstractFeatureTask extends AbstractServerTask { } @Override - void info(String msg) { + public void info(String msg) { if (!suppressLogs) { logger.lifecycle(msg); } else { @@ -245,9 +245,10 @@ public class AbstractFeatureTask extends AbstractServerTask { * @return instance of ServerFeatureUtil */ @Internal - protected ServerFeatureUtil getServerFeatureUtil(boolean suppressLogs) { + protected ServerFeatureUtil getServerFeatureUtil(boolean suppressLogs, Map libDirPropFiles) { if (servUtil == null) { servUtil = new ServerFeatureTaskUtil(); + servUtil.setLibertyDirectoryPropertyFiles(libDirPropFiles); } if (suppressLogs) { servUtil.setSuppressLogs(true); 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 28a87c34..23e6885e 100644 --- a/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy +++ b/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2019, 2021. + * (C) Copyright IBM Corporation 2019, 2023. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -315,8 +315,8 @@ class DevTask extends AbstractFeatureTask { false /* recompileDependencies only supported in ci.maven */, packagingType, buildFile, null /* parent build files */, generateFeatures, null /* compileArtifactPaths */, null /* testArtifactPaths */, new ArrayList() /* webResources */ ); - ServerFeatureUtil servUtil = getServerFeatureUtil(true); this.libertyDirPropertyFiles = AbstractServerTask.getLibertyDirectoryPropertyFiles(installDirectory, userDirectory, serverDirectory); + ServerFeatureUtil servUtil = getServerFeatureUtil(true, libertyDirPropertyFiles); this.existingFeatures = servUtil.getServerFeatures(serverDirectory, libertyDirPropertyFiles); this.existingLibertyFeatureDependencies = new HashSet(); @@ -686,7 +686,7 @@ class DevTask extends AbstractFeatureTask { @Override public void installFeatures(File configFile, File serverDir, boolean generateFeatures) { - ServerFeatureUtil servUtil = getServerFeatureUtil(true); + ServerFeatureUtil servUtil = getServerFeatureUtil(true, libertyDirPropertyFiles); Set features = servUtil.getServerFeatures(serverDir, libertyDirPropertyFiles); if (features == null) { @@ -738,7 +738,7 @@ class DevTask extends AbstractFeatureTask { @Override public ServerFeatureUtil getServerFeatureUtilObj() { // suppress logs from ServerFeatureUtil so that dev console is not flooded - return getServerFeatureUtil(true); + return getServerFeatureUtil(true, libertyDirPropertyFiles); } @Override @@ -748,7 +748,7 @@ class DevTask extends AbstractFeatureTask { @Override public void updateExistingFeatures() { - ServerFeatureUtil servUtil = getServerFeatureUtil(true); + ServerFeatureUtil servUtil = getServerFeatureUtil(true, libertyDirPropertyFiles); Set features = servUtil.getServerFeatures(getServerDir(project), libertyDirPropertyFiles); existingFeatures = features; } diff --git a/src/main/groovy/io/openliberty/tools/gradle/tasks/GenerateFeaturesTask.groovy b/src/main/groovy/io/openliberty/tools/gradle/tasks/GenerateFeaturesTask.groovy index 17729728..8db57926 100644 --- a/src/main/groovy/io/openliberty/tools/gradle/tasks/GenerateFeaturesTask.groovy +++ b/src/main/groovy/io/openliberty/tools/gradle/tasks/GenerateFeaturesTask.groovy @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2021, 2022. + * (C) Copyright IBM Corporation 2021, 2023. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,7 +98,7 @@ class GenerateFeaturesTask extends AbstractFeatureTask { } */ // get existing server features from source directory - ServerFeatureUtil servUtil = getServerFeatureUtil(true); + ServerFeatureUtil servUtil = getServerFeatureUtil(true, null); Set generatedFiles = new HashSet(); generatedFiles.add(GENERATED_FEATURES_FILE_NAME); From 9454ba6ac97687565f52263ca103994c5112fb2f Mon Sep 17 00:00:00 2001 From: Cheryl King Date: Mon, 10 Apr 2023 13:47:44 -0500 Subject: [PATCH 2/2] Revert reference to specific common branch --- .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 10617c26..1c73252b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -39,8 +39,7 @@ jobs: - name: Checkout ci.common uses: actions/checkout@v3 with: - repository: cherylking/ci.common - ref: includeLocationVarResolution + repository: OpenLiberty/ci.common path: ci.common - name: Checkout ci.ant uses: actions/checkout@v3 @@ -123,7 +122,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/cherylking/ci.common.git --branch includeLocationVarResolution --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