Skip to content

Commit 09dbca7

Browse files
committed
Update deps.
1 parent 49ca1f0 commit 09dbca7

File tree

2 files changed

+53
-31
lines changed

2 files changed

+53
-31
lines changed

config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
<plugin name="cordova-plugin-crosswalk-webview" spec="https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview" />
3434
<plugin name="cordova-plugin-device" version="^1.0.1" />
3535
<plugin name="cordova-plugin-camera" spec="https://github.com/eface2face/cordova-plugin-camera" />
36-
<plugin name="cordova-plugin-iosrtc" version="^1.4.5" />
36+
<plugin name="cordova-plugin-iosrtc" version="^2.0.1" />
3737
</widget>

hooks/iosrtc-swift-support.js

Lines changed: 52 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
// This hook automates this:
66
// https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/docs/Building.md
77

8-
var fs = require("fs"),
8+
var
9+
fs = require("fs"),
910
path = require("path"),
1011
xcode = require('xcode'),
1112

12-
BUILD_VERSION = '8.2',
13+
BUILD_VERSION = '7.0',
1314
BUILD_VERSION_XCODE = '"' + BUILD_VERSION + '"',
1415
RUNPATH_SEARCH_PATHS = '@executable_path/Frameworks',
1516
RUNPATH_SEARCH_PATHS_XCODE = '"' + RUNPATH_SEARCH_PATHS + '"',
16-
17+
ENABLE_BITCODE = 'NO',
18+
ENABLE_BITCODE_XCODE = '"' + ENABLE_BITCODE + '"',
1719
BRIDGING_HEADER_END = '/Plugins/cordova-plugin-iosrtc/cordova-plugin-iosrtc-Bridging-Header.h',
1820
COMMENT_KEY = /_comment$/;
1921

@@ -22,15 +24,17 @@ var fs = require("fs"),
2224

2325
// Returns the project name
2426
function getProjectName(protoPath) {
25-
var cordovaConfigPath = path.join(protoPath, 'config.xml'),
27+
var
28+
cordovaConfigPath = path.join(protoPath, 'config.xml'),
2629
content = fs.readFileSync(cordovaConfigPath, 'utf-8');
2730

2831
return /<name>([\s\S]*)<\/name>/mi.exec(content)[1].trim();
2932
}
3033

