You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jo...@apache.org on 2015/06/27 00:30:09 UTC

[1/2] git commit: [flex-falcon] [refs/heads/develop] - added -external-externs argument to externc to add externs that are parsed but don't get emitted

Repository: flex-falcon
Updated Branches:
  refs/heads/develop 6c98a0ac3 -> 500ad4e4a


added -external-externs argument to externc to add externs that are parsed but don't get emitted


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

Branch: refs/heads/develop
Commit: 0d67006e2524738068eb498011f3a0dd586e5f60
Parents: d77028a
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Jun 26 15:25:49 2015 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Jun 26 15:25:49 2015 -0700

----------------------------------------------------------------------
 .../compiler/clients/ExternCConfiguration.java  | 42 ++++++++++++++++++++
 .../externals/emit/ReferenceEmitter.java        | 15 +++++++
 .../externals/pass/ReferenceCompiler.java       |  6 +++
 3 files changed, 63 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0d67006e/compiler.jx/src/org/apache/flex/compiler/clients/ExternCConfiguration.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/clients/ExternCConfiguration.java b/compiler.jx/src/org/apache/flex/compiler/clients/ExternCConfiguration.java
index 1710958..6dbf4ac 100644
--- a/compiler.jx/src/org/apache/flex/compiler/clients/ExternCConfiguration.java
+++ b/compiler.jx/src/org/apache/flex/compiler/clients/ExternCConfiguration.java
@@ -30,6 +30,7 @@ import org.apache.flex.compiler.config.ConfigurationValue;
 import org.apache.flex.compiler.exceptions.ConfigurationException.CannotOpen;
 import org.apache.flex.compiler.exceptions.ConfigurationException.IncorrectArgumentCount;
 import org.apache.flex.compiler.internal.codegen.externals.pass.ReferenceCompiler.ExternalFile;
+import org.apache.flex.compiler.internal.codegen.externals.reference.BaseReference;
 import org.apache.flex.compiler.internal.codegen.externals.reference.ClassReference;
 import org.apache.flex.compiler.internal.codegen.externals.reference.FieldReference;
 import org.apache.flex.compiler.internal.codegen.externals.reference.MemberReference;
@@ -50,6 +51,7 @@ public class ExternCConfiguration extends Configuration
     private File asTypeDefRoot;
 
     private List<ExternalFile> externals = new ArrayList<ExternalFile>();
+    private List<ExternalFile> externalExterns = new ArrayList<ExternalFile>();
 
     private List<String> classToFunctions = new ArrayList<String>();
     private List<ExcludedMemeber> excludesClass = new ArrayList<ExcludedMemeber>();
@@ -113,6 +115,11 @@ public class ExternCConfiguration extends Configuration
         return externals;
     }
 
+    public Collection<ExternalFile> getExternalExterns()
+    {
+        return externalExterns;
+    }
+
     public boolean isClassToFunctions(String className)
     {
         return classToFunctions.contains(className);
@@ -135,6 +142,18 @@ public class ExternCConfiguration extends Configuration
         addExternal(new File(FilenameNormalization.normalize(externalFile)));
     }
 
+    public void addExternalExtern(File file) throws IOException
+    {
+        if (!file.exists())
+            throw new IOException(file.getAbsolutePath() + " does not exist.");
+        externalExterns.add(new ExternalFile(file));
+    }
+
+    public void addExternalExtern(String externalFile) throws IOException
+    {
+        addExternalExtern(new File(FilenameNormalization.normalize(externalFile)));
+    }
+
     @Config(allowMultiple = true)
     @Mapping("class-to-function")
     @Arguments(Arguments.CLASS)
@@ -152,6 +171,29 @@ public class ExternCConfiguration extends Configuration
     	for (String val : vals)
     		addExternal(resolvePathStrict(val, cfgval));
     }
