void RefreshMapsForGroupChildren(string projectPath, string realPath, PBXSourceTree realPathTree, PBXGroupData parent) { var children = new List <string>(parent.children); foreach (string guid in children) { PBXFileReferenceData fileRef = fileRefs[guid]; string pPath; string rPath; PBXSourceTree rTree; if (fileRef != null) { pPath = PBXPath.Combine(projectPath, fileRef.name); PBXPath.Combine(realPath, realPathTree, fileRef.path, fileRef.tree, out rPath, out rTree); if (!m_ProjectPathToFileRefMap.ContainsKey(pPath)) { m_ProjectPathToFileRefMap.Add(pPath, fileRef); } if (!m_FileRefGuidToProjectPathMap.ContainsKey(fileRef.guid)) { m_FileRefGuidToProjectPathMap.Add(fileRef.guid, pPath); } if (!m_RealPathToFileRefMap[rTree].ContainsKey(rPath)) { m_RealPathToFileRefMap[rTree].Add(rPath, fileRef); } if (!m_GuidToParentGroupMap.ContainsKey(guid)) { m_GuidToParentGroupMap.Add(guid, parent); } continue; } PBXGroupData gr = groups[guid]; if (gr != null) { pPath = PBXPath.Combine(projectPath, gr.name); PBXPath.Combine(realPath, realPathTree, gr.path, gr.tree, out rPath, out rTree); if (!m_ProjectPathToGroupMap.ContainsKey(pPath)) { m_ProjectPathToGroupMap.Add(pPath, gr); } if (!m_GroupGuidToProjectPathMap.ContainsKey(gr.guid)) { m_GroupGuidToProjectPathMap.Add(gr.guid, pPath); } if (!m_GuidToParentGroupMap.ContainsKey(guid)) { m_GuidToParentGroupMap.Add(guid, parent); } RefreshMapsForGroupChildren(pPath, rPath, rTree, gr); } } }
public static string GetFullPath(string path) { if (PBXPath.IsPathRooted(path)) { return(path); } return(PBXPath.Combine(PBXPath.GetCurrentDirectory(), path)); }
// Write the actual file to the disk. // If you don't call this method nothing will change. public void WriteToFile() { File.WriteAllText(m_PBXProjectPath, project.WriteToString()); if (m_Entitlements != null) { m_Entitlements.WriteToFile(PBXPath.Combine(m_BuildPath, m_EntitlementFilePath)); } if (m_InfoPlist != null) { m_InfoPlist.WriteToFile(PBXPath.Combine(m_BuildPath, "Info.plist")); } }
private void RefreshMapsForGroupChildren(string projectPath, string realPath, PBXSourceTree realPathTree, PBXGroupData parent) { foreach (string key1 in new List <string>((IEnumerable <string>)parent.children)) { PBXFileReferenceData fileReferenceData = this.fileRefs[key1]; string resPath; PBXSourceTree resTree; if (fileReferenceData != null) { string key2 = PBXPath.Combine(projectPath, fileReferenceData.name); PBXPath.Combine(realPath, realPathTree, fileReferenceData.path, fileReferenceData.tree, out resPath, out resTree); if (!this.m_ProjectPathToFileRefMap.ContainsKey(key2)) { this.m_ProjectPathToFileRefMap.Add(key2, fileReferenceData); } if (!this.m_FileRefGuidToProjectPathMap.ContainsKey(fileReferenceData.guid)) { this.m_FileRefGuidToProjectPathMap.Add(fileReferenceData.guid, key2); } if (!this.m_RealPathToFileRefMap[resTree].ContainsKey(resPath)) { this.m_RealPathToFileRefMap[resTree].Add(resPath, fileReferenceData); } if (!this.m_GuidToParentGroupMap.ContainsKey(key1)) { this.m_GuidToParentGroupMap.Add(key1, parent); } } else { PBXGroupData parent1 = this.groups[key1]; if (parent1 != null) { string str = PBXPath.Combine(projectPath, parent1.name); PBXPath.Combine(realPath, realPathTree, parent1.path, parent1.tree, out resPath, out resTree); if (!this.m_ProjectPathToGroupMap.ContainsKey(str)) { this.m_ProjectPathToGroupMap.Add(str, parent1); } if (!this.m_GroupGuidToProjectPathMap.ContainsKey(parent1.guid)) { this.m_GroupGuidToProjectPathMap.Add(parent1.guid, str); } if (!this.m_GuidToParentGroupMap.ContainsKey(key1)) { this.m_GuidToParentGroupMap.Add(key1, parent); } this.RefreshMapsForGroupChildren(str, resPath, resTree, parent1); } } } }
public void WriteToFile() { File.WriteAllText(this.m_PBXProjectPath, this.project.WriteToString()); if (this.m_Entitlements != null) { this.m_Entitlements.WriteToFile(PBXPath.Combine(this.m_BuildPath, this.m_EntitlementFilePath)); } if (this.m_InfoPlist == null) { return; } this.m_InfoPlist.WriteToFile(PBXPath.Combine(this.m_BuildPath, "Info.plist")); }
public static void Combine(string path1, PBXSourceTree tree1, string path2, PBXSourceTree tree2, out string resPath, out PBXSourceTree resTree) { if (tree2 == PBXSourceTree.Group) { resPath = PBXPath.Combine(path1, path2); resTree = tree1; } else { resPath = path2; resTree = tree2; } }
private PlistDocument GetOrCreateEntitlementDoc() { if (this.m_Entitlements == null) { this.m_Entitlements = new PlistDocument(); if (File.Exists(PBXPath.Combine(this.m_BuildPath, this.m_EntitlementFilePath))) { this.m_Entitlements.ReadFromFile(PBXPath.Combine(this.m_BuildPath, this.m_EntitlementFilePath)); } else { this.m_Entitlements.Create(); } } return(this.m_Entitlements); }
private PlistDocument GetOrCreateEntitlementDoc() { if (this.m_Entitlements == null) { this.m_Entitlements = new PlistDocument(); if (File.Exists(PBXPath.Combine(this.m_BuildPath, this.m_EntitlementFilePath))) { this.m_Entitlements.ReadFromFile(PBXPath.Combine(this.m_BuildPath, this.m_EntitlementFilePath)); } else { this.m_Entitlements.Create(); string target = this.project.TargetGuidByName(PBXProject.GetUnityTargetName()); this.project.SetBuildProperty(target, "CODE_SIGN_ENTITLEMENTS", this.m_EntitlementFilePath); System.Console.WriteLine(string.Format("target={0} m_EntitlementFilePath={1}", target, this.m_EntitlementFilePath)); } } return(this.m_Entitlements); }
public static string GetPBXProjectPath(string buildPath) => PBXPath.Combine(buildPath, "Unity-iPhone.xcodeproj/project.pbxproj");