jet 08ab62d0bd 重新导入ShareSDK 8 years ago
..
ICSharpCode.SharpZipLib.dll d7260af52d Update 5.12 8 years ago
ICSharpCode.SharpZipLib.dll.meta d7260af52d Update 5.12 8 years ago
LICENSE 08ab62d0bd 重新导入ShareSDK 8 years ago
LICENSE.meta 08ab62d0bd 重新导入ShareSDK 8 years ago
PBXBuildFile.cs d7260af52d Update 5.12 8 years ago
PBXBuildFile.cs.meta d7260af52d Update 5.12 8 years ago
PBXBuildPhase.cs d7260af52d Update 5.12 8 years ago
PBXBuildPhase.cs.meta d7260af52d Update 5.12 8 years ago
PBXDictionary.cs d7260af52d Update 5.12 8 years ago
PBXDictionary.cs.meta d7260af52d Update 5.12 8 years ago
PBXFileReference.cs d7260af52d Update 5.12 8 years ago
PBXFileReference.cs.meta d7260af52d Update 5.12 8 years ago
PBXGroup.cs d7260af52d Update 5.12 8 years ago
PBXGroup.cs.meta d7260af52d Update 5.12 8 years ago
PBXList.cs d7260af52d Update 5.12 8 years ago
PBXList.cs.meta d7260af52d Update 5.12 8 years ago
PBXObject.cs d7260af52d Update 5.12 8 years ago
PBXObject.cs.meta d7260af52d Update 5.12 8 years ago
PBXParser.cs d7260af52d Update 5.12 8 years ago
PBXParser.cs.meta d7260af52d Update 5.12 8 years ago
PBXProject.cs d7260af52d Update 5.12 8 years ago
PBXProject.cs.meta d7260af52d Update 5.12 8 years ago
Readme.mdown 08ab62d0bd 重新导入ShareSDK 8 years ago
Readme.mdown.meta 08ab62d0bd 重新导入ShareSDK 8 years ago
XCBuildConfiguration.cs d7260af52d Update 5.12 8 years ago
XCBuildConfiguration.cs.meta d7260af52d Update 5.12 8 years ago
XCConfigurationList.cs d7260af52d Update 5.12 8 years ago
XCConfigurationList.cs.meta d7260af52d Update 5.12 8 years ago
XCFileOperationQueue.cs d7260af52d Update 5.12 8 years ago
XCFileOperationQueue.cs.meta d7260af52d Update 5.12 8 years ago
XCMod.cs 08ab62d0bd 重新导入ShareSDK 8 years ago
XCMod.cs.meta d7260af52d Update 5.12 8 years ago
XCProject.cs 08ab62d0bd 重新导入ShareSDK 8 years ago
XCProject.cs.meta d7260af52d Update 5.12 8 years ago
XCSourceFile.cs d7260af52d Update 5.12 8 years ago
XCSourceFile.cs.meta d7260af52d Update 5.12 8 years ago
XCTarget.cs d7260af52d Update 5.12 8 years ago
XCTarget.cs.meta d7260af52d Update 5.12 8 years ago
XCodeEditorMenu.cs d7260af52d Update 5.12 8 years ago
XCodeEditorMenu.cs.meta d7260af52d Update 5.12 8 years ago
ZipHelper.cs d7260af52d Update 5.12 8 years ago
ZipHelper.cs.meta d7260af52d Update 5.12 8 years ago

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.