Skip to content

Commit

Permalink
Merge branch 'release/4.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jesse-gallagher committed Nov 17, 2022
2 parents a4d6091 + 340b889 commit fa76ab7
Show file tree
Hide file tree
Showing 6 changed files with 278 additions and 146 deletions.
28 changes: 18 additions & 10 deletions generate-domino-update-site/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.openntf.p2</groupId>
<artifactId>generate-domino-update-site</artifactId>
<version>4.1.0</version>
<version>4.2.0</version>
<packaging>maven-plugin</packaging>

<name>generate-domino-update-site</name>
Expand All @@ -13,7 +13,7 @@
<compiler>1.8</compiler>

<!-- Maven API version. This version should be supported by m2e -->
<maven.api.version>3.3.9</maven.api.version>
<maven.api.version>3.8.6</maven.api.version>
</properties>

<url>https://openntf.org/main.nsf/project.xsp?r=project/NSF%20ODP%20Tooling</url>
Expand All @@ -35,6 +35,14 @@
<url>https://artifactory.openntf.org/openntf</url>
</repository>
</distributionManagement>

<repositories>
<repository>
<id>artifactory.openntf.org</id>
<name>artifactory.openntf.org</name>
<url>https://artifactory.openntf.org/openntf</url>
</repository>
</repositories>

<developers>
<developer>
Expand Down Expand Up @@ -68,7 +76,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.8</version>
<version>3.5.0</version>
</dependency>

<dependency>
Expand All @@ -77,9 +85,9 @@
<version>9.0.0</version>
</dependency>
<dependency>
<groupId>com.ibm.sbt</groupId>
<artifactId>com.ibm.commons.xml</artifactId>
<version>9.0.0</version>
<groupId>org.openntf.nsfodp</groupId>
<artifactId>org.openntf.nsfodp.commons</artifactId>
<version>3.9.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
Expand All @@ -96,7 +104,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>

Expand All @@ -108,18 +116,18 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.tukaani</groupId>
<artifactId>xz</artifactId>
<version>1.8</version>
<version>1.9</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -36,6 +37,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.eclipse.osgi.util.ManifestElement;
import org.openntf.nsfodp.commons.xml.NSFODPDomUtil;
import org.openntf.p2.domino.updatesite.model.BundleEmbed;
import org.openntf.p2.domino.updatesite.model.BundleInfo;
import org.osgi.framework.Version;
Expand All @@ -44,8 +46,6 @@

import com.ibm.commons.util.StringUtil;
import com.ibm.commons.util.io.StreamUtil;
import com.ibm.commons.xml.DOMUtil;
import com.ibm.commons.xml.XMLException;

import lombok.SneakyThrows;

Expand Down Expand Up @@ -108,7 +108,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
Path tempPom;
try {
tempPom = generateBundlePom(bundle, basePom, bundlesByName);
} catch(XMLException | IOException e) {
} catch(IOException e) {
throw new MojoExecutionException(Messages.getString("AbstractMavenizeBundlesMojo.exceptionGeneratingPom"), e); //$NON-NLS-1$
}

