flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject git commit: [flex-falcon] [refs/heads/develop] - Added EXTERNC compiler client with static main. - Updated unit tests, all pass I don't know why the build was failing.
Date Thu, 11 Jun 2015 18:51:20 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop 210535099 -> 8aac04a65


Added EXTERNC compiler client with static main.
- Updated unit tests, all pass I don't know why the build was failing.


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

Branch: refs/heads/develop
Commit: 8aac04a655c9d4e000e1ecf4b18e33c51d0d735f
Parents: 2105350
Author: Michael Schmalle <mschmalle@apache.org>
Authored: Thu Jun 11 14:50:49 2015 -0400
Committer: Michael Schmalle <mschmalle@apache.org>
Committed: Thu Jun 11 14:50:49 2015 -0400

----------------------------------------------------------------------
 .../codegen/externals/ExternalsTestBase.java    |  17 +-
 .../codegen/externals/ExternalsTestUtils.java   |   5 +-
 .../externals/TestExternalsJSCompile.java       |  33 +--
 .../codegen/externals/TestPackageNamespace.java |   6 +
 .../codegen/externals/TestReferenceModel.java   |  26 ++-
 .../codegen/externals/TestTypeExternals.java    |   6 +
 .../apache/flex/compiler/clients/EXTERNC.java   | 150 +++++++++++++
 .../compiler/clients/ExternCConfiguration.java  | 219 +++++++++++++++++++
 .../codegen/externals/ExternalsClient.java      |  67 ------
 .../externals/ExternalsClientConfig.java        | 185 ----------------
 .../externals/emit/ReferenceEmitter.java        |  16 +-
 .../externals/pass/CollectTypesPass.java        |   2 +-
 .../externals/reference/BaseReference.java      |   2 +-
 .../externals/reference/FieldReference.java     |   2 +-
 .../externals/reference/FunctionReference.java  |   2 +-
 .../externals/reference/MemberReference.java    |   2 +-
 .../externals/reference/MethodReference.java    |   2 +-
 .../externals/reference/ReferenceModel.java     |  10 +-
 18 files changed, 444 insertions(+), 308 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java
index 44166ed..1ec1727 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java
@@ -22,6 +22,8 @@ package org.apache.flex.compiler.internal.codegen.externals;
 import java.io.File;
 import java.io.IOException;
 
+import org.apache.flex.compiler.clients.EXTERNC;
+import org.apache.flex.compiler.clients.ExternCConfiguration;
 import org.apache.flex.compiler.internal.codegen.externals.reference.ReferenceModel;
 import org.apache.flex.utils.FilenameNormalization;
 import org.junit.After;
@@ -35,18 +37,23 @@ public abstract class ExternalsTestBase
     private static File unitTestBaseDir = new File(
             FilenameNormalization.normalize("test-files/externals_unit_tests"));
 
-    protected ExternalsClientConfig config;
-    protected ExternalsClient client;
+    // Only used for testing, all configuration must happen in configure()
+    protected ExternCConfiguration config;
+    protected EXTERNC client;
     protected ReferenceModel model;
 
     @Before
-    public void setUp()
+    public void setUp() throws IOException
     {
-        config = new ExternalsClientConfig();
-        client = new ExternalsClient(config);
+        config = new ExternCConfiguration();
+        configure(config);
+        client = new EXTERNC(config);
         model = client.getModel();
     }
 
