You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jo...@apache.org on 2014/07/10 01:39:22 UTC
[26/26] git commit: [flex-falcon] [refs/heads/experimental/VF2JS] -
Fixed test file path issues and 'incremental writing' on 'writer'.
Fixed test file path issues and 'incremental writing' on 'writer'.
Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/3aa38f94
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/3aa38f94
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/3aa38f94
Branch: refs/heads/experimental/VF2JS
Commit: 3aa38f9460602981268ff6bcd1e1951b402f63bc
Parents: 0243e6f
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Mon Jul 7 15:08:57 2014 +0200
Committer: Jose Barragan <jo...@apache.org>
Committed: Thu Jul 10 01:36:17 2014 +0200
----------------------------------------------------------------------
.../codegen/js/vf2js/TestVF2JSFile.java | 10 ++++
.../codegen/js/vf2js/TestVF2JSProject.java | 9 ++--
.../compiler/internal/test/VF2JSTestBase.java | 51 ++++++++++----------
3 files changed, 39 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3aa38f94/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java
index a48bda8..dd86381 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java
@@ -20,11 +20,13 @@
package org.apache.flex.compiler.internal.codegen.js.vf2js;
import java.io.File;
+import java.util.List;
import org.apache.flex.compiler.driver.IBackend;
import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
import org.apache.flex.compiler.internal.test.VF2JSTestBase;
import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.utils.FilenameNormalization;
import org.junit.Test;
/**
@@ -54,6 +56,14 @@ public class TestVF2JSFile extends VF2JSTestBase
}
@Override
+ protected void addSourcePaths(List<File> sourcePaths)
+ {
+ sourcePaths.add(new File(FilenameNormalization.normalize("test-files/vf2js/files")));
+
+ super.addSourcePaths(sourcePaths);
+ }
+
+ @Override
protected IBackend createBackend()
{
return new FlexJSBackend();
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3aa38f94/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
index 2e534c1..282bf19 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
@@ -40,19 +40,19 @@ import org.junit.Test;
public class TestVF2JSProject extends VF2JSTestBase
{
- private static String projectDirPath = "vf2js/projects";
-
@Override
public void setUp()
{
project = new FlexJSProject(workspace);
+
super.setUp();
}
@Test
public void testSimpleMXMLProject()
{
- String testDirPath = projectDirPath + "/simpleMXML";
+ String testDirPath = new File("test-files").getAbsolutePath()
+ + "/vf2js/projects/simpleMXML/src";
String fileName = "SimpleMXML";
@@ -80,8 +80,7 @@ public class TestVF2JSProject extends VF2JSTestBase
//System.out.println(compiledResult);
- String expectedFilePath = new File("test-files").getAbsolutePath()
- + File.separator + testDirPath + File.separator
+ String expectedFilePath = testDirPath + File.separator
+ compiledFileName + "_result" + "."
+ backend.getOutputExtension();
String expectedResult = readCodeFile(new File(expectedFilePath));
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3aa38f94/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java
index 6a5f7b3..de0ba6d 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java
@@ -29,6 +29,7 @@ import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.flex.compiler.config.Configurator;
import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.as.ASFilterWriter;
import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSBackend;
import org.apache.flex.compiler.internal.mxml.MXMLNamespaceMapping;
import org.apache.flex.compiler.internal.projects.FlexJSProject;
@@ -56,13 +57,6 @@ public class VF2JSTestBase extends TestBase
project = new FlexJSProject(workspace);
super.setUp();
-
- asEmitter = backend.createEmitter(writer);
- mxmlEmitter = backend.createMXMLEmitter(writer);
-
- asBlockWalker = backend.createWalker(project, errors, asEmitter);
- mxmlBlockWalker = backend.createMXMLWalker(project, errors,
- mxmlEmitter, asEmitter, asBlockWalker);
}
@Override
@@ -107,7 +101,7 @@ public class VF2JSTestBase extends TestBase
@Override
protected void addSourcePaths(List<File> sourcePaths)
{
- sourcePaths.add(new File(FilenameNormalization.normalize("test-files/vf2js/files")));
+ //sourcePaths.add(new File(FilenameNormalization.normalize("")));
super.addSourcePaths(sourcePaths);
}
@@ -160,20 +154,11 @@ public class VF2JSTestBase extends TestBase
protected List<String> compileProject(String inputFileName,
String inputDirName)
{
- String path = new File(FilenameNormalization.normalize("test-files"
- + File.separator + inputDirName)).getPath();
-
- File[] files = new File(path).listFiles();
-
- createTempProjectDir(files, "test-files"
- + File.separator + inputDirName);
+ createTempProjectDir(new File(inputDirName).listFiles(), "");
- inputDirName = inputDirName + File.separator + "src";
-
List<String> compiledFileNames = new ArrayList<String>();
- String mainFileName = "temp" + File.separator + "test-files"
- + File.separator + inputDirName + File.separator
+ String mainFileName = "temp" + File.separator
+ inputFileName + inputFileExtension;
addDependencies();
@@ -204,10 +189,6 @@ public class VF2JSTestBase extends TestBase
if (cuType == ICompilationUnit.UnitType.AS_UNIT
|| cuType == ICompilationUnit.UnitType.MXML_UNIT)
{
- File outputRootDir = new File(
- FilenameNormalization.normalize(tempDir
- + File.separator + inputDirName));
-
String qname = "";
try
{
@@ -221,7 +202,12 @@ public class VF2JSTestBase extends TestBase
compiledFileNames.add(qname.replace(".", "/"));
final File outputClassFile = getOutputClassFile(qname
- + "_output", outputRootDir);
+ + "_output", tempDir);
+
+ ASFilterWriter outputWriter = backend.createWriterBuffer(project);
+
+ asEmitter = backend.createEmitter(outputWriter);
+ asBlockWalker = backend.createWalker(project, errors, asEmitter);
if (cuType == ICompilationUnit.UnitType.AS_UNIT)
{
@@ -229,17 +215,22 @@ public class VF2JSTestBase extends TestBase
}
else
{
+ mxmlEmitter = backend.createMXMLEmitter(outputWriter);
+
+ mxmlBlockWalker = backend.createMXMLWalker(project, errors,
+ mxmlEmitter, asEmitter, asBlockWalker);
+
mxmlBlockWalker.visitCompilationUnit(cu);
}
- System.out.println(writer.toString());
+ //System.out.println(outputWriter.toString());
try
{
BufferedOutputStream out = new BufferedOutputStream(
new FileOutputStream(outputClassFile));
- out.write(writer.toString().getBytes());
+ out.write(outputWriter.toString().getBytes());
out.flush();
out.close();
}
@@ -247,6 +238,14 @@ public class VF2JSTestBase extends TestBase
{
System.out.println(error);
}
+
+ mxmlBlockWalker = null;
+ mxmlEmitter = null;
+
+ asBlockWalker = null;
+ asEmitter = null;
+
+ outputWriter = null;
}
}