forked from jordaaash/react-native-webview-crosswalk
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathget_library.js
47 lines (41 loc) · 1.51 KB
/
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
39
40
41
42
43
44
45
46
47
var version = '22.52.561.4';
var beta = '';
var platform = require('os').platform();
var exec = require('child_process').execSync;
var fs = require('fs');
var wget = require('node-wget');
fs.stat('./libs/xwalk_core_library-'+ version + '.aar',function(err){
if( err ){
downloadLibrary();
}
})
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 {
prepareLibrary(data.filepath);
modifyGuide()
}
}
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);
}
function modifyGuide(){
console.log('\x1b[32m','\n Success download depedencies. \n')
console.log('\x1b[33m','For','\x1b[36m\x1b[1m','Linux-like OS','\x1b[33m','you can use')
console.log('\x1b[34m','cat ./node_modules/react-native-webkit-webview/modify_java_project_steps')
console.log('\x1b[33m','to show steps to modify project files.\n')
console.log('\x1b[33m','For Windows,you should open README.md for further modify info.\n')
}