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 2016/11/11 06:43:28 UTC

git commit: [flex-falcon] [refs/heads/develop] - generate the right kind of info() for FlexJS mustella tests

Repository: flex-falcon
Updated Branches:
  refs/heads/develop d13c18a01 -> 685f47211


generate the right kind of info() for FlexJS mustella tests


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

Branch: refs/heads/develop
Commit: 685f47211cdd10375d48bfe5611ebd520af84145
Parents: d13c18a
Author: Alex Harui <ah...@apache.org>
Authored: Thu Nov 10 22:41:43 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Nov 10 22:42:27 2016 -0800

----------------------------------------------------------------------
 .../org/apache/flex/compiler/clients/ASC.java   |  7 +++++++
 .../flex/compiler/config/Configuration.java     | 19 +++++++++++++++++++
 .../internal/config/TargetSettings.java         |  6 ++++++
 .../internal/targets/FlexAppSWFTarget.java      | 20 ++++++++++++--------
 .../internal/targets/FlexLibrarySWFTarget.java  |  4 ++--
 .../compiler/internal/targets/FlexTarget.java   |  9 +++++----
 .../flex/compiler/targets/ITargetSettings.java  |  5 +++++
 7 files changed, 56 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/685f4721/compiler/src/main/java/org/apache/flex/compiler/clients/ASC.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/clients/ASC.java b/compiler/src/main/java/org/apache/flex/compiler/clients/ASC.java
index a13c85a..d41663c 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/clients/ASC.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/clients/ASC.java
@@ -458,6 +458,13 @@ public class ASC
         }    
 
         @Override
+        public boolean getInfoFlex()
+        {
+            // Not used because ASC does handle MXML.
+            return false;
+        }    
+
+        @Override
         public boolean getAllowSubclassOverrides()
         {
             // Not used because ASC is not used in cross-compiling.

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/685f4721/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 a4e94de..0a95de3 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
@@ -2324,6 +2324,25 @@ public class Configuration
     }
 
     //
+    // 'compiler.info.flex' option
+    // used to suppress some of info() fields
+    //
+    private Boolean infoFlex = true;
+
+    public Boolean getCompilerInfoFlex()
+    {
+        return infoFlex;
+    }
+
+    @Config
+    @Mapping({ "compiler", "info", "flex" })
+    @FlexOnly
+    public void setCompilerInfoFlex(ConfigurationValue cv, Boolean asData) throws ConfigurationException
+    {
+    	infoFlex = asData;
+    }
+
+    //
     // 'compiler.allow-subclass-overrides' option
     //
     private Boolean allowSubclassOverrides = false;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/685f4721/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
index aad8301..1b2eb3a 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
@@ -575,6 +575,12 @@ public class TargetSettings implements ITargetSettings
     }
 
     @Override
+    public boolean getInfoFlex()
+    {
+        return configuration.getCompilerInfoFlex();
+    }
+
+    @Override
     public boolean getAllowSubclassOverrides()
     {
         return configuration.getCompilerMxmlChildrenAsData();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/685f4721/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
index 50cd567..d0f7f8f 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
@@ -125,6 +125,8 @@ public class FlexAppSWFTarget extends AppSWFTarget
         flexProject = project;
     }
     
+    private boolean isFlexSDKInfo = targetSettings.getInfoFlex();
+    
     private final FlexProject flexProject;
     
     public boolean isFlexInfo()
@@ -293,7 +295,7 @@ public class FlexAppSWFTarget extends AppSWFTarget
         final FlexDelegate delegate = getDelegate();
         final ASProjectScope projectScope = flexProject.getScope();
         
-        if (delegate.getGenerateSystemManagerAndFlexInit())
+        if (delegate.getGenerateSystemManagerAndFlexInit() && isFlexSDKInfo)
         {
             resolveReferenceToCompilationUnit(delegate.generateCSSStyleDeclarationsReference,
                     projectScope,
@@ -1455,7 +1457,8 @@ public class FlexAppSWFTarget extends AppSWFTarget
                         targetSettings.getRuntimeSharedLibraries(),
                         rslInfo,
                         problems,
-                        isAppFlexInfo);
+                        isAppFlexInfo,
+                        isFlexSDKInfo);
                 
             }
             else
@@ -1775,11 +1778,11 @@ public class FlexAppSWFTarget extends AppSWFTarget
             Name generatedSystemManagerName = new Name(generatedSystemManagerClassNameString);
 
             ImmutableList.Builder<Name> listOfInterfaces = new ImmutableList.Builder<Name>();
-            if (iModuleFactoryReference.resolve(flexProject) != null)
+            if (iModuleFactoryReference.resolve(flexProject) != null && isFlexSDKInfo)
             {
                 listOfInterfaces.add(iModuleFactoryReference.getMName());
             }
-            if (iSWFContextReference.resolve(flexProject) != null)
+            if (iSWFContextReference.resolve(flexProject) != null && isFlexSDKInfo)
             {
                 listOfInterfaces.add(iSWFContextReference.getMName());
             }
@@ -1793,7 +1796,7 @@ public class FlexAppSWFTarget extends AppSWFTarget
             // }
             final String compatibilityVersion = flexProject.getCompatibilityVersionString();
             final InstructionList classITraitsInit = new InstructionList();
