Search in sources :

Example 1 with ModuleOrProjectCompilerOptions

use of com.intellij.lang.javascript.flex.projectStructure.model.ModuleOrProjectCompilerOptions in project intellij-plugins by JetBrains.

the class FlexHighlightingTest method testConditionalCompilationDefinitions.

@JSTestOptions({ JSTestOption.WithFlexFacet })
public void testConditionalCompilationDefinitions() throws Exception {
    final String testName = getTestName(false);
    FlexTestUtils.modifyBuildConfiguration(myModule, bc -> {
        bc.getCompilerOptions().setAdditionalConfigFilePath(getTestDataPath() + "/" + getBasePath() + "/" + testName + "_custom_config.xml");
        bc.getCompilerOptions().setAdditionalOptions("-some_path=\"with space\" -define=CONFIG::Object,'string_value' -define+=CONFIG::defined2,true -define CONFIG::defined3 -1");
        bc.getCompilerOptions().setAllOptions(Collections.singletonMap("compiler.define", "CONFIG::defined4\tfalse\nCONFIG::defined5\t"));
    });
    final ModuleOrProjectCompilerOptions projectLevelOptions = FlexProjectLevelCompilerOptionsHolder.getInstance(myProject).getProjectLevelCompilerOptions();
    final ModuleOrProjectCompilerOptions moduleLevelOptions = FlexBuildConfigurationManager.getInstance(myModule).getModuleLevelCompilerOptions();
    moduleLevelOptions.setAdditionalOptions("-define=CONFIG::defined6,true");
    projectLevelOptions.setAdditionalOptions("-define=CONFIG::defined7,true -debug");
    moduleLevelOptions.setAllOptions(Collections.singletonMap("compiler.define", "CONFIG::not_defined1\tfalse"));
    projectLevelOptions.setAllOptions(Collections.singletonMap("compiler.define", "CONFIG::not_defined2\tfalse"));
    doTestFor(true, testName + ".mxml");
}
Also used : ModuleOrProjectCompilerOptions(com.intellij.lang.javascript.flex.projectStructure.model.ModuleOrProjectCompilerOptions)

Example 2 with ModuleOrProjectCompilerOptions

use of com.intellij.lang.javascript.flex.projectStructure.model.ModuleOrProjectCompilerOptions in project intellij-plugins by JetBrains.

the class JSConditionalCompilationDefinitionsProviderImpl method processConditionalCompilationDefinitions.

private void processConditionalCompilationDefinitions(final Module module, final Processor<Pair<String, String>> processor) {
    final FlexBuildConfigurationManager manager = FlexBuildConfigurationManager.getInstance(module);
    final FlexBuildConfiguration bc = manager.getActiveConfiguration();
    final ModuleOrProjectCompilerOptions moduleLevelOptions = manager.getModuleLevelCompilerOptions();
    final ModuleOrProjectCompilerOptions projectLevelOptions = FlexProjectLevelCompilerOptionsHolder.getInstance(module.getProject()).getProjectLevelCompilerOptions();
    if (!FlexUtils.processCompilerOption(module, bc, "compiler.define", processor))
        return;
    if (!processDefinitionsFromCompilerOptions(projectLevelOptions.getAdditionalOptions(), processor))
        return;
    if (!processDefinitionsFromCompilerOptions(moduleLevelOptions.getAdditionalOptions(), processor))
        return;
    if (!processDefinitionsFromCompilerOptions(bc.getCompilerOptions().getAdditionalOptions(), processor))
        return;
    for (Pair<String, String> nameAndValue : getDefinitionsFromConfigFile(bc.getCompilerOptions().getAdditionalConfigFilePath())) {
        if (!processor.process(nameAndValue))
            return;
    }
}
Also used : ModuleOrProjectCompilerOptions(com.intellij.lang.javascript.flex.projectStructure.model.ModuleOrProjectCompilerOptions) FlexBuildConfigurationManager(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)

Aggregations

ModuleOrProjectCompilerOptions (com.intellij.lang.javascript.flex.projectStructure.model.ModuleOrProjectCompilerOptions)2 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)1 FlexBuildConfigurationManager (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager)1