Search in sources :

Example 11 with Produce

use of io.quarkus.deployment.annotations.Produce in project quarkus by quarkusio.

the class TestTracingProcessor method startTesting.

@BuildStep(onlyIf = IsDevelopment.class)
@Produce(LogHandlerBuildItem.class)
@Produce(TestSetupBuildItem.class)
@Produce(ServiceStartBuildItem.class)
void startTesting(TestConfig config, LiveReloadBuildItem liveReloadBuildItem, LaunchModeBuildItem launchModeBuildItem, List<TestListenerBuildItem> testListenerBuildItems) {
    if (TestSupport.instance().isEmpty() || config.continuousTesting == TestConfig.Mode.DISABLED || config.flatClassPath) {
        return;
    }
    DevModeType devModeType = launchModeBuildItem.getDevModeType().orElse(null);
    if (devModeType == null || !devModeType.isContinuousTestingSupported()) {
        return;
    }
    if (testingSetup) {
        return;
    }
    testingSetup = true;
    TestSupport testSupport = TestSupport.instance().get();
    for (TestListenerBuildItem i : testListenerBuildItems) {
        testSupport.addListener(i.listener);
    }
    testSupport.setConfig(config);
    testSupport.setTags(config.includeTags.orElse(Collections.emptyList()), config.excludeTags.orElse(Collections.emptyList()));
    testSupport.setPatterns(config.includePattern.orElse(null), config.excludePattern.orElse(null));
    testSupport.setEngines(config.includeEngines.orElse(Collections.emptyList()), config.excludeEngines.orElse(Collections.emptyList()));
    testSupport.setConfiguredDisplayTestOutput(config.displayTestOutput);
    testSupport.setTestType(config.type);
    if (!liveReloadBuildItem.isLiveReload()) {
        if (config.continuousTesting == TestConfig.Mode.ENABLED) {
            testSupport.start();
        } else if (config.continuousTesting == TestConfig.Mode.PAUSED) {
            testSupport.stop();
        }
    }
    QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader();
    ((QuarkusClassLoader) cl.parent()).addCloseTask(ContinuousTestingSharedStateManager::reset);
}
Also used : ContinuousTestingSharedStateManager(io.quarkus.dev.testing.ContinuousTestingSharedStateManager) DevModeType(io.quarkus.dev.spi.DevModeType) QuarkusClassLoader(io.quarkus.bootstrap.classloading.QuarkusClassLoader) Produce(io.quarkus.deployment.annotations.Produce) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Example 12 with Produce

use of io.quarkus.deployment.annotations.Produce in project quarkus by quarkusio.

the class DevConsoleProcessor method setupConsole.

@Produce(ServiceStartBuildItem.class)
@BuildStep()
void setupConsole(HttpRootPathBuildItem rp, NonApplicationRootPathBuildItem np, LaunchModeBuildItem launchModeBuildItem) {
    if (launchModeBuildItem.getDevModeType().orElse(null) != DevModeType.LOCAL) {
        return;
    }
    if (context == null) {
        context = ConsoleStateManager.INSTANCE.createContext("HTTP");
    }
    Config c = ConfigProvider.getConfig();
    String host = c.getOptionalValue("quarkus.http.host", String.class).orElse("localhost");
    String port = c.getOptionalValue("quarkus.http.port", String.class).orElse("8080");
    context.reset(new ConsoleCommand('w', "Open the application in a browser", null, () -> openBrowser(rp, np, "/", host, port)), new ConsoleCommand('d', "Open the Dev UI in a browser", null, () -> openBrowser(rp, np, "/q/dev", host, port)));
}
Also used : Config(org.eclipse.microprofile.config.Config) RawString(io.quarkus.qute.RawString) ConsoleCommand(io.quarkus.deployment.console.ConsoleCommand) Produce(io.quarkus.deployment.annotations.Produce) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Aggregations

BuildStep (io.quarkus.deployment.annotations.BuildStep)12 Produce (io.quarkus.deployment.annotations.Produce)12 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 GeneratedClassGizmoAdaptor (io.quarkus.deployment.GeneratedClassGizmoAdaptor)3 Consume (io.quarkus.deployment.annotations.Consume)3 Record (io.quarkus.deployment.annotations.Record)3 MainBytecodeRecorderBuildItem (io.quarkus.deployment.builditem.MainBytecodeRecorderBuildItem)3 Map (java.util.Map)3 Consumer (java.util.function.Consumer)3 Config (org.eclipse.microprofile.config.Config)3 QuarkusClassLoader (io.quarkus.bootstrap.classloading.QuarkusClassLoader)2 DevServicesResultBuildItem (io.quarkus.deployment.builditem.DevServicesResultBuildItem)2 DevModeType (io.quarkus.dev.spi.DevModeType)2 ClassCreator (io.quarkus.gizmo.ClassCreator)2 ClassOutput (io.quarkus.gizmo.ClassOutput)2 MethodCreator (io.quarkus.gizmo.MethodCreator)2 StartupContext (io.quarkus.runtime.StartupContext)2 StartupTask (io.quarkus.runtime.StartupTask)2 List (java.util.List)2