You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/12/20 05:04:23 UTC
[royale-compiler] 01/02: emit better message if not optimizing or
there were errors
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 9a20bb57e50648c23e3867e9741ebed4abcb8a13
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Dec 19 19:10:41 2018 -0800
emit better message if not optimizing or there were errors
---
.../internal/codegen/mxml/royale/MXMLRoyalePublisher.java | 11 +++++++----
.../royale/compiler/utils/JSClosureCompilerWrapper.java | 8 +++++---
2 files changed, 12 insertions(+), 7 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 9cd88ad..30810ee 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
@@ -501,18 +501,21 @@ public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSPublisher
/////////////////////////////////////////////////////////////////////////////////
if (configuration.release()) {
+ boolean ok = true;
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();
+ ok = compilerWrapper.compile();
appendSourceMapLocation(projectReleaseMainFile, projectName);
+
+ if (ok)
+ System.out.println("The project '" + projectName + "' has been successfully compiled and optimized.");
}
-
- // if (ok)
- System.out.println("The project '" + projectName + "' has been successfully compiled and optimized.");
+ else
+ System.out.println("The project '" + projectName + "' has been successfully compiled.");
return true;
}
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 69ed41e..4c88298 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
@@ -43,6 +43,7 @@ import com.google.javascript.jscomp.CompilerOptions;
import com.google.javascript.jscomp.CompilerOptions.LanguageMode;
import com.google.javascript.jscomp.DependencyOptions;
import com.google.javascript.jscomp.DiagnosticGroups;
+import com.google.javascript.jscomp.Result;
import com.google.javascript.jscomp.RoyaleDiagnosticGroups;
import com.google.javascript.jscomp.ModuleIdentifier;
import com.google.javascript.jscomp.ShowByPathWarningsGuard;
@@ -128,7 +129,7 @@ public class JSClosureCompilerWrapper
sourceMap = enabled;
}
- public void compile()
+ public boolean compile()
{
System.out.println("list of source files");
for (SourceFile file : jsSourceFiles_)
@@ -162,8 +163,8 @@ public class JSClosureCompilerWrapper
}
- compiler_.compile(jsExternsFiles_, jsSourceFiles_, options_);
-
+ Result result = compiler_.compile(jsExternsFiles_, jsSourceFiles_, options_);
+
try
{
FileWriter targetFile = new FileWriter(targetFilePath);
@@ -223,6 +224,7 @@ public class JSClosureCompilerWrapper
System.err.println("Error message: " + message.toString());
}
*/
+ return result.success;
}
private Set<String> getUsedVars(File file)