XCode 4 project editor for Unity3D postprocess.
C#
Switch branches/tags
Nothing to show
Clone or download
dcariola Merge pull request #19 from GaborTB/master
Avoid null reference exception if mod.buildSettings is not defined
Latest commit 05962b4 Aug 6, 2016
Permalink
Failed to load latest commit information.
LICENSE Add readme and licence files Nov 5, 2012
LICENSE.meta Add readme and licence files Nov 5, 2012
PBXBuildFile.cs - Support other linker flags Jul 22, 2013
PBXBuildFile.cs.meta Complete PBX structure. Sep 21, 2012
PBXBuildPhase.cs applies mod to xcode project from projmods file Oct 15, 2012
PBXBuildPhase.cs.meta Complete PBX structure. Sep 21, 2012
PBXDictionary.cs AddFolder working Sep 28, 2012
PBXDictionary.cs.meta Complete PBX structure. Sep 21, 2012
PBXFileReference.cs applies mod to xcode project from projmods file Oct 15, 2012
PBXFileReference.cs.meta Complete PBX structure. Sep 21, 2012
PBXGroup.cs AddFolder working Sep 28, 2012
PBXGroup.cs.meta Complete PBX structure. Sep 21, 2012
PBXList.cs Many edits. Sep 23, 2012
PBXList.cs.meta Complete PBX structure. Sep 21, 2012
PBXObject.cs AddFolder working Sep 28, 2012
PBXObject.cs.meta Many edits. Sep 23, 2012
PBXParser.cs AddFolder working Sep 28, 2012
PBXParser.cs.meta Add initial structure. Working on PBXParser. Sep 17, 2012
PBXProject.cs AddFolder working Sep 28, 2012
PBXProject.cs.meta Many edits. Sep 23, 2012
Readme.mdown Copy usage instructions from http://www.keepcalmandrevert.com/blog/20… Feb 4, 2014
Readme.mdown.meta Add readme and licence files Nov 5, 2012
XCBuildConfiguration.cs - Able to edit build settings Jul 29, 2013
XCBuildConfiguration.cs.meta Many edits. Sep 23, 2012
XCConfigurationList.cs AddFolder working Sep 28, 2012
XCConfigurationList.cs.meta Complete PBX structure. Sep 21, 2012
XCFileOperationQueue.cs Add initial structure. Working on PBXParser. Sep 17, 2012
XCFileOperationQueue.cs.meta Add initial structure. Working on PBXParser. Sep 17, 2012
XCMod.cs - Able to edit build settings Jul 29, 2013
XCMod.cs.meta applies mod to xcode project from projmods file Oct 15, 2012
XCProject.cs Avoid throwing null reference exception if mod.buildSettings is not d… Aug 6, 2016
XCProject.cs.meta Add initial structure. Working on PBXParser. Sep 17, 2012
XCSourceFile.cs Add initial structure. Working on PBXParser. Sep 17, 2012
XCSourceFile.cs.meta Add initial structure. Working on PBXParser. Sep 17, 2012
XCTarget.cs Add initial structure. Working on PBXParser. Sep 17, 2012
XCTarget.cs.meta Add initial structure. Working on PBXParser. Sep 17, 2012
XCodeEditorMenu.cs - Support other linker flags Jul 22, 2013
XCodeEditorMenu.cs.meta Add initial structure. Working on PBXParser. Sep 17, 2012
XMiniJSON.cs - Able to edit build settings Jul 29, 2013
XMiniJSON.cs.meta - Able to edit build settings Jul 29, 2013
sample_config.projmods - Able to edit build settings Jul 29, 2013

Readme.mdown

XCode Editor for Unity

OVERVIEW

The purpose of this project is to allow editing an XCode 4 project.

This project is based upon the python project Mod PBXProj by Calvin Rien (http://the.darktable.com/). Due to the recent addiction of PostProcessBuild attribute to Unity, I found much useful having a C# version of the library.

INSTALLATION

Clone this repo somewhere under Assets/Editor in your project. If your project is not yet checked into git, then you'll need to do the appropriate setup and add this as a submodule (google: git-submodule).

If you already use git for your project, then just add this as a submodule.

USAGE

You can use the XCProject class in any part of your editor and postprocess code. Taking advantage of the great powers of the new PostProcessBuild attribute, I suggest to use a small cs static class to run through all the projmods files in your asses folder and simply apply them to the newly created xcode project.

using UnityEditor;

public static class XCodePostProcess
{
    [PostProcessBuild]
    public static void OnPostProcessBuild( BuildTarget target, string path )
    {
        // Create a new project object from build target
        XCodeEditor.XCProject project = new XCodeEditor.XCProject( targetPath );

        // Find and run through all projmods files to patch the project
        var files = System.IO.Directory.GetFiles( Application.dataPath, "*.projmods", SearchOption.AllDirectories );
        foreach( var file in files ) {
            project.ApplyMod( file );
        }

        // Finally save the xcode project
        project.Save();
    }
}

The projmods file is a simple text file containing a JSON object. It will be used to pass the parameters to the ApplyMod method. This is the file I use for the GameCenter plugin as a brief example:

{
    "group":       "GameCenter",
    "libs":        [],
    "frameworks":  ["GameKit.framework"],
    "headerpaths": ["Editor/iOS/GameCenter/**"],
    "files":       ["Editor/iOS/GameCenter/GameCenterBinding.m",
                    "Editor/iOS/GameCenter/GameCenterController.h",
                    "Editor/iOS/GameCenter/GameCenterController.mm",
                    "Editor/iOS/GameCenter/GameCenterManager.h",
                    "Editor/iOS/GameCenter/GameCenterManager.m"],
    "folders":     [],
    "excludes":    ["^.*.meta$", "^.*.mdown^", "^.*.pdf$"]
}
  • group: all files and folders will be parented to this group;
  • libs: add libraries to build phase;
  • frameworks: add frameworks to the project;
  • headerpaths: add header paths to build phase;
  • files: add single files to the project;
  • folders: create a subgroup and add all files to the project (recursive);
  • excludes: file mask to exclude;

Note: all paths are relative to projmods location

LICENSE

This code is distributed under the terms and conditions of the MIT license.

Copyright (c) 2012 Daniele Cariola

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.