From 4a9b46c4b0e765fa22b6f7668d1a689e58b746a7 Mon Sep 17 00:00:00 2001 From: Cheryl King Date: Wed, 10 May 2023 14:59:35 -0500 Subject: [PATCH 1/3] Add new skip install feature flag for dev mode --- .../tools/common/plugins/util/DevUtil.java | 12 ++++++++---- .../tools/common/plugins/util/BaseDevUtilTest.java | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java b/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java index bc01c8a8..03602fe4 100644 --- a/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java +++ b/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java @@ -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. @@ -82,7 +82,6 @@ import com.sun.nio.file.SensitivityWatchEventModifier; -import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; @@ -437,10 +436,11 @@ private enum FileTrackMode { private Set testArtifactPaths; protected final File generatedFeaturesFile; private File modifiedSrcBuildFile; + private boolean skipInstallFeature; public DevUtil(File buildDirectory, File serverDirectory, File sourceDirectory, File testSourceDirectory, File configDirectory, File projectDirectory, File multiModuleProjectDirectory, List resourceDirs, - boolean hotTests, boolean skipTests, boolean skipUTs, boolean skipITs, String applicationId, + boolean hotTests, boolean skipTests, boolean skipUTs, boolean skipITs, boolean skipInstallFeature, String applicationId, long serverStartTimeout, int appStartupTimeout, int appUpdateTimeout, long compileWaitMillis, boolean libertyDebug, boolean useBuildRecompile, boolean gradle, boolean pollingTest, boolean container, File dockerfile, File dockerBuildContext, String dockerRunOpts, int dockerBuildTimeout, @@ -460,6 +460,7 @@ public DevUtil(File buildDirectory, File serverDirectory, File sourceDirectory, this.skipTests = skipTests; this.skipUTs = skipUTs; this.skipITs = skipITs; + this.skipInstallFeature = skipInstallFeature; this.applicationId = applicationId; this.serverStartTimeout = serverStartTimeout; this.appStartupTimeout = appStartupTimeout; @@ -1849,8 +1850,11 @@ public void restartServer(boolean buildContainer) throws PluginExecutionExceptio libertyCreate(); // Skip installing features on container during restart, since the Dockerfile // should have 'RUN features.sh' - if (!container) { + // Also skip install feature on restart if config parameter specified. + if (!container && !skipInstallFeature) { libertyInstallFeature(); + } else { + info("Skipping liberty:install-feature"); } libertyDeploy(); startServer(buildContainer, false); diff --git a/src/test/java/io/openliberty/tools/common/plugins/util/BaseDevUtilTest.java b/src/test/java/io/openliberty/tools/common/plugins/util/BaseDevUtilTest.java index 18e044cd..7c0b062f 100644 --- a/src/test/java/io/openliberty/tools/common/plugins/util/BaseDevUtilTest.java +++ b/src/test/java/io/openliberty/tools/common/plugins/util/BaseDevUtilTest.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2019. + * (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. @@ -39,13 +39,13 @@ public class DevTestUtil extends DevUtil { public DevTestUtil(File serverDirectory, File sourceDirectory, File testSourceDirectory, File configDirectory, List resourceDirs, List webResourceDirs, boolean hotTests, boolean skipTests) throws IOException { super(temp.newFolder(), serverDirectory, sourceDirectory, testSourceDirectory, configDirectory, null, null, - resourceDirs, hotTests, skipTests, false, false, null, 30, 30, 5, 500, true, false, false, false, + resourceDirs, hotTests, skipTests, false, false, false, null, 30, 30, 5, 500, true, false, false, false, false, null, null, null, 0, false, null, false, null, null, false, null, null, null, false, null, null, webResourceDirs); } public DevTestUtil(File serverDirectory, File buildDir) { super(buildDir, serverDirectory, null, null, null, null, null, - null, false, false, false, false, null, 30, 30, 5, 500, true, false, false, false, + null, false, false, false, false, false, null, 30, 30, 5, 500, true, false, false, false, false, null, null, null, 0, false, null, false, null, null, false, null, null, null, false, null, null, null); } From a423bb0326543eee8415d3682204bc023365bbb3 Mon Sep 17 00:00:00 2001 From: Cheryl King Date: Fri, 19 May 2023 14:43:00 -0500 Subject: [PATCH 2/3] logging --- .../java/io/openliberty/tools/common/plugins/util/DevUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java b/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java index 094df6af..e1a71d53 100644 --- a/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java +++ b/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java @@ -436,7 +436,7 @@ private enum FileTrackMode { private Set testArtifactPaths; protected final File generatedFeaturesFile; private File modifiedSrcBuildFile; - private boolean skipInstallFeature; + protected boolean skipInstallFeature; public DevUtil(File buildDirectory, File serverDirectory, File sourceDirectory, File testSourceDirectory, File configDirectory, File projectDirectory, File multiModuleProjectDirectory, List resourceDirs, From 4e30a48e8068afde30a530de023b73914bc727a4 Mon Sep 17 00:00:00 2001 From: Cheryl King Date: Thu, 17 Aug 2023 11:48:09 -0500 Subject: [PATCH 3/3] Update message --- .../io/openliberty/tools/common/plugins/util/DevUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java b/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java index 4b0c6a7a..8bd0fe9a 100644 --- a/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java +++ b/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java @@ -1849,8 +1849,8 @@ public void restartServer(boolean buildContainer) throws PluginExecutionExceptio // Also skip install feature on restart if config parameter specified. if (!container && !skipInstallFeature) { libertyInstallFeature(); - } else { - info("Skipping liberty:install-feature"); + } else if (skipInstallFeature) { + info("Skipping installation of features due to skipInstallFeature configuration."); } libertyDeploy(); startServer(buildContainer, false);