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


Handle '-fb' arg for VF2JS.

Signed-off-by: Erik de Bruin <e...@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 <e...@ixsoftware.nl>
Authored: Fri Aug 1 17:04:16 2014 +0200
Committer: Erik de Bruin <e...@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;
     }
 

Reply via email to