diff --git a/api/src/main/java/org/jboss/galleon/api/ProvisioningImpl.java b/api/src/main/java/org/jboss/galleon/api/ProvisioningImpl.java index eb1cf532..617af9af 100644 --- a/api/src/main/java/org/jboss/galleon/api/ProvisioningImpl.java +++ b/api/src/main/java/org/jboss/galleon/api/ProvisioningImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 Red Hat, Inc. and/or its affiliates + * Copyright 2016-2024 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +16,6 @@ */ package org.jboss.galleon.api; -import java.io.IOException; import java.io.InputStream; import java.net.URLClassLoader; import java.nio.file.Files; @@ -42,7 +41,6 @@ import org.jboss.galleon.progresstracking.ProgressCallback; import org.jboss.galleon.progresstracking.ProgressTracker; import org.jboss.galleon.universe.UniverseResolver; -import org.jboss.galleon.util.IoUtils; import org.jboss.galleon.core.builder.ProvisioningContextBuilder; import org.jboss.galleon.diff.FsDiff; import org.jboss.galleon.impl.ProvisioningUtil; @@ -61,7 +59,6 @@ class ProvisioningImpl implements Provisioning { private boolean recordState; private final Map> progressTrackers = new HashMap<>(); - private final Path tmp; private final Map locals; private final String coreVersion; @@ -78,12 +75,6 @@ class ProvisioningImpl implements Provisioning { this.locals = builder.getLocals(); this.recordState = builder.isRecordState(); loader = GalleonBuilder.getCallerClassLoader(coreVersion, universeResolver); - try { - tmp = Files.createTempDirectory("galleon-tmp"); - } catch (IOException ex) { - throw new ProvisioningException(ex); - } - } /** @@ -169,7 +160,6 @@ private ProvisioningContext buildProvisioningContext() throws ProvisioningExcept @Override public void close() { - IoUtils.recursiveDelete(tmp); try { for (ProvisioningContext ctx : contexts) { ctx.close(); diff --git a/core/src/main/java/org/jboss/galleon/runtime/FeaturePackRuntime.java b/core/src/main/java/org/jboss/galleon/runtime/FeaturePackRuntime.java index 36bf3b76..640ab13c 100644 --- a/core/src/main/java/org/jboss/galleon/runtime/FeaturePackRuntime.java +++ b/core/src/main/java/org/jboss/galleon/runtime/FeaturePackRuntime.java @@ -105,14 +105,14 @@ public class FeaturePackRuntime extends FeaturePackLayout implements FeaturePack } // Filter out the packages that are not at the right stability level final Map filteredPackages = new LinkedHashMap<>(tmpPackages.size()); - Stability minStability= rt.getMinPackageStability(getSpec().getPackageStability()); + Stability stability= rt.getPackageStability(getSpec().getPackageStability()); for(Map.Entry entry : tmpPackages.entrySet()) { - Stability stability = entry.getValue().getSpec().getStability() == null ? Stability.DEFAULT : entry.getValue().getSpec().getStability(); - if (minStability.enables(stability)) { + Stability packageStability = entry.getValue().getSpec().getStability() == null ? Stability.DEFAULT : entry.getValue().getSpec().getStability(); + if (stability.enables(packageStability)) { filteredPackages.put(entry.getKey(), entry.getValue()); } else { if (rt.getMessageWriter().isVerboseEnabled()) { - rt.getMessageWriter().verbose("Excluding package '" + entry.getKey() + "'. Its stability '" + stability + "' is lower than the expected '" + minStability +"' stability"); + rt.getMessageWriter().verbose("Excluding package '" + entry.getKey() + "'. Its stability '" + packageStability + "' is lower than the expected '" + stability +"' stability"); } } } diff --git a/core/src/main/java/org/jboss/galleon/runtime/ProvisioningRuntimeBuilder.java b/core/src/main/java/org/jboss/galleon/runtime/ProvisioningRuntimeBuilder.java index 7a15b201..16824c6d 100644 --- a/core/src/main/java/org/jboss/galleon/runtime/ProvisioningRuntimeBuilder.java +++ b/core/src/main/java/org/jboss/galleon/runtime/ProvisioningRuntimeBuilder.java @@ -282,31 +282,27 @@ private ProvisioningRuntime doBuild() throws ProvisioningException { } /** - * The min config stability is constrained by the feature-pack stability that is the minimal for a - * given feature-pack. The stability set by the user can only reduce the scope. + * The config stability is by default the one declared in the feature-pack. if a user specify a config stability, + * this level is used. */ - public Stability getMinConfigStability(Stability featurePackStability) { - Stability minStability= featurePackStability == null ? Stability.DEFAULT : featurePackStability; + public Stability getConfigStability(Stability featurePackStability) { + Stability stability= featurePackStability == null ? Stability.DEFAULT : featurePackStability; if (getUserConfigStability() != null) { - if (minStability.enables(getUserConfigStability())) { - minStability = getUserConfigStability(); - } + stability = getUserConfigStability(); } - return minStability; + return stability; } /** - * The min package stability is constrained by the feature-pack stability that is the minimal for a - * given feature-pack. The stability set by the user can only reduce the scope. + * The package stability is by default the one declared in the feature-pack. if a user specify a config stability, + * this level is used. */ - public Stability getMinPackageStability(Stability featurePackStability) { - Stability minStability= featurePackStability == null ? Stability.DEFAULT : featurePackStability; + public Stability getPackageStability(Stability featurePackStability) { + Stability stability= featurePackStability == null ? Stability.DEFAULT : featurePackStability; if (getUserPackageStability() != null) { - if (minStability.enables(getUserPackageStability())) { - minStability = getUserPackageStability(); - } + stability = getUserPackageStability(); } - return minStability; + return stability; } public Stability getUserConfigStability() { @@ -968,10 +964,10 @@ private void processConfigItemContainer(ConfigItemContainer ciContainer) throws fpStability = fp.getSpec().getConfigStability(); } } - Stability minStability = getMinConfigStability(fpStability); - if (!minStability.enables(featureStability)) { + Stability stability = getConfigStability(fpStability); + if (!stability.enables(featureStability)) { if (messageWriter.isVerboseEnabled()) { - messageWriter.verbose(configStack.id + ". Excluding feature '" + fconfig.getSpecId().getName() + "'. Its stability '" + featureStability + "' is lower than the expected '" + minStability +"' stability"); + messageWriter.verbose(configStack.id + ". Excluding feature '" + fconfig.getSpecId().getName() + "'. Its stability '" + featureStability + "' is lower than the expected '" + stability +"' stability"); } continue; } @@ -980,9 +976,9 @@ private void processConfigItemContainer(ConfigItemContainer ciContainer) throws for (String p : fconfig.getParams().keySet()) { FeatureParameterSpec ps = spec.getSpec().getParam(p); Stability paramStability = ps.getStability() == null ? Stability.DEFAULT : ps.getStability(); - if (!minStability.enables(paramStability)) { + if (!stability.enables(paramStability)) { if (messageWriter.isVerboseEnabled()) { - messageWriter.verbose(configStack.id + ". Excluding parameter '" + p + "' from feature '" + fconfig.getSpecId().getName() + "'. Its stability '" + paramStability + "' is lower than the expected '" + minStability +"' stability"); + messageWriter.verbose(configStack.id + ". Excluding parameter '" + p + "' from feature '" + fconfig.getSpecId().getName() + "'. Its stability '" + paramStability + "' is lower than the expected '" + stability +"' stability"); } toRemove.add(p); } diff --git a/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureCommunityStabilityTestCase.java b/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureCommunityStabilityTestCase.java index dec4c782..f2c40330 100644 --- a/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureCommunityStabilityTestCase.java +++ b/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureCommunityStabilityTestCase.java @@ -44,7 +44,7 @@ protected ProvisioningConfig provisioningConfig() throws ProvisioningDescription @Override protected ProvisionedState provisionedState() throws ProvisioningDescriptionException { return ProvisionedState.builder() - .addFeaturePack(ProvisionedFeaturePack.builder(FP1_GAV).addPackage("p").addPackage("pDefault").addPackage("pCommunity").build()) + .addFeaturePack(ProvisionedFeaturePack.builder(FP1_GAV).addPackage("p").addPackage("pCommunity").addPackage("pDefault").build()) .addConfig(ProvisionedConfigBuilder.builder() .setName("configA") .addFeature(ProvisionedFeatureBuilder.builder(ResolvedFeatureId.create(new ResolvedSpecId(FP1_GAV.getProducer(), "specNoStability"), "id", "1"))) @@ -55,13 +55,17 @@ protected ProvisionedState provisionedState() throws ProvisioningDescriptionExce builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP1_GAV.getProducer(), "specDefault")). setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").build()) .build()) - .addFeaturePack(ProvisionedFeaturePack.builder(FP2_GAV).addPackage("p").addPackage("pDefault").build()) + .addFeaturePack(ProvisionedFeaturePack.builder(FP2_GAV).addPackage("p").addPackage("pCommunity").addPackage("pDefault").build()) .addConfig(ProvisionedConfigBuilder.builder() .setName("configB") .addFeature(ProvisionedFeatureBuilder.builder(ResolvedFeatureId.create(new ResolvedSpecId(FP2_GAV.getProducer(), "specNoStability"), "id", "1"))) + .addFeature(ProvisionedFeatureBuilder. + builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP2_GAV.getProducer(), "specCommunity")). + setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").build()) .addFeature(ProvisionedFeatureBuilder. builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP2_GAV.getProducer(), "specDefault")). - setParam("id", "1").build()).setConfigParam("idDefault", "1").build()) + setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").build()) + .build()) .build(); } diff --git a/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureDefaultConfigStabilityCommunityPackageTestCase.java b/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureDefaultConfigStabilityCommunityPackageTestCase.java index 08600281..e3220a24 100644 --- a/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureDefaultConfigStabilityCommunityPackageTestCase.java +++ b/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureDefaultConfigStabilityCommunityPackageTestCase.java @@ -54,7 +54,7 @@ protected ProvisionedState provisionedState() throws ProvisioningDescriptionExce builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP1_GAV.getProducer(), "specDefault")). setParam("id", "1").build()).setConfigParam("idDefault", "1").build()) .build()) - .addFeaturePack(ProvisionedFeaturePack.builder(FP2_GAV).addPackage("p").addPackage("pDefault").build()) + .addFeaturePack(ProvisionedFeaturePack.builder(FP2_GAV).addPackage("p").addPackage("pDefault").addPackage("pCommunity").build()) .addConfig(ProvisionedConfigBuilder.builder() .setName("configB") .addFeature(ProvisionedFeatureBuilder.builder(ResolvedFeatureId.create(new ResolvedSpecId(FP2_GAV.getProducer(), "specNoStability"), "id", "1"))) diff --git a/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureExperimentalStabilityTestCase.java b/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureExperimentalStabilityTestCase.java index 2fbf9fea..2e2cc673 100644 --- a/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureExperimentalStabilityTestCase.java +++ b/core/src/test/java/org/jboss/galleon/config/feature/stability/FeatureExperimentalStabilityTestCase.java @@ -61,13 +61,22 @@ protected ProvisionedState provisionedState() throws ProvisioningDescriptionExce builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP1_GAV.getProducer(), "specDefault")). setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").build()) .build()) - .addFeaturePack(ProvisionedFeaturePack.builder(FP2_GAV).addPackage("p").addPackage("pDefault").build()) + .addFeaturePack(ProvisionedFeaturePack.builder(FP2_GAV).addPackage("p").addPackage("pDefault").addPackage("pCommunity").addPackage("pPreview").addPackage("pExperimental").build()) .addConfig(ProvisionedConfigBuilder.builder() .setName("configB") .addFeature(ProvisionedFeatureBuilder.builder(ResolvedFeatureId.create(new ResolvedSpecId(FP2_GAV.getProducer(), "specNoStability"), "id", "1"))) + .addFeature(ProvisionedFeatureBuilder. + builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP2_GAV.getProducer(), "specExperimental")). + setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").setConfigParam("idPreview", "1").setConfigParam("idExperimental", "1").build()) + .addFeature(ProvisionedFeatureBuilder. + builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP2_GAV.getProducer(), "specPreview")). + setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").setConfigParam("idPreview", "1").setConfigParam("idExperimental", "1").build()) + .addFeature(ProvisionedFeatureBuilder. + builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP2_GAV.getProducer(), "specCommunity")). + setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").setConfigParam("idPreview", "1").build()) .addFeature(ProvisionedFeatureBuilder. builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP2_GAV.getProducer(), "specDefault")). - setParam("id", "1").build()).setConfigParam("idDefault", "1").build()) + setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").build()) .build()) .build(); } diff --git a/core/src/test/java/org/jboss/galleon/config/feature/stability/FeaturePreviewStabilityTestCase.java b/core/src/test/java/org/jboss/galleon/config/feature/stability/FeaturePreviewStabilityTestCase.java index 3b5b677e..7067c9f2 100644 --- a/core/src/test/java/org/jboss/galleon/config/feature/stability/FeaturePreviewStabilityTestCase.java +++ b/core/src/test/java/org/jboss/galleon/config/feature/stability/FeaturePreviewStabilityTestCase.java @@ -59,13 +59,19 @@ protected ProvisionedState provisionedState() throws ProvisioningDescriptionExce builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP1_GAV.getProducer(), "specDefault")). setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").build()) .build()) - .addFeaturePack(ProvisionedFeaturePack.builder(FP2_GAV).addPackage("p").addPackage("pDefault").build()) + .addFeaturePack(ProvisionedFeaturePack.builder(FP2_GAV).addPackage("p").addPackage("pDefault").addPackage("pCommunity").addPackage("pPreview").build()) .addConfig(ProvisionedConfigBuilder.builder() .setName("configB") .addFeature(ProvisionedFeatureBuilder.builder(ResolvedFeatureId.create(new ResolvedSpecId(FP2_GAV.getProducer(), "specNoStability"), "id", "1"))) + .addFeature(ProvisionedFeatureBuilder. + builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP2_GAV.getProducer(), "specPreview")). + setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").setConfigParam("idPreview", "1").build()) + .addFeature(ProvisionedFeatureBuilder. + builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP2_GAV.getProducer(), "specCommunity")). + setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").setConfigParam("idPreview", "1").build()) .addFeature(ProvisionedFeatureBuilder. builder(ResolvedFeatureId.builder(new ResolvedSpecId(FP2_GAV.getProducer(), "specDefault")). - setParam("id", "1").build()).setConfigParam("idDefault", "1").build()) + setParam("id", "1").build()).setConfigParam("idDefault", "1").setConfigParam("idCommunity", "1").build()) .build()) .build(); } diff --git a/core/src/test/java/org/jboss/galleon/featurepack/stability/FeaturePackSetExperimentalStabilityTestCase.java b/core/src/test/java/org/jboss/galleon/featurepack/stability/FeaturePackSetExperimentalStabilityTestCase.java index 88a7236f..a08e10ec 100644 --- a/core/src/test/java/org/jboss/galleon/featurepack/stability/FeaturePackSetExperimentalStabilityTestCase.java +++ b/core/src/test/java/org/jboss/galleon/featurepack/stability/FeaturePackSetExperimentalStabilityTestCase.java @@ -40,7 +40,7 @@ protected ProvisioningConfig provisioningConfig() throws ProvisioningDescription @Override protected ProvisionedState provisionedState() throws ProvisioningDescriptionException { return ProvisionedState.builder() - .addFeaturePack(ProvisionedFeaturePack.builder(FP1_100_GAV).addPackage("fp1_1default").addPackage("fp1_2noStability").build()) + .addFeaturePack(ProvisionedFeaturePack.builder(FP1_100_GAV).addPackage("fp1_1default").addPackage("fp1_2noStability").addPackage("fp1_3experimental").build()) .addFeaturePack(ProvisionedFeaturePack.builder(FP2_100_GAV).addPackage("fp2_1default").addPackage("fp2_2noStability").addPackage("fp2_3community").addPackage("fp2_4preview").addPackage("fp2_5experimental").build()) .build(); }