Skip to content

A tool for generating xcconfig files from a simple DSL

License

Notifications You must be signed in to change notification settings

danimal/pyconfig

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyconfig

pyconfig is a tool that allows you to write the contents of your xcconfig files in a simple and more expressive language and have them be generated prior to building a target in Xcode.

Contributing and Code of Conduct

This project and related material has a Code of Conduct that is listed in the contributing.md file. This must be read and adhered to when interacting with this project. Additionally this code is released under a 3-clause BSD license that you can read here.

Requirements

This script was written against system Python (2.7.10) on OS X 10.11.4. It uses two modules: argparse and pyparsing. Both of these come as part of the system Python installation for OS X, but you will have to install them yourself if necessary on other systems. Both of these modules can be accquired through pip install.

Installation

Via homebrew:

$ brew update
$ brew tap samdmarshall/formulae
$ brew install samdmarshall/formulae/pyconfig --head

Alternatively you can clone the repo and run the setup.py file to install.

Usage

To use pyconfig to generate an xcconfig file, you will have to pass it an input and the --output flag:

$ ./pyconfig.py <file path to the configuration file> --output <file path to write the xcconfig file>

You must create the intermediary directories if they do not already exist for the xcconfig file to be written to disk.

You can also use pyconfig to perform syntax validation on the configuration file by passing the --lint flag:

$ ./pyconfig.py <file path to the configuration file> --lint

Doing this should raise any of the major syntax errors and print out nothing if it passed successfully.

There is an additional flag that allows you to pass in an additional variable at execution of the script to represent the name of the scheme you are running. This feature exists to allow the generation of the xcconfig files to be added as a pre-build script phase to an Xcode scheme to re-define the build settings as necessary.

$ ./pyconfig.py <file path to the configuration file> --output <file path to write the xcconfig file> --scheme <name of scheme>

When using the --scheme flag, a new variable will be written to the generated xcconfig file as:

SCHEME_NAME = <value that was passed in via the flag>

Syntax

One of the greatest benefits to using xcconfig files are part of your build process is that they make the configuration of build settings be represented inside of a human-readable plain-text file rather than being part of the Xcode project's pbxproj file. The following sections detail the major aspects of the pyconfig language structures.

For the documentation on the DSL syntax please refer to the documentation file.

Future Plans

I hope to be able to further enhance the capabilities of this tool to make the management of the xcconfig files easy and understandable to newcomers. There are some additional tweaks to the syntax that I would like to add, including the ability to add comments anywhere in the configuration files. If you have an idea as to how to better extend this tool you should open a new issue to discuss it.

About

A tool for generating xcconfig files from a simple DSL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.0%
  • Shell 2.0%