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

erikdebruin pushed a commit to branch feature/wast
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit b17978dd13f2b931ec0ee078d6e8d21b7a7c6bbb
Author: Erik de Bruin <[email protected]>
AuthorDate: Wed Nov 15 15:55:33 2017 +0100

    Use actual source name instead of fixed string
    
    Signed-off-by: Erik de Bruin <[email protected]>
---
 .../compiler/internal/codegen/wast/WASTPublisher.java       | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/wast/WASTPublisher.java
 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/wast/WASTPublisher.java
index f1fb81b..fa2c182 100644
--- 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/wast/WASTPublisher.java
+++ 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/wast/WASTPublisher.java
@@ -40,6 +40,8 @@ public class WASTPublisher implements IWASTPublisher {
        
        
        private Configuration configuration;
+       
+       private String mainProjectFileName;
 
        private File outputFolder;
        private File outputParentFolder;
@@ -47,6 +49,7 @@ public class WASTPublisher implements IWASTPublisher {
        private EnvProperties env;
        
        
+       
        @Override
        public File getOutputFolder() {
                outputParentFolder = new 
File(configuration.getTargetFileDirectory()).getParentFile();
@@ -65,11 +68,13 @@ public class WASTPublisher implements IWASTPublisher {
                try {
                        String targetPath = getOutputFolder().getPath();
                        
-                       String targetWatFilePath = targetPath + 
"/HelloWorld.wat";
+                       mainProjectFileName = configuration.getMainDefinition();
+                       
+                       String targetWatFilePath = targetPath + "/" + 
mainProjectFileName + ".wat";
                        
                        env = EnvProperties.initiate();
                        
-                       String[] cmd = { env.WAT2WASM + "/wat2wasm", 
targetWatFilePath, "-o", targetPath + "/HelloWorld.wasm" };
+                       String[] cmd = { env.WAT2WASM + "/wat2wasm", 
targetWatFilePath, "-o", targetPath + "/" + mainProjectFileName + ".wasm" };
 
                        Process p = new 
ProcessBuilder(cmd).redirectError(Redirect.INHERIT)
                     .redirectOutput(Redirect.INHERIT)
@@ -138,7 +143,7 @@ public class WASTPublisher implements IWASTPublisher {
                htmlFile.append("  <meta charset=\"utf-8\">\n");
                htmlFile.append("  <meta http-equiv=\"X-UA-Compatible\" 
content=\"IE=edge\">\n");
                htmlFile.append("\n");
-               htmlFile.append("  <title>Royale WASM</title>\n");
+               htmlFile.append("  <title>" + mainProjectFileName + " - Royale 
WAST</title>\n");
                htmlFile.append("\n");
                htmlFile.append("  <meta name=\"viewport\" 
content=\"width=device-width, initial-scale=1\">\n");
                htmlFile.append("</head>\n");
@@ -150,7 +155,7 @@ public class WASTPublisher implements IWASTPublisher {
                htmlFile.append("\n");
                htmlFile.append("<script>\n");
                htmlFile.append("\n");
-               htmlFile.append("  fetchAndInstantiate('HelloWorld.wasm')\n");
+               htmlFile.append("  fetchAndInstantiate('" + mainProjectFileName 
+ ".wasm')\n");
                htmlFile.append("  .then(function(instance) {\n");
                htmlFile.append("    
document.getElementById('wasm-output').innerHTML = 'The result from the call to 
the WASM method is: ' + instance.exports.add(3, 7); // 10\n");
                htmlFile.append("  });\n");

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to