Skip to content

Commit

Permalink
Merge pull request #378 from jfdenise/9.x
Browse files Browse the repository at this point in the history
[9.x] Remove legacy patching
  • Loading branch information
jfdenise authored Dec 12, 2023
2 parents 7cbfe13 + d079005 commit ccddc98
Show file tree
Hide file tree
Showing 16 changed files with 2 additions and 1,702 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.stream.Collectors;
import org.apache.maven.plugin.logging.Log;
Expand All @@ -45,8 +44,6 @@
*/
public class CloudConfig {

private static final String ADD_EXPORTS_ATTRIBUTE = "Add-Exports";
private static final String NAMING_JNDI_DNS_EXPORT = "jdk.naming.dns/com.sun.jndi.dns";
private static final String OPENSHIFT = "openshift";
private static final String KUBERNETES = "kubernetes";

Expand Down Expand Up @@ -89,20 +86,8 @@ public void validate() throws MojoExecutionException {
}

public boolean updateManifest(Manifest manifest) {
Attributes attributes = manifest.getMainAttributes();
String val = attributes.getValue(ADD_EXPORTS_ATTRIBUTE);
boolean updated = true;
// needed for jgroups dns ping protocol on JDK15+
if (val == null) {
attributes.putValue(ADD_EXPORTS_ATTRIBUTE, NAMING_JNDI_DNS_EXPORT);
} else {
if (val.contains(NAMING_JNDI_DNS_EXPORT)) {
updated = false;
} else {
attributes.putValue(ADD_EXPORTS_ATTRIBUTE, val + " " + NAMING_JNDI_DNS_EXPORT);
}
}
return updated;
// No-op currently
return false;
}

public void copyExtraContent(BuildBootableJarMojo mojo, Path wildflyDir, Path contentDir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
import org.wildfly.plugins.bootablejar.maven.cli.LocalCLIExecutor;
import org.wildfly.plugins.bootablejar.maven.cli.RemoteCLIExecutor;
import org.wildfly.plugins.bootablejar.maven.common.FeaturePack;
import org.wildfly.plugins.bootablejar.maven.common.LegacyPatchCleaner;
import org.wildfly.plugins.bootablejar.maven.common.MavenRepositoriesEnricher;
import org.wildfly.plugins.bootablejar.maven.common.OverriddenArtifact;
import org.wildfly.plugins.bootablejar.maven.common.Utils;
Expand Down Expand Up @@ -287,32 +286,6 @@ public abstract class AbstractBuildBootableJarMojo extends AbstractMojo {
@Parameter(alias = "provisioning-file", property = "wildfly.bootable.provisioning.file", defaultValue = "${project.basedir}/galleon/provisioning.xml")
private File provisioningFile;

/**
* Deprecated. Path to a CLI script that applies legacy patches. Content of such script
* should be composed of 'patch apply [path to zip file] [patch apply
* options]' commands. Due to the nature of a bootable JAR trimmed with
* Galleon, part of the content of the patch can be missing. In order to
* force the patch to apply use the '--override-all' option. The
* '--distribution' option is not needed, System property 'jboss.home.dir'
* is automatically set to the server that will be packaged in the bootable
* JAR. If the script file is not absolute, it has to be relative to the
* project base directory.
* NB: The server is patched with a legacy patch right after the server
* has been provisioned with Galleon.
*/
@Deprecated
@Parameter(alias = "legacy-patch-cli-script")
String legacyPatchCliScript;

/**
* Deprecated. Set to true to enable patch cleanup. When cleanup is enabled, unused
* added modules, patched modules original directories, unused overlay
* directories and .installation/patches directory are deleted.
*/
@Deprecated
@Parameter(alias = "legacy-patch-clean-up", defaultValue = "false")
boolean legacyPatchCleanUp;

/**
* By default executed CLI scripts output is not shown if execution is
* successful. In order to display the CLI output, set this option to true.
Expand Down Expand Up @@ -486,8 +459,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info("CLI executions are done in forked process");
}

// Legacy Patching point
legacyPatching();
copyExtraContentInternal(wildflyDir, contentDir);
copyExtraContent(wildflyDir);
List<String> commands = new ArrayList<>();
Expand Down Expand Up @@ -578,37 +549,6 @@ private void restoreLoggingFile(Path originalLoggingFile) throws IOException {
}
}

private void legacyPatching() throws Exception {
if (legacyPatchCliScript != null) {
LegacyPatchCleaner patchCleaner = null;
if (legacyPatchCleanUp) {
patchCleaner = new LegacyPatchCleaner(wildflyDir, getLog());
}
String prop = "jboss.home.dir";
System.setProperty(prop, wildflyDir.toAbsolutePath().toString());
try {
Path patchScript = resolvePath(Paths.get(legacyPatchCliScript));
if (Files.notExists(patchScript)) {
throw new Exception("Patch CLI script " + patchScript + " doesn't exist");
}
List<CliSession> cliPatchingSessions = new ArrayList<>();
List<String> files = new ArrayList<>();
files.add(patchScript.toString());
CliSession patchingSession = new CliSession();
patchingSession.setResolveExpressions(true);
patchingSession.setScriptFiles(files);
cliPatchingSessions.add(patchingSession);
getLog().info("Patching server with " + patchScript + " CLI script.");
userScripts(wildflyDir, cliPatchingSessions, false);
if (patchCleaner != null) {
patchCleaner.clean();
}
} finally {
System.clearProperty(prop);
}
}
}

private void copyExtraContent(Path wildflyDir) throws Exception {
for (String path : extraServerContentDirs) {
Path extraContent = Paths.get(path);
Expand Down Expand Up @@ -1244,36 +1184,6 @@ private Artifact provisionServer(Path home, Path outputProvisioningFile, Path wo
"client", new DefaultArtifactHandler(JAR)));
continue;
}
if ("wildfly-patching".equals(a.getArtifactId())
&& "org.wildfly.core".equals(a.getGroupId())) {
// We got it.
debug("Found patching artifact %s in %s", a, (mavenUpgrade == null ? fprt.getFPID() : mavenUpgrade.getMavenFeaturePack(fprt.getFPID())));
cliArtifacts.add(a);
continue;
}
// All the following ones are patching required dependencies:
if ("wildfly-controller".equals(a.getArtifactId())
&& "org.wildfly.core".equals(a.getGroupId())) {
// We got it.
debug("Found controller artifact %s in %s", a, (mavenUpgrade == null ? fprt.getFPID() : mavenUpgrade.getMavenFeaturePack(fprt.getFPID())));
cliArtifacts.add(a);
continue;
}
if ("wildfly-version".equals(a.getArtifactId())
&& "org.wildfly.core".equals(a.getGroupId())) {
// We got it.
debug("Found version artifact %s in %s", a, (mavenUpgrade == null ? fprt.getFPID() : mavenUpgrade.getMavenFeaturePack(fprt.getFPID())));
cliArtifacts.add(a);
continue;
}
if ("vdx-core".equals(a.getArtifactId())
&& "org.projectodd.vdx".equals(a.getGroupId())) {
// We got it.
debug("Found vdx-core artifact %s in %s", a, (mavenUpgrade == null ? fprt.getFPID() : mavenUpgrade.getMavenFeaturePack(fprt.getFPID())));
cliArtifacts.add(a);
continue;
}
// End patching dependencies.
if ("jboss-modules".equals(a.getArtifactId())
&& "org.jboss.modules".equals(a.getGroupId())) {
jbossModules = a;
Expand Down
30 changes: 0 additions & 30 deletions tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,35 +120,6 @@

<build>
<plugins>
<!-- provision a full server to be used as patching distribution source -->

<plugin>
<groupId>org.jboss.galleon</groupId>
<artifactId>galleon-maven-plugin</artifactId>
<executions>
<execution>
<id>server-provisioning-for-patching</id>
<goals>
<goal>provision</goal>
</goals>
<phase>process-test-resources</phase>
<configuration>
<install-dir>${jbossas.dist}</install-dir>
<record-state>false</record-state>
<plugin-options>
<jboss-fork-embedded>true</jboss-fork-embedded>
</plugin-options>
<feature-packs>
<feature-pack>
<groupId>${wildfly.groupId}</groupId>
<artifactId>${wildfly.artifactId}</artifactId>
<version>${version.wildfly}</version>
</feature-pack>
</feature-packs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand All @@ -166,7 +137,6 @@
<test.version.wildfly-ee.upgrade>${test.version.wildfly-ee.upgrade}</test.version.wildfly-ee.upgrade>
<test.version.wildfly>${test.version.wildfly}</test.version.wildfly>
<test.plugin.version>${project.version}</test.plugin.version>
<test.patch.version>${test.patch.version}</test.patch.version>
<jbossas.dist>${jbossas.dist}</jbossas.dist>
<test.groupid.wildfly>${wildfly.groupId}</test.groupid.wildfly>
<!-- DevWatch* tests run maven and need to use the same repository -->
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit ccddc98

Please sign in to comment.