flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [2/4] git commit: Allow MXML imports to be specified in flex-config.xml
Date Fri, 29 Mar 2013 22:21:23 GMT
Allow MXML imports to be specified in flex-config.xml


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

Branch: refs/heads/develop
Commit: b3e9a326556a5c7b9e72c8a3e54670c831413dfd
Parents: a5b691a
Author: Alex Harui <aharui@apache.org>
Authored: Fri Mar 29 15:19:43 2013 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Mar 29 15:21:08 2013 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/compiler/clients/ASC.java  |    7 +++++
 .../apache/flex/compiler/config/Configuration.java |   20 +++++++++++++++
 .../apache/flex/compiler/config/Configurator.java  |    2 +-
 .../compiler/internal/config/FileConfigurator.java |    3 +-
 .../compiler/internal/config/TargetSettings.java   |    9 ++++++
 .../internal/projects/FlexProjectConfigurator.java |   20 +++++++++------
 .../flex/compiler/targets/ITargetSettings.java     |    5 +++
 7 files changed, 56 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3e9a326/compiler/src/org/apache/flex/compiler/clients/ASC.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/clients/ASC.java b/compiler/src/org/apache/flex/compiler/clients/ASC.java
index 75d3847..fbb0f7d 100644
--- a/compiler/src/org/apache/flex/compiler/clients/ASC.java
+++ b/compiler/src/org/apache/flex/compiler/clients/ASC.java
@@ -446,6 +446,13 @@ public class ASC
         }    
 
         @Override
+        public String[] getMxmlImplicitImports()
+        {
+            // Not used because ASC does not create SWCs.
+            return null;
+        }    
+
+        @Override
         public boolean getRemoveDeadCode()
         {
             return removeDeadCode;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3e9a326/compiler/src/org/apache/flex/compiler/config/Configuration.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/config/Configuration.java b/compiler/src/org/apache/flex/compiler/config/Configuration.java
index 1069d89..362fbd7 100644
--- a/compiler/src/org/apache/flex/compiler/config/Configuration.java
+++ b/compiler/src/org/apache/flex/compiler/config/Configuration.java
@@ -2113,6 +2113,26 @@ public class Configuration
     }
 
     //
+    // 'compiler.mxml.implicitImports' option
+    //
+    private String[] implicitImports;
+    
+    public String[] getCompilerMxmlImplicitImports()
+    {
+        return implicitImports;
+    }
+
+    @Config(allowMultiple = true)
+    @Mapping({"compiler", "mxml", "imports"})
+    @Arguments("implicit-import")
+    @InfiniteArguments
+    @FlexOnly
+    public void setCompilerMxmlImplicitImports(ConfigurationValue cv, String[] imports) throws
ConfigurationException
+    {
+        implicitImports = imports;
+    }
+
+    //
     // 'compiler.mxml.compatibility-version' option
     //
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3e9a326/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 b5d83e0..3ce223f 100644
--- a/compiler/src/org/apache/flex/compiler/config/Configurator.java
+++ b/compiler/src/org/apache/flex/compiler/config/Configurator.java
@@ -333,7 +333,7 @@ public class Configurator implements ICompilerSettings, IConfigurator,
ICompiler
             {
                 FlexProject flexProject = (FlexProject)project;
     
-                FlexProjectConfigurator.configure(flexProject);
+                FlexProjectConfigurator.configure(flexProject, configuration);
                 setupCompatibilityVersion(flexProject);
                 setupConfigVariables(flexProject);
                 setupLocaleSettings(flexProject);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3e9a326/compiler/src/org/apache/flex/compiler/internal/config/FileConfigurator.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/config/FileConfigurator.java b/compiler/src/org/apache/flex/compiler/internal/config/FileConfigurator.java
index e673479..89e015f 100644
--- a/compiler/src/org/apache/flex/compiler/internal/config/FileConfigurator.java
+++ b/compiler/src/org/apache/flex/compiler/internal/config/FileConfigurator.java
@@ -240,7 +240,7 @@ public class FileConfigurator
                     contextStack.push(newctx);
                     return;
                 }
