This repository has been archived by the owner on Oct 2, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0026e0c
commit a27143f
Showing
2 changed files
with
26 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,16 +15,30 @@ module.exports = function(context) { | |
var projectPath = path.join(platformRoot, projectName + '.xcodeproj/project.pbxproj'); | ||
var xcodeProject = xcode.project(projectPath); | ||
|
||
xcodeProject.parse(function(error) { | ||
if (error) { | ||
console.log('Error: ' + JSON.stringify(error)); | ||
} else { | ||
var pbxProjectSection = xcodeProject.pbxProjectSection(); | ||
var firstProjectUUID = Object.keys(pbxProjectSection)[0]; | ||
var firstProject = pbxProjectSection[firstProjectUUID]; | ||
// Xcode 7.2 | ||
firstProject.attributes['LastSwiftUpdateCheck'] = '0720'; | ||
fs.writeFileSync(projectPath, xcodeProject.writeSync()); | ||
xcodeProject.parseSync(); | ||
|
||
var configurations, buildSettings; | ||
configurations = nonComments(xcodeProject.pbxXCBuildConfigurationSection()); | ||
Object.keys(configurations).forEach(function (config) { | ||
buildSettings = configurations[config].buildSettings; | ||
buildSettings.SWIFT_VERSION = '3.0'; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
martijnwalraven
Author
Contributor
|
||
}); | ||
|
||
fs.writeFileSync(projectPath, xcodeProject.writeSync()); | ||
} | ||
|
||
// Extracted from https://github.com/alunny/node-xcode/blob/master/lib/pbxProject.js | ||
|
||
COMMENT_KEY = /_comment$/; | ||
|
||
function nonComments(obj) { | ||
var keys = Object.keys(obj), newObj = {}, i = 0; | ||
|
||
for (i; i < keys.length; i++) { | ||
if (!COMMENT_KEY.test(keys[i])) { | ||
newObj[keys[i]] = obj[keys[i]]; | ||
} | ||
}); | ||
} | ||
|
||
return newObj; | ||
} |
@martijnwalraven is the master now compatible with swift 3 or should we stick with the swift3 branch for now?