Expand All @@ -118,42 +118,42 @@ public void execute() throws MojoExecutionException, MojoFailureException {

protected abstract void processBundle(BundleInfo bundle, List<BundleInfo> bundles, Map<String, BundleInfo> bundlesByName, Path tempPom) throws MojoExecutionException;

protected Path generateBundlePom(BundleInfo bundle, String basePom, Map<String, BundleInfo> bundles) throws XMLException, IOException {
Document xml = DOMUtil.createDocument(basePom);
protected Path generateBundlePom(BundleInfo bundle, String basePom, Map<String, BundleInfo> bundles) throws IOException {
Document xml = NSFODPDomUtil.createDocument(new StringReader(basePom));

Element project = xml.getDocumentElement();

Element groupIdEl = DOMUtil.createElement(xml, project, "groupId"); //$NON-NLS-1$
Element groupIdEl = NSFODPDomUtil.createElement(project, "groupId"); //$NON-NLS-1$
groupIdEl.setTextContent(this.groupId);

Element artifactId = DOMUtil.createElement(xml, project, "artifactId"); //$NON-NLS-1$
Element artifactId = NSFODPDomUtil.createElement(project, "artifactId"); //$NON-NLS-1$
artifactId.setTextContent(bundle.getArtifactId());

Element version = DOMUtil.createElement(xml, project, "version"); //$NON-NLS-1$
Element version = NSFODPDomUtil.createElement(project, "version"); //$NON-NLS-1$
version.setTextContent(bundle.getVersion());

if(StringUtil.isNotEmpty(bundle.getVendor())) {
Element organization = DOMUtil.createElement(xml, project, "organization"); //$NON-NLS-1$
Element name = DOMUtil.createElement(xml, organization, "name"); //$NON-NLS-1$
Element organization = NSFODPDomUtil.createElement(project, "organization"); //$NON-NLS-1$
Element name = NSFODPDomUtil.createElement(organization, "name"); //$NON-NLS-1$
name.setTextContent(bundle.getVendor());
}

Element dependencies = DOMUtil.createElement(xml, project, "dependencies"); //$NON-NLS-1$
Element dependencies = NSFODPDomUtil.createElement(project, "dependencies"); //$NON-NLS-1$

// Add dependencies based on Require-Bundle
if(!bundle.getRequires().isEmpty()) {
for(String require : bundle.getRequires()) {
BundleInfo dep = bundles.get(require);
if(dep != null) {
Element dependency = DOMUtil.createElement(xml, dependencies, "dependency"); //$NON-NLS-1$
Element groupId = DOMUtil.createElement(xml, dependency, "groupId"); //$NON-NLS-1$
Element dependency = NSFODPDomUtil.createElement(dependencies, "dependency"); //$NON-NLS-1$
Element groupId = NSFODPDomUtil.createElement(dependency, "groupId"); //$NON-NLS-1$
groupId.setTextContent(this.groupId);
Element depArtifactId = DOMUtil.createElement(xml, dependency, "artifactId"); //$NON-NLS-1$
Element depArtifactId = NSFODPDomUtil.createElement(dependency, "artifactId"); //$NON-NLS-1$
depArtifactId.setTextContent(dep.getArtifactId());
Element depVersion = DOMUtil.createElement(xml, dependency, "version"); //$NON-NLS-1$
Element depVersion = NSFODPDomUtil.createElement(dependency, "version"); //$NON-NLS-1$
depVersion.setTextContent(dep.getVersion());
if(optionalDependencies) {
DOMUtil.createElement(xml, dependency, "optional").setTextContent("true"); //$NON-NLS-1$ //$NON-NLS-2$
NSFODPDomUtil.createElement(dependency, "optional").setTextContent("true"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
Expand All @@ -162,22 +162,22 @@ protected Path generateBundlePom(BundleInfo bundle, String basePom, Map<String,
// Add internal dependencies for Bundle-ClassPath entries
if(!bundle.getEmbeds().isEmpty()) {
for(BundleEmbed embed : bundle.getEmbeds()) {
Element dependency = DOMUtil.createElement(xml, dependencies, "dependency"); //$NON-NLS-1$
Element groupId = DOMUtil.createElement(xml, dependency, "groupId"); //$NON-NLS-1$
Element dependency = NSFODPDomUtil.createElement(dependencies, "dependency"); //$NON-NLS-1$
Element groupId = NSFODPDomUtil.createElement(dependency, "groupId"); //$NON-NLS-1$
groupId.setTextContent(this.groupId);
Element depArtifactId = DOMUtil.createElement(xml, dependency, "artifactId"); //$NON-NLS-1$
Element depArtifactId = NSFODPDomUtil.createElement(dependency, "artifactId"); //$NON-NLS-1$
depArtifactId.setTextContent(bundle.getArtifactId());
Element depVersion = DOMUtil.createElement(xml, dependency, "version"); //$NON-NLS-1$
Element depVersion = NSFODPDomUtil.createElement(dependency, "version"); //$NON-NLS-1$
depVersion.setTextContent(bundle.getVersion());
Element depClassifier = DOMUtil.createElement(xml, dependency, "classifier"); //$NON-NLS-1$
Element depClassifier = NSFODPDomUtil.createElement(dependency, "classifier"); //$NON-NLS-1$
depClassifier.setTextContent(toEmbedClassifierName(embed.getName()));
}
}

// Write out the temporary pom
Path tempPom = Files.createTempFile(bundle.getArtifactId(), ".pom"); //$NON-NLS-1$
tempPom.toFile().deleteOnExit();
Files.write(tempPom, DOMUtil.getXMLString(xml).getBytes(), StandardOpenOption.TRUNCATE_EXISTING);
Files.write(tempPom, NSFODPDomUtil.getXmlString(xml, null).getBytes(), StandardOpenOption.TRUNCATE_EXISTING);

return tempPom;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.openntf.p2.domino.updatesite;

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

Expand All @@ -18,4 +19,8 @@ public static String getString(String key) {
return '!' + key + '!';
}
}

public static String getString(String key, Object... params) {
return MessageFormat.format(getString(key), params);
}
}
Loading

0 comments on commit fa76ab7

Please sign in to comment.