-                System.err.println("Unknown:" + fullname);
+                System.err.println("Unknown tag:" + fullname);
                 throw new SAXConfigurationException(
                         new ConfigurationException.UnknownVariable(
                                                     fullname, source, locator.getLineNumber()),
@@ -459,6 +459,7 @@ public class FileConfigurator
             "compiler.fonts",
             "compiler.fonts.languages",
             "compiler.mxml",
+            "compiler.mxml.imports",
             "metadata",
             "licenses",
             "frames",

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3e9a326/compiler/src/org/apache/flex/compiler/internal/config/TargetSettings.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/config/TargetSettings.java b/compiler/src/org/apache/flex/compiler/internal/config/TargetSettings.java
index 61776d0..aef9e94 100644
--- a/compiler/src/org/apache/flex/compiler/internal/config/TargetSettings.java
+++ b/compiler/src/org/apache/flex/compiler/internal/config/TargetSettings.java
@@ -270,6 +270,15 @@ public class TargetSettings implements ITargetSettings
     }
 
     /**
+     * @return the implicitImports for MXML
+     */
+    @Override
+    public String[] getMxmlImplicitImports()
+    {
+        return configuration.getCompilerMxmlImplicitImports();
+    }
+
+    /**
      * @return the includes
      */
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3e9a326/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
b/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
index b9e09d8..cd2a657 100644
--- a/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
+++ b/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
@@ -24,6 +24,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 
+import org.apache.flex.compiler.config.Configuration;
 import org.apache.flex.compiler.mxml.IMXMLTypeConstants;
 
 /**
@@ -83,8 +84,6 @@ public class FlexProjectConfigurator
     
     private static final Map<String, Integer> NAMED_COLORS = new HashMap<String,
Integer>();
     
-    public static final Collection<String> IMPLICITLY_KEPT_METADATA = new HashSet<String>();
-
     static
     {
         NAMED_COLORS.put("aqua", 0x00FFFF);
@@ -111,16 +110,21 @@ public class FlexProjectConfigurator
         NAMED_COLORS.put("haloOrange", 0xFFB600);
         NAMED_COLORS.put("haloSilver", 0xAECAD9);
         
-        IMPLICITLY_KEPT_METADATA.add("Bindable");
-        IMPLICITLY_KEPT_METADATA.add("Managed");
-        IMPLICITLY_KEPT_METADATA.add("ChangeEvent");
-        IMPLICITLY_KEPT_METADATA.add("NonCommittingChangeEvent");
-        IMPLICITLY_KEPT_METADATA.add("Transient");
     }
 
     public static void configure(FlexProject project)
     {
-        project.setImplicitImportsForMXML(IMPLICIT_IMPORTS_FOR_MXML);
+        configure(project, null);
+    }
+    
+    public static void configure(FlexProject project, Configuration configuration)
+    {
+        String[] imports = null;
+        if (configuration != null)
+            imports = configuration.getCompilerMxmlImplicitImports();
+        if (imports == null)
+            imports = IMPLICIT_IMPORTS_FOR_MXML;
+        project.setImplicitImportsForMXML(imports);
         
         // Set the qualified names of various runtime types
         // that the compiler needs to know about.

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3e9a326/compiler/src/org/apache/flex/compiler/targets/ITargetSettings.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/targets/ITargetSettings.java b/compiler/src/org/apache/flex/compiler/targets/ITargetSettings.java
index a3f179d..61cc611 100644
--- a/compiler/src/org/apache/flex/compiler/targets/ITargetSettings.java
+++ b/compiler/src/org/apache/flex/compiler/targets/ITargetSettings.java
@@ -461,6 +461,11 @@ public interface ITargetSettings
      * optimization step is enabled.
      */
     boolean getRemoveDeadCode();
+
+    /**
+     * @return
+     */
+    String[] getMxmlImplicitImports();
     
 }
 


Mime
View raw message