You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2019/08/21 14:44:28 UTC

[royale-compiler] branch develop updated: compiler-jx: moved inject_html detection for source files back into GoogDepsWriter for now

This is an automated email from the ASF dual-hosted git repository.

joshtynjala 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 4963671  compiler-jx: moved inject_html detection for source files back into GoogDepsWriter for now
4963671 is described below

commit 4963671fb3923cb76d41cfc778e624b8fa3bf728
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Wed Aug 21 07:44:20 2019 -0700

    compiler-jx: moved inject_html detection for source files back into GoogDepsWriter for now
---
 .../codegen/mxml/royale/MXMLRoyalePublisher.java   |  6 +++---
 .../compiler/internal/graph/GoogDepsWriter.java    | 25 ++++++++++++++++++++--
 2 files changed, 26 insertions(+), 5 deletions(-)

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 f2ff42c..a4a32b9 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
@@ -458,9 +458,9 @@ public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSPublisher
                     sourceExternFiles.add(sourceExternPath);
             }
         }
-        for (String file : fileList)
+        if (compilerWrapper != null)
         {
-            if (compilerWrapper != null)
+            for (String file : fileList)
             {
                 compilerWrapper.addJSSourceFile(file);
                 if (googConfiguration.isVerbose())
@@ -468,7 +468,6 @@ public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSPublisher
                     System.out.println("using source file: " + file);
                 }
             }
-            collectFileAdditionalHTML(file);
         }
         for (String file : sourceExternFiles)
         {
@@ -482,6 +481,7 @@ public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSPublisher
             }
             collectFileAdditionalHTML(file);
         }
+        additionalHTML.addAll(gdw.additionalHTML);
 
         /////////////////////////////////////////////////////////////////////////////////
         // Generate the index.html for loading the application.
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
index 5f2817e..7c8d1e1 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
@@ -326,7 +326,9 @@ public class GoogDepsWriter {
 		return true;
 	}
     
-    private HashMap<String, GoogDep> visited = new HashMap<String, GoogDep>();
+	private HashMap<String, GoogDep> visited = new HashMap<String, GoogDep>();
+	
+	public ArrayList<String> additionalHTML = new ArrayList<String>();
     
 	private ArrayList<GoogDep> sort()
 	{
@@ -1088,7 +1090,8 @@ public class GoogDepsWriter {
 	    fi.constructorLine = -1;
 	    fi.suppressLine = -1;
 	    fi.fileoverviewLine = -1;
-	    fi.googProvideLine = -1;
+		fi.googProvideLine = -1;
+		boolean inInjectHTML = false;
 	    for (int i = 0; i < n; i++)
 	    {
 	        String line = lines.get(i);
@@ -1100,6 +1103,24 @@ public class GoogDepsWriter {
 	        }
 	        else
 	        {
+		        if (inInjectHTML)
+	            {
+	                if (line.indexOf("</inject_html>") > -1)
+	                {
+	                    inInjectHTML = false;
+	                    continue;
+	                }
+	            	line = line.trim();
+	            	if (line.startsWith("*"))
+	            		line = line.substring(1);
+				    additionalHTML.add(line);
+				    continue;
+	            }
+                c = line.indexOf("<inject_html>");
+                if (c > -1)
+                {
+                    inInjectHTML = true;
+                }
 		        c = line.indexOf("@constructor");
 		        if (c > -1)
 		        {