You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2014/08/03 12:05:25 UTC

[1/3] git commit: [flex-falcon] [refs/heads/develop] - Handle '-fb' arg for VF2JS.

Repository: flex-falcon
Updated Branches:
  refs/heads/develop 50517db64 -> e209cf3c9


Handle '-fb' arg for VF2JS.

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


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

Branch: refs/heads/develop
Commit: 16395dc1ebd600245ef17850eda05532281c9030
Parents: 50517db
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Fri Aug 1 17:04:16 2014 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Fri Aug 1 17:04:16 2014 +0200

----------------------------------------------------------------------
 .../apache/flex/compiler/clients/MXMLJSC.java   | 67 ++++++++++++--------
 .../flex/compiler/utils/VF2JSProjectUtils.java  | 18 ++++--
 2 files changed, 55 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16395dc1/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java b/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
index 84a1f18..73f92e5 100644
--- a/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
+++ b/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
@@ -152,22 +152,16 @@ public class MXMLJSC
 
         IBackend backend = new ASBackend();
         String jsOutputTypeString = "";
-        String projectFilePath = "";
         for (String s : args)
         {
             String[] kvp = s.split("=");
-            
+
             if (s.contains("-js-output-type"))
             {
                 jsOutputTypeString = kvp[1];
             }
-            
-            if (kvp.length == 1) // input file path
-            {
-                projectFilePath = kvp[0];
-            }
         }
-        
+
         if (jsOutputTypeString.equals(""))
         {
             jsOutputTypeString = JSOutputType.FLEXJS.getText();
@@ -186,19 +180,6 @@ public class MXMLJSC
             backend = new GoogBackend();
             break;
         case VF2JS:
-            String newProjectFilePath = 
-                VF2JSProjectUtils.createTempProject(projectFilePath);
-
-            for (int i = 0; i < args.length; i++)
-            {
-                String[] kvp = args[i].split("=");
-                
-                if (kvp.length == 1) // input file path
-                {
-                    args[i] = newProjectFilePath;
-                }
-            }
-
             backend = new MXMLVF2JSBackend();
             break;
         }
