public void ApplyMod(XCMod mod) { PBXGroup modGroup = this.GetGroup(mod.group); Debug.Log("Adding libraries..."); PBXGroup librariesGroup = this.GetGroup("Libraries"); foreach (XCModFile libRef in mod.libs) { string completeLibPath = System.IO.Path.Combine("usr/lib", libRef.filePath); this.AddFile(completeLibPath, modGroup, "SDKROOT", true, libRef.isWeak); } Debug.Log("Adding frameworks..."); PBXGroup frameworkGroup = this.GetGroup("Frameworks"); foreach (string framework in mod.frameworks) { string[] filename = framework.Split(':'); bool isWeak = (filename.Length > 1) ? true : false; string completePath = System.IO.Path.Combine("System/Library/Frameworks", filename[0]); this.AddFile(completePath, frameworkGroup, "SDKROOT", true, isWeak); } Debug.Log("Adding files..."); foreach (string filePath in mod.files) { string absoluteFilePath = System.IO.Path.Combine(mod.path, filePath); this.AddFile(absoluteFilePath, modGroup); } Debug.Log("Adding folders..."); foreach (string folderPath in mod.folders) { string absoluteFolderPath = System.IO.Path.Combine(mod.path, folderPath); this.AddFolder(absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray(typeof(string))); } Debug.Log("Adding headerpaths..."); foreach (string headerpath in mod.headerpaths) { string absoluteHeaderPath = System.IO.Path.Combine(mod.path, headerpath); this.AddHeaderSearchPaths(absoluteHeaderPath); } this.Consolidate(); }
public void ApplyMod(XCMod mod) { PBXGroup modGroup = this.GetGroup(mod.group); foreach (XCModFile libRef in mod.libs) { string completeLibPath; if (libRef.sourceTree.Equals("SDKROOT")) { completeLibPath = System.IO.Path.Combine("usr/lib", libRef.filePath); } else { completeLibPath = System.IO.Path.Combine(mod.path, libRef.filePath); } this.AddFile(completeLibPath, modGroup, libRef.sourceTree, true, libRef.isWeak); } PBXGroup frameworkGroup = this.GetGroup("Frameworks"); foreach (string framework in mod.frameworks) { string[] filename = framework.Split(':'); bool isWeak = (filename.Length > 1) ? true : false; string completePath = System.IO.Path.Combine("System/Library/Frameworks", filename[0]); this.AddFile(completePath, frameworkGroup, "SDKROOT", true, isWeak); } foreach (string filePath in mod.files) { string absoluteFilePath = System.IO.Path.Combine(mod.path, filePath); this.AddFile(absoluteFilePath, modGroup); } foreach (string folderPath in mod.folders) { string absoluteFolderPath = AddXcodeQuotes(System.IO.Path.Combine(mod.path, folderPath)); this.AddFolder(absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray( )); } foreach (string headerpath in mod.headerpaths) { string absoluteHeaderPath = AddXcodeQuotes(System.IO.Path.Combine(mod.path, headerpath)); this.AddHeaderSearchPaths(absoluteHeaderPath); } foreach (string librarypath in mod.librarysearchpaths) { string absolutePath = AddXcodeQuotes(System.IO.Path.Combine(mod.path, librarypath)); this.AddLibrarySearchPaths(absolutePath); } if (mod.frameworksearchpath != null) { foreach (string frameworksearchpath in mod.frameworksearchpath) { string absoluteHeaderPath = AddXcodeQuotes(System.IO.Path.Combine(mod.path, frameworksearchpath)); this.AddFrameworkSearchPaths(absoluteHeaderPath); } } this.Consolidate(); }
// #region Files // // // /// <summary> // /// Returns all file resources in the project, as an array of `XCSourceFile` objects. // /// </summary> // /// <returns> // /// The files. // /// </returns> // public ArrayList GetFiles() // { // return null; // } // // /// <summary> // /// Returns the project file with the specified key, or nil. // /// </summary> // /// <returns> // /// The file with key. // /// </returns> // /// <param name='key'> // /// Key. // /// </param> // public XCSourceFile GetFileWithKey( string key ) // { // return null; // } // // /// <summary> // /// Returns the project file with the specified name, or nil. If more than one project file matches the specified name, // /// which one is returned is undefined. // /// </summary> // /// <returns> // /// The file with name. // /// </returns> // /// <param name='name'> // /// Name. // /// </param> // public XCSourceFile GetFileWithName( string name ) // { // return null; // } // // /// <summary> // /// Returns all header files in the project, as an array of `XCSourceFile` objects. // /// </summary> // /// <returns> // /// The header files. // /// </returns> // public ArrayList GetHeaderFiles() // { // return null; // } // // /** // * Returns all implementation obj-c implementation files in the project, as an array of `XCSourceFile` objects. // */ // public ArrayList GetObjectiveCFiles() // { // return null; // } // // /** // * Returns all implementation obj-c++ implementation files in the project, as an array of `XCSourceFile` objects. // */ // public ArrayList GetObjectiveCPlusPlusFiles() // { // return null; // } // // /** // * Returns all the xib files in the project, as an array of `XCSourceFile` objects. // */ // public ArrayList GetXibFiles() // { // return null; // // } // // public ArrayList getImagePNGFiles() // { // return null; // } // // #endregion // #region Groups // /** // * Lists the groups in an xcode project, returning an array of `PBXGroup` objects. // */ // public PBXList groups { // get { // return null; // } // } // // /** // * Returns the root (top-level) group. // */ // public PBXGroup rootGroup { // get { // return null; // } // } // // /** // * Returns the root (top-level) groups, if there are multiple. An array of rootGroup if there is only one. // */ // public ArrayList rootGroups { // get { // return null; // } // } // // /** // * Returns the group with the given key, or nil. // */ // public PBXGroup GetGroupWithKey( string key ) // { // return null; // } // // /** // * Returns the group with the specified display name path - the directory relative to the root group. Eg Source/Main // */ // public PBXGroup GetGroupWithPathFromRoot( string path ) // { // return null; // } // // /** // * Returns the parent group for the group or file with the given key; // */ // public PBXGroup GetGroupForGroupMemberWithKey( string key ) // { // return null; // } // // /** // * Returns the parent group for the group or file with the source file // */ // public PBXGroup GetGroupWithSourceFile( XCSourceFile sourceFile ) // { // return null; // } // // #endregion // #region Target // // /** // * Lists the targets in an xcode project, returning an array of `XCTarget` objects. // */ // public ArrayList targets { // get { // return null; // } // } // // /** // * Returns the target with the specified name, or nil. // */ // public XCTarget GetTargetWithName( string name ) // { // return null; // } // // #endregion // #region Configurations // // /** // * Returns the target with the specified name, or nil. // */ // public Dictionary<string, string> configurations { // get { // return null; // } // } // // public Dictionary<string, string> GetConfigurationWithName( string name ) // { // return null; // } // // public XCBuildConfigurationList defaultConfiguration { // get { // return null; // } // } // // #endregion #region Mods public void ApplyMod(string pbxmod) { XCMod mod = new XCMod(pbxmod); ApplyMod(mod); }
public void ApplyMod(string rootPath, string pbxmod) { XCMod mod = new XCMod(rootPath, pbxmod); ApplyMod(mod); }