diff --git a/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java b/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java index 6d2b71999..e491947f8 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java +++ b/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java @@ -12,8 +12,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import io.quarkus.bootstrap.model.AppModel; - /** * Object that is used to pass context data from the plugin doing the invocation * into the dev mode process using java serialization. @@ -45,8 +43,6 @@ public class DevModeContext implements Serializable { private List compilerPluginArtifacts; private List compilerPluginsOptions; - private AppModel appModel; - public boolean isLocalProjectDiscovery() { return localProjectDiscovery; } @@ -173,15 +169,6 @@ public class DevModeContext implements Serializable { return this; } - public AppModel getAppModel() { - return appModel; - } - - public DevModeContext setAppModel(AppModel appModel) { - this.appModel = appModel; - return this; - } - public static class ModuleInfo implements Serializable { private final String name; diff --git a/core/devmode/src/main/java/io/quarkus/dev/IsolatedDevModeMain.java b/core/devmode/src/main/java/io/quarkus/dev/IsolatedDevModeMain.java index 756bbf9ca..56e0351d1 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/IsolatedDevModeMain.java +++ b/core/devmode/src/main/java/io/quarkus/dev/IsolatedDevModeMain.java @@ -154,11 +154,16 @@ public class IsolatedDevModeMain implements BiConsumer classDirFiles = classesDirs.getFiles(); + if (classDirFiles.size() == 1) { + classesPaths = classesDirs.getAsPath(); + } else { + //there does not seem to be any sane way of dealing with multiple output dirs, as there does not seem + //to be a way to map them. We will need to address this at some point, but for now we just stick them + //all in a temp dir + + Path path = getTemporaryDir().toPath(); + classesPaths = path.toAbsolutePath().toString(); + for (File c : classDirFiles) { + Path cd = c.toPath(); + if (!Files.exists(cd)) { + continue; + } + try (Stream stream = Files.walk(cd)) { + stream.forEach(s -> { + try { + if (Files.isDirectory(s)) { + return; + } + final Path file = cd.relativize(path); + final Path targetPath = path.resolve(file.toString()); + Files.createDirectories(targetPath.getParent()); + byte[] data = Files.readAllBytes(s); + Files.write(targetPath, data); + } catch (IOException e) { + throw new RuntimeException(e); + } + + }); + } + } + + } + + String resourcePaths = mainSourceSet.getResources().getSourceDirectories().getSingleFile().getAbsolutePath(); //TODO: multiple resource directories DevModeContext.ModuleInfo wsModuleInfo = new DevModeContext.ModuleInfo( dependencyProject.getName(), @@ -351,6 +393,13 @@ public class QuarkusDev extends QuarkusTask { obj.writeObject(context); obj.close(); out.write(bytes.toByteArray()); + + out.putNextEntry(new ZipEntry(BootstrapConstants.SERIALIZED_APP_MODEL)); + bytes = new ByteArrayOutputStream(); + obj = new ObjectOutputStream(new DataOutputStream(bytes)); + obj.writeObject(appModel); + obj.close(); + out.write(bytes.toByteArray()); } extension.outputDirectory().mkdirs(); diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java index 121f7e883..f415ced24 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java @@ -213,10 +213,10 @@ public class BootstrapAppModelFactory { } public CurationResult resolveAppModel() throws BootstrapException { - if (test) { - //gradle tests encode the result on the class path + if (test || devMode) { + //gradle tests and dev encode the result on the class path - try (InputStream existing = getClass().getResourceAsStream(BootstrapConstants.SERIALIZED_APP_MODEL)){ + try (InputStream existing = getClass().getClassLoader().getResourceAsStream(BootstrapConstants.SERIALIZED_APP_MODEL)){ if(existing != null ) { AppModel appModel = (AppModel) new ObjectInputStream(existing).readObject(); return new CurationResult(appModel); diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java index c135e67c6..14ad9834b 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java @@ -26,7 +26,6 @@ import io.quarkus.bootstrap.model.AppArtifact; import io.quarkus.bootstrap.model.AppArtifactKey; import io.quarkus.bootstrap.model.AppDependency; import io.quarkus.bootstrap.model.AppModel; -import io.quarkus.bootstrap.resolver.AppModelResolver; /** * The result of the curate step that is done by QuarkusBootstrap.