http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e96ef0b7/compiler/src/org/apache/flex/compiler/config/Configurator.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/config/Configurator.java b/compiler/src/org/apache/flex/compiler/config/Configurator.java index 30543e7..55d23ff 100644 --- a/compiler/src/org/apache/flex/compiler/config/Configurator.java +++ b/compiler/src/org/apache/flex/compiler/config/Configurator.java @@ -20,17 +20,7 @@ package org.apache.flex.compiler.config; import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; +import java.util.*; import org.apache.flex.compiler.clients.MXMLC; import org.apache.flex.compiler.common.IPathResolver; @@ -906,7 +896,7 @@ public class Configurator implements ICompilerSettings, IConfigurator, ICompiler * * @return true if successful, false otherwise. */ - protected boolean processConfiguration(String[] argsArray) + protected boolean processConfiguration(String[] argsArray) { initializeConfiguration(); @@ -1956,12 +1946,34 @@ public class Configurator implements ICompilerSettings, IConfigurator, ICompiler @Override public void setExternalLibraryPath(Collection<File> paths) { + removeNativeJSLibrariesIfNeeded(paths); + args.put(COMPILER_EXTERNAL_LIBRARY_PATH, paths); more.remove(COMPILER_EXTERNAL_LIBRARY_PATH); isConfigurationDirty = true; } + private void removeNativeJSLibrariesIfNeeded(Collection<File> paths) { + Iterator<File> fileIterator = paths.iterator(); + + while (fileIterator.hasNext()) { + final File file = fileIterator.next(); + final boolean isNativeJS = file.getAbsolutePath().contains("js/libs"); + boolean excludeNativeJS = false; + + try { + excludeNativeJS = cfgbuf.peekSimpleConfigurationVar("exclude-native-js-libraries").equals(Boolean.TRUE.toString()); + } catch (ConfigurationException e) { + e.printStackTrace(); + } + + if (isNativeJS && excludeNativeJS) { + fileIterator.remove(); + } + } + } + /** * Adds to the existing list of SWC files. * @@ -1971,6 +1983,8 @@ public class Configurator implements ICompilerSettings, IConfigurator, ICompiler @Override public void addExternalLibraryPath(Collection<File> paths) { + removeNativeJSLibrariesIfNeeded(paths); + addFiles(COMPILER_EXTERNAL_LIBRARY_PATH, paths); isConfigurationDirty = true; @@ -2151,6 +2165,8 @@ public class Configurator implements ICompilerSettings, IConfigurator, ICompiler @Override public void setLibraryPath(Collection<File> paths) { + removeNativeJSLibrariesIfNeeded(paths); + args.put(COMPILER_LIBRARY_PATH, paths); more.remove(COMPILER_LIBRARY_PATH); @@ -2165,6 +2181,8 @@ public class Configurator implements ICompilerSettings, IConfigurator, ICompiler */ public void addLibraryPath(Collection<File> paths) { + removeNativeJSLibrariesIfNeeded(paths); + addFiles(COMPILER_LIBRARY_PATH, paths); isConfigurationDirty = true; @@ -3424,6 +3442,12 @@ public class Configurator implements ICompilerSettings, IConfigurator, ICompiler isConfigurationDirty = true; } + @Override + public void setExcludeNativeJSLibraries(boolean value) + { + args.put(EXCLUDE_NATIVE_JS_LIBRARIES, value ? Boolean.TRUE : Boolean.TRUE); + } + // // End of Configuration settings. //
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e96ef0b7/compiler/src/org/apache/flex/compiler/config/ICompilerSettingsConstants.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/config/ICompilerSettingsConstants.java b/compiler/src/org/apache/flex/compiler/config/ICompilerSettingsConstants.java index 92c4168..c9fe803 100644 --- a/compiler/src/org/apache/flex/compiler/config/ICompilerSettingsConstants.java +++ b/compiler/src/org/apache/flex/compiler/config/ICompilerSettingsConstants.java @@ -141,7 +141,8 @@ public interface ICompilerSettingsConstants static final String INCLUDE_NAMESPACES = "--include-namespaces"; static final String INCLUDE_SOURCES = "--include-sources"; static final String INCLUDE_STYLESHEET = "--include-stylesheet"; - + static final String EXCLUDE_NATIVE_JS_LIBRARIES = "--exclude-native-js-libraries"; + // Setting options without the "--" separator. // These are used to set and get vars from the ConfigurationBuffer. static final String DUMP_CONFIG_VAR = "dump-config"; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e96ef0b7/compiler/src/org/apache/flex/compiler/internal/config/IWriteOnlyProjectSettings.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/internal/config/IWriteOnlyProjectSettings.java b/compiler/src/org/apache/flex/compiler/internal/config/IWriteOnlyProjectSettings.java index a5319fc..9a9d7f6 100644 --- a/compiler/src/org/apache/flex/compiler/internal/config/IWriteOnlyProjectSettings.java +++ b/compiler/src/org/apache/flex/compiler/internal/config/IWriteOnlyProjectSettings.java @@ -133,4 +133,12 @@ public interface IWriteOnlyProjectSettings * @param value true to turn on Flex behaviors, false otherwise. */ void setFlex(boolean value); + + /** + * Option to remove the Native JS libraries from external-library-path + * and library-path as they shouldn't be any when compiling SWFs / SWCs. + * + * @param value true to turn on the behaviors, false otherwise. + */ + void setExcludeNativeJSLibraries(boolean value); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e96ef0b7/compiler/src/org/apache/flex/compiler/internal/projects/FlexProject.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/internal/projects/FlexProject.java b/compiler/src/org/apache/flex/compiler/internal/projects/FlexProject.java index a6b5761..7e37de9 100644 --- a/compiler/src/org/apache/flex/compiler/internal/projects/FlexProject.java +++ b/compiler/src/org/apache/flex/compiler/internal/projects/FlexProject.java @@ -2072,4 +2072,9 @@ public class FlexProject extends ASProject implements IFlexProject { this.isFlex = value; } + + @Override + public void setExcludeNativeJSLibraries(final boolean value) { + + } }
