You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/01/09 18:49:45 UTC
[royale-compiler] branch develop updated: generate the test swcs in
a phases before the tests run so we don't have to control the order of
execution
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
The following commit(s) were added to refs/heads/develop by this push:
new 449ae99 generate the test swcs in a phases before the tests run so we don't have to control the order of execution
449ae99 is described below
commit 449ae99f52f7a5f47728340b7466d4cb1246abeb
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Jan 9 10:46:37 2018 -0800
generate the test swcs in a phases before the tests run so we don't have to control the order of execution
---
compiler/pom.xml | 91 ++++++++++++++-
compiler/src/test/java/aa/AAAMavenTestExternc.java | 84 --------------
compiler/src/test/java/aa/AAMavenTestSWCs.java | 126 ---------------------
3 files changed, 87 insertions(+), 214 deletions(-)
diff --git a/compiler/pom.xml b/compiler/pom.xml
index 73f28f3..cb40169 100644
--- a/compiler/pom.xml
+++ b/compiler/pom.xml
@@ -34,6 +34,42 @@
<build>
<plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>3.0.2</version>
+ <executions>
+ <execution>
+ <id>copy-externc-resources</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/../compiler-externc/target</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}/../compiler-externc/src/test/config</directory>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-custom-resources</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/target</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/test/config</directory>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<!--
Do all the JFlex code generation
-->
@@ -141,6 +177,56 @@
<sourceRoot>target/generated-sources/antlr</sourceRoot>
</configuration>
</execution>
+ <execution>
+ <id>generate-test-js-typedefs</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>java</executable>
+ <arguments>
+ <argument>-classpath</argument>
+ <classpath />
+ <arguments>org.apache.royale.compiler.clients.EXTERNC</arguments>
+ <argument>-load-config+=../compiler-externc/src/test/config/externc-config.xml</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>generate-test-js-swc</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>java</executable>
+ <arguments>
+ <argument>-classpath</argument>
+ <classpath />
+ <arguments>org.apache.royale.compiler.clients.COMPC</arguments>
+ <argument>-load-config+=../compiler-externc/target/compile-as-config.xml</argument>
+ <argument>-output=../compiler-externc/target/js.swc</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>generate-test-custom-swc</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>java</executable>
+ <arguments>
+ <argument>-classpath</argument>
+ <classpath />
+ <arguments>org.apache.royale.compiler.clients.COMPC</arguments>
+ <argument>-load-config+=target/compile-as-config.xml</argument>
+ <argument>-output=target/custom.swc</argument>
+ </arguments>
+ </configuration>
+ </execution>
</executions>
</plugin>
@@ -313,10 +399,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
- <runOrder>alphabetical</runOrder>
<includes>
- <include>**/AAAMavenTestExternc.java</include>
- <include>**/AAMavenTestSWCs.java</include>
<include>**/*Tests.java</include>
</includes>
<excludes>
@@ -479,7 +562,7 @@
<groupId>org.apache.royale.compiler</groupId>
<artifactId>compiler-externc</artifactId>
<version>0.9.1-SNAPSHOT</version>
- <scope>test</scope>
+ <!--<scope>test</scope>-->
</dependency>
<dependency>
<groupId>junit</groupId>
diff --git a/compiler/src/test/java/aa/AAAMavenTestExternc.java b/compiler/src/test/java/aa/AAAMavenTestExternc.java
deleted file mode 100644
index 66b1e60..0000000
--- a/compiler/src/test/java/aa/AAAMavenTestExternc.java
+++ /dev/null
@@ -1,84 +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 aa;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.royale.compiler.clients.COMPC;
-import org.apache.royale.compiler.clients.EXTERNC;
-import org.apache.royale.compiler.problems.ICompilerProblem;
-import org.apache.royale.swf.io.SWFDump;
-import org.apache.royale.utils.ITestAdapter;
-import org.apache.royale.utils.TestAdapterFactory;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.*;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import org.junit.Test;
-
-/**
- * Base class for AS feature tests which compile AS code with MXMLC and run it in the standalone Flash Player.
- * Copied and modified from MXMLFeatureTestsBase.java
- */
-public class AAAMavenTestExternc
-{
- private static boolean generateResultFile = false;
-
- public AAAMavenTestExternc()
- {
- }
-
- @Test
- public void AAMavenTestSWCs_AA_JS_EXTERNC()
- {
- // Write the MXML into a temp file.
- ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter();
-
- File externcDir = new File(testAdapter.getUnitTestBaseDir(), "../../../compiler-externc");
-
- String[] args = new String[1];
- args[0] = "-load-config+=" + new File(externcDir, "src/test/config/externc-config.xml").getAbsolutePath();
- // Run the COMPC client with the specified command line.
- EXTERNC externc = new EXTERNC();
- externc._mainNoExit(args);
-
- // Check that the SWC compiled cleanly.
- List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
- for (ICompilerProblem problem : externc.problems.getFilteredProblems())
- {
- problems.add(problem);
- }
- assertThat(problems.size(), is(0));
- }
-}
-
diff --git a/compiler/src/test/java/aa/AAMavenTestSWCs.java b/compiler/src/test/java/aa/AAMavenTestSWCs.java
deleted file mode 100644
index 0475b5d..0000000
--- a/compiler/src/test/java/aa/AAMavenTestSWCs.java
+++ /dev/null
@@ -1,126 +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 aa;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.royale.compiler.clients.COMPC;
-import org.apache.royale.compiler.clients.EXTERNC;
-import org.apache.royale.compiler.problems.ICompilerProblem;
-import org.apache.royale.swf.io.SWFDump;
-import org.apache.royale.utils.ITestAdapter;
-import org.apache.royale.utils.TestAdapterFactory;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.*;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import org.junit.Test;
-
-/**
- * Base class for AS feature tests which compile AS code with MXMLC and run it in the standalone Flash Player.
- * Copied and modified from MXMLFeatureTestsBase.java
- */
-public class AAMavenTestSWCs
-{
- private static boolean generateResultFile = false;
-
- public AAMavenTestSWCs()
- {
- }
-
- private void compileSWC(File outputFile, File configFile)
- {
- // Write the MXML into a temp file.
- ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter();
-
- String output = outputFile.getAbsolutePath();
-
- String[] args = new String[]
- {
- "-load-config+=" + configFile.getAbsolutePath(),
- "-output=" + output
- };
-
- // Run the COMPC client with the specified command line.
- COMPC compc = new COMPC();
- compc.mainNoExit(args);
-
- // Check that the SWC compiled cleanly.
- List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
- for (ICompilerProblem problem : compc.getProblems().getFilteredProblems())
- {
- problems.add(problem);
- }
- assertThat(problems.size(), is(0));
- }
-
- @Test
- public void AAMavenTestSWCs_AB_JS_SWC()
- {
- // Write the MXML into a temp file.
- ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter();
-
- File externcDir = new File(testAdapter.getUnitTestBaseDir(), "../../../compiler-externc");
- File outputFile = new File(externcDir, "target/js.swc");
- try {
- FileUtils.copyFile(new File(externcDir, "src/test/config/compile-as-config.xml"),
- new File(externcDir, "target/compile-as-config.xml"));
- }
- catch (IOException e)
- {
- }
-
- compileSWC(outputFile, new File(externcDir, "target/compile-as-config.xml"));
- assertThat(outputFile.exists(), is(true));
- }
-
- @Test
- public void AC_Custom_SWC()
- {
- // Write the MXML into a temp file.
- ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter();
-
- File baseDir = new File(testAdapter.getUnitTestBaseDir(), "../../../compiler");
- File outputFile = new File(baseDir, "target/custom.swc");
- try {
- FileUtils.copyFile(new File(baseDir, "src/test/config/compile-as-config.xml"),
- new File(baseDir, "target/compile-as-config.xml"));
- }
- catch (IOException e)
- {
- }
- compileSWC(outputFile, new File(baseDir, "target/compile-as-config.xml"));
- assertThat(outputFile.exists(), is(true));
- }
-}
-
--
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <co...@royale.apache.org>'].