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 2014/02/28 10:48:08 UTC

[11/50] git commit: [flex-falcon] [refs/heads/maven] - Added some relative path resolution in order to make the defaults work when the compiler is not launched from the root of the SDK directory.

Added some relative path resolution in order to make the defaults work when the compiler is not launched from the root of the SDK directory.

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/e3be84e9
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/e3be84e9
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/e3be84e9

Branch: refs/heads/maven
Commit: e3be84e96ba116fde0b761dda98d12424054b9ac
Parents: 79391ef
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Fri Nov 29 14:40:37 2013 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Fri Nov 29 14:40:37 2013 +0100

----------------------------------------------------------------------
 .../driver/js/goog/JSGoogConfiguration.java     | 37 ++++++++++++++++++--
 1 file changed, 34 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e3be84e9/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 897e409..5606226 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
@@ -19,6 +19,9 @@
 
 package org.apache.flex.compiler.internal.driver.js.goog;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -56,8 +59,15 @@ public class JSGoogConfiguration extends JSConfiguration
 
     public String getClosureLib()
     {
-        if (closureLib.equals(""))
-            closureLib = "./js/lib/google/closure-library";
+        try
+        {
+            if (closureLib.equals(""))
+            {
+                closureLib = getAbsolutePathFromPathRelativeToMXMLC(
+                        "../../js/lib/google/closure-library");
+            }
+        }
+        catch (Exception e) { /* better to try and fail... */ }
         
         return closureLib;
     }
@@ -139,7 +149,16 @@ public class JSGoogConfiguration extends JSConfiguration
     public List<String> getSDKJSLib()
     {
         if (sdkJSLib.size() == 0)
-            sdkJSLib.add("./frameworks/js/FlexJS/src");
+        {
+            try
+            {
+                String path = getAbsolutePathFromPathRelativeToMXMLC(
+                            "../../frameworks/js/FlexJS/src");
+
+                sdkJSLib.add(path);
+            }
+            catch (Exception e) { /* better to try and fail... */ }
+        }
         
         return sdkJSLib;
     }
@@ -192,4 +211,16 @@ public class JSGoogConfiguration extends JSConfiguration
         strictPublish = value;
     }
 
+    private String getAbsolutePathFromPathRelativeToMXMLC(String relativePath)
+        throws IOException
+    {
+        String mxmlcURL = MXMLJSC.class.getProtectionDomain().getCodeSource()
+                .getLocation().getPath();
+
+        File mxmlc = new File(URLDecoder.decode(mxmlcURL, "utf-8"));
+        
+        return new File(mxmlc.getParent() + File.separator + relativePath)
+                .getCanonicalPath();
+    }
+
 }