Repository: flex-falcon
Updated Branches:
  refs/heads/develop e82bca3f0 -> 212af3ef4


use env.properties before unittest.properties


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

Branch: refs/heads/develop
Commit: 212af3ef4b2b70029d945b64c0ab1ef8c95ef1ec
Parents: e82bca3
Author: Alex Harui <[email protected]>
Authored: Tue Feb 16 22:17:13 2016 -0800
Committer: Alex Harui <[email protected]>
Committed: Tue Feb 16 22:17:13 2016 -0800

----------------------------------------------------------------------
 .../flex/compiler/utils/EnvProperties.java      | 47 +++++++++++------
 .../org/apache/flex/utils/EnvProperties.java    | 53 ++++++++++++++------
 2 files changed, 70 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/212af3ef/compiler.jx.tests/src/org/apache/flex/compiler/utils/EnvProperties.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx.tests/src/org/apache/flex/compiler/utils/EnvProperties.java 
b/compiler.jx.tests/src/org/apache/flex/compiler/utils/EnvProperties.java
index ffd7494..cbb1497 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/utils/EnvProperties.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/utils/EnvProperties.java
@@ -80,27 +80,42 @@ public class EnvProperties
 
     private void setup()
     {
+       String prefix = "";
         Properties p = new Properties();
-        try
-        {
-            File f = new File("unittest.properties");
-            p.load(new FileInputStream(f));
-        }
-        catch (FileNotFoundException e)
-        {
-            System.out.println("unittest.properties not found");
-        }
-        catch (IOException e)
-        {
+        String envFileName = FilenameNormalization
+        .normalize("../env.properties");
+        try {
+            File f = new File(envFileName);
+            if (f.exists())
+            {
+               p.load(new FileInputStream( f ));
+               prefix = "env.";
+            }
+        } catch (FileNotFoundException e) {
+            System.out.println(envFileName + " not found");
+            try {
+                File f = new File("unittest.properties");
+                p.load(new FileInputStream( f ));
+            } catch (FileNotFoundException e1) {
+                System.out.println("unittest.properties not found");
+            } catch (IOException e1) {
+            }
+        } catch (IOException e) {
         }
 
-        SDK = p.getProperty("FLEX_HOME", System.getenv("FLEX_HOME"));
+        SDK = p.getProperty(prefix + "FLEX_HOME", System.getenv("FLEX_HOME"));
         if (SDK == null)
+        {
             SDK = FilenameNormalization
+               .normalize("../../flex-sdk");
+            File mxmlc = new File(SDK + "/lib/mxmlc.jar");
+            if (!mxmlc.exists())
+               SDK = FilenameNormalization
                     .normalize("../compiler/generated/dist/sdk");
+        }
         System.out.println("environment property - FLEX_HOME = " + SDK);
 
-        FPSDK = p.getProperty("PLAYERGLOBAL_HOME",
+        FPSDK = p.getProperty(prefix + "PLAYERGLOBAL_HOME",
                 System.getenv("PLAYERGLOBAL_HOME"));
         if (FPSDK == null)
             FPSDK = FilenameNormalization
@@ -108,12 +123,12 @@ public class EnvProperties
         System.out.println("environment property - PLAYERGLOBAL_HOME = "
                 + FPSDK);
 
-        FPVER = p.getProperty("PLAYERGLOBAL_VERSION", 
System.getenv("PLAYERGLOBAL_VERSION"));
+        FPVER = p.getProperty(prefix + "PLAYERGLOBAL_VERSION", 
System.getenv("PLAYERGLOBAL_VERSION"));
         if (FPVER == null)
             FPVER = "11.1";
         System.out.println("environment property - PLAYERGLOBAL_VERSION = " + 
FPVER);
         
-        AIRSDK = p.getProperty("AIR_HOME", System.getenv("AIR_HOME"));
+        AIRSDK = p.getProperty(prefix + "AIR_HOME", System.getenv("AIR_HOME"));
         System.out.println("environment property - AIR_HOME = " + AIRSDK);
 
         FDBG = p.getProperty("FLASHPLAYER_DEBUGGER",
@@ -121,7 +136,7 @@ public class EnvProperties
         System.out.println("environment property - FLASHPLAYER_DEBUGGER = "
                 + FDBG);
 
-        ASJS = p.getProperty("ASJS_HOME", System.getenv("ASJS_HOME"));
+        ASJS = p.getProperty(prefix + "ASJS_HOME", System.getenv("ASJS_HOME"));
         if (ASJS == null)
             ASJS = FilenameNormalization
                     .normalize("../../flex-asjs");

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/212af3ef/compiler.tests/src/org/apache/flex/utils/EnvProperties.java
----------------------------------------------------------------------
diff --git a/compiler.tests/src/org/apache/flex/utils/EnvProperties.java 
b/compiler.tests/src/org/apache/flex/utils/EnvProperties.java
index 062732e..03805d5 100644
--- a/compiler.tests/src/org/apache/flex/utils/EnvProperties.java
+++ b/compiler.tests/src/org/apache/flex/utils/EnvProperties.java
@@ -78,37 +78,62 @@ public class EnvProperties {
        
        private void setup()
        {
+        String prefix = "";
                Properties p = new Properties();
-               try {
-                       File f = new File("unittest.properties");
-                       p.load(new FileInputStream( f ));
-               } catch (FileNotFoundException e) {
-                       System.out.println("unittest.properties not found");
-               } catch (IOException e) {
-               }
+        String envFileName = FilenameNormalization
+        .normalize("../env.properties");
+        try {
+            File f = new File(envFileName);
+            if (f.exists())
+            {
+               p.load(new FileInputStream( f ));
+                prefix = "env.";
+            }
+        } catch (FileNotFoundException e) {
+            System.out.println(envFileName + " not found");
+            try {
+                File f = new File("unittest.properties");
+                p.load(new FileInputStream( f ));
+            } catch (FileNotFoundException e1) {
+                System.out.println("unittest.properties not found");
+            } catch (IOException e1) {
+            }
+        } catch (IOException e) {
+        }
                
-               SDK = p.getProperty("FLEX_HOME", System.getenv("FLEX_HOME"));
+               SDK = p.getProperty(prefix + "FLEX_HOME", 
System.getenv("FLEX_HOME"));
                if(SDK == null)
-                       SDK = 
FilenameNormalization.normalize("../compiler/generated/dist/sdk");              
  
+               {
+            SDK = FilenameNormalization
+            .normalize("../../flex-sdk");
+               File mxmlc = new File(SDK + "/lib/mxmlc.jar");
+               if (!mxmlc.exists())
+                   SDK = FilenameNormalization
+                       .normalize("../compiler/generated/dist/sdk");
+               }
                System.out.println("environment property - FLEX_HOME = " + SDK);
                
-               FPSDK = p.getProperty("PLAYERGLOBAL_HOME", 
System.getenv("PLAYERGLOBAL_HOME"));
+               FPSDK = p.getProperty(prefix + "PLAYERGLOBAL_HOME", 
System.getenv("PLAYERGLOBAL_HOME"));
                if(FPSDK == null)
                        FPSDK = 
FilenameNormalization.normalize("../compiler/generated/dist/sdk/frameworks/libs/player");
                System.out.println("environment property - PLAYERGLOBAL_HOME = 
" + FPSDK);
         
-        FPVER = p.getProperty("PLAYERGLOBAL_VERSION", 
System.getenv("PLAYERGLOBAL_VERSION"));
+        FPVER = p.getProperty(prefix + "PLAYERGLOBAL_VERSION", 
System.getenv("PLAYERGLOBAL_VERSION"));
         if (FPVER == null)
             FPVER = "11.1";
         System.out.println("environment property - PLAYERGLOBAL_VERSION = " + 
FPVER);
         
-        TLF = p.getProperty("TLF_HOME", System.getenv("TLF_HOME"));
+        TLF = p.getProperty(prefix + "TLF_HOME", System.getenv("TLF_HOME"));
+        if (TLF == null)
+        {
+            TLF = FilenameNormalization.normalize("../../flex-tlf");           
+        }
         System.out.println("environment property - TLF_HOME = " + TLF);
                
-               AIRSDK = p.getProperty("AIR_HOME", System.getenv("AIR_HOME"));
+               AIRSDK = p.getProperty(prefix + "AIR_HOME", 
System.getenv("AIR_HOME"));
                System.out.println("environment property - AIR_HOME = " + 
AIRSDK);
                
-               FDBG = p.getProperty("FLASHPLAYER_DEBUGGER", 
System.getenv("FLASHPLAYER_DEBUGGER"));
+               FDBG = p.getProperty(prefix + "FLASHPLAYER_DEBUGGER", 
System.getenv("FLASHPLAYER_DEBUGGER"));
                System.out.println("environment property - FLASHPLAYER_DEBUGGER 
= " + FDBG);
        }
 

Reply via email to