-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathget_library.js
38 lines (32 loc) · 989 Bytes
/
get_library.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
var version = '22.52.561.4';
var beta = '';
var exec = require('child_process').exec;
var fs = require('fs');
var wget = require('node-wget');
function prepareLibrary (filePath) {
try {
fs.unlinkSync('./libs/' + filePath);
}
catch (e) {
console.log('No previous file');
}
fs.renameSync(filePath, './libs/' + filePath);
console.log('Library baked');
}
function handleDownloaded (error, data) {
if (error) {
console.error('Failed downloading file');
console.error(error);
}
else {
console.log('File downloaded successfully');
prepareLibrary(data.filepath);
}
}
function downloadLibrary () {
var url = 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library' + beta + '/' + version + '/xwalk_core_library' + beta + '-' + version + '.aar';
console.log('Downloading file...');
wget(url, handleDownloaded);
}
downloadLibrary();