3134
// Drops the comments
3235
function nonComments(obj) {
33-
var keys = Object.keys(obj),
36+
var
37+
keys = Object.keys(obj),
3438
newObj = {},
3539
i = 0;
3640

@@ -47,7 +51,8 @@ function nonComments(obj) {
4751
// Starting here
4852

4953
module.exports = function (context) {
50-
var projectRoot = context.opts.projectRoot,
54+
var
55+
projectRoot = context.opts.projectRoot,
5156
projectName = getProjectName(projectRoot),
5257
xcconfigPath = path.join(projectRoot, '/platforms/ios/cordova/build.xcconfig'),
5358
xcodeProjectName = projectName + '.xcodeproj',
@@ -59,24 +64,27 @@ module.exports = function (context) {
5964

6065
// Checking if the project files are in the right place
6166
if (!fs.existsSync(xcodeProjectPath)) {
62-
console.error('ERROR: An error occured searching the project file at: "' + xcodeProjectPath + '"');
67+
debugerror('an error occurred searching the project file at: "' + xcodeProjectPath + '"');
6368

6469
return;
6570
}
66-
console.log('".pbxproj" project file found: ' + xcodeProjectPath);
71+
debug('".pbxproj" project file found: ' + xcodeProjectPath);
72+
6773
if (!fs.existsSync(xcconfigPath)) {
68-
console.error('ERROR: An error occured searching the project file at: "' + xcconfigPath + '"');
74+
debugerror('an error occurred searching the project file at: "' + xcconfigPath + '"');
6975

7076
return;
7177
}
72-
console.log('".xcconfig" project file found: ' + xcconfigPath);
78+
debug('".xcconfig" project file found: ' + xcconfigPath);
79+
7380
xcodeProject = xcode.project(xcodeProjectPath);
7481

7582
// Showing info about the tasks to do
76-
console.log('Fixing issues in the generated project files:');
77-
console.log('- "iOS Deployment Target" and "Deployment Target" to: ' + BUILD_VERSION_XCODE);
78-
console.log('- "Runpath Search Paths" to: ' + RUNPATH_SEARCH_PATHS_XCODE);
79-
console.log('- "Objective-C Bridging Header" to: ' + swiftBridgingHeadXcode);
83+
debug('fixing issues in the generated project files:');
84+
debug('- "iOS Deployment Target" and "Deployment Target" to: ' + BUILD_VERSION_XCODE);
85+
debug('- "Runpath Search Paths" to: ' + RUNPATH_SEARCH_PATHS_XCODE);
86+
debug('- "Objective-C Bridging Header" to: ' + swiftBridgingHeadXcode);
87+
debug('- "ENABLE_BITCODE" set to: ' + ENABLE_BITCODE_XCODE);
8088

8189

8290
// Massaging the files
@@ -85,32 +93,46 @@ module.exports = function (context) {
8593
swiftOptions.push('LD_RUNPATH_SEARCH_PATHS = ' + RUNPATH_SEARCH_PATHS);
8694
swiftOptions.push('SWIFT_OBJC_BRIDGING_HEADER = ' + swiftBridgingHead);
8795
swiftOptions.push('IPHONEOS_DEPLOYMENT_TARGET = ' + BUILD_VERSION);
96+
swiftOptions.push('ENABLE_BITCODE = ' + ENABLE_BITCODE);
8897
// NOTE: Not needed
8998
// swiftOptions.push('EMBEDDED_CONTENT_CONTAINS_SWIFT = YES');
9099
fs.appendFileSync(xcconfigPath, swiftOptions.join('\n'));
91-
console.log('File correctly fixed: ' + xcconfigPath);
100+
debug('file correctly fixed: ' + xcconfigPath);
92101

93102
// "project.pbxproj"
94103
// Parsing it
95104
xcodeProject.parse(function (error) {
96105
var configurations, buildSettings;
97106

98107
if (error) {
99-
console.error('ERROR: An error occured during the parse of the project file');
100-
} else {
101-
configurations = nonComments(xcodeProject.pbxXCBuildConfigurationSection());
102-
// Adding or changing the parameters we need
103-
Object.keys(configurations).forEach(function (config) {
104-
buildSettings = configurations[config].buildSettings;
105-
buildSettings.LD_RUNPATH_SEARCH_PATHS = RUNPATH_SEARCH_PATHS_XCODE;
106-
buildSettings.SWIFT_OBJC_BRIDGING_HEADER = swiftBridgingHeadXcode;
107-
buildSettings.IPHONEOS_DEPLOYMENT_TARGET = BUILD_VERSION_XCODE;
108-
});
109-
110-
// Writing the file again
111-
fs.writeFileSync(xcodeProjectPath, xcodeProject.writeSync(), 'utf-8');
112-
console.log('File correctly fixed: ' + xcodeProjectPath);
108+
debugerror('an error occurred during the parsing of the project file');
109+
110+
return;
113111
}
114-
});
115112

113+
114+
configurations = nonComments(xcodeProject.pbxXCBuildConfigurationSection());
115+
// Adding or changing the parameters we need
116+
Object.keys(configurations).forEach(function (config) {
117+
buildSettings = configurations[config].buildSettings;
118+
buildSettings.LD_RUNPATH_SEARCH_PATHS = RUNPATH_SEARCH_PATHS_XCODE;
119+
buildSettings.SWIFT_OBJC_BRIDGING_HEADER = swiftBridgingHeadXcode;
120+
buildSettings.IPHONEOS_DEPLOYMENT_TARGET = BUILD_VERSION_XCODE;
121+
buildSettings.ENABLE_BITCODE = ENABLE_BITCODE_XCODE;
122+
});
123+
124+
// Writing the file again
125+
fs.writeFileSync(xcodeProjectPath, xcodeProject.writeSync(), 'utf-8');
126+
debug('file correctly fixed: ' + xcodeProjectPath);
127+
});
116128
};
129+
130+
131+
function debug(msg) {
132+
console.log('iosrtc-swift-support.js [INFO] ' + msg);
133+
}
134+
135+
136+
function debugerror(msg) {
137+
console.error('iosrtc-swift-support.js [ERROR] ' + msg);
138+
}

0 commit comments

Comments
 (0)