Skip to content

Commit

Permalink
Merge pull request #22646 from quarkusio/revert-22336-multijar-modules
Browse files Browse the repository at this point in the history
Revert "Support for project modules that produce multiple JARs (with classifiers)"
  • Loading branch information
gsmet authored Jan 5, 2022
2 parents f7279c9 + 8d4d345 commit d8604fd
Show file tree
Hide file tree
Showing 122 changed files with 981 additions and 3,637 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ public PathCollection getResolvedPaths() {
}

@Override
@Deprecated
/**
* @deprecated in favor of {@link #getKey()}
* @return archive key
*/
public AppArtifactKey getArtifactKey() {
return artifactKey == null ? null
: new AppArtifactKey(artifactKey.getGroupId(), artifactKey.getArtifactId(), artifactKey.getClassifier(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import java.util.function.Consumer;

import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.bootstrap.prebuild.CodeGenException;
import io.quarkus.deployment.codegen.CodeGenData;
import io.quarkus.paths.PathCollection;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.runtime.configuration.ConfigUtils;
import io.smallrye.config.PropertiesConfigSource;
Expand All @@ -25,7 +25,7 @@ public class CodeGenerator {

// used by Gradle and Maven
public static void initAndRun(ClassLoader classLoader,
PathCollection sourceParentDirs, Path generatedSourcesDir, Path buildDir,
PathsCollection sourceParentDirs, Path generatedSourcesDir, Path buildDir,
Consumer<Path> sourceRegistrar, ApplicationModel appModel, Properties properties,
String launchMode) throws CodeGenException {
List<CodeGenData> generators = init(classLoader, sourceParentDirs, generatedSourcesDir, buildDir, sourceRegistrar);
Expand All @@ -36,7 +36,7 @@ public static void initAndRun(ClassLoader classLoader,
}

public static List<CodeGenData> init(ClassLoader deploymentClassLoader,
PathCollection sourceParentDirs,
PathsCollection sourceParentDirs,
Path generatedSourcesDir,
Path buildDir,
Consumer<Path> sourceRegistrar) throws CodeGenException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.builder.BuildChain;
import io.quarkus.builder.BuildChainBuilder;
import io.quarkus.builder.BuildExecutionBuilder;
Expand Down Expand Up @@ -45,7 +46,7 @@ public class QuarkusAugmentor {

private final ClassLoader classLoader;
private final ClassLoader deploymentClassLoader;
private final PathCollection root;
private final PathsCollection root;
private final Set<Class<? extends BuildItem>> finalResults;
private final List<Consumer<BuildChainBuilder>> buildChainCustomizers;
private final LaunchMode launchMode;
Expand Down Expand Up @@ -192,7 +193,7 @@ public static final class Builder {
List<PathCollection> additionalApplicationArchives = new ArrayList<>();
Collection<Path> excludedFromIndexing = Collections.emptySet();
ClassLoader classLoader;
PathCollection root;
PathsCollection root;
Path targetDir;
Set<Class<? extends BuildItem>> finalResults = new HashSet<>();
private final List<Consumer<BuildChainBuilder>> buildChainCustomizers = new ArrayList<>();
Expand Down Expand Up @@ -273,7 +274,7 @@ public Builder setClassLoader(ClassLoader classLoader) {
return this;
}

public PathCollection getRoot() {
public PathsCollection getRoot() {
return root;
}

Expand All @@ -282,7 +283,7 @@ public <T extends BuildItem> Builder addFinal(Class<T> clazz) {
return this;
}

public Builder setRoot(PathCollection root) {
public Builder setRoot(PathsCollection root) {
this.root = root;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.builder.item.SimpleBuildItem;
import io.quarkus.fs.util.ZipUtils;
import io.quarkus.paths.PathCollection;

public final class ArchiveRootBuildItem extends SimpleBuildItem {

Expand All @@ -30,7 +29,7 @@ public Builder addArchiveRoot(Path root) {
return this;
}

public Builder addArchiveRoots(PathCollection paths) {
public Builder addArchiveRoots(PathsCollection paths) {
paths.forEach(archiveRoots::add);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import io.quarkus.builder.item.MultiBuildItem;
import io.quarkus.deployment.pkg.NativeConfig;
import io.quarkus.util.GlobUtil;
import io.quarkus.deployment.util.GlobUtil;

/**
* A build item that indicates that a set of resource paths defined by regular expression patterns or globs should be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.List;
import java.util.Set;

import io.quarkus.paths.PathCollection;
import io.quarkus.bootstrap.model.PathsCollection;

public interface CompilationProvider extends Closeable {

Expand All @@ -23,7 +23,7 @@ default Set<String> handledSourcePaths() {

void compile(Set<File> files, Context context);

Path getSourcePath(Path classFilePath, PathCollection sourcePaths, String classesPath);
Path getSourcePath(Path classFilePath, PathsCollection sourcePaths, String classesPath);

@Override
default void close() throws IOException {
Expand Down Expand Up @@ -58,6 +58,7 @@ public Context(
String targetJvmVersion,
List<String> compilePluginArtifacts,
List<String> compilerPluginOptions) {

this.name = name;
this.classpath = classpath;
this.projectDirectory = projectDirectory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import java.util.Set;

import io.quarkus.bootstrap.app.QuarkusBootstrap;
import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.maven.dependency.ArtifactKey;
import io.quarkus.paths.PathCollection;
import io.quarkus.paths.PathList;

/**
* Object that is used to pass context data from the plugin doing the invocation
Expand All @@ -27,7 +27,7 @@
*/
public class DevModeContext implements Serializable {

public static final CompilationUnit EMPTY_COMPILATION_UNIT = new CompilationUnit(PathList.of(), null, null, null);
public static final CompilationUnit EMPTY_COMPILATION_UNIT = new CompilationUnit(PathsCollection.of(), null, null, null);

public static final String ENABLE_PREVIEW_FLAG = "--enable-preview";

Expand Down Expand Up @@ -59,7 +59,7 @@ public class DevModeContext implements Serializable {
private String alternateEntryPoint;
private QuarkusBootstrap.Mode mode = QuarkusBootstrap.Mode.DEV;
private String baseName;
private final Set<ArtifactKey> localArtifacts = new HashSet<>();
private final Set<AppArtifactKey> localArtifacts = new HashSet<>();

public boolean isLocalProjectDiscovery() {
return localProjectDiscovery;
Expand Down Expand Up @@ -232,7 +232,7 @@ public void setBaseName(String baseName) {
this.baseName = baseName;
}

public Set<ArtifactKey> getLocalArtifacts() {
public Set<AppArtifactKey> getLocalArtifacts() {
return localArtifacts;
}

Expand All @@ -245,17 +245,16 @@ public static class ModuleInfo implements Serializable {
private final CompilationUnit test;

private final String preBuildOutputDir;
private final PathCollection sourceParents;
private final PathsCollection sourceParents;
private final String targetDir;

ModuleInfo(Builder builder) {
this.appArtifactKey = builder.appArtifactKey;
this.name = builder.name == null ? builder.appArtifactKey.toGacString() : builder.name;
this.name = builder.name;
this.projectDirectory = builder.projectDirectory;
this.main = new CompilationUnit(builder.sourcePaths, builder.classesPath,
builder.resourcePaths,
builder.resourcesOutputPath);

if (builder.testClassesPath != null) {
this.test = new CompilationUnit(builder.testSourcePaths,
builder.testClassesPath, builder.testResourcePaths, builder.testResourcesOutputPath);
Expand All @@ -275,7 +274,7 @@ public String getProjectDirectory() {
return projectDirectory;
}

public PathCollection getSourceParents() {
public PathsCollection getSourceParents() {
return sourceParents;
}

Expand Down Expand Up @@ -313,18 +312,18 @@ public static class Builder {
private ArtifactKey appArtifactKey;
private String name;
private String projectDirectory;
private PathCollection sourcePaths = PathList.of();
private PathsCollection sourcePaths = PathsCollection.of();
private String classesPath;
private PathCollection resourcePaths = PathList.of();
private PathsCollection resourcePaths = PathsCollection.of();
private String resourcesOutputPath;

private String preBuildOutputDir;
private PathCollection sourceParents = PathList.of();
private PathsCollection sourceParents = PathsCollection.of();
private String targetDir;

private PathCollection testSourcePaths = PathList.of();
private PathsCollection testSourcePaths = PathsCollection.of();
private String testClassesPath;
private PathCollection testResourcePaths = PathList.of();
private PathsCollection testResourcePaths = PathsCollection.of();
private String testResourcesOutputPath;

public Builder setArtifactKey(ArtifactKey appArtifactKey) {
Expand All @@ -342,7 +341,7 @@ public Builder setProjectDirectory(String projectDirectory) {
return this;
}

public Builder setSourcePaths(PathCollection sourcePaths) {
public Builder setSourcePaths(PathsCollection sourcePaths) {
this.sourcePaths = sourcePaths;
return this;
}
Expand All @@ -352,7 +351,7 @@ public Builder setClassesPath(String classesPath) {
return this;
}

public Builder setResourcePaths(PathCollection resourcePaths) {
public Builder setResourcePaths(PathsCollection resourcePaths) {
this.resourcePaths = resourcePaths;
return this;
}
Expand All @@ -367,7 +366,7 @@ public Builder setPreBuildOutputDir(String preBuildOutputDir) {
return this;
}

public Builder setSourceParents(PathCollection sourceParents) {
public Builder setSourceParents(PathsCollection sourceParents) {
this.sourceParents = sourceParents;
return this;
}
Expand All @@ -377,7 +376,7 @@ public Builder setTargetDir(String targetDir) {
return this;
}

public Builder setTestSourcePaths(PathCollection testSourcePaths) {
public Builder setTestSourcePaths(PathsCollection testSourcePaths) {
this.testSourcePaths = testSourcePaths;
return this;
}
Expand All @@ -387,7 +386,7 @@ public Builder setTestClassesPath(String testClassesPath) {
return this;
}

public Builder setTestResourcePaths(PathCollection testResourcePaths) {
public Builder setTestResourcePaths(PathsCollection testResourcePaths) {
this.testResourcePaths = testResourcePaths;
return this;
}
Expand All @@ -404,28 +403,28 @@ public ModuleInfo build() {
}

public static class CompilationUnit implements Serializable {
private PathCollection sourcePaths;
private PathsCollection sourcePaths;
private final String classesPath;
private final PathCollection resourcePaths;
private final PathsCollection resourcePaths;
private final String resourcesOutputPath;

public CompilationUnit(PathCollection sourcePaths, String classesPath, PathCollection resourcePaths,
public CompilationUnit(PathsCollection sourcePaths, String classesPath, PathsCollection resourcePaths,
String resourcesOutputPath) {
this.sourcePaths = sourcePaths;
this.classesPath = classesPath;
this.resourcePaths = resourcePaths;
this.resourcesOutputPath = resourcesOutputPath;
}

public PathCollection getSourcePaths() {
public PathsCollection getSourcePaths() {
return sourcePaths;
}

public String getClassesPath() {
return classesPath;
}

public PathCollection getResourcePaths() {
public PathsCollection getResourcePaths() {
return resourcePaths;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
import org.apache.commons.lang3.SystemUtils;
import org.jboss.logging.Logger;

import io.quarkus.bootstrap.app.AdditionalDependency;
import io.quarkus.bootstrap.app.CuratedApplication;
import io.quarkus.bootstrap.app.QuarkusBootstrap;
import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.deployment.util.ProcessUtil;
import io.quarkus.dev.appstate.ApplicationStateNotification;
import io.quarkus.dev.spi.DevModeType;
import io.quarkus.maven.dependency.ArtifactKey;
import io.quarkus.paths.PathList;

/**
* The main entry point for the dev mojo execution
Expand Down Expand Up @@ -86,8 +87,8 @@ public void start() throws Exception {
}
}
}
final PathList.Builder appRoots = PathList.builder();
Path p = Path.of(context.getApplicationRoot().getMain().getClassesPath());
final PathsCollection.Builder appRoots = PathsCollection.builder();
Path p = Paths.get(context.getApplicationRoot().getMain().getClassesPath());
if (Files.exists(p)) {
appRoots.add(p);
}
Expand Down Expand Up @@ -115,10 +116,22 @@ public void start() throws Exception {
} else {
bootstrapBuilder.setProjectRoot(new File(".").toPath());
}
for (ArtifactKey i : context.getLocalArtifacts()) {
for (AppArtifactKey i : context.getLocalArtifacts()) {
bootstrapBuilder.addLocalArtifact(i);
}

for (DevModeContext.ModuleInfo i : context.getAdditionalModules()) {
if (i.getMain().getClassesPath() != null) {
Path classesPath = Paths.get(i.getMain().getClassesPath());
bootstrapBuilder.addAdditionalApplicationArchive(new AdditionalDependency(classesPath, true, false));
}
if (i.getMain().getResourcesOutputPath() != null
&& !i.getMain().getResourcesOutputPath().equals(i.getMain().getClassesPath())) {
Path resourceOutputPath = Paths.get(i.getMain().getResourcesOutputPath());
bootstrapBuilder.addAdditionalApplicationArchive(new AdditionalDependency(resourceOutputPath, true, false));
}
}

linkDotEnvFile();

Properties buildSystemProperties = new Properties();
Expand Down
Loading

0 comments on commit d8604fd

Please sign in to comment.