Streamlined the two EnvProperties - The one in compiler.tests now contains the missing ASJS property - Moved the EnvProperties in compiler.jx.tests to be in the same package as the one in compiler.tests - Replaced the code of the EnvProperties in compiler.jx.tests with the one in compiler.tests
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/3152e676 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/3152e676 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/3152e676 Branch: refs/heads/master Commit: 3152e6765f28298d7992d6e9e8391f9a35aeda97 Parents: 1270e03 Author: Christofer Dutz <[email protected]> Authored: Sat Mar 12 12:13:15 2016 +0100 Committer: Christofer Dutz <[email protected]> Committed: Sat Mar 12 12:13:15 2016 +0100 ---------------------------------------------------------------------- .../flex/compiler/internal/test/TestBase.java | 2 +- .../flex/compiler/utils/EnvProperties.java | 146 ------------------ .../org/apache/flex/utils/EnvProperties.java | 149 +++++++++++++++++++ .../org/apache/flex/utils/EnvProperties.java | 12 +- 4 files changed, 161 insertions(+), 148 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3152e676/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java index edaa29f..f54a8cd 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java @@ -60,7 +60,7 @@ import org.apache.flex.compiler.tree.as.IASNode; import org.apache.flex.compiler.tree.as.IFileNode; import org.apache.flex.compiler.tree.mxml.IMXMLFileNode; import org.apache.flex.compiler.units.ICompilationUnit; -import org.apache.flex.compiler.utils.EnvProperties; +import org.apache.flex.utils.EnvProperties; import org.apache.flex.compiler.visitor.as.IASBlockWalker; import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker; import org.apache.flex.utils.FilenameNormalization; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3152e676/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 deleted file mode 100644 index cbb1497..0000000 --- a/compiler.jx.tests/src/org/apache/flex/compiler/utils/EnvProperties.java +++ /dev/null @@ -1,146 +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.utils; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Properties; - -import org.apache.flex.utils.FilenameNormalization; - -/** - * EnvProperties checks in following order for a value. - * - * 1) unittest.properties 2) environment variables 3) for key FLEX_HOME & - * PLAYERGLOBAL_HOME sets a default value. - */ -public class EnvProperties -{ - - /** - * FLEX_HOME - */ - public String SDK; - - /** - * PLAYERGLOBAL_HOME - */ - public String FPSDK; - - /** - * AIR_HOME - */ - public String AIRSDK; - - /** - * FLASHPLAYER_DEBUGGER - */ - public String FDBG; - - /** - * ASJS_HOME - */ - public String ASJS; - - /** - * PLAYERGLOBAL_VERSION - */ - public String FPVER; - - private static EnvProperties env; - - public static EnvProperties initiate() - { - if (env == null) - { - env = new EnvProperties(); - env.setup(); - } - return env; - } - - private void setup() - { - String prefix = ""; - Properties p = new Properties(); - 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(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(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(prefix + "PLAYERGLOBAL_VERSION", System.getenv("PLAYERGLOBAL_VERSION")); - if (FPVER == null) - FPVER = "11.1"; - System.out.println("environment property - PLAYERGLOBAL_VERSION = " + FPVER); - - 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")); - System.out.println("environment property - FLASHPLAYER_DEBUGGER = " - + FDBG); - - ASJS = p.getProperty(prefix + "ASJS_HOME", System.getenv("ASJS_HOME")); - if (ASJS == null) - ASJS = FilenameNormalization - .normalize("../../flex-asjs"); - System.out.println("environment property - ASJS_HOME = " + ASJS); - } - -} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3152e676/compiler.jx.tests/src/org/apache/flex/utils/EnvProperties.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/utils/EnvProperties.java b/compiler.jx.tests/src/org/apache/flex/utils/EnvProperties.java new file mode 100644 index 0000000..97d4835 --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/utils/EnvProperties.java @@ -0,0 +1,149 @@ +/* + * + * 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.utils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Properties; + + +/** + * EnvProperties checks in following order for a value. + * + * 1) unittest.properties + * 2) environment variables + * 3) for key FLEX_HOME & PLAYERGLOBAL_HOME sets a default value. + */ +public class EnvProperties { + + /** + * FLEX_HOME + */ + public String SDK; + + /** + * TLF_HOME + */ + public String TLF; + + /** + * PLAYERGLOBAL_HOME + */ + public String FPSDK; + + /** + * AIR_HOME + */ + public String AIRSDK; + + /** + * FLASHPLAYER_DEBUGGER + */ + public String FDBG; + + /** + * ASJS_HOME + */ + public String ASJS; + + /** + * PLAYERGLOBAL_VERSION + */ + public String FPVER; + + + private static EnvProperties env; + + public static EnvProperties initiate() { + if(env == null) { + env = new EnvProperties(); + env.setup(); + } + return env; + } + + private void setup() + { + String prefix = ""; + Properties p = new Properties(); + 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) { + // Ignore + } + } catch (IOException e) { + // Ignore + } + + 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(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(prefix + "PLAYERGLOBAL_VERSION", System.getenv("PLAYERGLOBAL_VERSION")); + if (FPVER == null) + FPVER = "11.1"; + System.out.println("environment property - PLAYERGLOBAL_VERSION = " + FPVER); + + 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(prefix + "AIR_HOME", System.getenv("AIR_HOME")); + System.out.println("environment property - AIR_HOME = " + AIRSDK); + + FDBG = p.getProperty(prefix + "FLASHPLAYER_DEBUGGER", System.getenv("FLASHPLAYER_DEBUGGER")); + System.out.println("environment property - FLASHPLAYER_DEBUGGER = " + FDBG); + + ASJS = p.getProperty(prefix + "ASJS_HOME", System.getenv("ASJS_HOME")); + if (ASJS == null) + ASJS = FilenameNormalization.normalize("../../flex-asjs"); + System.out.println("environment property - ASJS_HOME = " + ASJS); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3152e676/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 b204b1b..be22fee 100644 --- a/compiler.tests/src/org/apache/flex/utils/EnvProperties.java +++ b/compiler.tests/src/org/apache/flex/utils/EnvProperties.java @@ -61,6 +61,11 @@ public class EnvProperties { public String FDBG; /** + * ASJS_HOME + */ + public String ASJS; + + /** * PLAYERGLOBAL_VERSION */ public String FPVER; @@ -131,9 +136,14 @@ public class EnvProperties { AIRSDK = p.getProperty(prefix + "AIR_HOME", System.getenv("AIR_HOME")); System.out.println("environment property - AIR_HOME = " + AIRSDK); - + FDBG = p.getProperty(prefix + "FLASHPLAYER_DEBUGGER", System.getenv("FLASHPLAYER_DEBUGGER")); System.out.println("environment property - FLASHPLAYER_DEBUGGER = " + FDBG); + + ASJS = p.getProperty(prefix + "ASJS_HOME", System.getenv("ASJS_HOME")); + if (ASJS == null) + ASJS = FilenameNormalization.normalize("../../flex-asjs"); + System.out.println("environment property - ASJS_HOME = " + ASJS); } }
