You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/10/21 09:07:20 UTC
[07/49] git commit: [flex-asjs]
[refs/heads/feature-autobuild/maven-archetypes] - FLEX-35138 - Implement
FlexJS Maven compiler option for 'html-template' - Added the compiler option
"htmlTemplate" - Added a first test for a testsuite implemented using th
FLEX-35138 - Implement FlexJS Maven compiler option for 'html-template'
- Added the compiler option "htmlTemplate"
- Added a first test for a testsuite implemented using the maven-invoker-plugin
NO JIRA:
- Fixed an obvious bug in JSGoogPublisher.java (Was using == to compare for String equality)
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/734e89aa
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/734e89aa
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/734e89aa
Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: 734e89aa884f1b2c909be5a50e7d93631bda0f93
Parents: 3784d29
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Wed Oct 5 13:36:16 2016 +0200
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Wed Oct 5 13:36:16 2016 +0200
----------------------------------------------------------------------
.gitignore | 1 -
pom.xml | 7 +
testsuite/pom.xml | 105 +++++++++++++++
.../custom-html-template/pom.xml | 128 +++++++++++++++++++
.../src/main/flex/HelloWorld.mxml | 30 +++++
.../main/template/custom-js-index-template.html | 30 +++++
.../custom-html-template/verify.groovy | 62 +++++++++
testsuite/src/it/settings.xml | 55 ++++++++
8 files changed, 417 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/734e89aa/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 96c39ca..b37ca3c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -118,7 +118,6 @@ _ReSharper*/
*.zip
*.rar
*.tar
-html-template
#VF2JS generated files
vf2js/frameworks/js/
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/734e89aa/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 90759ba..4f20976 100644
--- a/pom.xml
+++ b/pom.xml
@@ -216,6 +216,13 @@
<module>distribution</module>
</modules>
</profile>
+
+ <profile>
+ <id>run-testsuite</id>
+ <modules>
+ <module>testsuite</module>
+ </modules>
+ </profile>
</profiles>
<repositories>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/734e89aa/testsuite/pom.xml
----------------------------------------------------------------------
diff --git a/testsuite/pom.xml b/testsuite/pom.xml
new file mode 100644
index 0000000..cb1e7e0
--- /dev/null
+++ b/testsuite/pom.xml
@@ -0,0 +1,105 @@
+<?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.framework</groupId>
+ <artifactId>flexjs-framework-parent</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>testsuite</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>Apache Flex - FlexJS: Testsuite</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>2.0.0</version>
+ <configuration>
+ <!-- Define the place the projects are copied to and executed in -->
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <!-- Global settings file used by all tests -->
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <!--
+ Defines the location of the maven local repo
+ of all artifacts needed by the tests
+ -->
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <!-- Runs a test for every pom.xml down two levels from the base directory -->
+ <pomIncludes>*/*/pom.xml</pomIncludes>
+ <!--
+ Define the variables the plugin should replace
+ The plugin will replace any occurrence of '@variable.name@' by
+ the value of '<variable.name>...</variable.name>'
+ -->
+ <filterProperties>
+ <flash.version>${flash.version}</flash.version>
+ <air.version>${air.version}</air.version>
+ <flexjs.compiler.version>${flexjs.compiler.version}</flexjs.compiler.version>
+ <flexjs.typedefs.version>${flexjs.typedefs.version}</flexjs.typedefs.version>
+ <flexjs.framework.version>${project.version}</flexjs.framework.version>
+ <flexjs.build-tools.version>${flexjs.build-tools.version}</flexjs.build-tools.version>
+ </filterProperties>
+
+ <!-- Name of the verify script used to check if a test is successfull -->
+ <postBuildHookScript>verify</postBuildHookScript>
+ <!-- Add the test-dependencies of this module to the classpath of the tests -->
+ <addTestClassPath>true</addTestClassPath>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>3.3.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/734e89aa/testsuite/src/it/compiler-options/custom-html-template/pom.xml
----------------------------------------------------------------------
diff --git a/testsuite/src/it/compiler-options/custom-html-template/pom.xml b/testsuite/src/it/compiler-options/custom-html-template/pom.xml
new file mode 100644
index 0000000..eeb1d43
--- /dev/null
+++ b/testsuite/src/it/compiler-options/custom-html-template/pom.xml
@@ -0,0 +1,128 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.flex.flexjs.testsuite.compiler-options</groupId>
+ <artifactId>custom-html-template</artifactId>
+ <version>@flexjs.framework.version@</version>
+ <packaging>swf</packaging>
+
+ <description>
+ This test-project makes use of the htmlTemplate configuration option
+ which can be used to provide a custom html template for the js compilation.
+ </description>
+
+ <build>
+ <sourceDirectory>src/main/flex</sourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.flex.flexjs.compiler</groupId>
+ <artifactId>flexjs-maven-plugin</artifactId>
+ <version>@flexjs.compiler.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <mainClass>HelloWorld.mxml</mainClass>
+ <outputJavaScript>true</outputJavaScript>
+ <htmlTemplate>${basedir}/src/main/template/custom-js-index-template.html</htmlTemplate>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.compiler</groupId>
+ <artifactId>compiler-jx</artifactId>
+ <version>@flexjs.compiler.version@</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>package-javascript</id>
+ <phase>package</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <warSourceDirectory>${basedir}/target/javascript/bin/js-debug</warSourceDirectory>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.11</version>
+ <executions>
+ <execution>
+ <id>attach-war</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${basedir}/target/${project.artifactId}-${project.version}.war</file>
+ <type>war</type>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.adobe.flash.framework</groupId>
+ <artifactId>playerglobal</artifactId>
+ <version>@flash.version@</version>
+ <type>swc</type>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Core</artifactId>
+ <version>@flexjs.framework.version@</version>
+ <type>swc</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>HTML</artifactId>
+ <version>@flexjs.framework.version@</version>
+ <type>swc</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Language</artifactId>
+ <version>@flexjs.framework.version@</version>
+ <type>swc</type>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/734e89aa/testsuite/src/it/compiler-options/custom-html-template/src/main/flex/HelloWorld.mxml
----------------------------------------------------------------------
diff --git a/testsuite/src/it/compiler-options/custom-html-template/src/main/flex/HelloWorld.mxml b/testsuite/src/it/compiler-options/custom-html-template/src/main/flex/HelloWorld.mxml
new file mode 100644
index 0000000..70d8d20
--- /dev/null
+++ b/testsuite/src/it/compiler-options/custom-html-template/src/main/flex/HelloWorld.mxml
@@ -0,0 +1,30 @@
+<?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.
+
+-->
+<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic" >
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <js:View>
+ <js:Label text="Hello World!" />
+ </js:View>
+ </js:initialView>
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/734e89aa/testsuite/src/it/compiler-options/custom-html-template/src/main/template/custom-js-index-template.html
----------------------------------------------------------------------
diff --git a/testsuite/src/it/compiler-options/custom-html-template/src/main/template/custom-js-index-template.html b/testsuite/src/it/compiler-options/custom-html-template/src/main/template/custom-js-index-template.html
new file mode 100644
index 0000000..f2fbcc1
--- /dev/null
+++ b/testsuite/src/it/compiler-options/custom-html-template/src/main/template/custom-js-index-template.html
@@ -0,0 +1,30 @@
+<!--
+ 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.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="Custom Template for injecting custom style CSS">
+ <link rel="stylesheet" type="text/css" href="${application}.css">
+ <link rel="stylesheet" type="text/css" href="my-custom-style.css">
+${head}
+</head>
+<body>
+${body}
+</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/734e89aa/testsuite/src/it/compiler-options/custom-html-template/verify.groovy
----------------------------------------------------------------------
diff --git a/testsuite/src/it/compiler-options/custom-html-template/verify.groovy b/testsuite/src/it/compiler-options/custom-html-template/verify.groovy
new file mode 100644
index 0000000..a62efb8
--- /dev/null
+++ b/testsuite/src/it/compiler-options/custom-html-template/verify.groovy
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+import java.io.*
+import org.junit.Assert
+import org.hamcrest.core.Is
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader
+import org.apache.maven.model.Model
+import java.util.Scanner
+
+// Get the artifactId and version from the pom.
+File pom = new File((File) basedir, "pom.xml")
+MavenXpp3Reader reader = new MavenXpp3Reader();
+Model model = reader.read(new FileReader(pom));
+String artifactId = model.artifactId
+String version = model.version
+
+// Find the index.html produced by the build
+System.out.println("Base Dir: " + ((File) basedir).getPath())
+String fileName = "target/" + artifactId + "-" + version + "/index.html"
+File file = new File((File) basedir, fileName)
+
+// Check that the index.html file exists and is a file
+System.out.println("Template File: " + file.getPath())
+Assert.assertThat("Template file doesn't exist", file.exists(), Is.is(true))
+Assert.assertThat("Template file isn't a file", file.isFile(), Is.is(true))
+
+// Check that the file contains the additional content from our template
+Scanner sc = new Scanner(file)
+boolean foundCustomName = false
+boolean foundCustomStylesheet = false
+while (sc.hasNextLine()) {
+ String line = sc.nextLine()
+ if(line.contains("<meta name=\"Custom Template for injecting custom style CSS\">")) {
+ foundCustomName = true
+ } else if(line.contains("<link rel=\"stylesheet\" type=\"text/css\" href=\"my-custom-style.css\">")) {
+ foundCustomStylesheet = true
+ }
+ if(foundCustomName && foundCustomStylesheet) {
+ break
+ }
+}
+Assert.assertThat("Output should contain '<meta name=\"Custom Template for injecting custom style CSS\">'",
+ foundCustomName, Is.is(true))
+Assert.assertThat("Output should contain '<link rel=\"stylesheet\" type=\"text/css\" href=\"my-custom-style.css\">'",
+ foundCustomStylesheet, Is.is(true))
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/734e89aa/testsuite/src/it/settings.xml
----------------------------------------------------------------------
diff --git a/testsuite/src/it/settings.xml b/testsuite/src/it/settings.xml
new file mode 100644
index 0000000..4b402f2
--- /dev/null
+++ b/testsuite/src/it/settings.xml
@@ -0,0 +1,55 @@
+<?xml version="1.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.
+
+-->
+<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
+ xmlns="http://maven.apache.org/SETTINGS/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+</settings>
\ No newline at end of file