Search in sources :

Example 1 with ModuleInfo

use of io.quarkus.deployment.dev.DevModeContext.ModuleInfo in project quarkus by quarkusio.

the class IDEDevModeMain method accept.

@Override
public void accept(CuratedApplication curatedApplication, Map<String, Object> stringObjectMap) {
    Path appClasses = (Path) stringObjectMap.get("app-classes");
    DevModeContext devModeContext = new DevModeContext();
    devModeContext.setArgs((String[]) stringObjectMap.get("args"));
    ApplicationModel appModel = null;
    try {
        if (BuildToolHelper.isMavenProject(appClasses)) {
            appModel = curatedApplication.getApplicationModel();
        } else {
            appModel = BootstrapUtils.deserializeQuarkusModel((Path) stringObjectMap.get(BootstrapConstants.SERIALIZED_APP_MODEL));
        }
        if (appModel != null) {
            for (ResolvedDependency project : DependenciesFilter.getReloadableModules(appModel)) {
                final ModuleInfo module = toModule(project);
                if (project.getKey().equals(appModel.getAppArtifact().getKey()) && project.getVersion().equals(appModel.getAppArtifact().getVersion())) {
                    devModeContext.setApplicationRoot(module);
                } else {
                    devModeContext.getAdditionalModules().add(module);
                    devModeContext.getLocalArtifacts().add(project.getKey());
                }
            }
        }
    } catch (AppModelResolverException e) {
        log.error("Failed to load workspace, hot reload will not be available", e);
    }
    terminateIfRunning();
    delegate = new IsolatedDevModeMain();
    Map<String, Object> params = new HashMap<>();
    params.put(DevModeContext.class.getName(), devModeContext);
    params.put(DevModeType.class.getName(), DevModeType.LOCAL);
    delegate.accept(curatedApplication, params);
}
Also used : Path(java.nio.file.Path) ModuleInfo(io.quarkus.deployment.dev.DevModeContext.ModuleInfo) HashMap(java.util.HashMap) AppModelResolverException(io.quarkus.bootstrap.resolver.AppModelResolverException) ResolvedDependency(io.quarkus.maven.dependency.ResolvedDependency) ApplicationModel(io.quarkus.bootstrap.model.ApplicationModel) DevModeType(io.quarkus.dev.spi.DevModeType)

Aggregations

ApplicationModel (io.quarkus.bootstrap.model.ApplicationModel)1 AppModelResolverException (io.quarkus.bootstrap.resolver.AppModelResolverException)1 ModuleInfo (io.quarkus.deployment.dev.DevModeContext.ModuleInfo)1 DevModeType (io.quarkus.dev.spi.DevModeType)1 ResolvedDependency (io.quarkus.maven.dependency.ResolvedDependency)1 Path (java.nio.file.Path)1 HashMap (java.util.HashMap)1