+
+    @Config(allowMultiple = true, isPath = true)
+    @Mapping("external-externs")
+    @Arguments(Arguments.PATH_ELEMENT)
+    @InfiniteArguments
+    public void setExternalExterns(ConfigurationValue cfgval, String[] vals) throws IOException, CannotOpen
+    {
+        for (String val : vals)
+            addExternalExtern(resolvePathStrict(val, cfgval));
+    }
+    
+    public boolean isExternalExtern(BaseReference reference)
+    {
+        String sourceFileName = reference.getNode().getSourceFileName();
+        for (ExternalFile file : externalExterns)
+        {
+            if (sourceFileName.equals("[" + file.getName() + "]"))
+            {
+                return true;
+            }
+        }
+        return false;
+    }
     
     public ExcludedMemeber isExcludedClass(ClassReference classReference)
     {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0d67006e/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/emit/ReferenceEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/emit/ReferenceEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/emit/ReferenceEmitter.java
index 047b044..36d7827 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/emit/ReferenceEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/emit/ReferenceEmitter.java
@@ -62,6 +62,9 @@ public class ReferenceEmitter
             if (!reference.isInterface())
                 continue;
 
+            if (model.getConfiguration().isExternalExtern(reference))
+                continue;
+
             emit(reference, sb);
 
             File sourceFile = reference.getFile(model.getConfiguration().getAsInterfaceRoot());
@@ -82,6 +85,9 @@ public class ReferenceEmitter
             if (reference.isInterface())
                 continue;
 
+            if (model.getConfiguration().isExternalExtern(reference))
+                continue;
+            
             emit(reference, sb);
 
             File sourceFile = reference.getFile(model.getConfiguration().getAsClassRoot());
@@ -100,6 +106,9 @@ public class ReferenceEmitter
             if (model.isExcludedClass(reference) != null)
                 continue;
 
+            if (model.getConfiguration().isExternalExtern(reference))
+                continue;
+
             emit(reference, sb);
 
             File sourceFile = reference.getFile(model.getConfiguration().getAsTypeDefRoot());
@@ -114,6 +123,9 @@ public class ReferenceEmitter
         final StringBuilder sb = new StringBuilder();
         for (FunctionReference reference : model.getFunctions())
         {
+            if (model.getConfiguration().isExternalExtern(reference))
+                continue;
+            
             emit(reference, sb);
 
             File sourceFile = reference.getFile(model.getConfiguration().getAsFunctionRoot());
@@ -128,6 +140,9 @@ public class ReferenceEmitter
         final StringBuilder sb = new StringBuilder();
         for (ConstantReference reference : model.getConstants())
         {
+            if (model.getConfiguration().isExternalExtern(reference))
+                continue;
+            
             emit(reference, sb);
 
             File sourceFile = reference.getFile(model.getConfiguration().getAsConstantRoot());

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0d67006e/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
index c50fab0..ab47767 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
@@ -97,6 +97,12 @@ public class ReferenceCompiler
             String source = FileUtils.readFileToString(externalFile.getFile());
             sources.add(SourceFile.fromCode("[" + name + "]", source));
         }
+        for (ExternalFile externalFile : model.getConfiguration().getExternalExterns())
+        {
+            String name = externalFile.getName();
+            String source = FileUtils.readFileToString(externalFile.getFile());
+            sources.add(SourceFile.fromCode("[" + name + "]", source));
+        }
 
         Result result = jscompiler.compile(EMPTY_EXTERNS, sources, options);
         if (!result.success)


[2/2] git commit: [flex-falcon] [refs/heads/develop] - Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-falcon into develop

Posted by jo...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-falcon into develop


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

Branch: refs/heads/develop
Commit: 500ad4e4a0e3a0784280f8f45790478ae54ebd2f
Parents: 0d67006 6c98a0a
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Jun 26 15:26:14 2015 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Jun 26 15:26:14 2015 -0700

----------------------------------------------------------------------
 .../codegen/externals/TestConstructor.java      |   2 +-
 .../codegen/externals/TestExternES3.java        |  21 +
 .../externals/reference/ClassReference.java     |   8 +-
 .../externals/reference/FieldReference.java     |   2 +-
 .../externals/reference/FunctionReference.java  |   2 +-
 .../externals/reference/MethodReference.java    |  11 +-
 .../codegen/externals/utils/FunctionUtils.java  | 112 +++--
 .../codegen/externals/utils/JSTypeUtils.java    | 227 ++++------
 .../codegen/externals/utils/TypeUtils.java      | 421 -------------------
 externs/asdoc/asdoc-config.xml                  | 348 +++++++++++++++
 externs/asdoc/build.xml                         | 114 +++++
 flex-compiler-oem/src/flex2/tools/Compc.java    |  11 +-
 flex-compiler-oem/src/flex2/tools/Mxmlc.java    |  11 +-
 13 files changed, 642 insertions(+), 648 deletions(-)
----------------------------------------------------------------------