io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem Java Examples
The following examples show how to use
io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HotDeploymentProcessor.java From camel-k-runtime with Apache License 2.0 | 6 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> routes() { final Config config = ConfigProvider.getConfig(); final Optional<String> value = config.getOptionalValue(Constants.PROPERTY_CAMEL_K_ROUTES, String.class); List<HotDeploymentWatchedFileBuildItem> items = new ArrayList<>(); if (value.isPresent()) { for (String source : value.get().split(",", -1)) { String path = StringHelper.after(source, ":"); if (path == null) { path = source; } Path p = Paths.get(path); if (Files.exists(p)) { LOGGER.info("Register source for hot deployment: {}", p.toAbsolutePath()); items.add(new HotDeploymentWatchedFileBuildItem(p.toAbsolutePath().toString())); } } } return items; }
Example #2
Source File: QuteProcessor.java From quarkus with Apache License 2.0 | 6 votes |
private void scan(Path root, Path directory, String basePath, BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths, BuildProducer<TemplatePathBuildItem> templatePaths, BuildProducer<NativeImageResourceBuildItem> nativeImageResources) throws IOException { try (Stream<Path> files = Files.list(directory)) { Iterator<Path> iter = files.iterator(); while (iter.hasNext()) { Path filePath = iter.next(); if (Files.isRegularFile(filePath)) { LOGGER.debugf("Found template: %s", filePath); String templatePath = root.relativize(filePath).toString(); if (File.separatorChar != '/') { templatePath = templatePath.replace(File.separatorChar, '/'); } produceTemplateBuildItems(templatePaths, watchedPaths, nativeImageResources, basePath, templatePath, filePath); } else if (Files.isDirectory(filePath)) { LOGGER.debugf("Scan directory: %s", filePath); scan(root, filePath, basePath, watchedPaths, templatePaths, nativeImageResources); } } } }
Example #3
Source File: UndertowBuildStep.java From quarkus with Apache License 2.0 | 6 votes |
/** * Register the undertow-handlers.conf file */ @BuildStep public void registerUndertowHandlersConf(BuildProducer<ServletExtensionBuildItem> producer, ApplicationArchivesBuildItem applicationArchivesBuildItem, BuildProducer<HotDeploymentWatchedFileBuildItem> watchedFile, BuildProducer<NativeImageResourceBuildItem> nativeImageResourceBuildItemBuildProducer) { //we always watch the file, so if it gets added we restart watchedFile.produce( new HotDeploymentWatchedFileBuildItem(UndertowHandlersConfServletExtension.META_INF_UNDERTOW_HANDLERS_CONF)); //check for the file in the handlers dir Path handlerPath = applicationArchivesBuildItem.getRootArchive() .getChildPath(UndertowHandlersConfServletExtension.META_INF_UNDERTOW_HANDLERS_CONF); if (handlerPath != null) { producer.produce(new ServletExtensionBuildItem(new UndertowHandlersConfServletExtension())); nativeImageResourceBuildItemBuildProducer.produce( new NativeImageResourceBuildItem(UndertowHandlersConfServletExtension.META_INF_UNDERTOW_HANDLERS_CONF)); } }
Example #4
Source File: QuteProcessor.java From quarkus with Apache License 2.0 | 5 votes |
@BuildStep void collectTemplates(ApplicationArchivesBuildItem applicationArchivesBuildItem, BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths, BuildProducer<TemplatePathBuildItem> templatePaths, BuildProducer<NativeImageResourceBuildItem> nativeImageResources) throws IOException { ApplicationArchive applicationArchive = applicationArchivesBuildItem.getRootArchive(); String basePath = "templates"; Path templatesPath = applicationArchive.getChildPath(basePath); if (templatesPath != null) { scan(templatesPath, templatesPath, basePath + "/", watchedPaths, templatePaths, nativeImageResources); } }
Example #5
Source File: QuteProcessor.java From quarkus with Apache License 2.0 | 5 votes |
private static void produceTemplateBuildItems(BuildProducer<TemplatePathBuildItem> templatePaths, BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths, BuildProducer<NativeImageResourceBuildItem> nativeImageResources, String basePath, String filePath, Path originalPath) { if (filePath.isEmpty()) { return; } String fullPath = basePath + filePath; LOGGER.debugf("Produce template build items [filePath: %s, fullPath: %s, originalPath: %s", filePath, fullPath, originalPath); // NOTE: we cannot just drop the template because a template param can be added watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(fullPath, true)); nativeImageResources.produce(new NativeImageResourceBuildItem(fullPath)); templatePaths.produce(new TemplatePathBuildItem(filePath, originalPath)); }
Example #6
Source File: HibernateOrmProcessor.java From quarkus with Apache License 2.0 | 5 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> hotDeploymentWatchedFiles(LaunchModeBuildItem launchMode) { List<HotDeploymentWatchedFileBuildItem> watchedFiles = new ArrayList<>(); if (shouldIgnorePersistenceXmlResources()) { watchedFiles.add(new HotDeploymentWatchedFileBuildItem("META-INF/persistence.xml")); } watchedFiles.add(new HotDeploymentWatchedFileBuildItem(INTEGRATOR_SERVICE_FILE)); getSqlLoadScript(launchMode.getLaunchMode()).ifPresent(script -> { watchedFiles.add(new HotDeploymentWatchedFileBuildItem(script)); }); return watchedFiles; }
Example #7
Source File: SmallRyeOpenApiProcessor.java From quarkus with Apache License 2.0 | 5 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> configFiles() { return Stream.of(META_INF_OPENAPI_YAML, WEB_INF_CLASSES_META_INF_OPENAPI_YAML, META_INF_OPENAPI_YML, WEB_INF_CLASSES_META_INF_OPENAPI_YML, META_INF_OPENAPI_JSON, WEB_INF_CLASSES_META_INF_OPENAPI_JSON).map(HotDeploymentWatchedFileBuildItem::new) .collect(Collectors.toList()); }
Example #8
Source File: HotDeploymentConfigFileBuildStep.java From quarkus with Apache License 2.0 | 5 votes |
@BuildStep ServiceStartBuildItem setupConfigFileHotDeployment(List<HotDeploymentWatchedFileBuildItem> files) { // TODO: this should really be an output of the RuntimeRunner RuntimeUpdatesProcessor processor = IsolatedDevModeMain.runtimeUpdatesProcessor; if (processor != null) { Map<String, Boolean> watchedFilePaths = files.stream() .collect(Collectors.toMap(HotDeploymentWatchedFileBuildItem::getLocation, HotDeploymentWatchedFileBuildItem::isRestartNeeded)); processor.setWatchedFilePaths(watchedFilePaths); } return null; }
Example #9
Source File: CamelMainHotDeploymentProcessor.java From camel-quarkus with Apache License 2.0 | 4 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> xmlRoutes() { return locations("camel.main.xml-routes"); }
Example #10
Source File: CamelMainHotDeploymentProcessor.java From camel-quarkus with Apache License 2.0 | 4 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> xmlRests() { return locations("camel.main.xml-rests"); }
Example #11
Source File: HibernateValidatorProcessor.java From quarkus with Apache License 2.0 | 4 votes |
@BuildStep HotDeploymentWatchedFileBuildItem configFile() { return new HotDeploymentWatchedFileBuildItem(META_INF_VALIDATION_XML); }
Example #12
Source File: HotDeploymentConfigBuildStep.java From quarkus with Apache License 2.0 | 4 votes |
@BuildStep HotDeploymentWatchedFileBuildItem configFile() { return new HotDeploymentWatchedFileBuildItem("META-INF/beans.xml"); }
Example #13
Source File: ConfigYamlProcessor.java From quarkus with Apache License 2.0 | 4 votes |
@BuildStep void watchYamlConfig(BuildProducer<HotDeploymentWatchedFileBuildItem> items) { items.produce(new HotDeploymentWatchedFileBuildItem(ApplicationYamlProvider.APPLICATION_YAML)); items.produce(new HotDeploymentWatchedFileBuildItem(ApplicationYamlProvider.APPLICATION_YML)); }
Example #14
Source File: WebXmlParsingBuildStep.java From quarkus with Apache License 2.0 | 4 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> configFile() { return Arrays.asList(new HotDeploymentWatchedFileBuildItem(WEB_XML), new HotDeploymentWatchedFileBuildItem(WEB_FRAGMENT_XML)); }
Example #15
Source File: DevModeBuildStep.java From quarkus with Apache License 2.0 | 4 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> config() { return Arrays.asList(new HotDeploymentWatchedFileBuildItem("META-INF/microprofile-config.properties"), new HotDeploymentWatchedFileBuildItem("application.properties"), new HotDeploymentWatchedFileBuildItem( Paths.get(".env").toAbsolutePath().toAbsolutePath().toString())); }
Example #16
Source File: BannerProcessor.java From quarkus with Apache License 2.0 | 4 votes |
@BuildStep HotDeploymentWatchedFileBuildItem watchBannerChanges(BannerConfig config) { return new HotDeploymentWatchedFileBuildItem(config.path); }