--indy flag for Groovy compiler

This commit is contained in:
Maxim.Medvedev
2012-07-12 20:15:32 +04:00
parent 41743882cf
commit eb0baef05c
4 changed files with 33 additions and 3 deletions
@@ -147,7 +147,8 @@ public abstract class GroovyCompilerBase implements TranslatingCompiler {
classPathBuilder.add(PathManager.findFileInLibDirectory("yjp-controller-api-redist.jar").getAbsolutePath());
}
parameters.getVMParametersList().add("-Xmx" + GroovyCompilerConfiguration.getInstance(myProject).getHeapSize() + "m");
final GroovyCompilerConfiguration compilerConfiguration = GroovyCompilerConfiguration.getInstance(myProject);
parameters.getVMParametersList().add("-Xmx" + compilerConfiguration.getHeapSize() + "m");
if (profileGroovyc) {
parameters.getVMParametersList().add("-XX:+HeapDumpOnOutOfMemoryError");
}
@@ -199,6 +200,9 @@ public abstract class GroovyCompilerBase implements TranslatingCompiler {
parameters.getProgramParametersList().add(forStubs ? "stubs" : "groovyc");
parameters.getProgramParametersList().add(fileWithParameters.getPath());
if (compilerConfiguration.isInvokeDynamic()) {
parameters.getProgramParametersList().add("--indy");
}
try {
Process process = JdkUtil.setupJVMCommandLine(exePath, parameters, true).createProcess();
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.groovy.compiler.GroovyCompilerConfigurable">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="167"/>
@@ -41,7 +41,7 @@
</grid>
<grid id="4e3dc" binding="myExcludesPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
@@ -50,6 +50,14 @@
<border type="etched" title="Exclude from stub generation"/>
<children/>
</grid>
<component id="52aeb" class="com.intellij.ui.components.JBCheckBox" binding="myInvokeDynamicSupportCB">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Invoke &amp;dynamic support"/>
</properties>
</component>
</children>
</grid>
</form>
@@ -30,6 +30,7 @@ import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.Nls;
@@ -46,6 +47,8 @@ public class GroovyCompilerConfigurable implements SearchableConfigurable, Confi
private JTextField myHeapSize;
private JPanel myMainPanel;
private JPanel myExcludesPanel;
private JBCheckBox myInvokeDynamicSupportCB;
private final ExcludedEntriesConfigurable myExcludes;
private final GroovyCompilerConfiguration myConfig;
@@ -102,16 +105,19 @@ public class GroovyCompilerConfigurable implements SearchableConfigurable, Confi
public boolean isModified() {
return !Comparing.equal(myConfig.getHeapSize(), myHeapSize.getText()) ||
myInvokeDynamicSupportCB.isSelected() != myConfig.isInvokeDynamic() ||
myExcludes.isModified();
}
public void apply() throws ConfigurationException {
myExcludes.apply();
myConfig.setHeapSize(myHeapSize.getText());
myConfig.setInvokeDynamic(myInvokeDynamicSupportCB.isSelected());
}
public void reset() {
myHeapSize.setText(myConfig.getHeapSize());
myInvokeDynamicSupportCB.setSelected(myConfig.isInvokeDynamic());
myExcludes.reset();
}
@@ -36,12 +36,14 @@ import org.jdom.Element;
)
public class GroovyCompilerConfiguration implements PersistentStateComponent<GroovyCompilerConfiguration.MyStateBean>, Disposable {
private String myHeapSize = "400";
private boolean myInvokeDynamic = false;
public boolean transformsOk = false;
private final ExcludedEntriesConfiguration myExcludeFromStubGeneration = new ExcludedEntriesConfiguration();
public MyStateBean getState() {
final MyStateBean bean = new MyStateBean();
bean.heapSize = myHeapSize;
bean.invokeDynamic = myInvokeDynamic;
bean.transformsOk = transformsOk;
myExcludeFromStubGeneration.writeExternal(bean.excludes);
return bean;
@@ -57,6 +59,7 @@ public class GroovyCompilerConfiguration implements PersistentStateComponent<Gro
public void loadState(MyStateBean state) {
myHeapSize = state.heapSize;
myInvokeDynamic = state.invokeDynamic;
transformsOk = state.transformsOk;
myExcludeFromStubGeneration.readExternal(state.excludes);
@@ -70,16 +73,25 @@ public class GroovyCompilerConfiguration implements PersistentStateComponent<Gro
return myHeapSize;
}
public boolean isInvokeDynamic() {
return myInvokeDynamic;
}
public void setHeapSize(String heapSize) {
myHeapSize = heapSize;
}
public void setInvokeDynamic(boolean invokeDynamic) {
myInvokeDynamic = invokeDynamic;
}
public void dispose() {
Disposer.dispose(myExcludeFromStubGeneration);
}
public static class MyStateBean {
public String heapSize = "400";
public boolean invokeDynamic = false;
@Tag("excludes") public Element excludes = new Element("aaa");