Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25059] Add Hyperloop as a pre-packged module #9578

Merged
merged 4 commits into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 17 additions & 3 deletions build/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const path = require('path'),
os = require('os'),
exec = require('child_process').exec, // eslint-disable-line security/detect-child-process
spawn = require('child_process').spawn, // eslint-disable-line security/detect-child-process
async = require('async'),
fs = require('fs-extra'),
utils = require('./utils'),
Expand Down Expand Up @@ -41,9 +42,17 @@ function zip(folder, filename, next) {
function unzip(zipfile, dest, next) {
console.log('Unzipping ' + zipfile + ' to ' + dest);
const command = os.platform() === 'win32' ? path.join(ROOT_DIR, 'build', 'win32', 'unzip') : 'unzip';
exec(command + ' -o "' + zipfile + '" -d "' + dest + '"', function (err) {
if (err) {
return next(err);
const child = spawn(command, [ '-o', zipfile, '-d', dest ], { stdio: [ 'ignore', 'ignore', 'pipe' ] });
let err = '';
child.stderr.on('data', function (buffer) {
err += buffer.toString();
});
child.on('error', function (err) {
return next(err);
});
child.on('close', function (code) {
if (code !== 0) {
return next(`Unzipping of ${zipfile} exited with non-zero exit code ${code}. ${err}`);
}
next();
});
Expand Down Expand Up @@ -175,6 +184,11 @@ Packager.prototype.includePackagedModules = function (next) {
|| supportedPlatforms.indexOf('ipad') !== -1) {
supportedPlatforms = supportedPlatforms.concat([ 'ios', 'iphone', 'ipad' ]);
}

// Hyperloop has no single platform downloads yet, so we use a fake platform
// that will download the all-in-one distribution.
supportedPlatforms = supportedPlatforms.concat([ 'hyperloop' ]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so you can just hijack the "commonjs" entry to mean "All platforms" too. That's what I did locally when I took a look at this.


let urls = []; // urls of module zips to grab
// Read modules.json, grab the object for each supportedPlatform
const contents = fs.readFileSync(path.join(SUPPORT_DIR, 'module', 'packaged', 'modules.json')).toString(),
Expand Down
3 changes: 3 additions & 0 deletions support/module/packaged/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
],
"commonjs": [
"https://github.com/appcelerator-modules/ti.cloud/releases/download/3.2.11/ti.cloud-commonjs-3.2.11.zip"
],
"hyperloop": [
"https://github.com/appcelerator-modules/hyperloop-builds/releases/download/v3.0.0-beta.2/hyperloop-3.0.0-beta.2.zip"
]
}