+    protected abstract void configure(ExternCConfiguration config)
+            throws IOException;
+
     @After
     public void tearDown()
     {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java
index cd61e1f..5caccc3 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java
@@ -22,6 +22,7 @@ package org.apache.flex.compiler.internal.codegen.externals;
 import java.io.File;
 import java.io.IOException;
 
+import org.apache.flex.compiler.clients.ExternCConfiguration;
 import org.apache.flex.utils.FilenameNormalization;
 
 public class ExternalsTestUtils
@@ -38,7 +39,7 @@ public class ExternalsTestUtils
 
     public static File AS_ROOT_DIR = new File(TEMP_DIR, "externals/as");
 
-    public static void addTestExcludesFull(ExternalsClientConfig config)
+    public static void addTestExcludesFull(ExternCConfiguration config)
     {
         config.addFieldExclude("Window", "focus");
         config.addClassExclude("controlRange");
@@ -69,7 +70,7 @@ public class ExternalsTestUtils
         config.addExclude("IDBObjectStore", "delete");
     }
 
-    public static void addTestExternalsFull(ExternalsClientConfig config)
+    public static void addTestExternalsFull(ExternCConfiguration config)
             throws IOException
     {
         String coreRoot = ExternalsTestUtils.EXTERNAL_JS_DIR.getAbsolutePath();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternalsJSCompile.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternalsJSCompile.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternalsJSCompile.java
index 6c46a07..93ed5e2 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternalsJSCompile.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternalsJSCompile.java
@@ -30,6 +30,8 @@ import java.util.List;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.flex.compiler.clients.COMPC;
+import org.apache.flex.compiler.clients.EXTERNC;
+import org.apache.flex.compiler.clients.ExternCConfiguration;
 import org.apache.flex.compiler.codegen.as.IASEmitter;
 import org.apache.flex.compiler.config.Configurator;
 import org.apache.flex.compiler.internal.codegen.as.ASFilterWriter;
@@ -75,16 +77,21 @@ public class TestExternalsJSCompile
     private ArrayList<File> sourcePaths;
     private ArrayList<File> libraries;
 
-    private ExternalsClient client;
+    private EXTERNC client;
 
-    private ExternalsClientConfig config;
+    private ExternCConfiguration config;
 
     @Before
-    public void setUp()
+    public void setUp() throws IOException
     {
         backend = new FlexJSBackend();
-        config = new ExternalsClientConfig();
-        client = new ExternalsClient(config);
+
+        config = new ExternCConfiguration();
+        config.setASRoot(ExternalsTestUtils.AS_ROOT_DIR);
+        ExternalsTestUtils.addTestExcludesFull(config);
+        ExternalsTestUtils.addTestExternalsFull(config);
+
+        client = new EXTERNC(config);
 
         if (project == null)
             project = new FlexJSProject(workspace);
@@ -111,11 +118,6 @@ public class TestExternalsJSCompile
     @Test
     public void test_full_compile() throws IOException
     {
-        config.setASRoot(ExternalsTestUtils.AS_ROOT_DIR);
-
-        ExternalsTestUtils.addTestExcludesFull(config);
-        ExternalsTestUtils.addTestExternalsFull(config);
-
         client.cleanOutput();
         client.compile();
         client.emit();
@@ -225,12 +227,11 @@ public class TestExternalsJSCompile
     {
         arguments.setOutput(jsSWCFile.getAbsolutePath());
 
-        File root = ExternalsTestUtils.AS_ROOT_DIR;
-        File classes = new File(root, "classes");
-        File interfaces = new File(root, "interfaces");
-        File constants = new File(root, "constants");
-        File functions = new File(root, "functions");
-        File typedefs = new File(root, "typedefs");
+        File classes = config.getAsClassRoot();
+        File interfaces = config.getAsInterfaceRoot();
+        File constants = config.getAsConstantRoot();
+        File functions = config.getAsFunctionRoot();
+        File typedefs = config.getAsTypeDefRoot();
 
         arguments.addSourcepath(classes.getAbsolutePath());
         arguments.addSourcepath(interfaces.getAbsolutePath());

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestPackageNamespace.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestPackageNamespace.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestPackageNamespace.java
index 2977ece..e2d9f90 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestPackageNamespace.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestPackageNamespace.java
@@ -6,6 +6,7 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 
+import org.apache.flex.compiler.clients.ExternCConfiguration;
 import org.apache.flex.compiler.internal.codegen.externals.reference.ClassReference;
 import org.junit.Test;
 
@@ -36,4 +37,9 @@ public class TestPackageNamespace extends ExternalsTestBase
         assertEquals("Goo", reference3.getQualifiedName());
     }
 
+    @Override
+    protected void configure(ExternCConfiguration config)
+    {
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestReferenceModel.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestReferenceModel.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestReferenceModel.java
index 107b18c..09a7133 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestReferenceModel.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestReferenceModel.java
@@ -22,9 +22,9 @@ package org.apache.flex.compiler.internal.codegen.externals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import java.io.File;
 import java.io.IOException;
 
+import org.apache.flex.compiler.clients.ExternCConfiguration;
 import org.junit.Test;
 
 public class TestReferenceModel extends ExternalsTestBase
@@ -32,10 +32,6 @@ public class TestReferenceModel extends ExternalsTestBase
     @Test
     public void test_full_compile() throws IOException
     {
-        config.setASRoot(ExternalsTestUtils.AS_ROOT_DIR);
-
-        ExternalsTestUtils.addTestExcludesFull(config);
-        ExternalsTestUtils.addTestExternalsFull(config);
 
         client.cleanOutput();
 
@@ -48,11 +44,19 @@ public class TestReferenceModel extends ExternalsTestBase
 
         client.emit();
 
-        File root = ExternalsTestUtils.AS_ROOT_DIR;
-        assertTrue(new File(root, "classes").exists());
-        assertTrue(new File(root, "interfaces").exists());
-        assertTrue(new File(root, "constants").exists());
-        assertTrue(new File(root, "functions").exists());
-        assertTrue(new File(root, "typedefs").exists());
+        assertTrue(config.getAsClassRoot().exists());
+        assertTrue(config.getAsInterfaceRoot().exists());
+        assertTrue(config.getAsFunctionRoot().exists());
+        assertTrue(config.getAsConstantRoot().exists());
+        assertTrue(config.getAsTypeDefRoot().exists());
+    }
+
+    @Override
+    protected void configure(ExternCConfiguration config) throws IOException
+    {
+        config.setASRoot(ExternalsTestUtils.AS_ROOT_DIR);
+
+        ExternalsTestUtils.addTestExcludesFull(config);
+        ExternalsTestUtils.addTestExternalsFull(config);
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestTypeExternals.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestTypeExternals.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestTypeExternals.java
index c4a56fc..9a12ff7 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestTypeExternals.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestTypeExternals.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 
+import org.apache.flex.compiler.clients.ExternCConfiguration;
 import org.apache.flex.compiler.internal.codegen.externals.reference.ClassReference;
 import org.junit.Test;
 
@@ -129,4 +130,9 @@ public class TestTypeExternals extends ExternalsTestBase
                 model.getCompiler().getTypeRegistry());
         return jsType;
     }
+
+    @Override
+    protected void configure(ExternCConfiguration config) throws IOException
+    {
+    }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx/src/org/apache/flex/compiler/clients/EXTERNC.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/clients/EXTERNC.java b/compiler.jx/src/org/apache/flex/compiler/clients/EXTERNC.java
new file mode 100644
index 0000000..0ff9a3e
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/clients/EXTERNC.java
@@ -0,0 +1,150 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.clients;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.flex.compiler.internal.codegen.externals.emit.ReferenceEmitter;
+import org.apache.flex.compiler.internal.codegen.externals.pass.ReferenceCompiler;
+import org.apache.flex.compiler.internal.codegen.externals.reference.ReferenceModel;
+import org.apache.flex.compiler.internal.codegen.js.JSSharedData;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+
+import com.google.javascript.jscomp.Result;
+
+/**
+ * @author Michael Schmalle
+ */
+public class EXTERNC
+{
+    static enum ExitCode
+    {
+        SUCCESS(0),
+        PRINT_HELP(1),
+        FAILED_WITH_PROBLEMS(2),
+        FAILED_WITH_EXCEPTIONS(3),
+        FAILED_WITH_CONFIG_PROBLEMS(4);
+
+        ExitCode(int code)
+        {
+            this.code = code;
+        }
+
+        final int code;
+    }
+
+    private ExternCConfiguration configuration;
+    private ReferenceModel model;
+    private ReferenceCompiler compiler;
+    private ReferenceEmitter emitter;
+
+    public ReferenceModel getModel()
+    {
+        return model;
+    }
+
+    public EXTERNC(ExternCConfiguration configuration)
+    {
+        this.configuration = configuration;
+
+        model = new ReferenceModel(configuration);
+        compiler = new ReferenceCompiler(model);
+        emitter = new ReferenceEmitter(model);
+    }
+
+    /**
+     * Java program entry point.
+     * 
+     * @param args command line arguments
+     */
+    public static void main(final String[] args)
+    {
+        int exitCode = staticMainNoExit(args);
+        System.exit(exitCode);
+    }
+
+    /**
+     * Entry point for the <code>externc</code>.
+     *
+     * @param args Command line arguments.
+     * @return An exit code.
+     */
+    public static int staticMainNoExit(final String[] args)
+    {
+        long startTime = System.nanoTime();
+
+        ExternCConfiguration config = new ExternCConfiguration(args);
+        final EXTERNC compiler = new EXTERNC(config);
+        final Set<ICompilerProblem> problems = new HashSet<ICompilerProblem>();
+        final int exitCode = compiler.mainNoExit(args, problems, true);
+
+        long endTime = System.nanoTime();
+        JSSharedData.instance.stdout((endTime - startTime) / 1e9 + " seconds");
+
+        return exitCode;
+    }
+
+    public int mainNoExit(final String[] args, Set<ICompilerProblem> problems,
+            Boolean printProblems)
+    {
+        int exitCode = -1;
+
+        try
+        {
+            cleanOutput();
+            compile();
+            emit();
+        }
+        catch (IOException e)
+        {
+            JSSharedData.instance.stderr(e.toString());
+        }
+        finally
+        {
+            if (problems != null && !problems.isEmpty())
+            {
+                if (printProblems)
+                {
+                }
+            }
+        }
+
+        return exitCode;
+    }
+
+    public void cleanOutput() throws IOException
+    {
+        FileUtils.deleteDirectory(configuration.getAsRoot());
+    }
+
+    public void emit() throws IOException
+    {
+        emitter.emit();
+    }
+
+    public Result compile() throws IOException
+    {
+        return compiler.compile();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/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
new file mode 100644
index 0000000..6242d3a
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/clients/ExternCConfiguration.java
@@ -0,0 +1,219 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.clients;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.flex.compiler.internal.codegen.externals.pass.ReferenceCompiler.ExternalFile;
+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;
+import org.apache.flex.utils.FilenameNormalization;
+
+public class ExternCConfiguration
+{
+    private File asRoot;
+
+    private File asClassRoot;
+    private File asInterfaceRoot;
+    private File asFunctionRoot;
+    private File asConstantRoot;
+    private File asTypeDefRoot;
+
+    private List<ExternalFile> externals = new ArrayList<ExternalFile>();
+
+    private List<ExcludedMemeber> excludesClass = new ArrayList<ExcludedMemeber>();
+    private List<ExcludedMemeber> excludesField = new ArrayList<ExcludedMemeber>();
+    private List<ExcludedMemeber> excludes = new ArrayList<ExcludedMemeber>();
+
+    public ExternCConfiguration()
+    {
+    }
+
+    public ExternCConfiguration(String[] args)
+    {
+        // TODO (mschmalle) implement argument digesting
+    }
+
+    public File getAsRoot()
+    {
+        return asRoot;
+    }
+
+    public void setASRoot(File file)
+    {
+        this.asRoot = file;
+
+        asClassRoot = new File(asRoot, "classes");
+        asInterfaceRoot = new File(asRoot, "interfaces");
+        asFunctionRoot = new File(asRoot, "functions");
+        asConstantRoot = new File(asRoot, "constants");
+        asTypeDefRoot = new File(asRoot, "typedefs");
+    }
+
+    public File getAsClassRoot()
+    {
+        return asClassRoot;
+    }
+
+    public File getAsInterfaceRoot()
+    {
+        return asInterfaceRoot;
+    }
+
+    public File getAsFunctionRoot()
+    {
+        return asFunctionRoot;
+    }
+
+    public File getAsConstantRoot()
+    {
+        return asConstantRoot;
+    }
+
+    public File getAsTypeDefRoot()
+    {
+        return asTypeDefRoot;
+    }
+
+    public Collection<ExternalFile> getExternals()
+    {
+        return externals;
+    }
+
+    public void addExternal(File file) throws IOException
+    {
+        if (!file.exists())
+            throw new IOException(file.getAbsolutePath() + " does not exist.");
+        externals.add(new ExternalFile(file));
+    }
+
+    public void addExternal(String externalFile) throws IOException
+    {
+        addExternal(new File(FilenameNormalization.normalize(externalFile)));
+    }
+
+    public ExcludedMemeber isExcludedClass(ClassReference classReference)
+    {
+        for (ExcludedMemeber memeber : excludesClass)
+        {
+            if (memeber.isExcluded(classReference, null))
+                return memeber;
+        }
+        return null;
+    }
+
+    public ExcludedMemeber isExcludedMember(ClassReference classReference,
+            MemberReference memberReference)
+    {
+        if (memberReference instanceof FieldReference)
+        {
+            for (ExcludedMemeber memeber : excludesField)
+            {
+                if (memeber.isExcluded(classReference, memberReference))
+                    return memeber;
+            }
+        }
+        for (ExcludedMemeber memeber : excludes)
+        {
+            if (memeber.isExcluded(classReference, memberReference))
+                return memeber;
+        }
+        return null;
+    }
+
+    public void addExclude(String className, String name)
+    {
+        excludes.add(new ExcludedMemeber(className, name));
+    }
+
+    public void addExclude(String className, String name, String description)
+    {
+        excludes.add(new ExcludedMemeber(className, name, description));
+    }
+
+    public void addFieldExclude(String className, String fieldName)
+    {
+        excludesField.add(new ExcludedMemeber(className, fieldName, ""));
+    }
+
+    public void addClassExclude(String className)
+    {
+        excludesClass.add(new ExcludedMemeber(className, null, ""));
+    }
+
+    public static class ExcludedMemeber
+    {
+        private String className;
+        private String name;
+        private String description;
+
+        public String getClassName()
+        {
+            return className;
+        }
+
+        public String getName()
+        {
+            return name;
+        }
+
+        public String getDescription()
+        {
+            return description;
+        }
+
+        public ExcludedMemeber(String className, String name)
+        {
+            this.className = className;
+            this.name = name;
+        }
+
+        public ExcludedMemeber(String className, String name, String description)
+        {
+            this.className = className;
+            this.name = name;
+            this.description = description;
+        }
+
+        public boolean isExcluded(ClassReference classReference,
+                MemberReference memberReference)
+        {
+            if (memberReference == null)
+            {
+                return classReference.getQualifiedName().equals(className);
+            }
+            return classReference.getQualifiedName().equals(className)
+                    && memberReference.getQualifiedName().equals(name);
+        }
+
+        public void print(StringBuilder sb)
+        {
+            if (description != null)
+                sb.append("// " + description + "\n");
+            sb.append("//");
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsClient.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsClient.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsClient.java
deleted file mode 100644
index 9fa5348..0000000
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsClient.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.flex.compiler.internal.codegen.externals;
-
-import java.io.IOException;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.flex.compiler.internal.codegen.externals.emit.ReferenceEmitter;
-import org.apache.flex.compiler.internal.codegen.externals.pass.ReferenceCompiler;
-import org.apache.flex.compiler.internal.codegen.externals.reference.ReferenceModel;
-
-import com.google.javascript.jscomp.Result;
-
-public class ExternalsClient
-{
-    private ExternalsClientConfig configuration;
-    private ReferenceModel model;
-    private ReferenceCompiler compiler;
-    private ReferenceEmitter emitter;
-
-    public ReferenceModel getModel()
-    {
-        return model;
-    }
-
-    public ExternalsClient(ExternalsClientConfig config)
-    {
-        this.configuration = config;
-
-        model = new ReferenceModel(config);
-        compiler = new ReferenceCompiler(model);
-        emitter = new ReferenceEmitter(model);
-    }
-
-    public void cleanOutput() throws IOException
-    {
-        FileUtils.deleteDirectory(configuration.getAsRoot());
-    }
-
-    public void emit() throws IOException
-    {
-        emitter.emit();
-    }
-
-    public Result compile() throws IOException
-    {
-        return compiler.compile();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsClientConfig.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsClientConfig.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsClientConfig.java
deleted file mode 100644
index 1d64449..0000000
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsClientConfig.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- *
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.flex.compiler.internal.codegen.externals;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.flex.compiler.internal.codegen.externals.pass.ReferenceCompiler.ExternalFile;
-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;
-import org.apache.flex.utils.FilenameNormalization;
-
-public class ExternalsClientConfig
-{
-    private File asRoot;
-
-    private File asClassRoot;
-    private File asInterfaceRoot;
-    private File asFunctionRoot;
-    private File asConstantRoot;
-    private File asTypeDefRoot;
-
-    private List<ExternalFile> externals = new ArrayList<ExternalFile>();
-
-    private List<ExcludedMemeber> excludesClass = new ArrayList<ExcludedMemeber>();
-    private List<ExcludedMemeber> excludesField = new ArrayList<ExcludedMemeber>();
-    private List<ExcludedMemeber> excludes = new ArrayList<ExcludedMemeber>();
-
-    public Collection<ExternalFile> getExternals()
-    {
-        return externals;
-    }
-
-    public File getAsRoot()
-    {
-        return asRoot;
-    }
-
-    public void setASRoot(File file)
-    {
-        this.asRoot = file;
-
-        asClassRoot = new File(asRoot.getParent(), "as_functions");
-        asInterfaceRoot = new File(asRoot.getParent(), "as_interfaces");
-        asFunctionRoot = new File(asRoot.getParent(), "as_functions");
-        asConstantRoot = new File(asRoot.getParent(), "as_constants");
-        asTypeDefRoot = new File(asRoot.getParent(), "as_typedefs");
-    }
-
-    public void addExternal(File file) throws IOException
-    {
-        if (!file.exists())
-            throw new IOException(file.getAbsolutePath() + " does not exist.");
-        externals.add(new ExternalFile(file));
-    }
-
-    public void addExternal(String externalFile) throws IOException
-    {
-        addExternal(new File(FilenameNormalization.normalize(externalFile)));
-    }
-
-    public ExcludedMemeber isExcludedClass(ClassReference classReference)
-    {
-        for (ExcludedMemeber memeber : excludesClass)
-        {
-            if (memeber.isExcluded(classReference, null))
-                return memeber;
-        }
-        return null;
-    }
-
-    public ExcludedMemeber isExcludedMember(ClassReference classReference,
-            MemberReference memberReference)
-    {
-        if (memberReference instanceof FieldReference)
-        {
-            for (ExcludedMemeber memeber : excludesField)
-            {
-                if (memeber.isExcluded(classReference, memberReference))
-                    return memeber;
-            }
-        }
-        for (ExcludedMemeber memeber : excludes)
-        {
-            if (memeber.isExcluded(classReference, memberReference))
-                return memeber;
-        }
-        return null;
-    }
-
-    public void addExclude(String className, String name)
-    {
-        excludes.add(new ExcludedMemeber(className, name));
-    }
-
-    public void addExclude(String className, String name, String description)
-    {
-        excludes.add(new ExcludedMemeber(className, name, description));
-    }
-
-    public void addFieldExclude(String className, String fieldName)
-    {
-        excludesField.add(new ExcludedMemeber(className, fieldName, ""));
-    }
-
-    public void addClassExclude(String className)
-    {
-        excludesClass.add(new ExcludedMemeber(className, null, ""));
-    }
-
-    public static class ExcludedMemeber
-    {
-        private String className;
-        private String name;
-        private String description;
-
-        public String getClassName()
-        {
-            return className;
-        }
-
-        public String getName()
-        {
-            return name;
-        }
-
-        public String getDescription()
-        {
-            return description;
-        }
-
-        public ExcludedMemeber(String className, String name)
-        {
-            this.className = className;
-            this.name = name;
-        }
-
-        public ExcludedMemeber(String className, String name, String description)
-        {
-            this.className = className;
-            this.name = name;
-            this.description = description;
-        }
-
-        public boolean isExcluded(ClassReference classReference,
-                MemberReference memberReference)
-        {
-            if (memberReference == null)
-            {
-                return classReference.getQualifiedName().equals(className);
-            }
-            return classReference.getQualifiedName().equals(className)
-                    && memberReference.getQualifiedName().equals(name);
-        }
-
-        public void print(StringBuilder sb)
-        {
-            if (description != null)
-                sb.append("// " + description + "\n");
-            sb.append("//");
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/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 308c0d4..de531dd 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
@@ -43,12 +43,6 @@ public class ReferenceEmitter
         final File asRoot = model.getConfiguration().getAsRoot();
         asRoot.mkdirs();
 
-        File asClassRoot = new File(asRoot, "classes");
-        File asInterfacesRoot = new File(asRoot, "interfaces");
-        File asFunctionRoot = new File(asRoot, "functions");
-        File asConstantRoot = new File(asRoot, "constants");
-        File asTypeDefRoot = new File(asRoot, "typedefs");
-
         for (ClassReference reference : model.getClasses())
         {
             if (model.isExcludedClass(reference) != null)
@@ -61,7 +55,7 @@ public class ReferenceEmitter
 
             emit(reference, sb);
 
-            File sourceFile = reference.getFile(asClassRoot);
+            File sourceFile = reference.getFile(model.getConfiguration().getAsClassRoot());
             FileUtils.write(sourceFile, sb.toString());
         }
 
@@ -77,7 +71,7 @@ public class ReferenceEmitter
 
             emit(reference, sb);
 
-            File sourceFile = reference.getFile(asInterfacesRoot);
+            File sourceFile = reference.getFile(model.getConfiguration().getAsInterfaceRoot());
             FileUtils.write(sourceFile, sb.toString());
         }
 
@@ -91,7 +85,7 @@ public class ReferenceEmitter
 
             emit(reference, sb);
 
-            File sourceFile = reference.getFile(asTypeDefRoot);
+            File sourceFile = reference.getFile(model.getConfiguration().getAsTypeDefRoot());
             FileUtils.write(sourceFile, sb.toString());
         }
 
@@ -101,7 +95,7 @@ public class ReferenceEmitter
 
             emit(reference, sb);
 
-            File sourceFile = reference.getFile(asFunctionRoot);
+            File sourceFile = reference.getFile(model.getConfiguration().getAsFunctionRoot());
             FileUtils.write(sourceFile, sb.toString());
         }
 
@@ -111,7 +105,7 @@ public class ReferenceEmitter
 
             emit(reference, sb);
 
-            File sourceFile = reference.getFile(asConstantRoot);
+            File sourceFile = reference.getFile(model.getConfiguration().getAsConstantRoot());
             FileUtils.write(sourceFile, sb.toString());
         }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectTypesPass.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectTypesPass.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectTypesPass.java
index d29d9dd..7bceca5 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectTypesPass.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectTypesPass.java
@@ -154,7 +154,7 @@ public class CollectTypesPass extends AbstractCompilerPass
                 }
                 else if (comment != null && comment.isConstant())
                 {
-                    System.out.println(child.toStringTree());
+                    //System.out.println(child.toStringTree());
                     model.addConstant(child, first.getString());
                 }
                 //log(child.toStringTree());

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
index 36b7a06..d432461 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
@@ -21,7 +21,7 @@ package org.apache.flex.compiler.internal.codegen.externals.reference;
 
 import java.io.File;
 
-import org.apache.flex.compiler.internal.codegen.externals.ExternalsClientConfig.ExcludedMemeber;
+import org.apache.flex.compiler.clients.ExternCConfiguration.ExcludedMemeber;
 
 import com.google.javascript.jscomp.Compiler;
 import com.google.javascript.rhino.JSDocInfo;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
index fcae414..d14df69 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
@@ -19,7 +19,7 @@
 
 package org.apache.flex.compiler.internal.codegen.externals.reference;
 
-import org.apache.flex.compiler.internal.codegen.externals.ExternalsClientConfig.ExcludedMemeber;
+import org.apache.flex.compiler.clients.ExternCConfiguration.ExcludedMemeber;
 import org.apache.flex.compiler.internal.codegen.externals.utils.FunctionUtils;
 import org.apache.flex.compiler.internal.codegen.externals.utils.JSTypeUtils;
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java
index 3fcb730..2c0f695 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java
@@ -21,7 +21,7 @@ package org.apache.flex.compiler.internal.codegen.externals.reference;
 
 import java.io.File;
 
-import org.apache.flex.compiler.internal.codegen.externals.ExternalsClientConfig.ExcludedMemeber;
+import org.apache.flex.compiler.clients.ExternCConfiguration.ExcludedMemeber;
 import org.apache.flex.compiler.internal.codegen.externals.utils.FunctionUtils;
 
 import com.google.javascript.rhino.JSDocInfo;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MemberReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MemberReference.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MemberReference.java
index 5c3f92b..b73afbe 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MemberReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MemberReference.java
@@ -19,7 +19,7 @@
 
 package org.apache.flex.compiler.internal.codegen.externals.reference;
 
-import org.apache.flex.compiler.internal.codegen.externals.ExternalsClientConfig.ExcludedMemeber;
+import org.apache.flex.compiler.clients.ExternCConfiguration.ExcludedMemeber;
 
 import com.google.javascript.rhino.JSDocInfo;
 import com.google.javascript.rhino.Node;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
index 2f239ee..c70e3d6 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
@@ -19,7 +19,7 @@
 
 package org.apache.flex.compiler.internal.codegen.externals.reference;
 
-import org.apache.flex.compiler.internal.codegen.externals.ExternalsClientConfig.ExcludedMemeber;
+import org.apache.flex.compiler.clients.ExternCConfiguration.ExcludedMemeber;
 import org.apache.flex.compiler.internal.codegen.externals.utils.FunctionUtils;
 
 import com.google.javascript.rhino.JSDocInfo;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8aac04a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
index 4fa7d89..1ca540d 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
@@ -24,8 +24,8 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 
-import org.apache.flex.compiler.internal.codegen.externals.ExternalsClientConfig;
-import org.apache.flex.compiler.internal.codegen.externals.ExternalsClientConfig.ExcludedMemeber;
+import org.apache.flex.compiler.clients.ExternCConfiguration;
+import org.apache.flex.compiler.clients.ExternCConfiguration.ExcludedMemeber;
 
 import com.google.javascript.jscomp.Compiler;
 import com.google.javascript.jscomp.NodeUtil;
@@ -35,7 +35,7 @@ import com.google.javascript.rhino.jstype.JSType;
 
 public class ReferenceModel
 {
-    private ExternalsClientConfig configuration;
+    private ExternCConfiguration configuration;
     private Compiler compiler;
 
     private List<String> namespaces = new ArrayList<String>();
@@ -54,7 +54,7 @@ public class ReferenceModel
         this.compiler = compiler;
     }
 
-    public ExternalsClientConfig getConfiguration()
+    public ExternCConfiguration getConfiguration()
     {
         return configuration;
     }
@@ -84,7 +84,7 @@ public class ReferenceModel
         return constants.values();
     }
 
-    public ReferenceModel(ExternalsClientConfig config)
+    public ReferenceModel(ExternCConfiguration config)
     {
         this.configuration = config;
     }


Mime
View raw message