royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erikdebr...@apache.org
Subject [royale-asjs] 05/08: Automate much of the tool chain initialization
Date Fri, 17 Nov 2017 13:48:56 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 137474c814936506182bba472ac5ef4188367ef2
Author: Erik de Bruin <erik@ixsoftware.nl>
AuthorDate: Fri Nov 17 13:28:25 2017 +0100

    Automate much of the tool chain initialization
    
    Signed-off-by: Erik de Bruin <erik@ixsoftware.nl>
---
 .gitignore                 |  3 ++
 as2wasm/dev-build.xml      |  2 +-
 as2wasm/download.js        | 93 ++++++++++++++++++++++++++++++++++++++++++++++
 as2wasm/package.json       | 19 ++++++----
 as2wasm/resources/build.js |  1 -
 5 files changed, 108 insertions(+), 10 deletions(-)

diff --git a/.gitignore b/.gitignore
index a32c5ce..c77544a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -141,3 +141,6 @@ vf2js/frameworks/js/
 #FlexJS generated files
 frameworks/js/FlexJS/generated-sources
 manualtests/FlexJSTest_SVG/bin
+
+#NPM
+node_modules
diff --git a/as2wasm/dev-build.xml b/as2wasm/dev-build.xml
index e229477..6a3e853 100644
--- a/as2wasm/dev-build.xml
+++ b/as2wasm/dev-build.xml
@@ -23,7 +23,7 @@
   <target name="main" depends="compiler.jx,as2wasm.jars" description="Full build"/>
 
   <target name="compiler.jx" description="Builds Royale JS Transpiler jars">
-    <ant dir="../../royale-compiler/compiler-jx">
+    <ant dir="./lib/resources/royale-compiler/compiler-jx">
       <target name="clean" />
       <target name="main" />
     </ant>
diff --git a/as2wasm/download.js b/as2wasm/download.js
new file mode 100644
index 0000000..2457520
--- /dev/null
+++ b/as2wasm/download.js
@@ -0,0 +1,93 @@
+'use strict';
+
+const promptText = '\n\
+\n\
+Apache FlexJS SDK uses the Adobe Flash Player\'s playerglobal.swc to build\n\
+Adobe Flash applications. The playerglobal.swc file is subject to and governed\n\
+by the Adobe Flex SDK License Agreement specified here:\n\
+\n\
+http://www.adobe.com/products/eulas/pdfs/adobe_flex_software_development_kit-combined-20110916_0930.pdf\n\
+\n\
+By downloading, modifying, distributing, using and/or accessing the\n\
+playerglobal.swc fileyou agree to the terms and conditions of the applicable\n\
+end user license agreement.\n\
+\n\
+In addition to the Adobe license terms, you also agree to be bound by the\n\
+third-party terms specified here:\n\
+\n\
+http://www.adobe.com/products/eula/third_party/.\n\
+\n\
+Adobe recommends that you review these third-party terms. This license is not\n\
+compatible with the Apache v2 license.\n\
+\n\
+Adobe Flash Player\'s playerglobal.swc is a required component.\n\
+\n\
+Do you want to download and install the playerglobal.swc? (y/n)';
+
+let fs, fileData, prompt, request, schema;
+
+
+
+fs = require('fs');
+prompt = require('prompt');
+request = require('request');
+
+
+
+fileData = {
+  fileName: 'playerglobal',
+  fileExtension: '.swc',
+  url: 'http://download.macromedia.com/get/flashplayer/updaters',
+  version: '25'
+};
+
+
+schema = {
+  properties: {
+    accept: {
+      description: promptText.cyan,
+      pattern: /^[YNyn\s]$/,
+      message: 'Please respond with either y or n'.red,
+      required: true
+    }
+  }
+};
+
+prompt.start();
+prompt.get(schema, function (err, result) {
+  if('y' === result.accept.toLowerCase()) {
+    let url;
+
+    url = `${fileData.url}/${fileData.version}/${fileData.fileName}${fileData.version}_0${fileData.fileExtension}`;
+
+    console.log(`Downloading: ${url}`);
+
+    request
+    .get(url)
+    .on('response', function (response) {
+      if(200 !== response.statusCode) {
+        console.log(`Download failed with status code: ${response.statusCode}`);
+      } else {
+        let destination = `lib/player/${fileData.version}.0/`;
+
+        if (!fs.existsSync('lib')) {
+          fs.mkdirSync('lib');
+        }
+        if (!fs.existsSync('lib/player')) {
+          fs.mkdirSync('lib/player');
+        }
+        if (!fs.existsSync(destination)) {
+          fs.mkdirSync(destination);
+        }
+
+        response.pipe(fs.createWriteStream(`${destination}${fileData.fileName}${fileData.fileExtension}`)
+        .on('close', function(){
+          console.log(`Finished downloading: ${destination}${fileData.fileName}${fileData.fileExtension}`);
+        })
+        );
+      }
+    });
+  } else {
+    console.log('Aborting installation');
+  }
+});
diff --git a/as2wasm/package.json b/as2wasm/package.json
index f23ca01..5f6bd20 100644
--- a/as2wasm/package.json
+++ b/as2wasm/package.json
@@ -1,18 +1,21 @@
 {
-
   "author": "erikdebruin@apache.org",
-
+  "dependencies": {
+    "prompt": "^0.2.14",
+    "request": "^2.67.0",
+    "unzip": "^0.1.11"
+  },
   "description": "A Actionscript/MXML to WebAssembly transpiler",
-
   "license": "Apache-2.0",
-
   "name": "as2wasm",
-
   "scripts": {
-    "dev-build": "ant -f ./dev-build.xml",
+    "as2wasm-jars": "ant -f ./dev-build.xml",
+    "build": "npm install; npm run build-wat2wasm; npm run build-compiler; npm run as2wasm-jars;
node download.js",
+    "build-compiler": "npm run build-compiler-clone; npm run build-compiler-build",
+    "build-compiler-build": "cd lib/resources/royale-compiler; git checkout feature/as2wasm;
git pull; ant sdk",
+    "build-compiler-clone": "mkdir -p lib/resources ; git clone https://github.com/apache/royale-compiler.git
lib/resources/royale-compiler",
+    "build-wat2wasm": "echo 'npm install -g webassembly-binary-toolkit'",
     "create-project": "node create.js"
   },
-
   "version": "0.1.0"
-
 }
diff --git a/as2wasm/resources/build.js b/as2wasm/resources/build.js
index 91c5cb4..a0f6b90 100644
--- a/as2wasm/resources/build.js
+++ b/as2wasm/resources/build.js
@@ -51,7 +51,6 @@ playerHome = args['playerglobal-home'];
 playerVersion = args['playerglobal-version'];
 
 cmd = `/usr/bin/java -Xmx384m -Dsun.io.useCanonCaches=false -jar "${wastcJar}" -external-library-path="${playerHome}/${playerVersion}/playerglobal.swc"
${args['src']}`;
-
 exec(cmd, function (error, stdout, stderr) {
   console.log(stdout);
 

-- 
To stop receiving notification emails like this one, please contact
"commits@royale.apache.org" <commits@royale.apache.org>.

Mime
View raw message