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;
|
||||
}
|
||||
|
||||
public boolean isMinifying() {
|
||||
return minifying;
|
||||
}
|
||||
|
||||
public void setMinifying(boolean minifying) {
|
||||
this.minifying = minifying;
|
||||
}
|
||||
|
||||
public boolean isSourceMapsFileGenerated() {
|
||||
return sourceMapsFileGenerated;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,6 @@ class TeaVMBuild {
|
|||
tool.setDebugInformationGenerated(config.isSourceMapsFileGenerated());
|
||||
tool.setSourceFilesCopied(config.isSourceFilesCopied());
|
||||
|
||||
tool.setMinifying(config.isMinifying());
|
||||
for (SourceFileProvider fileProvider : sourceFileProviders) {
|
||||
tool.addSourceFileProvider(fileProvider);
|
||||
}
|
||||
|
|
|
@ -100,9 +100,11 @@ public class TeaVMMavenImporter extends MavenImporter {
|
|||
|
||||
TeaVMFacet facet = facetManager.getFacetByType(facetType.getId());
|
||||
|
||||
boolean justCreated = false;
|
||||
if (facet == null) {
|
||||
facet = facetManager.createFacet(facetType, facetType.getDefaultFacetName(), null);
|
||||
facetModel.addFacet(facet);
|
||||
justCreated = true;
|
||||
}
|
||||
|
||||
TeaVMJpsConfiguration configuration = facet.getConfiguration().getState();
|
||||
|
@ -110,13 +112,14 @@ public class TeaVMMavenImporter extends MavenImporter {
|
|||
for (Element child : source.getChildren()) {
|
||||
switch (child.getName()) {
|
||||
case "sourceFilesCopied":
|
||||
configuration.setSourceFilesCopied(Boolean.parseBoolean(child.getTextTrim()));
|
||||
if (justCreated) {
|
||||
configuration.setSourceFilesCopied(true);
|
||||
}
|
||||
break;
|
||||
case "sourceMapsGenerated":
|
||||
configuration.setSourceMapsFileGenerated(Boolean.parseBoolean(child.getTextTrim()));
|
||||
break;
|
||||
case "minifying":
|
||||
configuration.setMinifying(Boolean.parseBoolean(child.getTextTrim()));
|
||||
if (justCreated) {
|
||||
configuration.setSourceMapsFileGenerated(true);
|
||||
}
|
||||
break;
|
||||
case "targetDirectory":
|
||||
configuration.setTargetDirectory(child.getTextTrim());
|
||||
|
|
|
@ -45,15 +45,11 @@ import org.teavm.idea.jps.model.TeaVMJpsConfiguration;
|
|||
class TeaVMConfigurationPanel extends JPanel {
|
||||
private final TextFieldWithBrowseButton mainClassField = new TextFieldWithBrowseButton(event -> chooseMainClass());
|
||||
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>> copySourcesField = new JComboBox<>(new DefaultComboBoxModel<>());
|
||||
private final TeaVMJpsConfiguration initialConfiguration = new TeaVMJpsConfiguration();
|
||||
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"),
|
||||
new ComboBoxItem<>(false, "Skip"));
|
||||
|
||||
|
@ -65,9 +61,6 @@ class TeaVMConfigurationPanel extends JPanel {
|
|||
mainClassField::setText, mainClassField::getText),
|
||||
new Field<>(TeaVMJpsConfiguration::setTargetDirectory, TeaVMJpsConfiguration::getTargetDirectory,
|
||||
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,
|
||||
TeaVMJpsConfiguration::isSourceMapsFileGenerated,
|
||||
value -> sourceMapsField.setSelectedIndex(value ? 0 : 1),
|
||||
|
@ -87,7 +80,6 @@ class TeaVMConfigurationPanel extends JPanel {
|
|||
targetDirectoryField.addBrowseFolderListener("Target Directory", "Please, select folder where TeaVM should"
|
||||
+ "write generated JS files", project, targetDirectoryChooserDescriptor);
|
||||
|
||||
minifiedOptions.forEach(minifyingField::addItem);
|
||||
sourceMapsOptions.forEach(sourceMapsField::addItem);
|
||||
copySourcesOptions.forEach(copySourcesField::addItem);
|
||||
}
|
||||
|
@ -126,12 +118,6 @@ class TeaVMConfigurationPanel extends JPanel {
|
|||
add(targetDirectoryField, fieldConstraints);
|
||||
|
||||
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(new JBLabel("Indicates whether TeaVM should generate source maps."), descriptionConstraints);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
]]>
|
||||
</change-notes>
|
||||
|
||||
<idea-version since-build="163.12024.16"/>
|
||||
<idea-version since-build="163.9166.7"/>
|
||||
|
||||
<application-components>
|
||||
<component>
|
||||
|
|
Loading…
Reference in New Issue
Block a user