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

Use galleon API V2 #581

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
<artifact name="${org.wildfly.prospero:prospero-common}"/>
<artifact name="${org.wildfly.prospero:prospero-metadata}"/>
<artifact name="${org.wildfly.prospero:prospero-cli}"/>
<artifact name="${org.jboss.galleon:galleon-core}"/>
<artifact name="${org.jboss.galleon:galleon-api}"/>
<artifact name="${org.jboss.galleon:galleon-common-api}"/>
<artifact name="${org.jboss.galleon:galleon-maven-universe}"/>
<artifact name="${info.picocli:picocli}"/>
<artifact name="${com.fasterxml.jackson.dataformat:jackson-dataformat-yaml}"/>
Expand Down
13 changes: 12 additions & 1 deletion dist/standalone-galleon-pack/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,18 @@

<dependency>
<groupId>org.jboss.galleon</groupId>
<artifactId>galleon-core</artifactId>
<artifactId>galleon-api</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jboss.galleon</groupId>
<artifactId>galleon-common-api</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
Expand Down
13 changes: 12 additions & 1 deletion dist/wildfly-galleon-pack/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,18 @@

<dependency>
<groupId>org.jboss.galleon</groupId>
<artifactId>galleon-core</artifactId>
<artifactId>galleon-api</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jboss.galleon</groupId>
<artifactId>galleon-common-api</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
Expand Down
6 changes: 5 additions & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
<groupId>${project.groupId}</groupId>
<artifactId>prospero-cli</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.galleon</groupId>
<artifactId>galleon-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package org.wildfly.prospero.it;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
Expand Down Expand Up @@ -117,9 +119,13 @@ public ExecutionResult(Process process) {
}

