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

Handle more variable resolution for locations #812

Merged
merged 2 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 9 additions & 8 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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<String, File> libDirPropFiles) {
if (servUtil == null) {
servUtil = new ServerFeatureTaskUtil();
servUtil.setLibertyDirectoryPropertyFiles(libDirPropFiles);
}
if (suppressLogs) {
servUtil.setSuppressLogs(true);
Expand Down
10 changes: 5 additions & 5 deletions src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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<Path>() /* 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<String>();
Expand Down Expand Up @@ -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<String> features = servUtil.getServerFeatures(serverDir, libertyDirPropertyFiles);

if (features == null) {
Expand Down Expand Up @@ -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
Expand All @@ -748,7 +748,7 @@ class DevTask extends AbstractFeatureTask {

@Override
public void updateExistingFeatures() {
ServerFeatureUtil servUtil = getServerFeatureUtil(true);
ServerFeatureUtil servUtil = getServerFeatureUtil(true, libertyDirPropertyFiles);
Set<String> features = servUtil.getServerFeatures(getServerDir(project), libertyDirPropertyFiles);
existingFeatures = features;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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<String> generatedFiles = new HashSet<String>();
generatedFiles.add(GENERATED_FEATURES_FILE_NAME);

Expand Down