-            if (compatibilityVersion != null && flexVersionReference.resolve(flexProject) != null)
+            if (compatibilityVersion != null && flexVersionReference.resolve(flexProject) != null && isFlexSDKInfo)
             {
                 Name flexVersionSlotName = flexVersionReference.getMName();
                 classITraitsInit.addInstruction(ABCConstants.OP_getlex, flexVersionSlotName);
@@ -1810,9 +1813,9 @@ public class FlexAppSWFTarget extends AppSWFTarget
             final FlexSplashScreenImage splashScreenImage = getSplashScreenImage();
             
             // Codegen various methods
-            if (iSWFContextReference.resolve(flexProject) != null)
+            if (iSWFContextReference.resolve(flexProject) != null && isFlexSDKInfo)
                 codegenCallInContextMethod(classGen, true);
-            codegenCreateMethod(classGen, ((DefinitionBase)mainApplicationClassDefinition).getMName(flexProject));
+            codegenCreateMethod(classGen, ((DefinitionBase)mainApplicationClassDefinition).getMName(flexProject), isFlexSDKInfo);
             codegenInfoMethod(classGen, 
                     flexProject.getCompatibilityVersion(),
                     getMainClassQName(),
@@ -1829,7 +1832,8 @@ public class FlexAppSWFTarget extends AppSWFTarget
                     targetSettings.getRuntimeSharedLibraries(),
                     rslInfo,
                     problemCollection,
-                    false);
+                    false,
+                    isFlexSDKInfo);
             
             classGen.finishScript();
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/685f4721/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
index 2f9a996..655786e 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
@@ -403,7 +403,7 @@ public final class FlexLibrarySWFTarget extends LibrarySWFTarget
             // Override the create() and info() methods if we have embedded fonts.
             if (!frame1Info.embeddedFonts.isEmpty())
             {
-                codegenCreateMethod(classGen, objectReference.getMName());
+                codegenCreateMethod(classGen, objectReference.getMName(), true);
                 codegenInfoMethod(classGen, 
                         IASLanguageConstants.Object,
                         frame1Info,
@@ -461,7 +461,7 @@ public final class FlexLibrarySWFTarget extends LibrarySWFTarget
                     null, // rsls
                     null, // rslinof
                     problemCollection,
-                    false);
+                    false, false);
             
         }
         

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/685f4721/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexTarget.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexTarget.java b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexTarget.java
index 4809d09..0e3351b 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexTarget.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexTarget.java
@@ -161,7 +161,7 @@ public abstract class FlexTarget
      * application class at runtme. May not be null but a library.swf for a SWC
      * may pass in a {@link Name} that resolves to "Object" at runtime.
      */
-    protected final void codegenCreateMethod(ClassGeneratorHelper classGen, Name mainApplicationName)
+    protected final void codegenCreateMethod(ClassGeneratorHelper classGen, Name mainApplicationName, boolean isFlexSDKInfo)
     {
         IResolvedQualifiersReference applyReference = ReferenceFactory.resolvedQualifierQualifiedReference(flexProject.getWorkspace(), 
                 NamespaceDefinition.getAS3NamespaceDefinition(), "apply");
@@ -169,7 +169,7 @@ public abstract class FlexTarget
                 ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(), IASLanguageConstants.getDefinitionByName);
         IResolvedQualifiersReference iFlexModule =
                 ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(), IMXMLTypeConstants.IFlexModule);
-        boolean codegenIFlexModule = iFlexModule.resolve(flexProject) != null;
+        boolean codegenIFlexModule = iFlexModule.resolve(flexProject) != null && isFlexSDKInfo;
         Name getDefinitionByName = getDefinitionByNameReference.getMName();
         InstructionList create = new InstructionList();
         create.addInstruction(ABCConstants.OP_getlocal1);
@@ -275,7 +275,8 @@ public abstract class FlexTarget
             List<String> rsls,
             FlexRSLInfo rslInfo,
             Collection<ICompilerProblem> problemCollection,
-            boolean isAppFlexInfo) 
+            boolean isAppFlexInfo,
+            boolean isFlexSDKInfo) 
             throws InterruptedException
     {
         IResolvedQualifiersReference applicationDomainRef = ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(),
@@ -347,7 +348,7 @@ public abstract class FlexTarget
             infoEntries++;
         }
 
-        if (!isAppFlexInfo)
+        if (!isAppFlexInfo && isFlexSDKInfo)
         {
             // preloader:
             if (preloaderReference != null && preloaderReference.resolve(flexProject) != null)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/685f4721/compiler/src/main/java/org/apache/flex/compiler/targets/ITargetSettings.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/targets/ITargetSettings.java b/compiler/src/main/java/org/apache/flex/compiler/targets/ITargetSettings.java
index a27eb38..8d90f31 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/targets/ITargetSettings.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/targets/ITargetSettings.java
@@ -470,6 +470,11 @@ public interface ITargetSettings
     boolean getMxmlChildrenAsData();
     
     /**
+     * @return true if the info() structure should contain fields needed by FlexSDK only (and not FlexJS).
+     */
+    boolean getInfoFlex();
+    
+    /**
      * @return true if the return type of an override can be a subclass instead
      * of an exact match as the base class' return type
      */