Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
340 changes: 114 additions & 226 deletions plugin/src/main/java/org/docstr/gwt/AbstractBaseTask.java

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions plugin/src/main/java/org/docstr/gwt/ArgumentListUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package org.docstr.gwt;

import lombok.experimental.UtilityClass;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.Provider;

import java.util.Collection;

/**
* Utility-Methods for mapping Lazy Task Properties to command line arguments for GWT.
*/
@UtilityClass
public class ArgumentListUtils {

static void addStringArg(Collection<String> args, String argName, DirectoryProperty property) {

if (property.isPresent()) {
args.add("-" + argName);
args.add(property.get().getAsFile().getAbsolutePath());
}
}

static void addListArg(Collection<String> args, String argName, ListProperty<String> property) {

if (property.isPresent()) {
property.get().forEach(key -> {
args.add("-" + argName);
args.add(key);
});
}
}

static void addStringArg(Collection<String> args, String argName, Provider<?> property) {

if (property.isPresent()) {
args.add("-" + argName);
args.add(property.get().toString());
}
}

static void addBooleanArg(Collection<String> args, String argName, Provider<Boolean> property) {

if (property.isPresent()) {
if (property.get()) {
args.add("-" + argName);
}
else {
if (argName.startsWith("X")) {
args.add("-Xno" + argName.substring(1));
}
else {
args.add("-no" + argName);
}
}

}
}
}
1 change: 0 additions & 1 deletion plugin/src/main/java/org/docstr/gwt/GwtCompileConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ public void execute(GwtCompileTask task) {

// Configure classpath and arguments during configuration phase for Configuration Cache compatibility
task.configureClasspath(project);
task.configureArgs();
task.configureCompileArgs();
}

Expand Down
137 changes: 40 additions & 97 deletions plugin/src/main/java/org/docstr/gwt/GwtCompileTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import javax.inject.Inject;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.Input;
Expand All @@ -36,67 +35,11 @@ public abstract class GwtCompileTask extends AbstractBaseTask {
*/
public static final String COMPILER_CLASS = "com.google.gwt.dev.Compiler";

@Input
@Optional
private final Property<Boolean> closureFormattedOutput;
@Input
@Optional
private final Property<Boolean> compileReport;
@Input
@Optional
private final Property<Boolean> strict;
@Input
@Optional
private final Property<Boolean> classMetadata;
@Input
@Optional
private final Property<Boolean> draftCompile;
@Input
@Optional
private final Property<Boolean> checkAssertions;
@Input
@Optional
private final Property<Integer> fragmentCount;
@Input
@Optional
private final Property<String> namespace;
@Input
@Optional
private final Property<Integer> optimize;
@Input
@Optional
private final Property<Boolean> saveSource;
@Input
@Optional
private final Property<Boolean> validateOnly;
@Input
@Optional
private final Property<Integer> localWorkers;
@OutputDirectory
@Optional
private final DirectoryProperty saveSourceOutput;

/**
* Constructs a new GwtCompileTask.
*
* @param objects The object factory
*/
@Inject
public GwtCompileTask(ObjectFactory objects) {
super(objects);
this.closureFormattedOutput = objects.property(Boolean.class);
this.compileReport = objects.property(Boolean.class);
this.strict = objects.property(Boolean.class);
this.classMetadata = objects.property(Boolean.class);
this.draftCompile = objects.property(Boolean.class);
this.checkAssertions = objects.property(Boolean.class);
this.fragmentCount = objects.property(Integer.class);
this.namespace = objects.property(String.class);
this.optimize = objects.property(Integer.class);
this.saveSource = objects.property(Boolean.class);
this.validateOnly = objects.property(Boolean.class);
this.localWorkers = objects.property(Integer.class);
this.saveSourceOutput = objects.directoryProperty();
public GwtCompileTask() {

// Set GWT compiler as the main class
getMainClass().set(COMPILER_CLASS);
Expand All @@ -113,117 +56,117 @@ public GwtCompileTask(ObjectFactory objects) {
*
* @return The property
*/
public Property<Boolean> getClosureFormattedOutput() {
return closureFormattedOutput;
}
@Input
@Optional
public abstract Property<Boolean> getClosureFormattedOutput();

/**
* Compile a report that tells the "Story of Your Compile"
*
* @return The property
*/
public Property<Boolean> getCompileReport() {
return compileReport;
}
@Input
@Optional
public abstract Property<Boolean> getCompileReport();

/**
* Include metadata for some java.lang.Class methods
*
* @return The property
*/
public Property<Boolean> getStrict() {
return strict;
}
@Input
@Optional
public abstract Property<Boolean> getStrict();

/**
* Compile quickly with minimal optimizations
*
* @return The property
*/
public Property<Boolean> getClassMetadata() {
return classMetadata;
}
@Input
@Optional
public abstract Property<Boolean> getClassMetadata();

/**
* Include assert statements in compiled output
*
* @return The property
*/
public Property<Boolean> getDraftCompile() {
return draftCompile;
}
@Input
@Optional
public abstract Property<Boolean> getDraftCompile();

/**
* Include assert statements in compiled output
*
* @return The property
*/
public Property<Boolean> getCheckAssertions() {
return checkAssertions;
}
@Input
@Optional
public abstract Property<Boolean> getCheckAssertions();

/**
* The number of fragments into which the output JS should be split
*
* @return The property
*/
public Property<Integer> getFragmentCount() {
return fragmentCount;
}
@Input
@Optional
public abstract Property<Integer> getFragmentCount();

/**
* Puts most JavaScript globals into namespaces
*
* @return The property
*/
public Property<String> getNamespace() {
return namespace;
}
@Input
@Optional
public abstract Property<String> getNamespace();

/**
* The optimization level used by the compiler
*
* @return The property
*/
public Property<Integer> getOptimize() {
return optimize;
}
@Input
@Optional
public abstract Property<Integer> getOptimize();

/**
* Enables saving source code needed by debuggers
*
* @return The property
*/
public Property<Boolean> getSaveSource() {
return saveSource;
}
@Input
@Optional
public abstract Property<Boolean> getSaveSource();

/**
* Validate all source code, but do not compile
*
* @return The property
*/
public Property<Boolean> getValidateOnly() {
return validateOnly;
}
@Input
@Optional
public abstract Property<Boolean> getValidateOnly();

/**
* The number of local workers to use when compiling permutations
*
* @return The property
*/
public Property<Integer> getLocalWorkers() {
return localWorkers;
}
@Input
@Optional
public abstract Property<Integer> getLocalWorkers();

/**
* Overrides where source files useful to debuggers will be written
*
* @return The directory
*/
public DirectoryProperty getSaveSourceOutput() {
return saveSourceOutput;
}
@OutputDirectory
@Optional
public abstract DirectoryProperty getSaveSourceOutput();

/**
* Configure task-specific arguments during configuration phase.
Expand Down
1 change: 0 additions & 1 deletion plugin/src/main/java/org/docstr/gwt/GwtDevModeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,5 @@ public void execute(GwtDevModeTask task) {

// Configure classpath and arguments during configuration phase for Configuration Cache compatibility
task.configureClasspath(project);
task.configureArgs();
}
}
Loading