Skip to content

Commit

Permalink
Merge pull request #5727 from quarkusio/revert-5540-master
Browse files Browse the repository at this point in the history
Revert "Allow multiple source directories for Gradle."
  • Loading branch information
geoand authored Nov 24, 2019
2 parents 7c34e9d + 71057a3 commit 21cd452
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -215,7 +214,7 @@ private boolean checkForClassFilesChangesInModule(DevModeContext.ModuleInfo modu
}

try {
for (String folder : module.getClassesPath().split(Pattern.quote(File.pathSeparator))) {
for (String folder : module.getClassesPath().split(File.pathSeparator)) {
final Path moduleClassesPath = Paths.get(folder);
try (final Stream<Path> classesStream = Files.walk(moduleClassesPath)) {
final Set<Path> classFilePaths = classesStream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import java.io.File;
import java.util.Set;
import java.util.regex.Pattern;

import org.gradle.api.Project;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.SourceSet;

import io.quarkus.bootstrap.model.AppArtifact;
import io.quarkus.bootstrap.resolver.AppModelResolver;
Expand Down Expand Up @@ -35,25 +33,25 @@ public QuarkusPluginExtension(Project project) {
public File outputDirectory() {
if (outputDirectory == null)
outputDirectory = project.getConvention().getPlugin(JavaPluginConvention.class)
.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput().getClassesDirs().getAsPath();
.getSourceSets().getByName("main").getOutput().getClassesDirs().getAsPath();

return new File(outputDirectory);
}

public File outputConfigDirectory() {
if (outputConfigDirectory == null) {
outputConfigDirectory = project.getConvention().getPlugin(JavaPluginConvention.class)
.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput().getResourcesDir().getAbsolutePath();
.getSourceSets().getByName("main").getOutput().getResourcesDir().getAbsolutePath();
}
return new File(outputConfigDirectory);
}

public Set<File> sourceDir() {
public File sourceDir() {
if (sourceDir == null) {
sourceDir = project.getConvention().getPlugin(JavaPluginConvention.class)
.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getAllJava().getSourceDirectories().getAsPath();
.getSourceSets().getByName("main").getAllJava().getSourceDirectories().getAsPath();
}
return project.getLayout().files(sourceDir.split(Pattern.quote(File.pathSeparator))).getFiles();
return new File(sourceDir);
}

public File workingDir() {
Expand All @@ -73,7 +71,7 @@ public String finalName() {

public Set<File> resourcesDir() {
return project.getConvention().getPlugin(JavaPluginConvention.class)
.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getResources().getSrcDirs();
.getSourceSets().getByName("main").getResources().getSrcDirs();
}

public AppArtifact getAppArtifact() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
public class QuarkusBuild extends QuarkusTask {

private Boolean uberJar;
private boolean uberJar;

private List<String> ignoredEntries = new ArrayList<>();

Expand All @@ -33,12 +33,12 @@ public QuarkusBuild() {

@Optional
@Input
public Boolean isUberJar() {
public boolean isUberJar() {
return uberJar;
}

@Option(description = "Set to true if the build task should build an uberjar", option = "uber-jar")
public void setUberJar(Boolean uberJar) {
public void setUberJar(boolean uberJar) {
this.uberJar = uberJar;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package io.quarkus.gradle.tasks;

import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toSet;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
Expand All @@ -29,7 +26,6 @@
import java.util.concurrent.Executors;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

Expand All @@ -46,7 +42,6 @@
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.SourceSetContainer;
Expand Down Expand Up @@ -80,7 +75,7 @@ public class QuarkusDev extends QuarkusTask {

private String jvmArgs;

private Boolean preventnoverify = false;
private boolean preventnoverify = false;

public QuarkusDev() {
super("Development mode: enables hot deployment with background compilation");
Expand All @@ -99,12 +94,12 @@ public void setBuildDir(File buildDir) {
}

@Optional
@InputFiles
public Set<File> getSourceDir() {
@InputDirectory
public File getSourceDir() {
if (sourceDir == null)
return Collections.unmodifiableSet(new HashSet<>(extension().sourceDir()));
return extension().sourceDir();
else
return getProject().getLayout().files(sourceDir.split(Pattern.quote(File.pathSeparator))).getFiles();
return new File(sourceDir);
}

@Option(description = "Set source directory", option = "source-dir")
Expand Down Expand Up @@ -139,14 +134,14 @@ public void setJvmArgs(String jvmArgs) {

@Optional
@Input
public Boolean isPreventnoverify() {
public boolean isPreventnoverify() {
return preventnoverify;
}

@Option(description = "value is intended to be set to true when some generated bytecode is" +
" erroneous causing the JVM to crash when the verify:none option is set " +
"(which is on by default)", option = "prevent-noverify")
public void setPreventnoverify(Boolean preventnoverify) {
public void setPreventnoverify(boolean preventnoverify) {
this.preventnoverify = preventnoverify;
}

Expand All @@ -156,7 +151,7 @@ public void startDev() {
Project project = getProject();
QuarkusPluginExtension extension = (QuarkusPluginExtension) project.getExtensions().findByName("quarkus");

if (getSourceDir().stream().anyMatch(file -> !file.isDirectory())) {
if (!getSourceDir().isDirectory()) {
throw new GradleException("The `src/main/java` directory is required, please create it.");
}

Expand Down Expand Up @@ -314,8 +309,7 @@ public void startDev() {
DevModeContext.ModuleInfo moduleInfo = new DevModeContext.ModuleInfo(
project.getName(),
project.getProjectDir().getAbsolutePath(),
getSourceDir().stream().map(File::getAbsolutePath)
.collect(collectingAndThen(toSet(), Collections::unmodifiableSet)),
Collections.singleton(getSourceDir().getAbsolutePath()),
extension.outputDirectory().getAbsolutePath(),
res);
context.getModules().add(moduleInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
*/
public class QuarkusListExtensions extends QuarkusPlatformTask {

private Boolean all = true;
private boolean all = true;

private String format = "concise";

private String searchPattern;

@Optional
@Input
public Boolean isAll() {
public boolean isAll() {
return all;
}

@Option(description = "List all extensions or just the installable.", option = "all")
public void setAll(Boolean all) {
public void setAll(boolean all) {
this.all = all;
}

Expand Down
Loading

0 comments on commit 21cd452

Please sign in to comment.