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 2 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://appcelerator-modules.s3.amazonaws.com/hyperloop-2.2.2.zip"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please change to 3.0.0. Eventually, we should create a hyperloop-releases repo to store those, which would also have the benefit to attach changelogs and beta-versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We probably should do that right away. I can't update this link right now because that would break builds since ee don't have a 3.0.0 published yet. That would also trigger the automatic update in SDKs <= 6.3.0 so we shouldn't even publish Hyperloop 3.0.0 the old way?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should. Then people with an old SDK can still download it, but that on the other hand still breaks their app because of the bumped api-version that requires 7.0.0 anyway.

]
}