public void assertReturnCode(int expectedReturnCode) {
assertThat(process.exitValue())
.overridingErrorMessage(new ProcessErrorStreamReader(process))
.isEqualTo(expectedReturnCode);
try {
assertThat(process.exitValue())
.overridingErrorMessage(Files.readString(Path.of("target/test-out.log")))
.isEqualTo(expectedReturnCode);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.deployment.DeploymentException;
import org.jboss.galleon.ProvisioningException;
import org.jboss.galleon.config.ProvisioningConfig;
import org.jboss.galleon.api.config.GalleonProvisioningConfig;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -67,7 +67,7 @@ public class CacheManifestTest extends WfCoreTestBase {

@Rule
public TemporaryFolder tempDir = new TemporaryFolder();
private ProvisioningConfig baseProvCfg;
private GalleonProvisioningConfig baseProvCfg;
private Channel baseChannel;
private File baseManifest;
private TestRepositoryUtils repositoryUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
package org.wildfly.prospero.it.cli;

import org.apache.commons.io.FileUtils;
import org.jboss.galleon.config.FeaturePackConfig;
import org.jboss.galleon.config.ProvisioningConfig;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -46,6 +44,8 @@
import java.util.stream.Collectors;

import static org.assertj.core.api.Assertions.assertThat;
import org.jboss.galleon.api.config.GalleonFeaturePackConfig;
import org.jboss.galleon.api.config.GalleonProvisioningConfig;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -106,7 +106,7 @@ private void checkMetaData(InstallationMetadata metadata, Stream stream, Channel
try (InstallationMetadata meta = metadata) {
ChannelManifest channelManifest = meta.getManifest();
ProsperoConfig prosperoConfig = meta.getProsperoConfig();
ProvisioningConfig provisionedConfig = meta.getGalleonProvisioningConfig();
GalleonProvisioningConfig provisionedConfig = meta.getGalleonProvisioningConfig();
// check channelManifest
assertEquals(ChannelManifestMapper.CURRENT_SCHEMA_VERSION, channelManifest.getSchemaVersion());
assertNull(channelManifest.getDescription());
Expand Down Expand Up @@ -137,7 +137,7 @@ private void checkMetaData(InstallationMetadata metadata, Stream stream, Channel
// check provisionedConfig
assertTrue(provisionedConfig.hasFeaturePackDeps());
assertEquals(1, provisionedConfig.getFeaturePackDeps().size());
FeaturePackConfig featurePackConfig = provisionedConfig.getFeaturePackDeps().iterator().next();
GalleonFeaturePackConfig featurePackConfig = provisionedConfig.getFeaturePackDeps().iterator().next();
assertEquals("org.wildfly.core:wildfly-core-galleon-pack::zip", featurePackConfig.getLocation().getProducerName());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public void addFeaturePack() throws Exception {
ExecutionUtils.prosperoExecution(CliConstants.Commands.REVERT, CliConstants.Commands.PERFORM,
CliConstants.REVISION, savedState.getName(),
CliConstants.YES,
CliConstants.VERBOSE,
CliConstants.DIR, targetDir.getAbsolutePath())
.withTimeLimit(10, TimeUnit.MINUTES)
.execute()
Expand Down
27 changes: 18 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@
<version.org.apache.maven>3.6.3</version.org.apache.maven>
<version.org.codehaus.plexus-interpolation>1.27</version.org.codehaus.plexus-interpolation>
<version.org.codehaus.plexus-utils>3.5.0</version.org.codehaus.plexus-utils>
<version.org.jboss.staxmapper>1.5.0.Final</version.org.jboss.staxmapper>
<version.org.jboss.galleon>5.2.2.Final</version.org.jboss.galleon>
<version.org.eclipse.jgit>6.8.0.202311291450-r</version.org.eclipse.jgit>
<version.com.fasterxml.jackson>2.16.1</version.com.fasterxml.jackson>
<version.org.jboss.staxmapper>1.4.0.Final</version.org.jboss.staxmapper>
<version.org.jboss.galleon>6.0.0.Beta3</version.org.jboss.galleon>
<version.org.eclipse.jgit>6.7.0.202309050840-r</version.org.eclipse.jgit>
<version.com.fasterxml.jackson>2.15.2</version.com.fasterxml.jackson>
<version.org.jboss.logmanager>2.1.19.Final</version.org.jboss.logmanager>
<version.org.jboss.logging.slf4j-jboss-logmanager>2.0.1.Final</version.org.jboss.logging.slf4j-jboss-logmanager>
<version.org.jboss.logging.jboss-logging-processor>2.2.1.Final</version.org.jboss.logging.jboss-logging-processor>
<version.org.jboss.modules>2.1.2.Final</version.org.jboss.modules>
<version.org.jboss.xnio>3.8.13.Final</version.org.jboss.xnio>
<version.org.wildfly.common>1.7.0.Final</version.org.wildfly.common>
<version.org.wildfly.galleon-plugins>6.5.4.Final</version.org.wildfly.galleon-plugins>
<version.org.jboss.modules>2.1.0.Final</version.org.jboss.modules>
<version.org.jboss.xnio>3.8.10.Final</version.org.jboss.xnio>
<version.org.wildfly.common>1.6.0.Final</version.org.wildfly.common>
<version.org.wildfly.galleon-plugins>7.0.0.Beta3</version.org.wildfly.galleon-plugins>
<version.org.wildfly.installation-manager>1.0.2.Final</version.org.wildfly.installation-manager>
<version.org.wildfly.maven.plugins.licenses-plugin>2.4.1.Final</version.org.wildfly.maven.plugins.licenses-plugin>
<version.org.wildfly.prospero.prospero-metadata>1.2.1.Final</version.org.wildfly.prospero.prospero-metadata>
Expand Down Expand Up @@ -261,7 +261,16 @@
<artifactId>galleon-core</artifactId>
<version>${version.org.jboss.galleon}</version>
</dependency>

<dependency>
<groupId>org.jboss.galleon</groupId>
<artifactId>galleon-api</artifactId>
<version>${version.org.jboss.galleon}</version>
</dependency>
<dependency>
<groupId>org.jboss.galleon</groupId>
<artifactId>galleon-common-api</artifactId>
<version>${version.org.jboss.galleon}</version>
</dependency>
<dependency>
<groupId>org.jboss.galleon</groupId>
<artifactId>galleon-maven-universe</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions prospero-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
<groupId>org.wildfly.prospero</groupId>
<artifactId>prospero-common</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.galleon</groupId>
<artifactId>galleon-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.maven</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import org.wildfly.prospero.api.ProvisioningProgressEvent;
import org.wildfly.prospero.api.ArtifactChange;

import static org.jboss.galleon.layout.ProvisioningLayoutFactory.TRACK_CONFIGS;
import static org.jboss.galleon.layout.ProvisioningLayoutFactory.TRACK_LAYOUT_BUILD;
import static org.jboss.galleon.layout.ProvisioningLayoutFactory.TRACK_PACKAGES;
import static org.jboss.galleon.Constants.TRACK_CONFIGS;
import static org.jboss.galleon.Constants.TRACK_LAYOUT_BUILD;
import static org.jboss.galleon.Constants.TRACK_PACKAGES;
import static org.wildfly.prospero.galleon.GalleonEnvironment.TRACK_JBEXAMPLES;
import static org.wildfly.prospero.galleon.GalleonEnvironment.TRACK_JBMODULES;
import static org.wildfly.prospero.galleon.GalleonEnvironment.TRACK_JB_ARTIFACTS_RESOLVE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.wildfly.prospero.cli.commands;

import org.jboss.galleon.config.FeaturePackConfig;
import org.wildfly.channel.Channel;
import org.wildfly.prospero.ProsperoLogger;
import org.wildfly.prospero.api.InstallationMetadata;
Expand All @@ -37,6 +36,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.jboss.galleon.api.config.GalleonFeaturePackConfig;

@CommandLine.Command(name = CliConstants.Commands.CLONE)
public class CloneCommand extends AbstractCommand {
Expand Down Expand Up @@ -129,7 +129,7 @@ public Integer call() throws Exception {

try (InstallationMetadata metadataBundle = InstallationMetadata.fromMetadataBundle(inPath.toAbsolutePath())) {
console.println(CliMessages.MESSAGES.provisioningConfigHeader());
for (FeaturePackConfig featurePackDep : metadataBundle.getGalleonProvisioningConfig().getFeaturePackDeps()) {
for (GalleonFeaturePackConfig featurePackDep : metadataBundle.getGalleonProvisioningConfig().getFeaturePackDeps()) {
console.println(" * " + featurePackDep.getLocation().toString());
}
console.println(CliMessages.MESSAGES.subscribedChannelsHeader());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.jboss.galleon.api.config.GalleonProvisioningConfig;

import org.jboss.galleon.config.ProvisioningConfig;
import org.wildfly.channel.Channel;
import org.wildfly.channel.ChannelManifestCoordinate;
import org.wildfly.channel.Repository;
Expand Down Expand Up @@ -145,7 +145,7 @@ public Integer call() throws Exception {

final ProvisioningDefinition provisioningDefinition = buildDefinition();
final MavenOptions mavenOptions = getMavenOptions();
final ProvisioningConfig provisioningConfig = provisioningDefinition.toProvisioningConfig();
final GalleonProvisioningConfig provisioningConfig = provisioningDefinition.toProvisioningConfig();
final List<Channel> channels = resolveChannels(provisioningDefinition, mavenOptions);
final List<Repository> shadowRepositories = RepositoryDefinition.from(this.shadowRepositories);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.wildfly.prospero.cli.commands;

import org.apache.commons.io.FileUtils;
import org.jboss.galleon.config.ProvisioningConfig;
import org.wildfly.channel.Channel;
import org.wildfly.prospero.actions.ProvisioningAction;
import org.wildfly.prospero.api.MavenOptions;
Expand All @@ -34,6 +33,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import org.jboss.galleon.api.config.GalleonProvisioningConfig;

@CommandLine.Command(
name = CliConstants.Commands.PRINT_LICENSES,
Expand All @@ -52,7 +52,7 @@ public Integer call() throws Exception {
try {
final ProvisioningDefinition provisioningDefinition = buildDefinition();
final MavenOptions mavenOptions = getMavenOptions();
final ProvisioningConfig provisioningConfig = provisioningDefinition.toProvisioningConfig();
final GalleonProvisioningConfig provisioningConfig = provisioningDefinition.toProvisioningConfig();
final List<Channel> channels = resolveChannels(provisioningDefinition, mavenOptions);

final ProvisioningAction provisioningAction = actionFactory.install(tempDirectory.toAbsolutePath(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

import org.apache.commons.io.FileUtils;
import org.jboss.galleon.ProvisioningException;
import org.jboss.galleon.config.ProvisioningConfig;
import org.jboss.galleon.diff.FsDiff;
import org.jboss.galleon.diff.FsEntry;
import org.jboss.galleon.diff.FsEntryFactory;
Expand Down Expand Up @@ -65,6 +64,7 @@
import picocli.CommandLine;

import javax.xml.stream.XMLStreamException;
import org.jboss.galleon.api.config.GalleonProvisioningConfig;

@CommandLine.Command(
name = CliConstants.Commands.UPDATE,
Expand Down Expand Up @@ -395,7 +395,7 @@ private static boolean hasChangedEntries(FsDiff diff) {
}

private FeaturePackLocation getFpl(KnownFeaturePack knownFeaturePack, String version) throws XMLStreamException, ProvisioningException {
ProvisioningConfig config = GalleonUtils.loadProvisioningConfig(knownFeaturePack.getGalleonConfiguration());
GalleonProvisioningConfig config = GalleonUtils.loadProvisioningConfig(knownFeaturePack.getGalleonConfiguration());
if (config.getFeaturePackDeps().isEmpty()) {
throw new ProvisioningException("At least one feature pack location must be specified in the provisioning configuration");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import java.util.List;
import java.util.stream.Collectors;

import org.jboss.galleon.config.ProvisioningConfig;
import org.jboss.galleon.universe.FeaturePackLocation;
import org.jboss.galleon.xml.ProvisioningXmlWriter;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
Expand All @@ -54,6 +52,9 @@
import org.wildfly.prospero.test.MetadataTestUtils;

import static org.assertj.core.api.Assertions.assertThat;
import org.jboss.galleon.api.GalleonBuilder;
import org.jboss.galleon.api.Provisioning;
import org.jboss.galleon.api.config.GalleonProvisioningConfig;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
Expand All @@ -74,7 +75,7 @@ public class InstallCommandTest extends AbstractMavenCommandTest {
private ProvisioningAction provisionAction;

@Captor
private ArgumentCaptor<ProvisioningConfig> configCaptor;
private ArgumentCaptor<GalleonProvisioningConfig> configCaptor;

@Captor
private ArgumentCaptor<List<Channel>> channelCaptor;
Expand Down Expand Up @@ -182,10 +183,11 @@ public void callProvisionOnInstallKnownFplOverrideChannelsCommand() throws Excep
@Test
public void usingProvisionDefinitonRequiresChannel() throws Exception {
final File provisionDefinitionFile = temporaryFolder.newFile("provision.xml");
ProvisioningXmlWriter.getInstance().write(ProvisioningConfig.builder()
try(Provisioning p = new GalleonBuilder().newProvisioningBuilder().build()) {
p.storeProvisioningConfig(GalleonProvisioningConfig.builder()
.addFeaturePackDep(FeaturePackLocation.fromString("org.wildfly.core:wildfly-core-galleon-pack::zip"))
.build(),
provisionDefinitionFile.toPath());
.build(), provisionDefinitionFile.toPath());
}

final File channelsFile = temporaryFolder.newFile();
Channel channel = createChannel("dev", "wildfly-channel", "http://test.test", "org.wildfly");
Expand Down
Loading
Loading