Code Wiget
Code Wiget

Reputation: 1682

Parse .pbxproj files on linux

Ive been looking for some way to convert .pbxproj files to xml files for parsing for a CI pipeline. On mac, I can use "plutil -convert xml1 < filename >", and it works perfectly, but Linux's open source plist parsing tool is full of bugs and fails (even with debug mode) with a basic "failed to convert plist file".

Is there any alternative solution/way of parsing this file? Our goal is to validate that all files are included in multiple xcode targets.

Upvotes: 0

Views: 568

Answers (2)

Tomas Reimers
Tomas Reimers

Reputation: 3292

As you've already figured out, the pbxproj is actually just a plist (in old-style, nextstep format I believe; http://www.monobjc.net/xcode-project-file-format.html).

In order to parse it, you need to be able to parse a plist on Ubuntu.

There are a few options there, including plist-util, which works but does not have the same API. Personally, I forked a drop-in replacement for plutil so that I didn't need to update our scripts to account for Linux and Mac envs separately.

Upvotes: 0

Eugene Dudnyk
Eugene Dudnyk

Reputation: 6030

If you are familiar with ruby, you can use Xcodeproj gem. It allows you to parse the pbxproj file directly, without conversion into xml.

Upvotes: 1

Related Questions