Repository: flex-falcon
Updated Branches:
refs/heads/featue/flexjs-ant-tasks d1f0c033e -> dfe370ad8
- Moved shared test-code from the compiler-build-tools to a new modules compiler-test-utils
- Removed the PreProcessSourcesMojo from the compiler-build-tools
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/dfe370ad
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/dfe370ad
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/dfe370ad
Branch: refs/heads/featue/flexjs-ant-tasks
Commit: dfe370ad88933de547e536bd33305133537f2116
Parents: d1f0c03
Author: Christofer Dutz <christofer.dutz@codecentric.de>
Authored: Sat Jul 9 11:11:57 2016 +0200
Committer: Christofer Dutz <christofer.dutz@codecentric.de>
Committed: Sat Jul 9 11:11:57 2016 +0200
----------------------------------------------------------------------
compiler-build-tools/pom.xml | 15 +-
.../tools/patchfiles/CopyFileOperation.java | 47 -----
.../compiler/tools/patchfiles/CutOperation.java | 70 ------
.../tools/patchfiles/DeleteFileOperation.java | 39 ----
.../compiler/tools/patchfiles/Operation.java | 29 ---
.../tools/patchfiles/PreProcessSourcesMojo.java | 87 --------
.../tools/patchfiles/ReplaceOperation.java | 62 ------
.../patchfiles/ReplaceRegexpOperation.java | 87 --------
.../org/apache/flex/utils/AntTestAdapter.java | 115 ----------
.../org/apache/flex/utils/EnvProperties.java | 149 -------------
.../flex/utils/FilenameNormalization.java | 109 ----------
.../org/apache/flex/utils/ITestAdapter.java | 50 -----
.../org/apache/flex/utils/MavenTestAdapter.java | 211 -------------------
.../apache/flex/utils/TestAdapterFactory.java | 41 ----
compiler-jx/pom.xml | 2 +-
compiler-test-utils/pom.xml | 57 +++++
.../org/apache/flex/utils/AntTestAdapter.java | 115 ++++++++++
.../org/apache/flex/utils/EnvProperties.java | 149 +++++++++++++
.../flex/utils/FilenameNormalization.java | 109 ++++++++++
.../org/apache/flex/utils/ITestAdapter.java | 50 +++++
.../org/apache/flex/utils/MavenTestAdapter.java | 211 +++++++++++++++++++
.../apache/flex/utils/TestAdapterFactory.java | 41 ++++
compiler/pom.xml | 2 +-
externs/js/pom.xml | 26 ---
pom.xml | 1 +
25 files changed, 740 insertions(+), 1134 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/pom.xml
----------------------------------------------------------------------
diff --git a/compiler-build-tools/pom.xml b/compiler-build-tools/pom.xml
index 89eef36..42e0541 100644
--- a/compiler-build-tools/pom.xml
+++ b/compiler-build-tools/pom.xml
@@ -46,6 +46,11 @@
<version>2.2</version>
</dependency>
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ <version>1.10</version>
+ </dependency>
+ <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
@@ -65,16 +70,6 @@
<artifactId>plexus-utils</artifactId>
<version>3.0.3</version>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-compress</artifactId>
- <version>1.10</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.10</version>
- </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/CopyFileOperation.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/CopyFileOperation.java b/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/CopyFileOperation.java
deleted file mode 100644
index 4049321..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/CopyFileOperation.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed 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.tools.patchfiles;
-
-import org.apache.commons.io.FileUtils;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Created by christoferdutz on 16.03.16.
- */
-public class CopyFileOperation extends Operation {
-
- private File targetDirectory;
-
- public CopyFileOperation() {
- }
-
- public File getTargetDirectory() {
- return targetDirectory;
- }
-
- public void setTargetDirectory(File targetDirectory) {
- this.targetDirectory = targetDirectory;
- }
-
- @Override
- public void perform(File file) throws IOException {
- FileUtils.copyFile(file, new File(targetDirectory, file.getName()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/CutOperation.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/CutOperation.java b/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/CutOperation.java
deleted file mode 100644
index 817d34c..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/CutOperation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed 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.tools.patchfiles;
-
-import org.apache.commons.io.IOUtils;
-
-import java.io.*;
-
-/**
- * Created by christoferdutz on 16.03.16.
- */
-public class CutOperation extends Operation {
-
- private Integer startCuttingLine = -1;
- private Integer stopCuttingLine = -1;
-
- public CutOperation() {
- }
-
- public Integer getStartCuttingLine() {
- return startCuttingLine;
- }
-
- public void setStartCuttingLine(Integer startCuttingLine) {
- this.startCuttingLine = startCuttingLine;
- }
-
- public Integer getStopCuttingLine() {
- return stopCuttingLine;
- }
-
- public void setStopCuttingLine(Integer stopCuttingLine) {
- this.stopCuttingLine = stopCuttingLine;
- }
-
- @Override
- public void perform(File file) throws IOException {
- StringBuilder sb = new StringBuilder();
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new FileReader(file));
- String line;
- for (int lineNumber = 1; (line = reader.readLine()) != null; lineNumber++) {
- if((startCuttingLine > lineNumber) || (lineNumber > stopCuttingLine)) {
- sb.append(line).append("\n");
- }
- }
- } finally {
- if(reader != null) {
- reader.close();
- }
- }
- IOUtils.write(sb.toString(), new FileOutputStream(file), "UTF-8");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/DeleteFileOperation.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/DeleteFileOperation.java b/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/DeleteFileOperation.java
deleted file mode 100644
index f135343..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/DeleteFileOperation.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed 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.tools.patchfiles;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Created by christoferdutz on 16.03.16.
- */
-public class DeleteFileOperation extends Operation {
-
- public DeleteFileOperation() {
- }
-
- @Override
- public void perform(File file) throws IOException {
- if(file.exists()) {
- if(!file.delete()) {
- throw new IOException("Could not delete file " + file.getPath());
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/Operation.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/Operation.java b/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/Operation.java
deleted file mode 100644
index 23065c7..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/Operation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed 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.tools.patchfiles;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Created by christoferdutz on 16.03.16.
- */
-public abstract class Operation {
-
- public abstract void perform(File file) throws IOException;
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/PreProcessSourcesMojo.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/PreProcessSourcesMojo.java b/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/PreProcessSourcesMojo.java
deleted file mode 100644
index d2cce9d..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/PreProcessSourcesMojo.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed 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.tools.patchfiles;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
-import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
-import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Goal which pre-processes the JavaScript input files so they can be processed by EXTERNC.
- */
-@Mojo(name="pre-process-sources",defaultPhase = LifecyclePhase.GENERATE_SOURCES)
-public class PreProcessSourcesMojo
- extends AbstractMojo
-{
-
- @Parameter
- private Set<String> includes = new HashSet<String>();
-
- @Parameter
- private Set<String> excludes = new HashSet<String>();
-
- @Parameter(defaultValue="${project.build.directory}/downloads")
- private File downloadesSourceDirectory;
-
- @Parameter
- private List<Operation> operations;
-
- @Parameter(defaultValue="${project}")
- private MavenProject project;
-
- public void execute()
- throws MojoExecutionException
- {
- SuffixMapping mapping = new SuffixMapping("js", Collections.<String>emptySet());
- SimpleSourceInclusionScanner scan = new SimpleSourceInclusionScanner(includes, excludes);
- scan.addSourceMapping(mapping);
- try {
- Set<File> candidates = scan.getIncludedSources(downloadesSourceDirectory, null);
- for(File candidate : candidates) {
- if(operations != null) {
- getLog().info("- Processing file: " + candidate.getPath());
- for (Operation operation : operations) {
- try {
- operation.perform(candidate);
- } catch (IOException e) {
- throw new MojoExecutionException("Error performing pre-processing operation " +
- operation + " on file " + candidate.getPath(), e);
- }
- }
- }
- }
- } catch (InclusionScanException e) {
- throw new MojoExecutionException("Error scanning files to be processed.", e);
- }
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/ReplaceOperation.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/ReplaceOperation.java b/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/ReplaceOperation.java
deleted file mode 100644
index ed62072..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/ReplaceOperation.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed 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.tools.patchfiles;
-
-import org.apache.commons.io.IOUtils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Created by christoferdutz on 16.03.16.
- */
-public class ReplaceOperation extends Operation {
-
- private String token;
- private String value;
-
- public ReplaceOperation() {
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- @Override
- public void perform(File file) throws IOException {
- String content = IOUtils.toString(new FileInputStream(file), "UTF-8");
- content = content.replaceAll(Pattern.quote(token), Matcher.quoteReplacement((value == null) ? "" : value));
- IOUtils.write(content, new FileOutputStream(file), "UTF-8");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/ReplaceRegexpOperation.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/ReplaceRegexpOperation.java b/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/ReplaceRegexpOperation.java
deleted file mode 100644
index fbfcd2e..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/patchfiles/ReplaceRegexpOperation.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed 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.tools.patchfiles;
-
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.io.IOUtils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-/**
- * Created by christoferdutz on 16.03.16.
- */
-public class ReplaceRegexpOperation extends Operation {
-
- private String match;
- private String replace;
- private String flags;
-
- public ReplaceRegexpOperation() {
- }
-
- public String getMatch() {
- return match;
- }
-
- public void setMatch(String match) {
- this.match = match;
- }
-
- public String getReplace() {
- return replace;
- }
-
- public void setReplace(String replace) {
- this.replace = replace;
- }
-
- public String getFlags() {
- return flags;
- }
-
- public void setFlags(String flags) {
- this.flags = flags;
- }
-
- @Override
- public void perform(File file) throws IOException {
- String content = IOUtils.toString(new FileInputStream(file), "UTF-8");
- // TODO: Add the "flags" support
- String matchExpression = match;
- if(matchExpression.contains("§{file.base}")) {
- matchExpression = matchExpression.replaceAll("§\\{file.base\\}", FilenameUtils.getBaseName(file.getName()));
- }
- String replaceExpression = (replace == null) ? "" : replace;
- if(replaceExpression.contains("§{file.base}")) {
- replaceExpression = replaceExpression.replaceAll("§\\{file.base\\}", FilenameUtils.getBaseName(file.getName()));
- }
- if(replaceExpression.contains("_")) {
- replaceExpression = replaceExpression.replaceAll("_", " ");
- }
- if(replaceExpression.contains("\\n")) {
- replaceExpression = replaceExpression.replaceAll("\\\\n", "\n");
- }
-
- //content = Pattern.compile(matchExpression, Pattern.DOTALL).matcher(content).replaceAll(replaceExpression);
- content = content.replaceAll(matchExpression, replaceExpression);
- IOUtils.write(content, new FileOutputStream(file), "UTF-8");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/utils/AntTestAdapter.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/utils/AntTestAdapter.java b/compiler-build-tools/src/main/java/org/apache/flex/utils/AntTestAdapter.java
deleted file mode 100644
index bbae5d7..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/utils/AntTestAdapter.java
+++ /dev/null
@@ -1,115 +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.utils;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertNotNull;
-
-/**
- * Created by christoferdutz on 23.02.16.
- */
-public class AntTestAdapter implements ITestAdapter {
-
- private static EnvProperties env = EnvProperties.initiate();
-
- private static final File PLAYERGLOBAL_SWC = new File(FilenameNormalization.normalize(env.FPSDK + "\\" + env.FPVER + "\\playerglobal.swc"));
- // The Ant script for compiler.tests copies a standalone player to the temp directory.
- private static final File FLASHPLAYER = new File(FilenameNormalization.normalize(env.FDBG));
-
- private static final File LIBS_ROOT = new File(FilenameNormalization.normalize(env.SDK + "\\frameworks\\libs"));
- private static final File RESOURCE_BUNDLES_ROOT = new File(FilenameNormalization.normalize(env.SDK + "\\frameworks\\locale\\en_US"));
-
- @Override
- public String getTempDir() {
- return FilenameNormalization.normalize("../../target/junit-temp"); // ensure this exists
- }
-
- @Override
- public List<File> getLibraries(boolean withFlex) {
- // Do some checks if all needed environment variables are set.
- if (withFlex) {
- assertNotNull("Environment variable FLEX_HOME is not set", env.SDK);
- }
- assertNotNull("Environment variable PLAYERGLOBAL_HOME is not set", env.FPSDK);
-
- // Create a list of libs needed to compile.
- List<File> libraries = new ArrayList<File>();
- libraries.add(getPlayerglobal());
- if (withFlex)
- {
- libraries.add(getFlexArtifact("framework"));
- libraries.add(getFlexArtifact("rpc"));
- libraries.add(getFlexArtifact("spark"));
- }
- return libraries;
- }
-
- @Override
- public File getPlayerglobal() {
- return PLAYERGLOBAL_SWC;
- }
-
- @Override
- public File getFlashplayerDebugger() {
- return FLASHPLAYER;
- }
-
- @Override
- public String getFlexManifestPath(String type) {
- return env.SDK + "\\frameworks\\" + type + "-manifest.xml";
- }
-
- @Override
- public File getFlexArtifact(String artifactName) {
- return getLib(artifactName);
- }
-
- @Override
- public File getFlexArtifactResourceBundle(String artifactName) {
- return getResourceBundle(artifactName);
- }
-
- @Override
- public String getFlexJsManifestPath(String type) {
- return null;
- }
-
- @Override
- public File getFlexJSArtifact(String artifactName) {
- return null;
- }
-
- @Override
- public File getUnitTestBaseDir() {
- return new File("resources");
- }
-
- private File getLib(String artifactId) {
- return new File(LIBS_ROOT, artifactId + ".swc");
- }
-
- private File getResourceBundle(String artifactId) {
- return new File(RESOURCE_BUNDLES_ROOT, artifactId + "_rb.swc");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/utils/EnvProperties.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/utils/EnvProperties.java b/compiler-build-tools/src/main/java/org/apache/flex/utils/EnvProperties.java
deleted file mode 100644
index c591964..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/utils/EnvProperties.java
+++ /dev/null
@@ -1,149 +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.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/lib");
- }
- System.out.println("environment property - FLEX_HOME = " + SDK);
-
- FPSDK = p.getProperty(prefix + "PLAYERGLOBAL_HOME", System.getenv("PLAYERGLOBAL_HOME"));
- if(FPSDK == null)
- FPSDK = FilenameNormalization.normalize("../../../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/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/utils/FilenameNormalization.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/utils/FilenameNormalization.java b/compiler-build-tools/src/main/java/org/apache/flex/utils/FilenameNormalization.java
deleted file mode 100644
index 7ef5e68..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/utils/FilenameNormalization.java
+++ /dev/null
@@ -1,109 +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.utils;
-
-import java.io.File;
-
-import org.apache.commons.io.FilenameUtils;
-
-/**
- * Utility class to normalize filenames. All Files entering the driver
- * should be run through this class
- */
-public class FilenameNormalization
-{
- /**
- * Normalizes an array of files.
- *
- * @see #normalize(File)
- * @param files Array of files to normalize.
- * @return Array of normalized files.
- */
- public static File[] normalize(File[] files)
- {
- File[] result = new File[files.length];
- for (int i = 0; i < files.length; ++i)
- {
- result[i] = normalize(files[i]);
- }
- return result;
- }
-
- /**
- * Normalize a {@link File}. This method normalizes the case of the file path
- * characters and then calls {@link FilenameUtils#normalize(String)}.
- * @see FilenameUtils#normalize(String)
- * @param f A file.
- * @return The normalized File.
- */
- public static File normalize(File f)
- {
- String caseNormalizedAbsPath = f.getAbsolutePath();
- return new File(FilenameUtils.normalize(caseNormalizedAbsPath));
- }
-
- /**
- * Normalize a {@link String}. This method normalizes the case of the file
- * path characters and then calls {@link FilenameUtils#normalize(String)}.
- *
- * @see FilenameUtils#normalize(String)
- * @param path The fiel path.
- * @return The normalized String. If the given path is already normalized,
- * the original string object will be returned.
- */
- public static String normalize(String path)
- {
- File f = new File(path);
- String caseNormalizedAbsPath = f.getAbsolutePath();
- String normalized = FilenameUtils.normalize(caseNormalizedAbsPath);
-
- if (normalized == null)
- return path;
-
- // If the path is already normalized, return the original string object
- // to prevent duplicated string objects.
- if (normalized.equals(path))
- return path;
- else
- return normalized;
- }
-
- /**
- * Determines whether a file path is in normalized form.
- *
- * @param path A file path.
- */
- public static boolean isNormalized(String path)
- {
- String normalizedPath = normalize(path);
- return normalizedPath.equals(path);
- }
-
- /**
- * Get the normalized file path of a Java {@link File} object.
- *
- * @param file File object.
- * @return Normalized file path.
- */
- public static String normalizeFileToPath(File file)
- {
- return normalize(file.getAbsolutePath());
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/utils/ITestAdapter.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/utils/ITestAdapter.java b/compiler-build-tools/src/main/java/org/apache/flex/utils/ITestAdapter.java
deleted file mode 100644
index 5f35557..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/utils/ITestAdapter.java
+++ /dev/null
@@ -1,50 +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.utils;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * Created by christoferdutz on 23.02.16.
- */
-public interface ITestAdapter {
-
- String getTempDir();
-
- List<File> getLibraries(boolean withFlex);
-
- File getPlayerglobal();
-
- File getFlashplayerDebugger();
-
- String getFlexManifestPath(String type);
-
- File getFlexArtifact(String artifactName);
-
- File getFlexArtifactResourceBundle(String artifactName);
-
- String getFlexJsManifestPath(String type);
-
- File getFlexJSArtifact(String artifactName);
-
- File getUnitTestBaseDir();
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/utils/MavenTestAdapter.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/utils/MavenTestAdapter.java b/compiler-build-tools/src/main/java/org/apache/flex/utils/MavenTestAdapter.java
deleted file mode 100644
index 81da0c8..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/utils/MavenTestAdapter.java
+++ /dev/null
@@ -1,211 +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.utils;
-
-import org.apache.commons.compress.archivers.ArchiveEntry;
-import org.apache.commons.compress.archivers.ArchiveException;
-import org.apache.commons.compress.archivers.ArchiveInputStream;
-import org.apache.commons.compress.archivers.ArchiveStreamFactory;
-import org.apache.commons.io.FilenameUtils;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-
-/**
- * Created by christoferdutz on 23.02.16.
- */
-public class MavenTestAdapter implements ITestAdapter {
-
- private static final int KILOBYTE = 1024;
- private static final int MEGABYTE = KILOBYTE * 1024;
- private static final int BUFFER_MAX = MEGABYTE;
-
- @Override
- public String getTempDir() {
- File tempDir = new File("target/surefire-temp");
- if(!tempDir.exists()) {
- if(!tempDir.mkdirs()) {
- throw new RuntimeException("Could not create temp dir at: " + tempDir.getAbsolutePath());
- }
- }
- return tempDir.getPath();
- }
-
- @Override
- public List<File> getLibraries(boolean withFlex) {
- List<File> libs = new ArrayList<File>();
- libs.add(getPlayerglobal());
- if(withFlex) {
- String flexVersion = System.getProperty("flexVersion");
- libs.add(getDependency("org.apache.flex.framework", "framework", flexVersion, "swc", null));
- libs.add(getDependency("org.apache.flex.framework", "rpc", flexVersion, "swc", null));
- libs.add(getDependency("org.apache.flex.framework", "spark", flexVersion, "swc", null));
- }
- return libs;
- }
-
- @Override
- public File getPlayerglobal() {
- return getDependency("com.adobe.flash.framework", "playerglobal",
- System.getProperty("flashVersion"), "swc", null);
- }
-
- @Override
- public File getFlashplayerDebugger() {
- // TODO: If the archive isn't unpacked, unpack it.
- // TODO: Return a reference to the player debugger executable, depending on the current platform.
- String FLASHPLAYER_DEBUGGER = System.getProperty("FLASHPLAYER_DEBUGGER", null);
- if(FLASHPLAYER_DEBUGGER == null || FLASHPLAYER_DEBUGGER.length() == 0) {
- FLASHPLAYER_DEBUGGER = System.getenv("FLASHPLAYER_DEBUGGER");
- if(FLASHPLAYER_DEBUGGER == null || FLASHPLAYER_DEBUGGER.length() == 0) {
- throw new RuntimeException("You have to specify the location of the flash debug player executable.");
- }
- }
- return new File(FLASHPLAYER_DEBUGGER);
- /*return getDependency("com.adobe.flash.runtime", "player-debugger",
- System.getProperty("flashVersion"), "zip", null);*/
- }
-
- @Override
- public String getFlexManifestPath(String type) {
- File configsZip = getDependency("org.apache.flex.framework", "framework",
- System.getProperty("flexVersion"), "zip", "configs");
- File frameworkDir = configsZip.getParentFile();
- File unpackedConfigsDir = new File(frameworkDir, "configs_zip");
- // If the directory doesn't exist, we have to create it by unpacking the zip archive.
- // This is identical behaviour to Flexmojos, which does the same thing.
- if(!unpackedConfigsDir.exists()) {
- unpackFrameworkConfigs(configsZip, unpackedConfigsDir);
- }
- return new File(unpackedConfigsDir, type + "-manifest.xml").getPath();
- }
-
- @Override
- public File getFlexArtifact(String artifactName) {
- String flexVersion = System.getProperty("flexVersion");
- return getDependency("org.apache.flex.framework", artifactName, flexVersion, "swc", null);
- }
-
- @Override
- public File getFlexArtifactResourceBundle(String artifactName) {
- String flexVersion = System.getProperty("flexVersion");
- return getDependency("org.apache.flex.framework", artifactName, flexVersion, "rb.swc", "en_US");
- }
-
- @Override
- public String getFlexJsManifestPath(String type) {
- File configsZip = getDependency("org.apache.flex.framework.flexjs", "framework",
- System.getProperty("flexJsVersion"), "zip", "configs");
- File frameworkDir = configsZip.getParentFile();
- File unpackedConfigsDir = new File(frameworkDir, "configs_zip");
- // If the directory doesn't exist, we have to create it by unpacking the zip archive.
- // This is identical behaviour to Flexmojos, which does the same thing.
- if(!unpackedConfigsDir.exists()) {
- unpackFrameworkConfigs(configsZip, unpackedConfigsDir);
- }
- return new File(unpackedConfigsDir, type + "-manifest.xml").getPath();
- }
-
- @Override
- public File getFlexJSArtifact(String artifactName) {
- String flexJsVersion = System.getProperty("flexJsVersion");
- return getDependency("org.apache.flex.framework.flexjs", artifactName, flexJsVersion, "swc", null);
- }
-
- @Override
- public File getUnitTestBaseDir() {
- return new File(FilenameUtils.normalize("target/test-classes"));
- }
-
- private File getDependency(String groupId, String artifactId, String version, String type, String classifier) {
- String dependencyPath = System.getProperty("mavenLocalRepoDir") + File.separator +
- groupId.replaceAll("\\.", Matcher.quoteReplacement(File.separator)) + File.separator + artifactId + File.separator + version +
- File.separator + artifactId + "-" + version + ((classifier != null) ? "-" + classifier : "") + "." +
- type;
- File dependency = new File(dependencyPath);
- if(!dependency.exists()) {
- throw new RuntimeException("Could not read SWC dependency at " + dependency.getAbsolutePath());
- }
- return dependency;
- }
-
- private void unpackFrameworkConfigs(File configZip, File outputDirectory) {
- final byte[] data = new byte[BUFFER_MAX];
- ArchiveInputStream archiveInputStream = null;
- ArchiveEntry entry;
- try {
- archiveInputStream = new ArchiveStreamFactory().createArchiveInputStream(
- new BufferedInputStream(new FileInputStream(configZip)));
- if(!outputDirectory.exists() && !outputDirectory.mkdirs()) {
- throw new RuntimeException("Could not create output directory for config zip at " +
- outputDirectory.getPath());
- }
- while ((entry = archiveInputStream.getNextEntry()) != null) {
- final File outputFile = new File(outputDirectory, entry.getName());
-
- // Entry is a directory.
- if (entry.isDirectory()) {
- if (!outputFile.exists()) {
- if(!outputFile.mkdirs()) {
- throw new RuntimeException(
- "Could not create output directory " + outputFile.getAbsolutePath());
- }
- }
- }
-
- // Entry is a file.
- else {
- final FileOutputStream fos = new FileOutputStream(outputFile);
- BufferedOutputStream dest = null;
- try {
- dest = new BufferedOutputStream(fos, BUFFER_MAX);
-
- int count;
- while ((count = archiveInputStream.read(data, 0, BUFFER_MAX)) != -1) {
- dest.write(data, 0, count);
- }
- } finally {
- if(dest != null) {
- dest.flush();
- dest.close();
- }
- }
- }
- }
- } catch (FileNotFoundException e) {
- throw new RuntimeException("Error unpacking resources", e);
- } catch (IOException e) {
- throw new RuntimeException("Error unpacking resources", e);
- } catch (ArchiveException e) {
- throw new RuntimeException("Error unpacking resources", e);
- } finally {
- if(archiveInputStream != null) {
- try {
- archiveInputStream.close();
- } catch(Exception e) {
- // Ignore...
- }
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-build-tools/src/main/java/org/apache/flex/utils/TestAdapterFactory.java
----------------------------------------------------------------------
diff --git a/compiler-build-tools/src/main/java/org/apache/flex/utils/TestAdapterFactory.java b/compiler-build-tools/src/main/java/org/apache/flex/utils/TestAdapterFactory.java
deleted file mode 100644
index ccdb0c2..0000000
--- a/compiler-build-tools/src/main/java/org/apache/flex/utils/TestAdapterFactory.java
+++ /dev/null
@@ -1,41 +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.utils;
-
-/**
- * Created by christoferdutz on 10.03.16.
- */
-public class TestAdapterFactory {
-
- private static final ITestAdapter adapter =
- System.getProperty("buildType", "Ant").equals("Maven") ?
- new MavenTestAdapter() : new AntTestAdapter();
-
- /**
- * Depending on the "buildType" system-property, create the corresponding test-adapter
- * Make the AntTestAdapter the default.
- *
- * @return test adapter instance for the given type of build.
- */
- public static ITestAdapter getTestAdapter() {
- return adapter;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-jx/pom.xml
----------------------------------------------------------------------
diff --git a/compiler-jx/pom.xml b/compiler-jx/pom.xml
index 7b322a0..4e22532 100644
--- a/compiler-jx/pom.xml
+++ b/compiler-jx/pom.xml
@@ -117,7 +117,7 @@
<dependency>
<groupId>org.apache.flex.flexjs.compiler</groupId>
- <artifactId>compiler-build-tools</artifactId>
+ <artifactId>compiler-test-utils</artifactId>
<version>0.7.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-test-utils/pom.xml
----------------------------------------------------------------------
diff --git a/compiler-test-utils/pom.xml b/compiler-test-utils/pom.xml
new file mode 100644
index 0000000..841b556
--- /dev/null
+++ b/compiler-test-utils/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.flex.flexjs</groupId>
+ <artifactId>flexjs-parent</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.flex.flexjs.compiler</groupId>
+ <artifactId>compiler-test-utils</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+
+ <name>Apache Flex - FlexJS: Test Utils</name>
+ <description>
+ Shared test code, which is needed by the compiler and the compiler-jx test-suites.
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ <version>1.10</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-test-utils/src/main/java/org/apache/flex/utils/AntTestAdapter.java
----------------------------------------------------------------------
diff --git a/compiler-test-utils/src/main/java/org/apache/flex/utils/AntTestAdapter.java b/compiler-test-utils/src/main/java/org/apache/flex/utils/AntTestAdapter.java
new file mode 100644
index 0000000..ec59556
--- /dev/null
+++ b/compiler-test-utils/src/main/java/org/apache/flex/utils/AntTestAdapter.java
@@ -0,0 +1,115 @@
+/*
+ *
+ * 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 org.junit.Assert;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by christoferdutz on 23.02.16.
+ */
+public class AntTestAdapter implements ITestAdapter {
+
+ private static EnvProperties env = EnvProperties.initiate();
+
+ private static final File PLAYERGLOBAL_SWC = new File(FilenameNormalization.normalize(env.FPSDK + "\\" + env.FPVER + "\\playerglobal.swc"));
+ // The Ant script for compiler.tests copies a standalone player to the temp directory.
+ private static final File FLASHPLAYER = new File(FilenameNormalization.normalize(env.FDBG));
+
+ private static final File LIBS_ROOT = new File(FilenameNormalization.normalize(env.SDK + "\\frameworks\\libs"));
+ private static final File RESOURCE_BUNDLES_ROOT = new File(FilenameNormalization.normalize(env.SDK + "\\frameworks\\locale\\en_US"));
+
+ @Override
+ public String getTempDir() {
+ return FilenameNormalization.normalize("../../target/junit-temp"); // ensure this exists
+ }
+
+ @Override
+ public List<File> getLibraries(boolean withFlex) {
+ // Do some checks if all needed environment variables are set.
+ if (withFlex) {
+ Assert.assertNotNull("Environment variable FLEX_HOME is not set", env.SDK);
+ }
+ Assert.assertNotNull("Environment variable PLAYERGLOBAL_HOME is not set", env.FPSDK);
+
+ // Create a list of libs needed to compile.
+ List<File> libraries = new ArrayList<File>();
+ libraries.add(getPlayerglobal());
+ if (withFlex)
+ {
+ libraries.add(getFlexArtifact("framework"));
+ libraries.add(getFlexArtifact("rpc"));
+ libraries.add(getFlexArtifact("spark"));
+ }
+ return libraries;
+ }
+
+ @Override
+ public File getPlayerglobal() {
+ return PLAYERGLOBAL_SWC;
+ }
+
+ @Override
+ public File getFlashplayerDebugger() {
+ return FLASHPLAYER;
+ }
+
+ @Override
+ public String getFlexManifestPath(String type) {
+ return env.SDK + "\\frameworks\\" + type + "-manifest.xml";
+ }
+
+ @Override
+ public File getFlexArtifact(String artifactName) {
+ return getLib(artifactName);
+ }
+
+ @Override
+ public File getFlexArtifactResourceBundle(String artifactName) {
+ return getResourceBundle(artifactName);
+ }
+
+ @Override
+ public String getFlexJsManifestPath(String type) {
+ return null;
+ }
+
+ @Override
+ public File getFlexJSArtifact(String artifactName) {
+ return null;
+ }
+
+ @Override
+ public File getUnitTestBaseDir() {
+ return new File("resources");
+ }
+
+ private File getLib(String artifactId) {
+ return new File(LIBS_ROOT, artifactId + ".swc");
+ }
+
+ private File getResourceBundle(String artifactId) {
+ return new File(RESOURCE_BUNDLES_ROOT, artifactId + "_rb.swc");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-test-utils/src/main/java/org/apache/flex/utils/EnvProperties.java
----------------------------------------------------------------------
diff --git a/compiler-test-utils/src/main/java/org/apache/flex/utils/EnvProperties.java b/compiler-test-utils/src/main/java/org/apache/flex/utils/EnvProperties.java
new file mode 100644
index 0000000..c591964
--- /dev/null
+++ b/compiler-test-utils/src/main/java/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/lib");
+ }
+ System.out.println("environment property - FLEX_HOME = " + SDK);
+
+ FPSDK = p.getProperty(prefix + "PLAYERGLOBAL_HOME", System.getenv("PLAYERGLOBAL_HOME"));
+ if(FPSDK == null)
+ FPSDK = FilenameNormalization.normalize("../../../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/dfe370ad/compiler-test-utils/src/main/java/org/apache/flex/utils/FilenameNormalization.java
----------------------------------------------------------------------
diff --git a/compiler-test-utils/src/main/java/org/apache/flex/utils/FilenameNormalization.java b/compiler-test-utils/src/main/java/org/apache/flex/utils/FilenameNormalization.java
new file mode 100644
index 0000000..7ef5e68
--- /dev/null
+++ b/compiler-test-utils/src/main/java/org/apache/flex/utils/FilenameNormalization.java
@@ -0,0 +1,109 @@
+/*
+ *
+ * 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 org.apache.commons.io.FilenameUtils;
+
+/**
+ * Utility class to normalize filenames. All Files entering the driver
+ * should be run through this class
+ */
+public class FilenameNormalization
+{
+ /**
+ * Normalizes an array of files.
+ *
+ * @see #normalize(File)
+ * @param files Array of files to normalize.
+ * @return Array of normalized files.
+ */
+ public static File[] normalize(File[] files)
+ {
+ File[] result = new File[files.length];
+ for (int i = 0; i < files.length; ++i)
+ {
+ result[i] = normalize(files[i]);
+ }
+ return result;
+ }
+
+ /**
+ * Normalize a {@link File}. This method normalizes the case of the file path
+ * characters and then calls {@link FilenameUtils#normalize(String)}.
+ * @see FilenameUtils#normalize(String)
+ * @param f A file.
+ * @return The normalized File.
+ */
+ public static File normalize(File f)
+ {
+ String caseNormalizedAbsPath = f.getAbsolutePath();
+ return new File(FilenameUtils.normalize(caseNormalizedAbsPath));
+ }
+
+ /**
+ * Normalize a {@link String}. This method normalizes the case of the file
+ * path characters and then calls {@link FilenameUtils#normalize(String)}.
+ *
+ * @see FilenameUtils#normalize(String)
+ * @param path The fiel path.
+ * @return The normalized String. If the given path is already normalized,
+ * the original string object will be returned.
+ */
+ public static String normalize(String path)
+ {
+ File f = new File(path);
+ String caseNormalizedAbsPath = f.getAbsolutePath();
+ String normalized = FilenameUtils.normalize(caseNormalizedAbsPath);
+
+ if (normalized == null)
+ return path;
+
+ // If the path is already normalized, return the original string object
+ // to prevent duplicated string objects.
+ if (normalized.equals(path))
+ return path;
+ else
+ return normalized;
+ }
+
+ /**
+ * Determines whether a file path is in normalized form.
+ *
+ * @param path A file path.
+ */
+ public static boolean isNormalized(String path)
+ {
+ String normalizedPath = normalize(path);
+ return normalizedPath.equals(path);
+ }
+
+ /**
+ * Get the normalized file path of a Java {@link File} object.
+ *
+ * @param file File object.
+ * @return Normalized file path.
+ */
+ public static String normalizeFileToPath(File file)
+ {
+ return normalize(file.getAbsolutePath());
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-test-utils/src/main/java/org/apache/flex/utils/ITestAdapter.java
----------------------------------------------------------------------
diff --git a/compiler-test-utils/src/main/java/org/apache/flex/utils/ITestAdapter.java b/compiler-test-utils/src/main/java/org/apache/flex/utils/ITestAdapter.java
new file mode 100644
index 0000000..5f35557
--- /dev/null
+++ b/compiler-test-utils/src/main/java/org/apache/flex/utils/ITestAdapter.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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.util.List;
+
+/**
+ * Created by christoferdutz on 23.02.16.
+ */
+public interface ITestAdapter {
+
+ String getTempDir();
+
+ List<File> getLibraries(boolean withFlex);
+
+ File getPlayerglobal();
+
+ File getFlashplayerDebugger();
+
+ String getFlexManifestPath(String type);
+
+ File getFlexArtifact(String artifactName);
+
+ File getFlexArtifactResourceBundle(String artifactName);
+
+ String getFlexJsManifestPath(String type);
+
+ File getFlexJSArtifact(String artifactName);
+
+ File getUnitTestBaseDir();
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-test-utils/src/main/java/org/apache/flex/utils/MavenTestAdapter.java
----------------------------------------------------------------------
diff --git a/compiler-test-utils/src/main/java/org/apache/flex/utils/MavenTestAdapter.java b/compiler-test-utils/src/main/java/org/apache/flex/utils/MavenTestAdapter.java
new file mode 100644
index 0000000..81da0c8
--- /dev/null
+++ b/compiler-test-utils/src/main/java/org/apache/flex/utils/MavenTestAdapter.java
@@ -0,0 +1,211 @@
+/*
+ *
+ * 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 org.apache.commons.compress.archivers.ArchiveEntry;
+import org.apache.commons.compress.archivers.ArchiveException;
+import org.apache.commons.compress.archivers.ArchiveInputStream;
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.io.FilenameUtils;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+
+/**
+ * Created by christoferdutz on 23.02.16.
+ */
+public class MavenTestAdapter implements ITestAdapter {
+
+ private static final int KILOBYTE = 1024;
+ private static final int MEGABYTE = KILOBYTE * 1024;
+ private static final int BUFFER_MAX = MEGABYTE;
+
+ @Override
+ public String getTempDir() {
+ File tempDir = new File("target/surefire-temp");
+ if(!tempDir.exists()) {
+ if(!tempDir.mkdirs()) {
+ throw new RuntimeException("Could not create temp dir at: " + tempDir.getAbsolutePath());
+ }
+ }
+ return tempDir.getPath();
+ }
+
+ @Override
+ public List<File> getLibraries(boolean withFlex) {
+ List<File> libs = new ArrayList<File>();
+ libs.add(getPlayerglobal());
+ if(withFlex) {
+ String flexVersion = System.getProperty("flexVersion");
+ libs.add(getDependency("org.apache.flex.framework", "framework", flexVersion, "swc", null));
+ libs.add(getDependency("org.apache.flex.framework", "rpc", flexVersion, "swc", null));
+ libs.add(getDependency("org.apache.flex.framework", "spark", flexVersion, "swc", null));
+ }
+ return libs;
+ }
+
+ @Override
+ public File getPlayerglobal() {
+ return getDependency("com.adobe.flash.framework", "playerglobal",
+ System.getProperty("flashVersion"), "swc", null);
+ }
+
+ @Override
+ public File getFlashplayerDebugger() {
+ // TODO: If the archive isn't unpacked, unpack it.
+ // TODO: Return a reference to the player debugger executable, depending on the current platform.
+ String FLASHPLAYER_DEBUGGER = System.getProperty("FLASHPLAYER_DEBUGGER", null);
+ if(FLASHPLAYER_DEBUGGER == null || FLASHPLAYER_DEBUGGER.length() == 0) {
+ FLASHPLAYER_DEBUGGER = System.getenv("FLASHPLAYER_DEBUGGER");
+ if(FLASHPLAYER_DEBUGGER == null || FLASHPLAYER_DEBUGGER.length() == 0) {
+ throw new RuntimeException("You have to specify the location of the flash debug player executable.");
+ }
+ }
+ return new File(FLASHPLAYER_DEBUGGER);
+ /*return getDependency("com.adobe.flash.runtime", "player-debugger",
+ System.getProperty("flashVersion"), "zip", null);*/
+ }
+
+ @Override
+ public String getFlexManifestPath(String type) {
+ File configsZip = getDependency("org.apache.flex.framework", "framework",
+ System.getProperty("flexVersion"), "zip", "configs");
+ File frameworkDir = configsZip.getParentFile();
+ File unpackedConfigsDir = new File(frameworkDir, "configs_zip");
+ // If the directory doesn't exist, we have to create it by unpacking the zip archive.
+ // This is identical behaviour to Flexmojos, which does the same thing.
+ if(!unpackedConfigsDir.exists()) {
+ unpackFrameworkConfigs(configsZip, unpackedConfigsDir);
+ }
+ return new File(unpackedConfigsDir, type + "-manifest.xml").getPath();
+ }
+
+ @Override
+ public File getFlexArtifact(String artifactName) {
+ String flexVersion = System.getProperty("flexVersion");
+ return getDependency("org.apache.flex.framework", artifactName, flexVersion, "swc", null);
+ }
+
+ @Override
+ public File getFlexArtifactResourceBundle(String artifactName) {
+ String flexVersion = System.getProperty("flexVersion");
+ return getDependency("org.apache.flex.framework", artifactName, flexVersion, "rb.swc", "en_US");
+ }
+
+ @Override
+ public String getFlexJsManifestPath(String type) {
+ File configsZip = getDependency("org.apache.flex.framework.flexjs", "framework",
+ System.getProperty("flexJsVersion"), "zip", "configs");
+ File frameworkDir = configsZip.getParentFile();
+ File unpackedConfigsDir = new File(frameworkDir, "configs_zip");
+ // If the directory doesn't exist, we have to create it by unpacking the zip archive.
+ // This is identical behaviour to Flexmojos, which does the same thing.
+ if(!unpackedConfigsDir.exists()) {
+ unpackFrameworkConfigs(configsZip, unpackedConfigsDir);
+ }
+ return new File(unpackedConfigsDir, type + "-manifest.xml").getPath();
+ }
+
+ @Override
+ public File getFlexJSArtifact(String artifactName) {
+ String flexJsVersion = System.getProperty("flexJsVersion");
+ return getDependency("org.apache.flex.framework.flexjs", artifactName, flexJsVersion, "swc", null);
+ }
+
+ @Override
+ public File getUnitTestBaseDir() {
+ return new File(FilenameUtils.normalize("target/test-classes"));
+ }
+
+ private File getDependency(String groupId, String artifactId, String version, String type, String classifier) {
+ String dependencyPath = System.getProperty("mavenLocalRepoDir") + File.separator +
+ groupId.replaceAll("\\.", Matcher.quoteReplacement(File.separator)) + File.separator + artifactId + File.separator + version +
+ File.separator + artifactId + "-" + version + ((classifier != null) ? "-" + classifier : "") + "." +
+ type;
+ File dependency = new File(dependencyPath);
+ if(!dependency.exists()) {
+ throw new RuntimeException("Could not read SWC dependency at " + dependency.getAbsolutePath());
+ }
+ return dependency;
+ }
+
+ private void unpackFrameworkConfigs(File configZip, File outputDirectory) {
+ final byte[] data = new byte[BUFFER_MAX];
+ ArchiveInputStream archiveInputStream = null;
+ ArchiveEntry entry;
+ try {
+ archiveInputStream = new ArchiveStreamFactory().createArchiveInputStream(
+ new BufferedInputStream(new FileInputStream(configZip)));
+ if(!outputDirectory.exists() && !outputDirectory.mkdirs()) {
+ throw new RuntimeException("Could not create output directory for config zip at " +
+ outputDirectory.getPath());
+ }
+ while ((entry = archiveInputStream.getNextEntry()) != null) {
+ final File outputFile = new File(outputDirectory, entry.getName());
+
+ // Entry is a directory.
+ if (entry.isDirectory()) {
+ if (!outputFile.exists()) {
+ if(!outputFile.mkdirs()) {
+ throw new RuntimeException(
+ "Could not create output directory " + outputFile.getAbsolutePath());
+ }
+ }
+ }
+
+ // Entry is a file.
+ else {
+ final FileOutputStream fos = new FileOutputStream(outputFile);
+ BufferedOutputStream dest = null;
+ try {
+ dest = new BufferedOutputStream(fos, BUFFER_MAX);
+
+ int count;
+ while ((count = archiveInputStream.read(data, 0, BUFFER_MAX)) != -1) {
+ dest.write(data, 0, count);
+ }
+ } finally {
+ if(dest != null) {
+ dest.flush();
+ dest.close();
+ }
+ }
+ }
+ }
+ } catch (FileNotFoundException e) {
+ throw new RuntimeException("Error unpacking resources", e);
+ } catch (IOException e) {
+ throw new RuntimeException("Error unpacking resources", e);
+ } catch (ArchiveException e) {
+ throw new RuntimeException("Error unpacking resources", e);
+ } finally {
+ if(archiveInputStream != null) {
+ try {
+ archiveInputStream.close();
+ } catch(Exception e) {
+ // Ignore...
+ }
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler-test-utils/src/main/java/org/apache/flex/utils/TestAdapterFactory.java
----------------------------------------------------------------------
diff --git a/compiler-test-utils/src/main/java/org/apache/flex/utils/TestAdapterFactory.java b/compiler-test-utils/src/main/java/org/apache/flex/utils/TestAdapterFactory.java
new file mode 100644
index 0000000..ccdb0c2
--- /dev/null
+++ b/compiler-test-utils/src/main/java/org/apache/flex/utils/TestAdapterFactory.java
@@ -0,0 +1,41 @@
+/*
+ *
+ * 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;
+
+/**
+ * Created by christoferdutz on 10.03.16.
+ */
+public class TestAdapterFactory {
+
+ private static final ITestAdapter adapter =
+ System.getProperty("buildType", "Ant").equals("Maven") ?
+ new MavenTestAdapter() : new AntTestAdapter();
+
+ /**
+ * Depending on the "buildType" system-property, create the corresponding test-adapter
+ * Make the AntTestAdapter the default.
+ *
+ * @return test adapter instance for the given type of build.
+ */
+ public static ITestAdapter getTestAdapter() {
+ return adapter;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/compiler/pom.xml
----------------------------------------------------------------------
diff --git a/compiler/pom.xml b/compiler/pom.xml
index 7da563f..8872035 100644
--- a/compiler/pom.xml
+++ b/compiler/pom.xml
@@ -422,7 +422,7 @@
<dependency>
<groupId>org.apache.flex.flexjs.compiler</groupId>
- <artifactId>compiler-build-tools</artifactId>
+ <artifactId>compiler-test-utils</artifactId>
<version>0.7.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/externs/js/pom.xml
----------------------------------------------------------------------
diff --git a/externs/js/pom.xml b/externs/js/pom.xml
index d122ea3..0ab1c3c 100644
--- a/externs/js/pom.xml
+++ b/externs/js/pom.xml
@@ -218,32 +218,6 @@
</dependency>
</dependencies>
</plugin>
- <plugin>
- <groupId>org.apache.flex.flexjs.compiler</groupId>
- <artifactId>compiler-build-tools</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <executions>
- <execution>
- <id>pre-process-actionscript-sources</id>
- <phase>process-sources</phase>
- <goals>
- <goal>pre-process-sources</goal>
- </goals>
- <configuration>
- <operations>
- <replace-regexp-operation>
- <match>base\:Number\)</match>
- <replace>base:Number = 10)</replace>
- </replace-regexp-operation>
- </operations>
- <downloadesSourceDirectory>target/generated-sources/externc</downloadesSourceDirectory>
- <includes>
- <include>functions/parseInt.as</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dfe370ad/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2e8cb3e..c81eec6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -119,6 +119,7 @@
<modules>
<module>compiler</module>
<module>compiler-jx</module>
+ <module>compiler-test-utils</module>
<module>debugger</module>
<module>flex-compiler-oem</module>
<module>flexjs-ant-tasks</module>
|