@@ -278,7 +259,34 @@ public class MXMLJSC
         ExitCode exitCode = ExitCode.SUCCESS;
         try
         {
-            final boolean continueCompilation = configure(args);
+            String[] adjustedArgs = args;
+
+            switch (jsOutputType)
+            {
+            case VF2JS:
+                boolean isFlashBuilderProject = useFlashBuilderProjectFiles(args);
+
+                if (isFlashBuilderProject)
+                {
+                    adjustedArgs = FlashBuilderConfigurator
+                            .computeFlashBuilderArgs(adjustedArgs,
+                                    getTargetType().getExtension());
+                }
+
+                String projectFilePath = adjustedArgs[adjustedArgs.length - 1];
+
+                String newProjectFilePath = VF2JSProjectUtils
+                        .createTempProject(projectFilePath,
+                                isFlashBuilderProject);
+                
+                adjustedArgs[adjustedArgs.length - 1] = newProjectFilePath;
+                
+                break;
+            default:
+                break;
+            }
+
+            final boolean continueCompilation = configure(adjustedArgs);
 
             if (outProblems != null && !config.isVerbose())
                 JSSharedData.STDOUT = JSSharedData.STDERR = null;
@@ -685,11 +693,20 @@ public class MXMLJSC
 
         try
         {
-            if (useFlashBuilderProjectFiles(args))
-                projectConfigurator.setConfiguration(FlashBuilderConfigurator.computeFlashBuilderArgs(args, getTargetType().getExtension()), 
+            if (useFlashBuilderProjectFiles(args)
+                    && !jsOutputType.equals(JSOutputType.VF2JS))
+            {
+                projectConfigurator.setConfiguration(FlashBuilderConfigurator
+                        .computeFlashBuilderArgs(args, getTargetType()
+                                .getExtension()),
                         ICompilerSettingsConstants.FILE_SPECS_VAR);
+            }
             else
-                projectConfigurator.setConfiguration(args, ICompilerSettingsConstants.FILE_SPECS_VAR);
+            {
+                projectConfigurator.setConfiguration(args,
+                        ICompilerSettingsConstants.FILE_SPECS_VAR);
+            }
+
             projectConfigurator.applyToProject(project);
             problems = new ProblemQuery(
                     projectConfigurator.getCompilerProblemSettings());

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16395dc1/compiler.jx/src/org/apache/flex/compiler/utils/VF2JSProjectUtils.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/utils/VF2JSProjectUtils.java b/compiler.jx/src/org/apache/flex/compiler/utils/VF2JSProjectUtils.java
index cdf4e54..f7439ed 100644
--- a/compiler.jx/src/org/apache/flex/compiler/utils/VF2JSProjectUtils.java
+++ b/compiler.jx/src/org/apache/flex/compiler/utils/VF2JSProjectUtils.java
@@ -13,17 +13,25 @@ public class VF2JSProjectUtils
 
     private static File tempDir;
     
-    public static final String createTempProject(String projectFilePath)
+    public static final String createTempProject(String projectFilePath,
+            boolean isFlashBuilderProject)
     {
         tempDir = Files.createTempDir();
-        tempDir.deleteOnExit();
         
-        String path = projectFilePath.substring(0, projectFilePath.lastIndexOf(File.separator));
+        String fileName = projectFilePath.substring(projectFilePath.lastIndexOf(File.separator) + 1, projectFilePath.length());
+
+        String path = "";
+        if (!isFlashBuilderProject)
+        {
+            path = projectFilePath + File.separator + "src";
+        }
+        else
+        {
+            path = projectFilePath.substring(0, projectFilePath.lastIndexOf(File.separator));
+        }
         
         createTempProjectDir(new File(path).listFiles(), "");
         
-        String fileName = projectFilePath.substring(projectFilePath.lastIndexOf(File.separator) + 1, projectFilePath.length());
-        
         return tempDir.getAbsolutePath() + File.separator + fileName;
     }
 


[2/3] git commit: [flex-falcon] [refs/heads/develop] - Raise visibility of members to allow override.

Posted by er...@apache.org.
Raise visibility of members to allow override.

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


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

Branch: refs/heads/develop
Commit: d2d5fb7bd079a8f8ed1cd2506e69abf73f04a6c6
Parents: 16395dc
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Sun Aug 3 12:04:12 2014 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Sun Aug 3 12:04:12 2014 +0200

----------------------------------------------------------------------
 .../compiler/internal/driver/js/goog/JSGoogConfiguration.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d2d5fb7b/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java b/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
index 5606226..d54809d 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
@@ -55,7 +55,7 @@ public class JSGoogConfiguration extends JSConfiguration
     // 'closure-lib'
     //
 
-    private String closureLib = "";
+    protected String closureLib = "";
 
     public String getClosureLib()
     {
@@ -211,7 +211,7 @@ public class JSGoogConfiguration extends JSConfiguration
         strictPublish = value;
     }
 
-    private String getAbsolutePathFromPathRelativeToMXMLC(String relativePath)
+    protected String getAbsolutePathFromPathRelativeToMXMLC(String relativePath)
         throws IOException
     {
         String mxmlcURL = MXMLJSC.class.getProtectionDomain().getCodeSource()


[3/3] git commit: [flex-falcon] [refs/heads/develop] - Override config class to allow for new relative path to Closure Library.

Posted by er...@apache.org.
Override config class to allow for new relative path to Closure Library.


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

Branch: refs/heads/develop
Commit: e209cf3c969d6769d8971ab0090888963268de66
Parents: d2d5fb7
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Sun Aug 3 12:04:46 2014 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Sun Aug 3 12:04:46 2014 +0200

----------------------------------------------------------------------
 .../driver/js/vf2js/JSVF2JSConfiguration.java   | 62 ++++++++++++++++++++
 .../driver/mxml/vf2js/MXMLVF2JSBackend.java     |  4 +-
 2 files changed, 64 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e209cf3c/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/vf2js/JSVF2JSConfiguration.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/vf2js/JSVF2JSConfiguration.java b/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/vf2js/JSVF2JSConfiguration.java
new file mode 100644
index 0000000..ec431ca
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/vf2js/JSVF2JSConfiguration.java
@@ -0,0 +1,62 @@
+/*
+ *
+ *  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.driver.js.vf2js;
+
+import org.apache.flex.compiler.clients.MXMLJSC;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+
+/**
+ * The {@link JSVF2JSConfiguration} class holds all compiler arguments needed for
+ * compiling ActionScript to JavaScript the 'goog' way.
+ * <p>
+ * Specific flags are implemented here for the configuration to be loaded by the
+ * configure() method of {@link MXMLJSC}.
+ * <p>
+ * This class inherits all compiler arguments from the MXMLC compiler.
+ * 
+ * @author Erik de Bruin
+ */
+public class JSVF2JSConfiguration extends JSGoogConfiguration
+{
+    public JSVF2JSConfiguration()
+    {
+    }
+
+    //
+    // 'closure-lib'
+    //
+
+    @Override
+    public String getClosureLib()
+    {
+        try
+        {
+            if (closureLib.equals(""))
+            {
+                closureLib = getAbsolutePathFromPathRelativeToMXMLC(
+                        "../lib/google/closure-library");
+            }
+        }
+        catch (Exception e) { /* better to try and fail... */ }
+        
+        return closureLib;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e209cf3c/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/vf2js/MXMLVF2JSBackend.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/vf2js/MXMLVF2JSBackend.java b/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/vf2js/MXMLVF2JSBackend.java
index 8d95230..3f164d9 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/vf2js/MXMLVF2JSBackend.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/vf2js/MXMLVF2JSBackend.java
@@ -35,7 +35,7 @@ import org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker;
 import org.apache.flex.compiler.internal.codegen.mxml.MXMLWriter;
 import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSBlockWalker;
 import org.apache.flex.compiler.internal.codegen.mxml.vf2js.MXMLVF2JSEmitter;
-import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.internal.driver.js.vf2js.JSVF2JSConfiguration;
 import org.apache.flex.compiler.internal.driver.mxml.MXMLBackend;
 import org.apache.flex.compiler.internal.targets.FlexJSTarget;
 import org.apache.flex.compiler.internal.targets.JSTarget;
@@ -63,7 +63,7 @@ public class MXMLVF2JSBackend extends MXMLBackend
     @Override
     public Configurator createConfigurator()
     {
-        return new Configurator(JSGoogConfiguration.class);
+        return new Configurator(JSVF2JSConfiguration.class);
     }
 
     @Override