Skip to content

Commit

Permalink
Introduce IsLocalDevelopment boolean supplier
Browse files Browse the repository at this point in the history
  • Loading branch information
aloubyansky committed Dec 16, 2024
1 parent 45449a2 commit 7e19d99
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.quarkus.deployment;

import java.util.function.BooleanSupplier;

import io.quarkus.dev.spi.DevModeType;
import io.quarkus.runtime.LaunchMode;

/**
* Similar to {@link IsDevelopment} except checks whether the application is being launched in dev mode but not from a
* {@code mutable-jar} package,
* in other words, not a remote server in a remote dev session.
*/
public class IsLocalDevelopment implements BooleanSupplier {

private final LaunchMode launchMode;
private final DevModeType devModeType;

public IsLocalDevelopment(LaunchMode launchMode, DevModeType devModeType) {
this.launchMode = launchMode;
this.devModeType = devModeType;
}

@Override
public boolean getAsBoolean() {
return launchMode == LaunchMode.DEVELOPMENT && devModeType != DevModeType.REMOTE_SERVER_SIDE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import io.quarkus.agroal.runtime.DataSourcesJdbcBuildTimeConfig;
import io.quarkus.agroal.runtime.dev.ui.DatabaseInspector;
import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.IsLocalDevelopment;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.BuildSteps;
Expand All @@ -12,7 +12,7 @@
import io.quarkus.devui.spi.page.CardPageBuildItem;
import io.quarkus.devui.spi.page.Page;

@BuildSteps(onlyIf = IsDevelopment.class)
@BuildSteps(onlyIf = IsLocalDevelopment.class)
class AgroalDevUIProcessor {

@BuildStep
Expand Down

0 comments on commit 7e19d99

Please sign in to comment.