This is an automated email from the ASF dual-hosted git repository.
carlosrovira 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 65c67ee modules-publication: inject_html was not processed for
modules. Now we add for debug and release the lines generated (normaly script
or link tags) so the lines will be added dynamically to the HTML when module
are loaded avoiding user need to add this manually
65c67ee is described below
commit 65c67ee27f8d0d068b3e2163445d48cf200cddc3
Author: Carlos Rovira <[email protected]>
AuthorDate: Tue Jul 2 23:48:04 2019 +0200
modules-publication: inject_html was not processed for modules. Now we add
for debug and release the lines generated (normaly script or link tags) so the
lines will be added dynamically to the HTML when module are loaded avoiding
user need to add this manually
---
.../codegen/mxml/royale/MXMLRoyalePublisher.java | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java
index 0dbf01b..80326a8 100644
---
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java
+++
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java
@@ -479,12 +479,21 @@ public class MXMLRoyalePublisher extends JSGoogPublisher
implements IJSPublisher
// is generated here so it can be used for outputting the html
templates.
String depsFileData = gdw.generateDeps(project, problems);
+ // FOR MODULES: this generate inject_html lines for js to be added to
__deps.js
+ String moduleAdditionHTML = "";
+
if (project.isModule(mainClassQName))
{
+ for (String s : gdw.additionalHTML)
+ {
+ moduleAdditionHTML += "document.head.innerHTML += '"+ s.trim()
+ "';";
+ }
+
// need better test someday
depsFileData += "\ngoog.require('" + mainClassQName + "');\n";
- writeFile(new File(intermediateDir, projectName + "__deps.js"),
depsFileData, false);
+ writeFile(new File(intermediateDir, projectName + "__deps.js"),
depsFileData + moduleAdditionHTML + "\n", false);
gdw.needCSS = true;
+ writeFile(new File(releaseDir, projectName + ".js"),
moduleAdditionHTML, false);
}
else
{
@@ -537,6 +546,14 @@ public class MXMLRoyalePublisher extends JSGoogPublisher
implements IJSPublisher
ok = compilerWrapper.compile();
+ // FOR MODULES: add moduleAdditionHTML to main js release file too
+ if (project.isModule(mainClassQName))
+ {
+ StringBuilder appendString = new StringBuilder();
+ appendString.append(moduleAdditionHTML);
+ writeFile(projectReleaseMainFile, appendString.toString(),
true);
+ }
+
appendSourceMapLocation(projectReleaseMainFile, projectName);
if (ok)