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

commit 285eb2fbb64386ee3f238bf4c8eaf159273a3000
Author: Josh Tynjala <[email protected]>
AuthorDate: Tue Jan 21 13:57:43 2025 -0800

    MXHXRoyalePublisher: allow empty string for html-output-filename
    
    Usage: mxmlc -html-output-filename= HelloWorld.mxml
    
    May be used to skip creating an HTML file
---
 .../codegen/mxml/royale/MXMLRoyalePublisher.java       | 18 ++++++++++++++++--
 .../driver/js/goog/JSGoogCompcConfiguration.java       |  2 ++
 .../internal/driver/js/goog/JSGoogConfiguration.java   |  2 ++
 3 files changed, 20 insertions(+), 2 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 29f0f8028..ba3ca3c43 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
@@ -894,6 +894,13 @@ public class MXMLRoyalePublisher extends JSPublisher 
implements IJSRoyalePublish
             return;
         }
 
+        String htmlOutputFileName = googConfiguration.getHtmlOutputFileName();
+        if (htmlOutputFileName.length() == 0)
+        {
+            // output file name has been intentionally cleared by the user
+            return;
+        }
+
         String input = readCode(template);
         ITargetAttributes ta = project.computeTargetAttributes();
         Float width = null;
@@ -936,7 +943,7 @@ public class MXMLRoyalePublisher extends JSPublisher 
implements IJSRoyalePublish
         String templateBody = getTemplateBody("release".equals(type) ? 
projectName : mainClassQName);
         result = result.replaceAll("\\$\\{body\\}", 
safeReplacement(templateBody));
 
-               writeFile(new File(targetDir, 
googConfiguration.getHtmlOutputFileName()), result, false);
+               writeFile(new File(targetDir, htmlOutputFileName), result, 
false);
        }
 
     protected String getTemplateAdditionalHTML(List<String> additionalHTML)
@@ -986,6 +993,13 @@ public class MXMLRoyalePublisher extends JSPublisher 
implements IJSRoyalePublish
     protected void writeHTML(String type, String projectName, String 
mainClassQName, File targetDir, String deps, List<String> additionalHTML)
             throws IOException
     {
+        String htmlOutputFileName = googConfiguration.getHtmlOutputFileName();
+        if (htmlOutputFileName.length() == 0)
+        {
+            // output file name has been intentionally cleared by the user
+            return;
+        }
+
         StringBuilder htmlFile = new StringBuilder();
         htmlFile.append("<!DOCTYPE html>\n");
         htmlFile.append("<html>\n");
@@ -1011,7 +1025,7 @@ public class MXMLRoyalePublisher extends JSPublisher 
implements IJSRoyalePublish
         htmlFile.append("</body>\n");
         htmlFile.append("</html>");
 
-        writeFile(new File(targetDir, 
googConfiguration.getHtmlOutputFileName()), htmlFile.toString(), false);
+        writeFile(new File(targetDir, htmlOutputFileName), 
htmlFile.toString(), false);
     }
 
     private void writeCSS(String projectName, File targetDir, Boolean minify) 
throws IOException
diff --git 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogCompcConfiguration.java
 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogCompcConfiguration.java
index 3d92bd2ef..2a248fd48 100644
--- 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogCompcConfiguration.java
+++ 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogCompcConfiguration.java
@@ -34,6 +34,7 @@ import org.apache.royale.compiler.config.ConfigurationValue;
 import org.apache.royale.compiler.exceptions.ConfigurationException;
 import org.apache.royale.compiler.internal.config.annotations.Arguments;
 import org.apache.royale.compiler.internal.config.annotations.Config;
+import 
org.apache.royale.compiler.internal.config.annotations.DefaultArgumentValue;
 import org.apache.royale.compiler.internal.config.annotations.RoyaleOnly;
 import 
org.apache.royale.compiler.internal.config.annotations.InfiniteArguments;
 import org.apache.royale.compiler.internal.config.annotations.Mapping;
@@ -376,6 +377,7 @@ public class JSGoogCompcConfiguration extends 
JSConfiguration
     @Config(advanced = true)
     @Mapping("html-output-filename")
     @Arguments("filename")
+    @DefaultArgumentValue("")
     public void setHtmlOutputFileName(ConfigurationValue cv, String filename)
     {
         this.htmlOutputFileName = filename;
diff --git 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java
 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java
index 009ea52f0..5cf4b5d39 100644
--- 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java
+++ 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java
@@ -34,6 +34,7 @@ import org.apache.royale.compiler.config.ConfigurationValue;
 import org.apache.royale.compiler.exceptions.ConfigurationException;
 import org.apache.royale.compiler.internal.config.annotations.Arguments;
 import org.apache.royale.compiler.internal.config.annotations.Config;
+import 
org.apache.royale.compiler.internal.config.annotations.DefaultArgumentValue;
 import org.apache.royale.compiler.internal.config.annotations.RoyaleOnly;
 import 
org.apache.royale.compiler.internal.config.annotations.InfiniteArguments;
 import org.apache.royale.compiler.internal.config.annotations.Mapping;
@@ -380,6 +381,7 @@ public class JSGoogConfiguration extends JSConfiguration
     @Config(advanced = true)
     @Mapping("html-output-filename")
     @Arguments("filename")
+    @DefaultArgumentValue("")
     public void setHtmlOutputFileName(ConfigurationValue cv, String filename)
     {
         this.htmlOutputFileName = filename;

Reply via email to