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-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/078fe695 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/078fe695 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/078fe695 Branch: refs/heads/feature-autobuild/maven-archetypes Commit: 078fe695a7691f7808134b48b85d655013324331 Parents: 936f256 Author: Christofer Dutz <[email protected]> Authored: Wed Oct 5 13:36:16 2016 +0200 Committer: Christofer Dutz <[email protected]> Committed: Wed Oct 5 13:36:16 2016 +0200 ---------------------------------------------------------------------- .../compiler/internal/codegen/js/goog/JSGoogPublisher.java | 2 +- .../internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java | 9 +++++---- .../java/org/apache/flex/maven/flexjs/CompileAppMojo.java | 8 ++++++++ .../main/resources/config/compile-app-javascript-config.xml | 4 ++++ 4 files changed, 18 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/078fe695/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogPublisher.java ---------------------------------------------------------------------- diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogPublisher.java index a031737..ea39e45 100644 --- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogPublisher.java +++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogPublisher.java @@ -228,7 +228,7 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher htmlFile.append("\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n"); htmlFile.append("\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"); - if (type == "intermediate") + if ("intermediate".equals(type)) { htmlFile.append("\t<script type=\"text/javascript\" src=\"./library/closure/goog/base.js\"></script>\n"); htmlFile.append("\t<script type=\"text/javascript\">\n"); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/078fe695/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java ---------------------------------------------------------------------- diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java index b4f5c44..40a9e1c 100644 --- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java +++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java @@ -18,7 +18,6 @@ */ package org.apache.flex.compiler.internal.codegen.mxml.flexjs; -import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -55,9 +54,6 @@ import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration; import org.apache.flex.compiler.internal.graph.GoogDepsWriter; import org.apache.flex.compiler.internal.projects.FlexJSProject; import org.apache.flex.compiler.internal.targets.ITargetAttributes; -import org.apache.flex.compiler.targets.ISWFTarget; -import org.apache.flex.compiler.targets.ITargetReport; -import org.apache.flex.compiler.targets.ITargetSettings; import org.apache.flex.compiler.utils.JSClosureCompilerWrapper; import org.apache.flex.swc.ISWC; import org.apache.flex.swc.ISWCFileEntry; @@ -583,6 +579,11 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher protected void writeTemplate(File template, String type, String projectName, String dirPath, String deps, List<String> additionalHTML) throws IOException { + // Check if the template exists. + if(!template.exists()) { + throw new IOException("Template specified by 'html-template' does not exist: " + template.getPath()); + } + String input = readCode(template); ITargetAttributes ta = project.computeTargetAttributes(); Float width = null; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/078fe695/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java index d407143..8a4da76 100644 --- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java +++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java @@ -47,6 +47,13 @@ public class CompileAppMojo @Parameter(defaultValue = "namespaces") protected String namespaceDirectory; + /** + * Allows providing of a custom htmlTemplate which overrides the built-in one. + * This option is only effective if outputJavaScript is true. + */ + @Parameter + protected String htmlTemplate; + @Parameter(defaultValue = "false") protected boolean outputJavaScript; @@ -81,6 +88,7 @@ public class CompileAppMojo protected VelocityContext getVelocityContext() throws MojoExecutionException { VelocityContext context = super.getVelocityContext(); context.put("removeCirculars", removeCirculars); + context.put("htmlTemplate", htmlTemplate); return context; } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/078fe695/flexjs-maven-plugin/src/main/resources/config/compile-app-javascript-config.xml ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/resources/config/compile-app-javascript-config.xml b/flexjs-maven-plugin/src/main/resources/config/compile-app-javascript-config.xml index d0c5de4..1e709d2 100644 --- a/flexjs-maven-plugin/src/main/resources/config/compile-app-javascript-config.xml +++ b/flexjs-maven-plugin/src/main/resources/config/compile-app-javascript-config.xml @@ -371,6 +371,10 @@ <!-- Enables SWFs to access the network. --> <use-network>true</use-network> +#if($htmlTemplate) + <html-template>${htmlTemplate}</html-template> +#end + <!-- Metadata added to SWFs via the SWF Metadata tag. --> <metadata> <title>Apache FlexJS Application</title>
