-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathafter_prepare_2.js
50 lines (33 loc) · 1.48 KB
/
after_prepare_2.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
48
49
50
#!/usr/bin/env node
'use strict';
const fs = require('fs');
const path = require('path');
const child_process = require('child_process');
const execSync = child_process.execSync;
function list(dir) {
// List WebRTC architectures
console.log('List WebRTC architectures...');
console.log(execSync(`file WebRTC`, {cwd: dir}).toString().trim());
}
module.exports = function(ctx) {
console.log('[after_prepare hook] Project root: ' + ctx.opts.projectRoot);
const IOSRTC_PLUGIN_PATH = path.join(ctx.opts.projectRoot, 'plugins/cordova-plugin-iosrtc');
const LIB_PATH = path.join(IOSRTC_PLUGIN_PATH, 'lib');
const WEBRTC_BIN_PATH = path.join(LIB_PATH, 'WebRTC.framework');
const dir = WEBRTC_BIN_PATH;
console.log('List WebRTC files...');
console.log(execSync('ls -ahl | grep WebRTC', {cwd: dir}).toString().trim());
console.log(execSync(`lipo -info "WebRTC"`, {cwd: dir}).toString().trim());
console.log('Remove i386...');
execSync(`lipo -output "WebRTC-tmp" -remove "i386" "WebRTC"`, {cwd: dir});
execSync(`rm "WebRTC"`, {cwd: dir});
execSync(`mv "WebRTC-tmp" "WebRTC"`, {cwd: dir});
console.log('Remove x86_64...');
execSync(`lipo -output "WebRTC-tmp" -remove "x86_64" "WebRTC"`, {cwd: dir});
execSync(`rm "WebRTC"`, {cwd: dir});
execSync(`mv "WebRTC-tmp" "WebRTC"`, {cwd: dir});
console.log('List WebRTC files...');
console.log(execSync('ls -ahl | grep WebRTC', {cwd: dir}).toString().trim());
console.log(execSync(`lipo -info "WebRTC"`, {cwd: dir}).toString().trim());
list(dir);
};