commit | 6af1ba82ad702b4a9900f8e2513128f76e2405b4 | [log] [tgz] |
---|---|---|
author | Dimitar Kerezov <dimitar.kerezov@telerik.com> | Tue Jun 30 18:02:38 2015 +0300 |
committer | Dimitar Kerezov <dimitar.kerezov@telerik.com> | Tue Jun 30 18:02:38 2015 +0300 |
tree | 4e6e4574b4be8a37c3a4d997781e2b58d0b66a47 | |
parent | 4982cedb488b51c9c282183897e0ebb9704d31e9 [diff] |
Fix AddBuildPhase able to add duplicate files Add a check - if a file exists in the PBXBuildFile and the PBXFileReference sections do not add it
parser/toolkit for xcodeproj project files
Allows you to edit xcodeproject files and write them back out.
// API is a bit wonky right now var xcode = require('xcode'), fs = require('fs'), projectPath = 'myproject.xcodeproj/project.pbxproj', myProj = xcode.project(projectPath); // parsing is async, in a different process myProj.parse(function (err) { myProj.addHeaderFile('foo.h'); myProj.addSourceFile('foo.m'); myProj.addFramework('FooKit.framework'); fs.writeFileSync(projectPath, myProj.writeSync()); console.log('new project written'); });
If there's a problem parsing, you will want to edit the grammar under lib/parser/pbxproj.pegjs
. You can test it online with the PEGjs online thingy at http://pegjs.majda.cz/online - I have had some mixed results though.
Tests under the test/parser
directory will compile the parser from the grammar. Other tests will use the prebuilt parser (lib/parser/pbxproj.js
).
To rebuild the parser js file after editing the grammar, run:
./node_modules/.bin/pegjs lib/parser/pbxproj.pegjs
(easier if ./node_modules/.bin
is in your path)
MIT