You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/09/30 18:14:55 UTC

[royale-compiler] branch develop updated: avoid generation of the .js.map file in release mode for App.js

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 ad33823  avoid generation of the .js.map file in release mode for App.js
ad33823 is described below

commit ad33823b2073094087ad2bd157a4c47f6e61dc2a
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Sep 30 20:14:48 2018 +0200

    avoid generation of the .js.map file in release mode for App.js
---
 .../internal/codegen/mxml/royale/MXMLRoyalePublisher.java    |  2 +-
 .../royale/compiler/utils/JSClosureCompilerWrapper.java      | 12 ++++++++----
 2 files changed, 9 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 6f81156..655a162 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
@@ -505,7 +505,7 @@ public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSPublisher
             compilerWrapper.setOptions(projectReleaseMainFile.getCanonicalPath(), useStrictPublishing, !googConfiguration.getRemoveCirculars(), projectName);
             compilerWrapper.targetFilePath = projectReleaseMainFile.getCanonicalPath();
 
-            compilerWrapper.compile();
+            compilerWrapper.compile(false);
 
             //we don't want sourceMap file in release build since it's only needed in debug
             //appendSourceMapLocation(projectReleaseMainFile, projectName);
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..a7dd7dd 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
@@ -122,7 +122,8 @@ public class JSClosureCompilerWrapper
     	provideds = set;
     }
     
-    public void compile()
+    // isDebug is used to avoid sourceMaps on release build
+    public void compile(Boolean isDebug)
     {
     	System.out.println("list of source files");
     	for (SourceFile file : jsSourceFiles_)
@@ -164,9 +165,12 @@ public class JSClosureCompilerWrapper
             targetFile.write(compiler_.toSource());
             targetFile.close();
 
-            FileWriter sourceMapFile = new FileWriter(options_.sourceMapOutputPath);
-            compiler_.getSourceMap().appendTo(sourceMapFile, "");
-            sourceMapFile.close();
+            if(isDebug)
+            {
+                FileWriter sourceMapFile = new FileWriter(options_.sourceMapOutputPath);
+                compiler_.getSourceMap().appendTo(sourceMapFile, "");
+                sourceMapFile.close();
+            }
         }
         catch (IOException error)
         {