mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Don't allow user to change minifier settings via IDEA facet UI
This commit is contained in:
parent
3e3b25bddc
commit
3821d29f1c
|
@ -66,14 +66,6 @@ public class TeaVMJpsConfiguration extends JpsElementBase<TeaVMJpsConfiguration>
|
||||||
this.targetDirectory = targetDirectory;
|
this.targetDirectory = targetDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMinifying() {
|
|
||||||
return minifying;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinifying(boolean minifying) {
|
|
||||||
this.minifying = minifying;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSourceMapsFileGenerated() {
|
public boolean isSourceMapsFileGenerated() {
|
||||||
return sourceMapsFileGenerated;
|
return sourceMapsFileGenerated;
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,6 @@ class TeaVMBuild {
|
||||||
tool.setDebugInformationGenerated(config.isSourceMapsFileGenerated());
|
tool.setDebugInformationGenerated(config.isSourceMapsFileGenerated());
|
||||||
tool.setSourceFilesCopied(config.isSourceFilesCopied());
|
tool.setSourceFilesCopied(config.isSourceFilesCopied());
|
||||||
|
|
||||||
tool.setMinifying(config.isMinifying());
|
|
||||||
for (SourceFileProvider fileProvider : sourceFileProviders) {
|
for (SourceFileProvider fileProvider : sourceFileProviders) {
|
||||||
tool.addSourceFileProvider(fileProvider);
|
tool.addSourceFileProvider(fileProvider);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,9 +100,11 @@ public class TeaVMMavenImporter extends MavenImporter {
|
||||||
|
|
||||||
TeaVMFacet facet = facetManager.getFacetByType(facetType.getId());
|
TeaVMFacet facet = facetManager.getFacetByType(facetType.getId());
|
||||||
|
|
||||||
|
boolean justCreated = false;
|
||||||
if (facet == null) {
|
if (facet == null) {
|
||||||
facet = facetManager.createFacet(facetType, facetType.getDefaultFacetName(), null);
|
facet = facetManager.createFacet(facetType, facetType.getDefaultFacetName(), null);
|
||||||
facetModel.addFacet(facet);
|
facetModel.addFacet(facet);
|
||||||
|
justCreated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TeaVMJpsConfiguration configuration = facet.getConfiguration().getState();
|
TeaVMJpsConfiguration configuration = facet.getConfiguration().getState();
|
||||||
|
@ -110,13 +112,14 @@ public class TeaVMMavenImporter extends MavenImporter {
|
||||||
for (Element child : source.getChildren()) {
|
for (Element child : source.getChildren()) {
|
||||||
switch (child.getName()) {
|
switch (child.getName()) {
|
||||||
case "sourceFilesCopied":
|
case "sourceFilesCopied":
|
||||||
configuration.setSourceFilesCopied(Boolean.parseBoolean(child.getTextTrim()));
|
if (justCreated) {
|
||||||
|
configuration.setSourceFilesCopied(true);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "sourceMapsGenerated":
|
case "sourceMapsGenerated":
|
||||||
configuration.setSourceMapsFileGenerated(Boolean.parseBoolean(child.getTextTrim()));
|
if (justCreated) {
|
||||||
break;
|
configuration.setSourceMapsFileGenerated(true);
|
||||||
case "minifying":
|
}
|
||||||
configuration.setMinifying(Boolean.parseBoolean(child.getTextTrim()));
|
|
||||||
break;
|
break;
|
||||||
case "targetDirectory":
|
case "targetDirectory":
|
||||||
configuration.setTargetDirectory(child.getTextTrim());
|
configuration.setTargetDirectory(child.getTextTrim());
|
||||||
|
|
|
@ -45,15 +45,11 @@ import org.teavm.idea.jps.model.TeaVMJpsConfiguration;
|
||||||
class TeaVMConfigurationPanel extends JPanel {
|
class TeaVMConfigurationPanel extends JPanel {
|
||||||
private final TextFieldWithBrowseButton mainClassField = new TextFieldWithBrowseButton(event -> chooseMainClass());
|
private final TextFieldWithBrowseButton mainClassField = new TextFieldWithBrowseButton(event -> chooseMainClass());
|
||||||
private final TextFieldWithBrowseButton targetDirectoryField = new TextFieldWithBrowseButton();
|
private final TextFieldWithBrowseButton targetDirectoryField = new TextFieldWithBrowseButton();
|
||||||
private final JComboBox<ComboBoxItem<Boolean>> minifyingField = new JComboBox<>(new DefaultComboBoxModel<>());
|
|
||||||
private final JComboBox<ComboBoxItem<Boolean>> sourceMapsField = new JComboBox<>(new DefaultComboBoxModel<>());
|
private final JComboBox<ComboBoxItem<Boolean>> sourceMapsField = new JComboBox<>(new DefaultComboBoxModel<>());
|
||||||
private final JComboBox<ComboBoxItem<Boolean>> copySourcesField = new JComboBox<>(new DefaultComboBoxModel<>());
|
private final JComboBox<ComboBoxItem<Boolean>> copySourcesField = new JComboBox<>(new DefaultComboBoxModel<>());
|
||||||
private final TeaVMJpsConfiguration initialConfiguration = new TeaVMJpsConfiguration();
|
private final TeaVMJpsConfiguration initialConfiguration = new TeaVMJpsConfiguration();
|
||||||
private final Project project;
|
private final Project project;
|
||||||
|
|
||||||
private final List<ComboBoxItem<Boolean>> minifiedOptions = Arrays.asList(new ComboBoxItem<>(false, "Readable"),
|
|
||||||
new ComboBoxItem<>(true, "Minified (obfuscated)"));
|
|
||||||
|
|
||||||
private final List<ComboBoxItem<Boolean>> sourceMapsOptions = Arrays.asList(new ComboBoxItem<>(true, "Generate"),
|
private final List<ComboBoxItem<Boolean>> sourceMapsOptions = Arrays.asList(new ComboBoxItem<>(true, "Generate"),
|
||||||
new ComboBoxItem<>(false, "Skip"));
|
new ComboBoxItem<>(false, "Skip"));
|
||||||
|
|
||||||
|
@ -65,9 +61,6 @@ class TeaVMConfigurationPanel extends JPanel {
|
||||||
mainClassField::setText, mainClassField::getText),
|
mainClassField::setText, mainClassField::getText),
|
||||||
new Field<>(TeaVMJpsConfiguration::setTargetDirectory, TeaVMJpsConfiguration::getTargetDirectory,
|
new Field<>(TeaVMJpsConfiguration::setTargetDirectory, TeaVMJpsConfiguration::getTargetDirectory,
|
||||||
targetDirectoryField::setText, targetDirectoryField::getText),
|
targetDirectoryField::setText, targetDirectoryField::getText),
|
||||||
new Field<>(TeaVMJpsConfiguration::setMinifying, TeaVMJpsConfiguration::isMinifying,
|
|
||||||
value -> minifyingField.setSelectedIndex(value ? 1 : 0),
|
|
||||||
() -> minifiedOptions.get(minifyingField.getSelectedIndex()).value),
|
|
||||||
new Field<>(TeaVMJpsConfiguration::setSourceMapsFileGenerated,
|
new Field<>(TeaVMJpsConfiguration::setSourceMapsFileGenerated,
|
||||||
TeaVMJpsConfiguration::isSourceMapsFileGenerated,
|
TeaVMJpsConfiguration::isSourceMapsFileGenerated,
|
||||||
value -> sourceMapsField.setSelectedIndex(value ? 0 : 1),
|
value -> sourceMapsField.setSelectedIndex(value ? 0 : 1),
|
||||||
|
@ -87,7 +80,6 @@ class TeaVMConfigurationPanel extends JPanel {
|
||||||
targetDirectoryField.addBrowseFolderListener("Target Directory", "Please, select folder where TeaVM should"
|
targetDirectoryField.addBrowseFolderListener("Target Directory", "Please, select folder where TeaVM should"
|
||||||
+ "write generated JS files", project, targetDirectoryChooserDescriptor);
|
+ "write generated JS files", project, targetDirectoryChooserDescriptor);
|
||||||
|
|
||||||
minifiedOptions.forEach(minifyingField::addItem);
|
|
||||||
sourceMapsOptions.forEach(sourceMapsField::addItem);
|
sourceMapsOptions.forEach(sourceMapsField::addItem);
|
||||||
copySourcesOptions.forEach(copySourcesField::addItem);
|
copySourcesOptions.forEach(copySourcesField::addItem);
|
||||||
}
|
}
|
||||||
|
@ -126,12 +118,6 @@ class TeaVMConfigurationPanel extends JPanel {
|
||||||
add(targetDirectoryField, fieldConstraints);
|
add(targetDirectoryField, fieldConstraints);
|
||||||
|
|
||||||
fieldConstraints.fill = GridBagConstraints.NONE;
|
fieldConstraints.fill = GridBagConstraints.NONE;
|
||||||
add(bold(new JBLabel("Minification")), labelConstraints);
|
|
||||||
add(new JBLabel("Indicates whether TeaVM should minify (obfuscate) generated JavaScript."),
|
|
||||||
descriptionConstraints);
|
|
||||||
add(new JBLabel("It is highly desirable for production environment, since minified code is up to 3 "
|
|
||||||
+ "times smaller."), descriptionConstraints);
|
|
||||||
add(minifyingField, fieldConstraints);
|
|
||||||
|
|
||||||
add(bold(new JBLabel("Source maps")), labelConstraints);
|
add(bold(new JBLabel("Source maps")), labelConstraints);
|
||||||
add(new JBLabel("Indicates whether TeaVM should generate source maps."), descriptionConstraints);
|
add(new JBLabel("Indicates whether TeaVM should generate source maps."), descriptionConstraints);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
]]>
|
]]>
|
||||||
</change-notes>
|
</change-notes>
|
||||||
|
|
||||||
<idea-version since-build="163.12024.16"/>
|
<idea-version since-build="163.9166.7"/>
|
||||||
|
|
||||||
<application-components>
|
<application-components>
|
||||||
<component>
|
<component>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user