Do not run re-augmentation if config is the same in dev mode

Closes #9906
This commit is contained in:
Pedro Igor 2022-01-31 19:49:20 -03:00
parent 829e2a9a3e
commit fe0cb36284
3 changed files with 29 additions and 2 deletions

View file

@ -67,6 +67,7 @@ import io.quarkus.hibernate.orm.deployment.HibernateOrmConfig;
import io.quarkus.hibernate.orm.deployment.PersistenceXmlDescriptorBuildItem;
import io.quarkus.resteasy.server.common.deployment.ResteasyDeploymentCustomizerBuildItem;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.runtime.configuration.ProfileManager;
import io.quarkus.smallrye.health.runtime.SmallRyeHealthHandler;
import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem;
import io.quarkus.vertx.http.deployment.RouteBuildItem;
@ -341,6 +342,13 @@ class KeycloakProcessor {
properties.put(String.format("kc.provider.file.%s.last-modified", jar.getName()), String.valueOf(jar.lastModified()));
}
String profile = Environment.getProfile();
if (profile != null) {
properties.put(Environment.PROFILE, profile);
properties.put(ProfileManager.QUARKUS_PROFILE_PROP, profile);
}
properties.put(QUARKUS_PROPERTY_ENABLED, String.valueOf(QuarkusPropertiesConfigSource.getConfigurationFile() != null));
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {

View file

@ -108,12 +108,12 @@ public final class Environment {
public static void setProfile(String profile) {
System.setProperty(PROFILE, profile);
System.setProperty("quarkus.profile", profile);
System.setProperty(ProfileManager.QUARKUS_PROFILE_PROP, profile);
if (isTestLaunchMode()) {
System.setProperty("mp.config.profile", profile);
System.setProperty(ProfileManager.QUARKUS_TEST_PROFILE_PROP, profile);
}
}
public static String getCurrentOrPersistedProfile() {
String profile = getProfile();
if(profile == null) {

View file

@ -18,6 +18,7 @@
package org.keycloak.it.cli.dist;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@ -93,4 +94,22 @@ public class StartAutoBuildDistTest {
cliResult.assertBuild();
cliResult.assertStarted();
}
@Test
@Launch({ "start-dev" })
@Order(7)
void testStartDevFirstTime(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;
assertTrue(cliResult.getOutput().contains("Updating the configuration and installing your custom providers, if any. Please wait."));
cliResult.assertStartedDevMode();
}
@Test
@Launch({ "start-dev" })
@Order(8)
void testShouldNotReAugStartDevIfConfigIsSame(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;
assertFalse(cliResult.getOutput().contains("Updating the configuration and installing your custom providers, if any. Please wait."));
cliResult.assertStartedDevMode();
}
}