From e3fd8a72f99be32805030055a14abeb55061f447 Mon Sep 17 00:00:00 2001 From: Robert Stupp Date: Fri, 17 Feb 2023 19:47:14 +0100 Subject: [PATCH] SAVE POINT / BROKEN --- .../quarkus/deployment/pkg/PackageConfig.java | 9 + .../deployment/pkg/BuiltInTypeTest.java | 23 ++ .../configuration/ConfigInstantiator.java | 10 +- .../extension/QuarkusPluginExtension.java | 4 + .../tasks/CombinedConfigSourceProvider.java | 46 ++++ .../quarkus/gradle/tasks/EffectiveConfig.java | 196 +++++++++++++++ .../gradle/tasks/EffectiveConfigHelper.java | 225 ------------------ .../io/quarkus/gradle/tasks/QuarkusBuild.java | 66 ++--- .../quarkus/gradle/tasks/QuarkusBuildApp.java | 66 +++-- .../tasks/QuarkusBuildConfiguration.java | 102 ++------ .../tasks/QuarkusBuildDependencies.java | 45 ++-- .../gradle/tasks/QuarkusBuildTask.java | 29 +-- .../tasks/QuarkusShowEffectiveConfig.java | 16 +- .../tasks/EffectiveConfigHelperTest.java | 212 ----------------- .../gradle/tasks/EffectiveConfigTest.java | 168 +++++++++++++ .../tasks/QuarkusBuildConfigurationTest.java | 56 +++++ .../application.properties | 1 + .../application.yaml | 2 + .../application.yml | 2 + .../cfg/overload/1/application.properties | 2 +- .../gradle/cfg/overload/2/application.yaml | 2 +- 21 files changed, 665 insertions(+), 617 deletions(-) create mode 100644 core/deployment/src/test/java/io/quarkus/deployment/pkg/BuiltInTypeTest.java create mode 100644 devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/CombinedConfigSourceProvider.java create mode 100644 devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfig.java delete mode 100644 devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfigHelper.java delete mode 100644 devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigHelperTest.java create mode 100644 devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigTest.java create mode 100644 devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/QuarkusBuildConfigurationTest.java diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java index 0c227fe209e5e..3172e9e7ffbc0 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java @@ -78,6 +78,15 @@ private BuiltInType(final String name) { public String toString() { return name; } + + public static BuiltInType fromString(String name) { + for (PackageConfig.BuiltInType type : values()) { + if (type.toString().equals(name)) { + return type; + } + } + throw new IllegalArgumentException("Unknown Quarkus package type '" + name + "'"); + } } /** diff --git a/core/deployment/src/test/java/io/quarkus/deployment/pkg/BuiltInTypeTest.java b/core/deployment/src/test/java/io/quarkus/deployment/pkg/BuiltInTypeTest.java new file mode 100644 index 0000000000000..7906aaa32aa0f --- /dev/null +++ b/core/deployment/src/test/java/io/quarkus/deployment/pkg/BuiltInTypeTest.java @@ -0,0 +1,23 @@ +package io.quarkus.deployment.pkg; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; + +public class BuiltInTypeTest { + + @ParameterizedTest + @EnumSource(PackageConfig.BuiltInType.class) + void packageTypeConversion(PackageConfig.BuiltInType packageType) { + assertThat(PackageConfig.BuiltInType.fromString(packageType.toString())).isSameAs(packageType); + } + + @Test + void invalidPackageType() { + assertThatIllegalArgumentException().isThrownBy(() -> PackageConfig.BuiltInType.fromString("not-a-package-type")) + .withMessage("Unknown Quarkus package type 'not-a-package-type'"); + } +} diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigInstantiator.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigInstantiator.java index 8d65a8c75cf3a..c182a2af1fe52 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigInstantiator.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigInstantiator.java @@ -54,6 +54,10 @@ public static T handleObject(Supplier supplier) { public static void handleObject(Object o) { final SmallRyeConfig config = (SmallRyeConfig) ConfigProvider.getConfig(); + handleObject(o, config); + } + + public static void handleObject(Object o, SmallRyeConfig config) { final String clsNameSuffix = getClassNameSuffix(o); if (clsNameSuffix == null) { // unsupported object type @@ -190,7 +194,11 @@ private static Converter getConverterFor(Type type, SmallRyeConfig config) { } else if (rawType == Optional.class) { return Converters.newOptionalConverter(getConverterFor(typeOfParameter(type, 0), config)); } else if (rawType == List.class) { - return Converters.newCollectionConverter(getConverterFor(typeOfParameter(type, 0), config), ArrayList::new); + return Converters.newCollectionConverter(getConverterFor(typeOfParameter(type, 0), config), + ConfigUtils.listFactory()); + } else if (rawType == Set.class) { + return Converters.newCollectionConverter(getConverterFor(typeOfParameter(type, 0), config), + ConfigUtils.setFactory()); } else { return config.requireConverter(rawTypeOf(type)); } diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java index 01ef7f9a0734c..839f57450c80a 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java @@ -108,6 +108,10 @@ public void beforeTest(Test task) { } public String resolveBuildProperty(String propertyKey, Map taskSystemProps, String defaultValue) { + if (true) { + // TODO !!! + throw new UnsupportedOperationException("Delegate to EffectiveConfig"); + } Object v = taskSystemProps.get(propertyKey); if (v instanceof String) { return v.toString(); diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/CombinedConfigSourceProvider.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/CombinedConfigSourceProvider.java new file mode 100644 index 0000000000000..69db37a746c40 --- /dev/null +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/CombinedConfigSourceProvider.java @@ -0,0 +1,46 @@ +package io.quarkus.gradle.tasks; + +import java.io.IOException; +import java.net.URL; +import java.util.List; +import java.util.function.Consumer; + +import org.eclipse.microprofile.config.spi.ConfigSource; +import org.eclipse.microprofile.config.spi.ConfigSourceProvider; + +import io.smallrye.config.AbstractLocationConfigSourceLoader; +import io.smallrye.config.PropertiesConfigSource; +import io.smallrye.config.source.yaml.YamlConfigSource; + +final class CombinedConfigSourceProvider extends AbstractLocationConfigSourceLoader implements ConfigSourceProvider { + private final Consumer sourceUrls; + private final int ordinal; + + CombinedConfigSourceProvider(Consumer sourceUrls, int ordinal) { + this.sourceUrls = sourceUrls; + this.ordinal = ordinal; + } + + @Override + protected String[] getFileExtensions() { + return new String[] { + "application.yaml", + "application.yml", + "application.properties" + }; + } + + @Override + protected ConfigSource loadConfigSource(final URL url, final int ordinal) throws IOException { + sourceUrls.accept(url); + return url.getPath().endsWith(".properties") ? new PropertiesConfigSource(url, ordinal) + : new YamlConfigSource(url, ordinal); + } + + @Override + public List getConfigSources(final ClassLoader classLoader) { + // Note: + return loadConfigSources(new String[] { "application.properties", "application.yaml", "application.yml" }, ordinal, + classLoader); + } +} diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfig.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfig.java new file mode 100644 index 0000000000000..cba7d9fb38b1a --- /dev/null +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfig.java @@ -0,0 +1,196 @@ +package io.quarkus.gradle.tasks; + +import static java.util.Collections.*; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +import org.eclipse.microprofile.config.spi.ConfigSource; + +import com.google.common.annotations.VisibleForTesting; + +import io.quarkus.deployment.configuration.ClassLoadingConfig; +import io.quarkus.deployment.pkg.PackageConfig; +import io.quarkus.gradle.dsl.Manifest; +import io.quarkus.runtime.configuration.ConfigInstantiator; +import io.quarkus.runtime.configuration.ConfigUtils; +import io.smallrye.config.EnvConfigSource; +import io.smallrye.config.PropertiesConfigSource; +import io.smallrye.config.SmallRyeConfig; +import io.smallrye.config.common.utils.ConfigSourceUtil; + +/** + * Helper that bundles the various sources of config options for the Gradle plugin: system environment, system properties, + * quarkus build properties (on the Quarkus extension), Gradle project properties, application properties and "forced" + * properties (on the Gradle task). + * + *

+ * Eventually used to construct a map with the effective config options from all the sources above and expose + * the Quarkus config objects like {@link PackageConfig}, {@link ClassLoadingConfig} and the underlying {@link SmallRyeConfig}. + */ +final class EffectiveConfig { + private final SmallRyeConfig config; + private final PackageConfig packageConfig; + private final ClassLoadingConfig classLoadingConfig; + private final Manifest manifest = new Manifest(); + private final Map fullConfig; + private final List applicationPropsSources; + + private EffectiveConfig(Builder builder) { + List configSources = new ArrayList<>(); + // TODO add io.quarkus.runtime.configuration.DefaultsConfigSource ? + // TODO leverage io.quarkus.runtime.configuration.ProfileManager ? + + // Effective "ordinals" for the config sources: + // 700 -> forcedProperties + // 600 -> System.getProperties() + // 500 -> System.getenv() + // 480 -> quarkusBuildProperties + // 300 -> projectProperties + // 0-250 -> application.(properties|yaml|yml) + + applicationPropsSources = new ArrayList<>(); + + configSources.add(new PropertiesConfigSource(builder.forcedProperties, "forcedProperties", 700)); + configSources.add(new PropertiesConfigSource(ConfigSourceUtil.propertiesToMap(System.getProperties()), + "System.getProperties()", 600)); + configSources.add(new EnvConfigSource(500) { + }); + configSources.add(new PropertiesConfigSource(builder.buildProperties, "quarkusBuildProperties", 400)); + configSources.add(new PropertiesConfigSource(builder.projectProperties, "projectProperties", 300)); + + configSourcesForApplicationProperties(builder.sourceDirectories, applicationPropsSources::add, configSources::add); + config = buildConfig(builder.profile, configSources); + + packageConfig = new PackageConfig(); + classLoadingConfig = new ClassLoadingConfig(); + + ConfigInstantiator.handleObject(classLoadingConfig, config); + ConfigInstantiator.handleObject(packageConfig, config); + + // populate the Gradle Manifest object + manifest.attributes(packageConfig.manifest.attributes); + packageConfig.manifest.manifestSections.forEach((section, attribs) -> manifest.attributes(attribs, section)); + + this.fullConfig = generateFullConfigMap(config); + } + + @VisibleForTesting + static Map generateFullConfigMap(SmallRyeConfig config) { + Map map = new HashMap<>(); + config.getPropertyNames().forEach(property -> { + String v = config.getConfigValue(property).getValue(); + if (v != null) { + map.put(property, v); + } + }); + Map fullConfig = unmodifiableMap(map); + return fullConfig; + } + + @VisibleForTesting + static SmallRyeConfig buildConfig(String profile, List configSources) { + return ConfigUtils.emptyConfigBuilder() + .withSources(configSources) + .withProfile(profile) + .build(); + } + + public static Builder builder() { + return new Builder(); + } + + public PackageConfig.BuiltInType packageType() { + return PackageConfig.BuiltInType.fromString(packageConfig.type); + } + + public Map configMap() { + return fullConfig; + } + + public List applicationPropsSources() { + return applicationPropsSources; + } + + public SmallRyeConfig config() { + return config; + } + + public PackageConfig packageConfig() { + return packageConfig; + } + + public ClassLoadingConfig classLoadingConfig() { + return classLoadingConfig; + } + + static void configSourcesForApplicationProperties(Set sourceDirectories, Consumer sourceUrls, + Consumer configSourceConsumer) { + URL[] resourceUrls = sourceDirectories.stream().map(File::toURI) + .map(u -> { + try { + return u.toURL(); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + }) + .toArray(URL[]::new); + + for (URL resourceUrl : resourceUrls) { + URLClassLoader classLoader = new URLClassLoader(new URL[] { resourceUrl }); + CombinedConfigSourceProvider configSourceProvider = new CombinedConfigSourceProvider(sourceUrls, 250); + configSourceProvider.getConfigSources(classLoader).forEach(configSourceConsumer); + } + } + + static final class Builder { + private Map buildProperties = emptyMap(); + private Map projectProperties = emptyMap(); + private Map forcedProperties = emptyMap(); + private Set sourceDirectories = emptySet(); + private String profile = "prod"; + + EffectiveConfig build() { + return new EffectiveConfig(this); + } + + public Builder withForcedProperties(Map forcedProperties) { + this.forcedProperties = forcedProperties; + return this; + } + + public Builder withBuildProperties(Map buildProperties) { + this.buildProperties = buildProperties; + return this; + } + + public Builder withProjectProperties(Map projectProperties) { + Map target = new HashMap<>(); + projectProperties.forEach((k, v) -> { + if (v != null) { + target.put(k, v.toString()); + } + }); + this.projectProperties = target; + return this; + } + + public Builder withSourceDirectories(Set sourceDirectories) { + this.sourceDirectories = sourceDirectories; + return this; + } + + public Builder withProfile(String profile) { + this.profile = profile; + return this; + } + } +} diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfigHelper.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfigHelper.java deleted file mode 100644 index 4dcde2df3ba92..0000000000000 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfigHelper.java +++ /dev/null @@ -1,225 +0,0 @@ -package io.quarkus.gradle.tasks; - -import static java.util.Collections.unmodifiableMap; - -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.TreeMap; -import java.util.function.Consumer; -import java.util.stream.Collectors; - -import org.eclipse.microprofile.config.spi.ConfigSource; -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; -import org.gradle.api.logging.Logger; - -import io.quarkus.gradle.QuarkusPlugin; -import io.smallrye.config.AbstractLocationConfigSourceLoader; -import io.smallrye.config.PropertiesConfigSource; -import io.smallrye.config.source.yaml.YamlConfigSource; - -/** - * Helper that bundles the various sources of config options for the Gradle plugin: system environment, system properties, - * quarkus build properties (on the Quarkus extension), Gradle project properties, application properties and "forced" - * properties (on the Gradle task). - * - *

- * Eventually used to construct a map with the effective config options from all the sources above. - */ -final class EffectiveConfigHelper { - // System properties starting with 'quarkus.' - final Map quarkusSystemProperties; - // Environment properties starting with 'QUARKUS_' - final Map quarkusEnvProperties; - // Gradle project + extension properties starting with 'quarkus.' - private Map quarkusBuildProperties; - private Map projectProperties; - private Map applicationProperties; - private Map forcedProperties; - final List applicationPropertiesSourceUrls = new ArrayList<>(); - - EffectiveConfigHelper() { - this(collectQuarkusSystemProperties(), collectQuarkusEnvProperties()); - } - - EffectiveConfigHelper(Map quarkusSystemProperties, Map quarkusEnvProperties) { - this.quarkusSystemProperties = quarkusSystemProperties; - this.quarkusEnvProperties = quarkusEnvProperties; - } - - EffectiveConfigHelper applyBuildProperties(Map buildProperties) { - quarkusBuildProperties = unmodifiableMap(collectProperties(buildProperties)); - return this; - } - - EffectiveConfigHelper applyProjectProperties(Map buildProperties) { - projectProperties = collectProperties(buildProperties); - return this; - } - - EffectiveConfigHelper applyApplicationProperties(Set sourceDirectories, Logger logger) { - applicationProperties = loadApplicationProperties(sourceDirectories, logger, applicationPropertiesSourceUrls::add); - return this; - } - - EffectiveConfigHelper applyForcedProperties(Map forcedProperties) { - this.forcedProperties = forcedProperties; - return this; - } - - Map buildEffectiveConfiguration() { - Map map = new HashMap<>(); - - // Add non-"profile-prefixed" configuration options (aka all that do not start with '%') - addNonProfileToEffectiveConfig(projectProperties, map); - addNonProfileToEffectiveConfig(quarkusBuildProperties, map); - addNonProfileToEffectiveConfig(applicationProperties, map); - addNonProfileToEffectiveConfig(quarkusEnvProperties, map); - addNonProfileToEffectiveConfig(quarkusSystemProperties, map); - addNonProfileToEffectiveConfig(forcedProperties, map); - - String quarkusProfile = map.getOrDefault(QuarkusPlugin.QUARKUS_PROFILE, QuarkusPlugin.DEFAULT_PROFILE); - String profilePrefix = "%" + quarkusProfile + "."; - - // Add the configuration options for the selected profile (filtering on the key + truncating the key) - addProfileToEffectiveConfig(projectProperties, profilePrefix, map); - addProfileToEffectiveConfig(quarkusBuildProperties, profilePrefix, map); - addProfileToEffectiveConfig(applicationProperties, profilePrefix, map); - addProfileToEffectiveConfig(quarkusEnvProperties, profilePrefix, map); - addProfileToEffectiveConfig(quarkusSystemProperties, profilePrefix, map); - addProfileToEffectiveConfig(forcedProperties, profilePrefix, map); - - return unmodifiableMap(map); - } - - static Map loadApplicationProperties(Set sourceDirectories, Logger logger, Consumer sourceUrls) { - URL[] resourceUrls = sourceDirectories.stream().map(File::toURI) - .map(u -> { - try { - return u.toURL(); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - }) - .toArray(URL[]::new); - - Map config = new HashMap<>(); - - if (logger.isInfoEnabled()) { - logger.info("Loading Quarkus application config from resource URLs {}", - Arrays.stream(resourceUrls).map(Object::toString).collect(Collectors.joining(", "))); - } - - CombinedConfigSourceProvider configSourceProvider = new CombinedConfigSourceProvider(sourceUrls); - logger.debug("Loading Quarkus application config"); - for (URL resourceUrl : resourceUrls) { - URLClassLoader classLoader = new URLClassLoader(new URL[] { resourceUrl }); - for (ConfigSource configSource : configSourceProvider.getConfigSources(classLoader)) { - Map properties = configSource.getProperties(); - logger.debug("Loaded {} Quarkus application config entries via {}", properties.size(), - configSource); - config.putAll(properties); - } - } - - if (logger.isDebugEnabled()) { - logger.debug("Loaded Quarkus application config from 'application.[properties|yaml|yml]: {}", - new TreeMap<>(config).entrySet().stream().map(Objects::toString) - .collect(Collectors.joining("\n ", "\n ", ""))); - } - - return unmodifiableMap(config); - } - - static final class CombinedConfigSourceProvider extends AbstractLocationConfigSourceLoader implements ConfigSourceProvider { - final Consumer sourceUrls; - - CombinedConfigSourceProvider(Consumer sourceUrls) { - this.sourceUrls = sourceUrls; - } - - @Override - protected String[] getFileExtensions() { - return new String[] { - "application.yaml", - "application.yml", - "application.properties" - }; - } - - @Override - protected ConfigSource loadConfigSource(final URL url, final int ordinal) throws IOException { - sourceUrls.accept(url); - return url.getPath().endsWith(".properties") ? new PropertiesConfigSource(url, ordinal) - : new YamlConfigSource(url, ordinal); - } - - @Override - public List getConfigSources(final ClassLoader classLoader) { - // Note: - return loadConfigSources(new String[] { "application.yml", "application.yaml", "application.properties" }, 260, - classLoader); - } - } - - static Map collectQuarkusSystemProperties() { - return collectQuarkusSystemProperties(System.getProperties()); - } - - static Map collectQuarkusSystemProperties(Map systemProperties) { - return unmodifiableMap(collectProperties(systemProperties)); - } - - static Map collectQuarkusEnvProperties() { - return collectQuarkusEnvProperties(System.getenv()); - } - - static Map collectQuarkusEnvProperties(Map env) { - Map quarkusEnvProperties = new HashMap<>(); - env.forEach((k, v) -> { - if (k.startsWith("QUARKUS_")) { - // convert environment name to property key - String key = k.toLowerCase(Locale.ROOT).replace('_', '.'); - quarkusEnvProperties.put(key, v); - } - }); - return unmodifiableMap(quarkusEnvProperties); - } - - static Map collectProperties(Map source) { - Map target = new HashMap<>(); - source.forEach((k, v) -> { - String key = k.toString(); - if (key.startsWith("quarkus.") && v instanceof String) { - target.put(key, (String) v); - } - }); - return target; - } - - static void addNonProfileToEffectiveConfig(Map source, Map map) { - source.forEach((k, v) -> { - if (v instanceof String && !k.startsWith("%")) { - map.put(k, (String) v); - } - }); - } - - static void addProfileToEffectiveConfig(Map source, String profilePrefix, Map map) { - source.forEach((k, v) -> { - if (v instanceof String && k.startsWith(profilePrefix)) { - map.put(k.substring(profilePrefix.length()), (String) v); - } - }); - } -} diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java index 9a2e0e0f419c9..f37d345601868 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java @@ -20,6 +20,7 @@ import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.options.Option; +import io.quarkus.deployment.pkg.PackageConfig; import io.quarkus.gradle.dsl.Manifest; import io.quarkus.runtime.util.StringUtil; @@ -54,17 +55,17 @@ public void setIgnoredEntries(List ignoredEntries) { @OutputFile public File getRunnerJar() { - return effectiveConfig().runnerJar(); + return buildConfiguration.runnerJar(); } @OutputFile public File getNativeRunner() { - return effectiveConfig().nativeRunner(); + return buildConfiguration.nativeRunner(); } @OutputDirectory public File getFastJar() { - return effectiveConfig().fastJar(); + return buildConfiguration.fastJar(); } @OutputFile @@ -73,21 +74,28 @@ public File getArtifactProperties() { } @TaskAction - public void buildQuarkus() { - String packageType = effectiveConfig().packageType(); + public void finalizeQuarkusBuild() { cleanup(); - if (QuarkusBuildConfiguration.isFastJarPackageType(packageType)) { - assembleFastJar(); - } else if (QuarkusBuildConfiguration.isLegacyJarPackageType(packageType)) { - assembleLegacyJar(); - } else if (QuarkusBuildConfiguration.isMutableJarPackageType(packageType)) { - assembleFullBuild(); - } else if (QuarkusBuildConfiguration.isUberJarPackageType(packageType)) { - assembleFullBuild(); - } else { - throw new GradleException("Unsupported package type " + packageType); + PackageConfig.BuiltInType packageType = effectiveConfig().packageType(); + switch (packageType) { + case JAR: + case FAST_JAR: + case NATIVE: + assembleFastJar(); + break; + case LEGACY_JAR: + case LEGACY: + assembleLegacyJar(); + break; + case MUTABLE_JAR: + case UBER_JAR: + case NATIVE_SOURCES: + assembleFullBuild(); + break; + default: + throw new GradleException("Unsupported package type " + packageType); } } @@ -102,7 +110,7 @@ private void cleanup() { // package types, output directory, output name where they were. if (extension().getCleanupBuildOutput().get()) { getLogger().info("Removing potentially existing runner files and fast-jar directory."); - File fastJar = effectiveConfig().fastJar(); + File fastJar = buildConfiguration.fastJar(); getFileSystemOperations().delete(delete -> delete.delete(getRunnerJar(), getNativeRunner(), fastJar)); } } @@ -112,8 +120,8 @@ private void assembleLegacyJar() { Path buildDir = getProject().getBuildDir().toPath(); Path libDir = buildDir.resolve("lib"); - Path depBuildDir = effectiveConfig().depBuildDir(); - Path appBuildDir = effectiveConfig().appBuildDir(); + Path depBuildDir = buildConfiguration.depBuildDir(); + Path appBuildDir = buildConfiguration.appBuildDir(); getLogger().info("Removing potentially existing legacy-jar lib/ directory."); getFileSystemOperations().delete(delete -> delete.delete(libDir)); @@ -150,14 +158,14 @@ private void assembleLegacyJar() { throw new GradleException("Failed to clean up non-modified jars in lib/"); } - copyRunnersAndArtifactProperties(effectiveConfig().appBuildDir()); + copyRunnersAndArtifactProperties(buildConfiguration.appBuildDir()); } private void assembleFullBuild() { File targetDir = getProject().getBuildDir(); // build/quarkus-build/gen - Path genBuildDir = effectiveConfig().genBuildDir(); + Path genBuildDir = buildConfiguration.genBuildDir(); getLogger().info("Copying Quarkus build for {} packaging from {} into {}", effectiveConfig().packageType(), genBuildDir, targetDir); @@ -166,18 +174,18 @@ private void assembleFullBuild() { copy.from(genBuildDir); }); - copyRunnersAndArtifactProperties(effectiveConfig().genBuildDir()); + copyRunnersAndArtifactProperties(buildConfiguration.genBuildDir()); } private void assembleFastJar() { - File appTargetDir = effectiveConfig().fastJar(); + File appTargetDir = buildConfiguration.fastJar(); // build/quarkus-build/app - Path appBuildBaseDir = effectiveConfig().appBuildDir(); + Path appBuildBaseDir = buildConfiguration.appBuildDir(); // build/quarkus-build/app/quarkus-app - Path appBuildDir = appBuildBaseDir.resolve(effectiveConfig().outputDirectory()); + Path appBuildDir = appBuildBaseDir.resolve(buildConfiguration.outputDirectory()); // build/quarkus-build/dep - Path depBuildDir = effectiveConfig().depBuildDir(); + Path depBuildDir = buildConfiguration.depBuildDir(); getLogger().info("Synchronizing Quarkus build for {} packaging from {} and {} into {}", effectiveConfig().packageType(), appBuildDir, depBuildDir, appTargetDir); @@ -186,7 +194,7 @@ private void assembleFastJar() { sync.from(appBuildDir, depBuildDir); }); - copyRunnersAndArtifactProperties(effectiveConfig().appBuildDir()); + copyRunnersAndArtifactProperties(buildConfiguration.appBuildDir()); } private void copyRunnersAndArtifactProperties(Path sourceDir) { @@ -196,9 +204,9 @@ private void copyRunnersAndArtifactProperties(Path sourceDir) { effectiveConfig().packageType(), sourceDir, buildDir); getFileSystemOperations().copy( copy -> copy.into(buildDir).from(sourceDir).include(QUARKUS_ARTIFACT_PROPERTIES, - effectiveConfig().nativeRunnerFileName(), - effectiveConfig().runnerJarFileName(), "jib-image*", - effectiveConfig().runnerBaseName() + "-native-image-source-jar/**")); + buildConfiguration.nativeRunnerFileName(), + buildConfiguration.runnerJarFileName(), "jib-image*", + buildConfiguration.runnerBaseName() + "-native-image-source-jar/**")); } private String expandConfigurationKey(String shortKey) { diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildApp.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildApp.java index 25df22b8fc71d..c8323f1e3c4cb 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildApp.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildApp.java @@ -26,12 +26,16 @@ import io.quarkus.bootstrap.app.QuarkusBootstrap; import io.quarkus.bootstrap.model.ApplicationModel; import io.quarkus.bootstrap.resolver.AppModelResolverException; +import io.quarkus.deployment.pkg.PackageConfig; import io.quarkus.gradle.QuarkusPlugin; import io.quarkus.maven.dependency.GACTV; @CacheableTask public abstract class QuarkusBuildApp extends QuarkusBuildTask { + private static final String MANIFEST_SECTIONS_PROPERTY_PREFIX = "quarkus.package.manifest.manifest-sections"; + private static final String MANIFEST_ATTRIBUTES_PROPERTY_PREFIX = "quarkus.package.manifest.attributes"; + @Inject @SuppressWarnings("CdiInjectionPointsInspection") public QuarkusBuildApp(QuarkusBuildConfiguration buildConfiguration) { @@ -44,37 +48,43 @@ public QuarkusBuildApp(QuarkusBuildConfiguration buildConfiguration) { */ @OutputDirectory public File getAppBuildDir() { - return effectiveConfig().appBuildDir().toFile(); + return buildConfiguration.appBuildDir().toFile(); } @TaskAction - public void finalizeQuarkusBuild() { - Path appDir = effectiveConfig().appBuildDir(); + public void performQuarkusBuild() { + Path appDir = buildConfiguration.appBuildDir(); // Caching and "up-to-date" checks depend on the inputs, this 'delete()' should ensure that the up-to-date // checks work against "clean" outputs, considering that the outputs depend on the package-type. getFileSystemOperations().delete(delete -> delete.delete(appDir)); - String packageType = effectiveConfig().packageType(); - - if (QuarkusBuildConfiguration.isFastJarPackageType(packageType)) { - fastJarBuild(); - } else if (QuarkusBuildConfiguration.isLegacyJarPackageType(packageType)) { - legacyJarBuild(); - } else if (QuarkusBuildConfiguration.isMutableJarPackageType(packageType)) { - generateBuild(); - } else if (QuarkusBuildConfiguration.isUberJarPackageType(packageType)) { - generateBuild(); - } else { - throw new GradleException("Unsupported package type " + packageType); + PackageConfig.BuiltInType packageType = effectiveConfig().packageType(); + switch (packageType) { + case JAR: + case FAST_JAR: + case NATIVE: + fastJarBuild(); + break; + case LEGACY_JAR: + case LEGACY: + legacyJarBuild(); + break; + case MUTABLE_JAR: + case UBER_JAR: + case NATIVE_SOURCES: + generateBuild(); + break; + default: + throw new GradleException("Unsupported package type " + packageType); } } private void legacyJarBuild() { generateBuild(); - Path genDir = effectiveConfig().genBuildDir(); - Path appDir = effectiveConfig().appBuildDir(); + Path genDir = buildConfiguration.genBuildDir(); + Path appDir = buildConfiguration.appBuildDir(); getLogger().info("Synchronizing Quarkus legacy-jar app for package type {} into {}", effectiveConfig().packageType(), appDir); @@ -95,9 +105,9 @@ private void legacyJarBuild() { private void fastJarBuild() { generateBuild(); - String outputDirectory = effectiveConfig().outputDirectory(); - Path genDir = effectiveConfig().genBuildDir(); - Path appDir = effectiveConfig().appBuildDir(); + String outputDirectory = buildConfiguration.outputDirectory(); + Path genDir = buildConfiguration.genBuildDir(); + Path appDir = buildConfiguration.appBuildDir(); getLogger().info("Synchronizing Quarkus fast-jar-like app for package type {} into {}", effectiveConfig().packageType(), appDir); @@ -109,9 +119,9 @@ private void fastJarBuild() { }); } - void generateBuild() { - Path genDir = effectiveConfig().genBuildDir(); - String packageType = effectiveConfig().packageType(); + private void generateBuild() { + Path genDir = buildConfiguration.genBuildDir(); + PackageConfig.BuiltInType packageType = effectiveConfig().packageType(); getLogger().info("Building Quarkus app for package type {} in {}", packageType, genDir); // Caching and "up-to-date" checks depend on the inputs, this 'delete()' should ensure that the up-to-date @@ -130,6 +140,10 @@ void generateBuild() { final Properties effectiveProperties = getBuildSystemProperties(appModel.getAppArtifact()); effectiveProperties.putAll(forcedProperties); + + // TODO The following becomes meaningless + effectiveConfig().packageConfig().userConfiguredIgnoredEntries.map(l -> String.join(",", l)) + .ifPresent(v -> effectiveProperties.setProperty("quarkus.package.user-configured-ignored-entries", v)); List ignoredEntries = getIgnoredEntries(); if (!ignoredEntries.isEmpty()) { String joinedEntries = String.join(",", ignoredEntries); @@ -198,12 +212,14 @@ void generateBuild() { } private void exportCustomManifestProperties(Properties buildSystemProperties) { - for (Map.Entry attribute : effectiveConfig().manifest.getAttributes().entrySet()) { + effectiveConfig(); + // TODO think about the manifest stuff + for (Map.Entry attribute : buildConfiguration.gradleManifest().getAttributes().entrySet()) { buildSystemProperties.put(toManifestAttributeKey(attribute.getKey()), attribute.getValue()); } - for (Map.Entry section : effectiveConfig().manifest.getSections().entrySet()) { + for (Map.Entry section : buildConfiguration.gradleManifest().getSections().entrySet()) { for (Map.Entry attribute : section.getValue().entrySet()) { buildSystemProperties .put(toManifestSectionAttributeKey(section.getKey(), attribute.getKey()), attribute.getValue()); diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildConfiguration.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildConfiguration.java index 54c0a1e3645b8..d953a59ec2a48 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildConfiguration.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildConfiguration.java @@ -9,9 +9,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.TreeMap; -import java.util.stream.Collectors; import org.gradle.api.Project; import org.gradle.api.file.FileCollection; @@ -19,6 +16,7 @@ import org.gradle.api.provider.MapProperty; import org.gradle.api.tasks.SourceSet; +import io.quarkus.deployment.pkg.PackageConfig; import io.quarkus.gradle.QuarkusPlugin; import io.quarkus.gradle.dsl.Manifest; import io.quarkus.gradle.extension.QuarkusPluginExtension; @@ -36,11 +34,10 @@ public class QuarkusBuildConfiguration { final ListProperty forcedDependenciesProperty; final MapProperty forcedPropertiesProperty; final List ignoredEntries = new ArrayList<>(); - final Manifest manifest = new Manifest(); + private final Manifest manifest = new Manifest(); - private final EffectiveConfigHelper effectiveConfig; - private boolean effective; - private Map configMap; + private final EffectiveConfig.Builder effectiveConfigBuilder; + private EffectiveConfig effective; public QuarkusBuildConfiguration(Project project, QuarkusPluginExtension extension) { this.project = project; @@ -49,7 +46,7 @@ public QuarkusBuildConfiguration(Project project, QuarkusPluginExtension extensi mainSourceSet = getSourceSet(project, SourceSet.MAIN_SOURCE_SET_NAME); classpath = dependencyClasspath(mainSourceSet); - effectiveConfig = new EffectiveConfigHelper(); + effectiveConfigBuilder = EffectiveConfig.builder(); forcedDependenciesProperty = project.getObjects().listProperty(String.class); forcedPropertiesProperty = project.getObjects().mapProperty(String.class, String.class); @@ -109,92 +106,43 @@ String runnerBaseName() { } String outputDirectory() { - return effective().configMap().getOrDefault(QuarkusPlugin.OUTPUT_DIRECTORY, - QuarkusPlugin.DEFAULT_OUTPUT_DIRECTORY); + return effectiveConfig().packageConfig().outputDirectory.orElse(QuarkusPlugin.DEFAULT_OUTPUT_DIRECTORY); } - String packageType() { - return effective().configMap().getOrDefault(QuarkusPlugin.QUARKUS_PACKAGE_TYPE, - QuarkusPlugin.DEFAULT_PACKAGE_TYPE); + Manifest gradleManifest() { + return manifest; } - Map getQuarkusSystemProperties() { - return effectiveConfig.quarkusSystemProperties; + PackageConfig packageConfig() { + return effectiveConfig().packageConfig(); } - Map getQuarkusEnvProperties() { - return effectiveConfig.quarkusEnvProperties; + PackageConfig.BuiltInType packageType() { + return PackageConfig.BuiltInType.fromString(effectiveConfig().packageConfig().type); } - static boolean isUberJarPackageType(String packageType) { - // Layout: - // build/ - return "uber-jar".equals(packageType); - } - - static boolean isLegacyJarPackageType(String packageType) { - // Layout: - // build/ - // build/lib/ - return "legacy-jar".equals(packageType); - } - - static boolean isMutableJarPackageType(String packageType) { - // like "fast-jar", but additional folder (not implemented, fallback to "full build" ATM). - // Additional folder: - // build//lib/deployment/ - // ^ contains dependency jars AND generated files - return "mutable-jar".equals(packageType); - } - - static boolean isFastJarPackageType(String packageType) { - // Layout: - // build// - // build//lib/boot/ - // build//lib/main/ - // build//quarkus/ - // build//app/ - // build//... - switch (packageType) { - case "jar": - case "fast-jar": - case "native": - return true; - default: - return false; + EffectiveConfig effectiveConfig() { + if (effective == null) { + effective = buildEffectiveConfiguration(); } - } - - QuarkusBuildConfiguration effective() { - if (!effective) { - configMap = buildEffectiveConfiguration(); - effective = true; - } - return this; + return effective; } List applicationPropsSources() { - return effectiveConfig.applicationPropertiesSourceUrls; + return effectiveConfig().applicationPropsSources(); } - private Map buildEffectiveConfiguration() { - Map map = effectiveConfig.applyForcedProperties(forcedPropertiesProperty.get()) - .applyBuildProperties(extension.getQuarkusBuildProperties().get()) - .applyProjectProperties(project.getProperties()) - .applyApplicationProperties(mainSourceSet.getResources().getSourceDirectories().getFiles(), project.getLogger()) - .buildEffectiveConfiguration(); - - if (project.getLogger().isInfoEnabled()) { - project.getLogger().info("Effective Quarkus application config: {}", - new TreeMap<>(map).entrySet().stream().map(Objects::toString) - .collect(Collectors.joining("\n ", "\n ", ""))); - } - - return map; + private EffectiveConfig buildEffectiveConfiguration() { + return effectiveConfigBuilder.withForcedProperties(forcedPropertiesProperty.get()) + .withBuildProperties(extension.getQuarkusBuildProperties().get()) + .withProjectProperties(project.getProperties()) + .withSourceDirectories(mainSourceSet.getResources().getSourceDirectories().getFiles()) + .withProfile("prod") + .build(); } Map configMap() { - return configMap; + return effectiveConfig().configMap(); } private static FileCollection dependencyClasspath(SourceSet mainSourceSet) { diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java index 8013c11748d94..f3ccea2f1dd94 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java @@ -16,6 +16,7 @@ import org.gradle.api.tasks.TaskAction; import io.quarkus.bootstrap.model.ApplicationModel; +import io.quarkus.deployment.pkg.PackageConfig; import io.quarkus.gradle.QuarkusPlugin; import io.quarkus.maven.dependency.ArtifactKey; import io.quarkus.maven.dependency.DependencyFlags; @@ -41,31 +42,37 @@ public QuarkusBuildDependencies(QuarkusBuildConfiguration buildConfiguration) { */ @OutputDirectory public File getDependenciesBuildDir() { - return effectiveConfig().depBuildDir().toFile(); + return buildConfiguration.depBuildDir().toFile(); } @TaskAction public void collectDependencies() { - Path depDir = effectiveConfig().depBuildDir(); + Path depDir = buildConfiguration.depBuildDir(); // Caching and "up-to-date" checks depend on the inputs, this 'delete()' should ensure that the up-to-date // checks work against "clean" outputs, considering that the outputs depend on the package-type. getFileSystemOperations().delete(delete -> delete.delete(depDir)); - String packageType = effectiveConfig().packageType(); - if (QuarkusBuildConfiguration.isFastJarPackageType(packageType)) { - fastJarDependencies(); - } else if (QuarkusBuildConfiguration.isLegacyJarPackageType(packageType)) { - legacyJarDependencies(); - } else if (QuarkusBuildConfiguration.isMutableJarPackageType(packageType)) { - getLogger().info( - "Falling back to 'full quarkus application build' for packaging type {}, this task's output is empty for this package type", - packageType); - } else if (QuarkusBuildConfiguration.isUberJarPackageType(packageType)) { - getLogger().info("Dependencies not needed for packaging type {}, this task's output is empty for this package type", - packageType); - } else { - throw new GradleException("Unsupported package type " + packageType); + PackageConfig.BuiltInType packageType = effectiveConfig().packageType(); + switch (packageType) { + case JAR: + case FAST_JAR: + case NATIVE: + fastJarDependencies(); + break; + case LEGACY_JAR: + case LEGACY: + legacyJarDependencies(); + break; + case MUTABLE_JAR: + case UBER_JAR: + case NATIVE_SOURCES: + getLogger().info( + "Falling back to 'full quarkus application build' for packaging type {}, this task's output is empty for this package type", + packageType); + break; + default: + throw new GradleException("Unsupported package type " + packageType); } } @@ -75,7 +82,7 @@ public void collectDependencies() { * Unnecessary for {@code uber-jar}. */ private void fastJarDependencies() { - Path depDir = effectiveConfig().depBuildDir(); + Path depDir = buildConfiguration.depBuildDir(); Path libBoot = depDir.resolve("lib/boot"); Path libMain = depDir.resolve("lib/main"); jarDependencies(libBoot, libMain); @@ -89,13 +96,13 @@ private void fastJarDependencies() { * dependencies, but this implementation has no knowledge of which dependencies will be modified. */ private void legacyJarDependencies() { - Path depDir = effectiveConfig().depBuildDir(); + Path depDir = buildConfiguration.depBuildDir(); Path lib = depDir.resolve("lib"); jarDependencies(lib, lib); } private void jarDependencies(Path libBoot, Path libMain) { - Path depDir = effectiveConfig().depBuildDir(); + Path depDir = buildConfiguration.depBuildDir(); getLogger().info("Placing Quarkus application dependencies for package type {} in {}", effectiveConfig().packageType(), depDir); diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildTask.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildTask.java index 6b39b8b49ea3e..f5c64e923ad2a 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildTask.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildTask.java @@ -23,8 +23,6 @@ abstract class QuarkusBuildTask extends QuarkusTask { static final String NATIVE_PROPERTY_NAMESPACE = "quarkus.native"; - static final String MANIFEST_SECTIONS_PROPERTY_PREFIX = "quarkus.package.manifest.manifest-sections"; - static final String MANIFEST_ATTRIBUTES_PROPERTY_PREFIX = "quarkus.package.manifest.attributes"; static final String QUARKUS_ARTIFACT_PROPERTIES = "quarkus-artifact.properties"; final QuarkusBuildConfiguration buildConfiguration; @@ -34,16 +32,17 @@ abstract class QuarkusBuildTask extends QuarkusTask { this.buildConfiguration = buildConfiguration; } - QuarkusBuildConfiguration effectiveConfig() { - return buildConfiguration.effective(); + EffectiveConfig effectiveConfig() { + return buildConfiguration.effectiveConfig(); } @Internal public boolean isCachedByDefault() { switch (effectiveConfig().packageType()) { - case "jar": - case "fast-jar": - case "legacy-jar": + case JAR: + case FAST_JAR: + case LEGACY_JAR: + case LEGACY: return true; default: return false; @@ -60,19 +59,9 @@ public List getIgnoredEntries() { protected abstract FileSystemOperations getFileSystemOperations(); @Optional - @Input + @Internal public abstract MapProperty getForcedProperties(); - @Input - public Map getQuarkusBuildSystemProperties() { - return effectiveConfig().getQuarkusSystemProperties(); - } - - @Input - public Map getQuarkusBuildEnvProperties() { - return effectiveConfig().getQuarkusEnvProperties(); - } - /** * Retrieve all {@code quarkus.*} properties, which may be relevant for the Quarkus application build, from * (likely) all possible sources. @@ -87,12 +76,12 @@ protected Properties getBuildSystemProperties(ResolvedDependency appArtifact) { @Classpath public FileCollection getClasspath() { - return effectiveConfig().classpath; + return buildConfiguration.classpath; } @Internal public Manifest getManifest() { - return effectiveConfig().manifest; + return buildConfiguration.gradleManifest(); } @Input diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusShowEffectiveConfig.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusShowEffectiveConfig.java index f03463343aea6..6730efe1bb10e 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusShowEffectiveConfig.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusShowEffectiveConfig.java @@ -18,6 +18,8 @@ import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.options.Option; +import io.quarkus.deployment.pkg.PackageConfig; + /** * Just show the effective configuration and settings. */ @@ -42,7 +44,7 @@ public Property getSaveConfigProperties() { @TaskAction public void dumpEffectiveConfiguration() { try { - QuarkusBuildConfiguration effective = effectiveConfig().effective(); + EffectiveConfig effective = effectiveConfig(); String config = effective.configMap().entrySet().stream() .map(e -> format("%s=%s", e.getKey(), e.getValue())).sorted() @@ -50,9 +52,9 @@ public void dumpEffectiveConfiguration() { getLogger().lifecycle("Effective Quarkus configuration options: {}", config); - String finalName = effective.extension.finalName(); - String packageType = effective.packageType(); - File fastJar = effective.fastJar(); + String finalName = buildConfiguration.extension.finalName(); + PackageConfig.BuiltInType packageType = effectiveConfig().packageType(); + File fastJar = buildConfiguration.fastJar(); getLogger().lifecycle( "" + "Quarkus package type: {}\n" + @@ -64,10 +66,10 @@ public void dumpEffectiveConfiguration() { "application.(properties|yaml|yml) sources: {}", packageType, finalName, - effective.outputDirectory(), + buildConfiguration.outputDirectory(), fastJar, - effective.runnerJar(), - effective.nativeRunner(), + buildConfiguration.runnerJar(), + buildConfiguration.nativeRunner(), effective.applicationPropsSources().stream().map(Object::toString) .collect(Collectors.joining("\n ", "\n ", "\n"))); diff --git a/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigHelperTest.java b/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigHelperTest.java deleted file mode 100644 index 1c1bac8dae7fb..0000000000000 --- a/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigHelperTest.java +++ /dev/null @@ -1,212 +0,0 @@ -package io.quarkus.gradle.tasks; - -import static io.quarkus.gradle.tasks.EffectiveConfigHelper.*; -import static java.util.Collections.*; -import static java.util.Map.entry; -import static org.mockito.Mockito.mock; - -import java.io.File; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.assertj.core.api.SoftAssertions; -import org.assertj.core.api.junit.jupiter.InjectSoftAssertions; -import org.assertj.core.api.junit.jupiter.SoftAssertionsExtension; -import org.gradle.api.logging.Logger; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; - -@ExtendWith(SoftAssertionsExtension.class) -public class EffectiveConfigHelperTest { - @InjectSoftAssertions - protected SoftAssertions soft; - - @Test - void empty() { - Logger dummyLogger = mock(Logger.class); - - EffectiveConfigHelper effectiveConfigHelper = new EffectiveConfigHelper(emptyMap(), emptyMap()); - Map map = effectiveConfigHelper.applyBuildProperties(emptyMap()) - .applyProjectProperties(emptyMap()) - .applyForcedProperties(emptyMap()) - .applyApplicationProperties(emptySet(), dummyLogger) - .buildEffectiveConfiguration(); - - soft.assertThat(map).isEmpty(); - } - - @Test - void fromSystemProperties() { - Logger dummyLogger = mock(Logger.class); - - EffectiveConfigHelper effectiveConfigHelper = new EffectiveConfigHelper( - collectQuarkusSystemProperties(Map.of("quarkus.foo", "bar", "not.a.quarkus.thing", "nope")), emptyMap()); - Map map = effectiveConfigHelper.applyBuildProperties(emptyMap()) - .applyProjectProperties(emptyMap()) - .applyForcedProperties(emptyMap()) - .applyApplicationProperties(emptySet(), dummyLogger) - .buildEffectiveConfiguration(); - - soft.assertThat(map).containsExactly(entry("quarkus.foo", "bar")); - } - - @Test - void fromSystemEnvironment() { - Logger dummyLogger = mock(Logger.class); - - EffectiveConfigHelper effectiveConfigHelper = new EffectiveConfigHelper(emptyMap(), - collectQuarkusEnvProperties(Map.of("QUARKUS_FOO", "bar", "NOT_A_QUARKUS_THING", "nope"))); - Map map = effectiveConfigHelper.applyBuildProperties(emptyMap()) - .applyProjectProperties(emptyMap()) - .applyForcedProperties(emptyMap()) - .applyApplicationProperties(emptySet(), dummyLogger) - .buildEffectiveConfiguration(); - - soft.assertThat(map).containsExactly(entry("quarkus.foo", "bar")); - } - - @Test - void fromProjectProperties() { - Logger dummyLogger = mock(Logger.class); - - EffectiveConfigHelper effectiveConfigHelper = new EffectiveConfigHelper(emptyMap(), emptyMap()); - Map map = effectiveConfigHelper.applyBuildProperties(emptyMap()) - .applyProjectProperties(Map.of("quarkus.foo", "bar")) - .applyForcedProperties(emptyMap()) - .applyApplicationProperties(emptySet(), dummyLogger) - .buildEffectiveConfiguration(); - - soft.assertThat(map).containsExactly(entry("quarkus.foo", "bar")); - } - - @Test - void fromForcedProperties() { - Logger dummyLogger = mock(Logger.class); - - EffectiveConfigHelper effectiveConfigHelper = new EffectiveConfigHelper(emptyMap(), emptyMap()); - Map map = effectiveConfigHelper.applyBuildProperties(emptyMap()) - .applyProjectProperties(emptyMap()) - .applyForcedProperties(Map.of("quarkus.foo", "bar")) - .applyApplicationProperties(emptySet(), dummyLogger) - .buildEffectiveConfiguration(); - - soft.assertThat(map).containsExactly(entry("quarkus.foo", "bar")); - } - - @ParameterizedTest - @ValueSource(strings = { - "app-props-and-yaml", - "app-props-and-yaml-and-yml", - "app-yaml-and-yml", - "single-app-props", - "single-app-yaml", - "single-app-yml" - }) - void appProps(String variant) throws Exception { - Logger dummyLogger = mock(Logger.class); - - URL url = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/" + variant); - List urls = new ArrayList<>(); - Map props = loadApplicationProperties(singleton(new File(url.toURI())), dummyLogger, urls::add); - - Map expected = new HashMap<>(); - if (variant.contains("-yml")) { - expected.put("quarkus.prop.yml", "yml"); - } - if (variant.contains("-yaml")) { - expected.put("quarkus.prop.yaml", "yaml"); - } - if (variant.contains("-props")) { - expected.put("quarkus.prop.properties", "hello"); - } - - soft.assertThat(urls).hasSize(expected.size()); - - soft.assertThat(props).isEqualTo(expected); - } - - @Test - void appPropsOverload() throws Exception { - Logger dummyLogger = mock(Logger.class); - - URL url1 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/1/"); - URL url2 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/2/"); - Set source = new LinkedHashSet<>(); - source.add(new File(url1.toURI())); - source.add(new File(url2.toURI())); - - EffectiveConfigHelper effectiveConfigHelper = new EffectiveConfigHelper(emptyMap(), emptyMap()); - Map props = effectiveConfigHelper.applyBuildProperties(emptyMap()) - .applyProjectProperties(emptyMap()) - .applyForcedProperties(emptyMap()) - .applyApplicationProperties(source, dummyLogger) - .buildEffectiveConfiguration(); - - soft.assertThat(effectiveConfigHelper.applicationPropertiesSourceUrls).containsExactly( - url1.toURI().resolve("application.properties").toURL(), - url2.toURI().resolve("application.yaml").toURL()); - soft.assertThat(props).containsExactly(entry("quarkus.prop.overload", "overloaded")); - } - - @Test - void appPropsOverloadWrongProfile() throws Exception { - Logger dummyLogger = mock(Logger.class); - - URL url1 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/1/"); - URL url2 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/2/"); - URL url3 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/3/"); - Set source = new LinkedHashSet<>(); - source.add(new File(url1.toURI())); - source.add(new File(url2.toURI())); - source.add(new File(url3.toURI())); - - EffectiveConfigHelper effectiveConfigHelper = new EffectiveConfigHelper(emptyMap(), emptyMap()); - Map props = effectiveConfigHelper.applyBuildProperties(emptyMap()) - .applyProjectProperties(emptyMap()) - .applyForcedProperties(emptyMap()) - .applyApplicationProperties(source, dummyLogger) - .buildEffectiveConfiguration(); - - soft.assertThat(effectiveConfigHelper.applicationPropertiesSourceUrls).containsExactly( - url1.toURI().resolve("application.properties").toURL(), - url2.toURI().resolve("application.yaml").toURL(), - url3.toURI().resolve("application.properties").toURL()); - soft.assertThat(props).containsExactly(entry("quarkus.prop.overload", "overloaded")); - } - - @Test - void appPropsOverloadProdProfile() throws Exception { - Logger dummyLogger = mock(Logger.class); - - URL url1 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/1/"); - URL url2 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/2/"); - URL url3 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/3/"); - URL url4 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/4/"); - Set source = new LinkedHashSet<>(); - source.add(new File(url1.toURI())); - source.add(new File(url2.toURI())); - source.add(new File(url3.toURI())); - source.add(new File(url4.toURI())); - - EffectiveConfigHelper effectiveConfigHelper = new EffectiveConfigHelper(emptyMap(), emptyMap()); - Map props = effectiveConfigHelper.applyBuildProperties(emptyMap()) - .applyProjectProperties(emptyMap()) - .applyForcedProperties(emptyMap()) - .applyApplicationProperties(source, dummyLogger) - .buildEffectiveConfiguration(); - - soft.assertThat(effectiveConfigHelper.applicationPropertiesSourceUrls).containsExactly( - url1.toURI().resolve("application.properties").toURL(), - url2.toURI().resolve("application.yaml").toURL(), - url3.toURI().resolve("application.properties").toURL(), - url4.toURI().resolve("application.properties").toURL()); - soft.assertThat(props).containsExactly(entry("quarkus.prop.overload", "but-this-one")); - } -} diff --git a/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigTest.java b/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigTest.java new file mode 100644 index 0000000000000..6e6176449de37 --- /dev/null +++ b/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigTest.java @@ -0,0 +1,168 @@ +package io.quarkus.gradle.tasks; + +import static io.quarkus.gradle.tasks.EffectiveConfig.*; +import static java.util.Collections.singleton; + +import java.io.File; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.assertj.core.api.SoftAssertions; +import org.assertj.core.api.junit.jupiter.InjectSoftAssertions; +import org.assertj.core.api.junit.jupiter.SoftAssertionsExtension; +import org.eclipse.microprofile.config.spi.ConfigSource; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import io.smallrye.config.SmallRyeConfig; + +@ExtendWith(SoftAssertionsExtension.class) +public class EffectiveConfigTest { + @InjectSoftAssertions + protected SoftAssertions soft; + + @Test + void foo() throws Exception { + URL url = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/app-props-and-yaml-and-yml"); + + Set sources = new LinkedHashSet<>(); + sources.add(new File(url.toURI())); + EffectiveConfig effectiveConfig = EffectiveConfig.builder() + .withSourceDirectories(sources) + .build(); + + System.err.println(effectiveConfig.packageConfig()); + } + + @Test + void empty() { + EffectiveConfig effectiveConfig = EffectiveConfig.builder().build(); + + Map expect = new HashMap<>(); + System.getProperties().forEach((k, v) -> expect.put(k.toString(), v.toString())); + expect.putAll(System.getenv()); + + // Cannot do an exact match, because `map` contains both the "raw" environment variables AND the + // "property-key-ish" entries - i.e. environment appears "twice". + soft.assertThat(effectiveConfig.configMap()).containsAllEntriesOf(expect); + } + + @Test + void fromProjectProperties() { + EffectiveConfig effectiveConfig = EffectiveConfig.builder().withProjectProperties(Map.of("quarkus.foo", "bar")).build(); + + soft.assertThat(effectiveConfig.configMap()).containsEntry("quarkus.foo", "bar"); + } + + @Test + void fromForcedProperties() { + EffectiveConfig effectiveConfig = EffectiveConfig.builder().withForcedProperties(Map.of("quarkus.foo", "bar")).build(); + + soft.assertThat(effectiveConfig.configMap()).containsEntry("quarkus.foo", "bar"); + } + + @ParameterizedTest + @ValueSource(strings = { + "app-props-and-yaml", + "app-props-and-yaml-and-yml", + "app-yaml-and-yml", + "single-app-props", + "single-app-yaml", + "single-app-yml" + }) + void appProps(String variant) throws Exception { + URL url = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/" + variant); + List urls = new ArrayList<>(); + List configSources = new ArrayList<>(); + configSourcesForApplicationProperties(singleton(new File(url.toURI())), urls::add, configSources::add); + SmallRyeConfig config = buildConfig("prod", configSources); + + Map expected = new HashMap<>(); + if (variant.contains("-yml")) { + expected.put("quarkus.prop.yml", "yml"); + } + if (variant.contains("-yaml")) { + expected.put("quarkus.prop.yaml", "yaml"); + } + if (variant.contains("-props")) { + expected.put("quarkus.prop.properties", "hello"); + } + + soft.assertThat(urls).hasSize(expected.size() * 2); // "no profile" + "prod" profile + + soft.assertThat(generateFullConfigMap(config)).containsAllEntriesOf(expected); + } + + @Test + void appPropsOverload() throws Exception { + URL url1 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/1/"); + URL url2 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/2/"); + Set source = new LinkedHashSet<>(); + source.add(new File(url1.toURI())); + source.add(new File(url2.toURI())); + + EffectiveConfig effectiveConfig = EffectiveConfig.builder().withSourceDirectories(source).build(); + + soft.assertThat(effectiveConfig.applicationPropsSources()).containsExactly( + url1.toURI().resolve("application.properties").toURL(), + url2.toURI().resolve("application.yaml").toURL(), + url1.toURI().resolve("application-prod.properties").toURL(), + url2.toURI().resolve("application-prod.yaml").toURL()); + soft.assertThat(effectiveConfig.configMap()).containsEntry("quarkus.prop.overload", "overloaded"); + } + + @Test + void appPropsOverloadWrongProfile() throws Exception { + URL url1 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/1/"); + URL url2 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/2/"); + URL url3 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/3/"); + Set source = new LinkedHashSet<>(); + source.add(new File(url1.toURI())); + source.add(new File(url2.toURI())); + source.add(new File(url3.toURI())); + + EffectiveConfig effectiveConfig = EffectiveConfig.builder().withSourceDirectories(source).build(); + + soft.assertThat(effectiveConfig.applicationPropsSources()).containsExactly( + url1.toURI().resolve("application.properties").toURL(), + url2.toURI().resolve("application.yaml").toURL(), + url3.toURI().resolve("application.properties").toURL(), + url1.toURI().resolve("application-prod.properties").toURL(), + url2.toURI().resolve("application-prod.yaml").toURL(), + url3.toURI().resolve("application-prod.properties").toURL()); + soft.assertThat(effectiveConfig.configMap()).containsEntry("quarkus.prop.overload", "overloaded"); + } + + @Test + void appPropsOverloadProdProfile() throws Exception { + URL url1 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/1/"); + URL url2 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/2/"); + URL url3 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/3/"); + URL url4 = getClass().getClassLoader().getResource("io/quarkus/gradle/cfg/overload/4/"); + Set source = new LinkedHashSet<>(); + source.add(new File(url4.toURI())); + source.add(new File(url1.toURI())); + source.add(new File(url2.toURI())); + source.add(new File(url3.toURI())); + + EffectiveConfig effectiveConfig = EffectiveConfig.builder().withSourceDirectories(source).build(); + + soft.assertThat(effectiveConfig.applicationPropsSources()).containsExactly( + url4.toURI().resolve("application.properties").toURL(), + url1.toURI().resolve("application.properties").toURL(), + url2.toURI().resolve("application.yaml").toURL(), + url3.toURI().resolve("application.properties").toURL(), + url4.toURI().resolve("application-prod.properties").toURL(), + url1.toURI().resolve("application-prod.properties").toURL(), + url2.toURI().resolve("application-prod.yaml").toURL(), + url3.toURI().resolve("application-prod.properties").toURL()); + soft.assertThat(effectiveConfig.configMap()).containsEntry("quarkus.prop.overload", "but-this-one"); + } +} diff --git a/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/QuarkusBuildConfigurationTest.java b/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/QuarkusBuildConfigurationTest.java new file mode 100644 index 0000000000000..369cdf472530d --- /dev/null +++ b/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/QuarkusBuildConfigurationTest.java @@ -0,0 +1,56 @@ +package io.quarkus.gradle.tasks; + +import org.assertj.core.api.SoftAssertions; +import org.assertj.core.api.junit.jupiter.InjectSoftAssertions; +import org.assertj.core.api.junit.jupiter.SoftAssertionsExtension; +import org.gradle.api.Project; +import org.gradle.api.internal.tasks.DefaultSourceSetContainer; +import org.gradle.api.tasks.SourceSetContainer; +import org.gradle.testfixtures.ProjectBuilder; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; + +import io.quarkus.deployment.pkg.PackageConfig; +import io.quarkus.gradle.extension.QuarkusPluginExtension; + +@ExtendWith(SoftAssertionsExtension.class) +public class QuarkusBuildConfigurationTest { + @InjectSoftAssertions + protected SoftAssertions soft; + + @ParameterizedTest + @EnumSource(PackageConfig.BuiltInType.class) + void packageTypeConversion(PackageConfig.BuiltInType packageType) { + QuarkusBuildConfiguration buildConfiguration = setupQuarkusBuildConfiguration(); + buildConfiguration.forcedPropertiesProperty.put("quarkus.package.type", packageType.toString()); + EffectiveConfig effectiveConfig = buildConfiguration.effectiveConfig(); + + soft.assertThat(effectiveConfig.configMap()).containsEntry("quarkus.package.type", packageType.toString()); + PackageConfig.BuiltInType effectivePackageType = effectiveConfig.packageType(); + soft.assertThat(effectivePackageType).isSameAs(packageType); + } + + @Test + void invalidPackageType() { + QuarkusBuildConfiguration buildConfiguration = setupQuarkusBuildConfiguration(); + buildConfiguration.forcedPropertiesProperty.put("quarkus.package.type", "not-a-package-type"); + EffectiveConfig effectiveBuildConfiguration = buildConfiguration.effectiveConfig(); + + soft.assertThatIllegalArgumentException().isThrownBy(effectiveBuildConfiguration::packageType) + .withMessage("Unknown Quarkus package type 'not-a-package-type'"); + } + + private static QuarkusBuildConfiguration setupQuarkusBuildConfiguration() { + Project project = ProjectBuilder.builder().build(); + SourceSetContainer sourceSetContainer = project.getExtensions().create("sourceSets", DefaultSourceSetContainer.class); + sourceSetContainer.create("main", sourceSet -> { + sourceSet.setCompileClasspath(project.files()); + sourceSet.setRuntimeClasspath(project.files()); + sourceSet.setAnnotationProcessorPath(project.files()); + }); + QuarkusPluginExtension extension = new QuarkusPluginExtension(project); + return new QuarkusBuildConfiguration(project, extension); + } +} diff --git a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.properties b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.properties index cfe085a3e1b51..f6834e346f911 100644 --- a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.properties +++ b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.properties @@ -1 +1,2 @@ quarkus.prop.properties=hello +quarkus.package.type=fast-jar diff --git a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.yaml b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.yaml index 5cb44a30844f9..8f45de2459e8a 100644 --- a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.yaml +++ b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.yaml @@ -1,3 +1,5 @@ quarkus: prop: yaml: 'yaml' + package: + type: legacy-jar diff --git a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.yml b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.yml index df2aa80f08d2c..9c537d34e6b77 100644 --- a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.yml +++ b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/app-props-and-yaml-and-yml/application.yml @@ -1,3 +1,5 @@ quarkus: prop: yml: 'yml' + package: + type: legacy diff --git a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/overload/1/application.properties b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/overload/1/application.properties index 21baa426a5247..7c111e47ae34c 100644 --- a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/overload/1/application.properties +++ b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/overload/1/application.properties @@ -1 +1 @@ -quarkus.prop.overload=not-this +quarkus.prop.overload=overloaded diff --git a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/overload/2/application.yaml b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/overload/2/application.yaml index 54b46299f0aa8..4a0e14d38751d 100644 --- a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/overload/2/application.yaml +++ b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/cfg/overload/2/application.yaml @@ -1,3 +1,3 @@ quarkus: prop: - overload: 'overloaded' + overload: 'not-this'