royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joshtynj...@apache.org
Subject [royale-compiler] branch develop updated: compiler-jx: the -source-map compiler option now also controls whether release build source maps are generated or not
Date Wed, 24 Oct 2018 21:52:46 GMT
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 c080985  compiler-jx: the -source-map compiler option now also controls whether release
build source maps are generated or not
c080985 is described below

commit c080985f5042b37ad5fc363780768f6ccdd3f584
Author: Josh Tynjala <joshtynjala@apache.org>
AuthorDate: Wed Oct 24 14:52:42 2018 -0700

    compiler-jx: the -source-map compiler option now also controls whether release build source
maps are generated or not
---
 .../internal/codegen/js/goog/JSGoogPublisher.java         |  4 ++++
 .../internal/codegen/mxml/royale/MXMLRoyalePublisher.java |  1 +
 .../royale/compiler/utils/JSClosureCompilerWrapper.java   | 15 ++++++++++++---
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogPublisher.java
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogPublisher.java
index 20239ac..45c14a9 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogPublisher.java
@@ -186,6 +186,10 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
     protected void appendSourceMapLocation(File path, String projectName)
             throws IOException
     {
+        if (!googConfiguration.getSourceMap())
+        {
+            return;
+        }
         StringBuilder appendString = new StringBuilder();
         appendString.append("\n//# sourceMappingURL=./" + projectName
                 + ".js.map");
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 281fe99..9cd88ad 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
@@ -504,6 +504,7 @@ public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSPublisher
             final File projectReleaseMainFile = new File(releaseDir, outputFileName);
             compilerWrapper.setOptions(projectReleaseMainFile.getCanonicalPath(), useStrictPublishing,
!googConfiguration.getRemoveCirculars(), projectName);
             compilerWrapper.targetFilePath = projectReleaseMainFile.getCanonicalPath();
+            compilerWrapper.setSourceMap(googConfiguration.getSourceMap());
 
             compilerWrapper.compile();
 
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java
b/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java
index 5437c70..2207985 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java
@@ -94,6 +94,7 @@ public class JSClosureCompilerWrapper
     private String propertyMapInputPath;
     private boolean skipTypeInference;
     private Set<String> provideds;
+    private boolean sourceMap = false;
     
     public String targetFilePath;
     
@@ -121,6 +122,11 @@ public class JSClosureCompilerWrapper
     {
     	provideds = set;
     }
+
+    public void setSourceMap(boolean enabled)
+    {
+        sourceMap = enabled;
+    }
     
     public void compile()
     {
@@ -164,9 +170,12 @@ public class JSClosureCompilerWrapper
             targetFile.write(compiler_.toSource());
             targetFile.close();
 
-            FileWriter sourceMapFile = new FileWriter(options_.sourceMapOutputPath);
-            compiler_.getSourceMap().appendTo(sourceMapFile, "");
-            sourceMapFile.close();
+            if (sourceMap)
+            {
+                FileWriter sourceMapFile = new FileWriter(options_.sourceMapOutputPath);
+                compiler_.getSourceMap().appendTo(sourceMapFile, "");
+                sourceMapFile.close();
+            }
         }
         catch (IOException error)
         {


Mime
View raw message