diff --git a/tools/idea/jps-common/src/main/java/org/teavm/idea/jps/model/TeaVMJpsConfiguration.java b/tools/idea/jps-common/src/main/java/org/teavm/idea/jps/model/TeaVMJpsConfiguration.java index 407e8cc11..ba71bb0ea 100644 --- a/tools/idea/jps-common/src/main/java/org/teavm/idea/jps/model/TeaVMJpsConfiguration.java +++ b/tools/idea/jps-common/src/main/java/org/teavm/idea/jps/model/TeaVMJpsConfiguration.java @@ -39,12 +39,21 @@ public class TeaVMJpsConfiguration extends JpsElementBase @Transient private TeaVMTargetType targetType; + private boolean skipped; private String mainClass; private String targetDirectory; private boolean sourceMapsFileGenerated = true; private boolean sourceFilesCopied = true; private List properties = new ArrayList<>(); + public boolean isSkipped() { + return skipped; + } + + public void setSkipped(boolean skipped) { + this.skipped = skipped; + } + public TeaVMTargetType getTargetType() { return targetType; } diff --git a/tools/idea/jps-plugin/src/main/java/org/teavm/idea/jps/TeaVMBuild.java b/tools/idea/jps-plugin/src/main/java/org/teavm/idea/jps/TeaVMBuild.java index dd63a7119..d4f76300c 100644 --- a/tools/idea/jps-plugin/src/main/java/org/teavm/idea/jps/TeaVMBuild.java +++ b/tools/idea/jps-plugin/src/main/java/org/teavm/idea/jps/TeaVMBuild.java @@ -96,6 +96,11 @@ class TeaVMBuild { storage = context.getProjectDescriptor().dataManager.getStorage(target, storageProvider); TeaVMJpsConfiguration config = target.getConfiguration(); + if (config.isSkipped()) { + context.processMessage(new CompilerMessage("TeaVM", BuildMessage.Kind.INFO, + "TeaVM skipped due to facet configuration")); + return false; + } classPathEntries.clear(); buildStrategy.init(); diff --git a/tools/idea/plugin/src/main/java/org/teavm/idea/ui/TeaVMConfigurationPanel.java b/tools/idea/plugin/src/main/java/org/teavm/idea/ui/TeaVMConfigurationPanel.java index 108ab053c..3edb5f4ad 100644 --- a/tools/idea/plugin/src/main/java/org/teavm/idea/ui/TeaVMConfigurationPanel.java +++ b/tools/idea/plugin/src/main/java/org/teavm/idea/ui/TeaVMConfigurationPanel.java @@ -52,6 +52,7 @@ import org.teavm.idea.jps.model.TeaVMJpsConfiguration; import org.teavm.idea.jps.model.TeaVMProperty; class TeaVMConfigurationPanel extends JPanel { + private final JComboBox> skipField = new JComboBox<>(new DefaultComboBoxModel<>()); private final TextFieldWithBrowseButton mainClassField = new TextFieldWithBrowseButton(event -> chooseMainClass()); private final TextFieldWithBrowseButton targetDirectoryField = new TextFieldWithBrowseButton(); private final JComboBox> sourceMapsField = new JComboBox<>(new DefaultComboBoxModel<>()); @@ -67,7 +68,13 @@ class TeaVMConfigurationPanel extends JPanel { private final List> copySourcesOptions = Arrays.asList(new ComboBoxItem<>(true, "Copy"), new ComboBoxItem<>(false, "Skip")); + private final List> skipOptions = Arrays.asList(new ComboBoxItem<>(true, "Skip"), + new ComboBoxItem<>(false, "Don't skip")); + private final List> fields = Arrays.asList( + new Field<>(TeaVMJpsConfiguration::setSkipped, TeaVMJpsConfiguration::isSkipped, + value -> skipField.setSelectedIndex(value ? 0 : 1), + () -> skipOptions.get(skipField.getSelectedIndex()).value), new Field<>(TeaVMJpsConfiguration::setMainClass, TeaVMJpsConfiguration::getMainClass, mainClassField::setText, mainClassField::getText), new Field<>(TeaVMJpsConfiguration::setTargetDirectory, TeaVMJpsConfiguration::getTargetDirectory, @@ -94,6 +101,7 @@ class TeaVMConfigurationPanel extends JPanel { sourceMapsOptions.forEach(sourceMapsField::addItem); copySourcesOptions.forEach(copySourcesField::addItem); + skipOptions.forEach(skipField::addItem); } private void setupLayout() { @@ -123,6 +131,9 @@ class TeaVMConfigurationPanel extends JPanel { fieldConstraints.insets.left = 10; fieldConstraints.insets.right = 10; + add(bold(new JBLabel("Skip TeaVM compilation")), labelConstraints); + add(skipField, fieldConstraints); + add(bold(new JBLabel("Main class")), labelConstraints); add(mainClassField, fieldConstraints);