Skip to content

Commit

Permalink
Prototype installing interim fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cherylking committed Oct 1, 2023
1 parent b7ff292 commit 68c12b3
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ jobs:
- name: Checkout ci.ant
uses: actions/checkout@v3
with:
repository: OpenLiberty/ci.ant
repository: cherylking/ci.ant
ref: addIfixSupport
path: ci.ant
- name: Set up Maven
uses: stCarolas/[email protected]
Expand Down Expand Up @@ -99,7 +100,7 @@ jobs:
run: |
cp -r D:/a/ci.maven/ci.maven C:/ci.maven
git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common
git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant
git clone https://github.com/cherylking/ci.ant.git --branch addIfixSupport --single-branch C:/ci.ant
- name: Set up Maven
uses: stCarolas/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion liberty-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<dependency>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-ant-tasks</artifactId>
<version>1.9.13</version>
<version>1.9.14-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;

import io.openliberty.tools.ant.InstallLibertyInterimFixTask;
import io.openliberty.tools.ant.install.InstallLibertyTask;
import io.openliberty.tools.common.plugins.util.ServerFeatureUtil;

Expand Down Expand Up @@ -93,6 +94,12 @@ public abstract class BasicSupport extends AbstractLibertySupport {
@Parameter(property = "installDirectory")
protected File installDirectory;

/**
* Directory containing interim fixes.
*/
@Parameter(property = "interimFixDirectory")
protected File interimFixDirectory;

/**
* Liberty server name, default is defaultServer
*/
Expand Down Expand Up @@ -443,6 +450,7 @@ protected void installServerAssembly() throws MojoExecutionException, IOExceptio
installFromFile();
}
installLicense();
installInterimFixes(installDirectory, interimFixDirectory);
}
}

Expand Down Expand Up @@ -575,6 +583,41 @@ protected void installLicense() throws MojoExecutionException, IOException {
}
}

/**
* Executes the InstallLibertyInterimFixTask to install interim fixes located in the specified interimFixDirectory.
*
* @param installDirectory
* : Installation directory of Liberty profile.
* @param interimFixDirectory
* : Directory containing interim fixes
*/
protected void installInterimFixes(File installDirectory, File interimFixDirectory) throws MojoExecutionException, IOException {
if (interimFixDirectory == null) {
return;
} else if (!interimFixDirectory.isDirectory()) {
getLog().warn("The interimFixDirectory is not a directory or does not exist. Interim fixes will not be installed.");
return;
}

getLog().info("Installing interim fixes...");
io.openliberty.tools.ant.InstallLibertyInterimFixTask iFixTask = (InstallLibertyInterimFixTask) ant
.createTask("antlib:io/openliberty/tools/ant:install-fix");
if (iFixTask == null) {
throw new IllegalStateException(
MessageFormat.format(messages.getString("error.dependencies.not.found"), "install-fix"));
}

iFixTask.setInstallDir(installDirectory);
iFixTask.setInterimFixDirectory(interimFixDirectory);
iFixTask.setSuppressInfo(false);

try {
iFixTask.execute();
} catch (Exception e) {
getLog().warn("An error occurred when installing the Liberty interim fixes: "+e.getMessage());
getLog().debug("Exception received: "+e.getMessage(), (Throwable) e);
}
}
/*
* Handle cleaning up all three possible locations for applications, and check for both stripped and non-stripped file name in
* case that setting has been modified.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public class ExecuteMojoUtil {
"version"));

private static final ArrayList<String> LIBERTY_COMMON_PARAMS = new ArrayList<>(Arrays.asList(
"installDirectory", "assemblyArchive", "assemblyArtifact", "libertyRuntimeVersion",
"installDirectory", "interimFixDirectory", "assemblyArchive", "assemblyArtifact", "libertyRuntimeVersion",
"install", "licenseArtifact", "serverName", "userDirectory", "outputDirectory",
"assemblyInstallDirectory", "refresh", "skip", "serverXmlFile", "configDirectory",
"serverEnvFile", "mergeServerEnv"
Expand Down

0 comments on commit 68c12b3

Please sign in to comment.