You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2017/05/01 03:47:56 UTC

[30/38] git commit: [flex-falcon] [refs/heads/develop] - allow library-path to contain js swcs by adding swf-library-path for SWF SWCs

allow library-path to contain js swcs by adding swf-library-path for SWF SWCs


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/78bc6c04
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/78bc6c04
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/78bc6c04

Branch: refs/heads/develop
Commit: 78bc6c043d927b0029cf8125b3858108ab87b409
Parents: a940299
Author: Alex Harui <ah...@apache.org>
Authored: Sun Mar 5 23:33:59 2017 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Mar 5 23:33:59 2017 -0800

----------------------------------------------------------------------
 .../flex/compiler/config/Configuration.java     | 72 ++++++++++++++++++++
 .../compiler/internal/projects/FlexProject.java |  6 ++
 2 files changed, 78 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/78bc6c04/compiler/src/main/java/org/apache/flex/compiler/config/Configuration.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/config/Configuration.java b/compiler/src/main/java/org/apache/flex/compiler/config/Configuration.java
index 6e77b97..fc356ec 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/config/Configuration.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/config/Configuration.java
@@ -2041,6 +2041,37 @@ public class Configuration
     }
 
     //
+    // 'compiler.swf-external-library-path' option
+    //
+
+    private final List<String> swfExternalLibraryPath = new ArrayList<String>();
+
+    public List<String> getCompilerSwfExternalLibraryPath()
+    {
+        return swfExternalLibraryPath;
+    }
+
+    @Config(allowMultiple = true, isPath = true)
+    @Mapping({ "compiler", "swf-external-library-path" })
+    @Arguments(Arguments.PATH_ELEMENT)
+    @SoftPrerequisites({ "target-player", "exclude-native-js-libraries" })
+    @InfiniteArguments
+    public void setCompilerSwfExternalLibraryPath(ConfigurationValue cv, String[] pathlist) throws ConfigurationException
+    {
+        pathlist = removeNativeJSLibrariesIfNeeded(pathlist);
+
+        final ImmutableList<String> pathElements = ImmutableList.copyOf(pathlist);
+        final ImmutableList<String> resolvedPaths = expandTokens(pathElements, locales, cv,
+                !reportMissingCompilerLibraries);
+        swfExternalLibraryPath.addAll(resolvedPaths);
+
+        // TODO: Review usages of "compilingForAIR", because only looking at path elements
+        // on library path isn't enough. There might be a folder on the library path that
+        // contains AIR libraries.
+        compilingForAIR = containsAIRLibraries(pathElements);
+    }
+    
+    //
     // 'compiler.generated-directory' option
     // This can only be configured using getter and setter.
     //
@@ -2261,6 +2292,47 @@ public class Configuration
     }
 
     //
+    // 'compiler.swf-library-path' option
+    //
+
+    private final List<String> swfLibraryPath = new ArrayList<String>();
+    protected boolean reportMissingCompilerSwfLibraries = true;
+
+    /**
+     * Sets whether to report missing libraries in the configuration. If this is false any missing libraries will not be
+     * warned about, and the filename will also be added to list of libraries in the project when it doesn't exist. If
+     * reportMissingCompilerLibraries is true, any missing libraries will not be added to the project.
+     * 
+     * @param reportMissingCompilerLibraries true to report missing libraries
+     */
+    public void setReportMissingCompilerSwfLibraries(boolean reportMissingCompilerLibraries)
+    {
+        this.reportMissingCompilerLibraries = reportMissingCompilerLibraries;
+    }
+
+    public List<String> getCompilerSwfLibraryPath()
+    {
+        return swfLibraryPath;
+    }
+
+    /**
+     * Links SWC files to the resulting application SWF file. The compiler only links in those classes for the SWC file
+     * that are required. You can specify a directory or individual SWC files.
+     */
+    @Config(allowMultiple = true, isPath = true)
+    @Mapping({ "compiler", "swf-library-path" })
+    @Arguments(Arguments.PATH_ELEMENT)
+    @InfiniteArguments
+    @SoftPrerequisites({ "locale", "target-player", "exclude-native-js-libraries" })
+    public void setCompilerSwfLibraryPath(ConfigurationValue cv, String[] pathlist) throws CannotOpen
+    {
+        pathlist = removeNativeJSLibrariesIfNeeded(pathlist);
+        final ImmutableList<String> resolvedPaths = expandTokens(Arrays.asList(pathlist), locales, cv,
+                !reportMissingCompilerLibraries);
+        swfLibraryPath.addAll(resolvedPaths);
+    }
+
+    //
     // 'compiler.locale' option
     //
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/78bc6c04/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java b/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
index 7a29c35..c2d58c4 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
@@ -2339,6 +2339,9 @@ public class FlexProject extends ASProject implements IFlexProject
      */
     public List<String> getCompilerExternalLibraryPath(Configuration config)
     {
+    	List<String> list = config.getCompilerSwfExternalLibraryPath();
+    	if (list != null && list.size() > 0)
+    		return list;
     	return config.getCompilerExternalLibraryPath();
     }
 
@@ -2347,6 +2350,9 @@ public class FlexProject extends ASProject implements IFlexProject
      */
     public List<String> getCompilerLibraryPath(Configuration config)
     {
+    	List<String> list = config.getCompilerSwfLibraryPath();
+    	if (list != null && list.size() > 0)
+    		return list;
     	return config.getCompilerLibraryPath();
     }