Skip to content

Commit

Permalink
add -setProperty gwt compiler option
Browse files Browse the repository at this point in the history
  • Loading branch information
chwalker-fadv committed Oct 11, 2023
1 parent 061517c commit 660e3a2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 16,7 @@
package org.docstr.gradle.plugins.gwt;

import java.io.File;
import java.util.List;
import java.util.concurrent.Callable;
import org.gradle.api.internal.IConventionAware;
import org.gradle.api.tasks.Input;
Expand Down Expand Up @@ -51,6 52,11 @@ protected void addArgs() {
argIfEnabled(getDisableGeneratingOnShards(), "-XdisableGeneratingOnShards");

argIfSet("-optimize", getOptimize());

for (String property: getSetProperties()) {
args("-setProperty", property);
}

argIfEnabled(getDisableAggressiveOptimization(),
"-XdisableAggressiveOptimization");
argIfEnabled(getDisableClassMetadata(), "-XdisableClassMetadata");
Expand Down Expand Up @@ -433,4 439,18 @@ public Boolean getClosureFormattedOutput() {
public void setClosureFormattedOutput(Boolean closureFormattedOutput) {
options.setClosureFormattedOutput(closureFormattedOutput);
}

/** {@inheritDoc} */
@Override
public void setSetProperties(List<String> properties) {
options.setSetProperties(properties);
}

/** {@inheritDoc} */
@Optional
@Input
@Override
public List<String> getSetProperties() {
return options.getSetProperties();
}
}
2 changes: 2 additions & 0 deletions src/main/java/org/docstr/gradle/plugins/gwt/GwtCompile.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 16,7 @@
package org.docstr.gradle.plugins.gwt;

import java.io.File;
import java.util.List;
import java.util.concurrent.Callable;
import org.gradle.api.internal.ConventionMapping;
import org.gradle.api.internal.IConventionAware;
Expand Down Expand Up @@ -93,5 94,6 @@ protected void configure(final GwtCompileOptions options) {
(Callable<File>) () -> options.getSaveSourceOutput());
conventionMapping
.map("closureFormattedOutput", options::getClosureFormattedOutput);
conventionMapping.map("setProperties", options::getSetProperties);
}
}
11 changes: 11 additions & 0 deletions src/main/java/org/docstr/gradle/plugins/gwt/GwtCompileOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 16,7 @@
package org.docstr.gradle.plugins.gwt;

import java.io.File;
import java.util.List;


/**
Expand Down Expand Up @@ -236,4 237,14 @@ public interface GwtCompileOptions {
* @param closureFormattedOutput The closure formatted output.
*/
void setClosureFormattedOutput(Boolean closureFormattedOutput);

/**
* Set the values of a property in the form of propertyName=value1[,value2...].
* Example: -setProperties = ["user.agent=safari", "locale=default"]
* would add the parameters -setProperty user.agent=safari -setProperty locale=default
* @param properties The list of properties to be set
*/
void setSetProperties(List<String> properties);

List<String> getSetProperties();
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 16,8 @@
package org.docstr.gradle.plugins.gwt.internal;

import java.io.File;
import java.util.Collections;
import java.util.List;
import org.docstr.gradle.plugins.gwt.GwtCompileOptions;
import org.docstr.gradle.plugins.gwt.Namespace;
import org.docstr.gradle.plugins.gwt.Style;
Expand Down Expand Up @@ -61,6 63,7 @@ public class GwtCompileOptionsImpl implements GwtCompileOptions {
private File saveSourceOutput;
// -X[no]closureFormattedOutput
private Boolean closureFormattedOutput;
private List<String> properties = Collections.emptyList();

/** {@inheritDoc} */
@Override
Expand Down Expand Up @@ -363,4 366,16 @@ public Boolean getClosureFormattedOutput() {
public void setClosureFormattedOutput(Boolean closureFormattedOutput) {
this.closureFormattedOutput = closureFormattedOutput;
}

/** {@inheritDoc} */
@Override
public void setSetProperties(List<String> properties) {
this.properties = properties;
}

/** {@inheritDoc} */
@Override
public List<String> getSetProperties() {
return this.properties;
}
}

0 comments on commit 660e3a2

Please sign in to comment.