protected bool AddSearchPaths(PBXList paths, string key, bool recursive = true, bool quoted = false) //we want no quoting whenever we can get away with it { // Debug.Log ("AddSearchPaths " + paths + key + (recursive?" recursive":"") + " " + (quoted?" quoted":"")); bool modified = false; if (!ContainsKey(BUILDSETTINGS_KEY)) { this.Add(BUILDSETTINGS_KEY, new PBXSortedDictionary()); } foreach (string path in paths) { string currentPath = path; // Converting path to use Forward slashes currentPath = currentPath.Replace('\\', '/'); // Debug.Log ("path " + currentPath); if (!((PBXDictionary)_data[BUILDSETTINGS_KEY]).ContainsKey(key)) { ((PBXDictionary)_data[BUILDSETTINGS_KEY]).Add(key, new PBXList()); } else if (((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] is string) { PBXList list = new PBXList(); list.Add(((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]); ((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] = list; } //Xcode uses space as the delimiter here, so if there's a space in the filename, we *must* quote. Escaping with slash may work when you are in the Xcode UI, in some situations, but it doesn't work here. if (currentPath.Contains(@" ")) { quoted = true; } if (quoted) { //if it ends in "/**", it wants to be recursive, and the "/**" needs to be _outside_ the quotes if (currentPath.EndsWith("/**")) { currentPath = "\\\"" + currentPath.Replace("/**", "\\\"/**"); } else { currentPath = "\\\"" + currentPath + "\\\""; } } // Debug.Log ("currentPath = " + currentPath); if (!((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]).Contains(currentPath)) { ((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]).Add(currentPath); modified = true; } } return(modified); }
public bool AddFrameworkSearchPaths(PBXList paths) { foreach (KeyValuePair <string, XCBuildConfiguration> buildConfig in buildConfigurations) { buildConfig.Value.AddFrameworkSearchPaths(paths); } modified = true; return(modified); }
public bool AddOtherLinkerFlags(PBXList flags) { foreach (KeyValuePair <string, XCBuildConfiguration> buildConfig in buildConfigurations) { buildConfig.Value.AddOtherLinkerFlags(flags); } modified = true; return(modified); }
public bool SetWeakLink(bool weak = false) { PBXDictionary settings = null; PBXList attributes = null; _data.Remove(SETTINGS_KEY); if (!_data.ContainsKey(SETTINGS_KEY)) { if (weak) { attributes = new PBXList(); attributes.Add(WEAK_VALUE); settings = new PBXDictionary(); settings.Add(ATTRIBUTES_KEY, attributes); _data.Add(SETTINGS_KEY, settings); } return(true); } settings = _data[SETTINGS_KEY] as PBXDictionary; if (!settings.ContainsKey(ATTRIBUTES_KEY)) { if (weak) { attributes = new PBXList(); attributes.Add(WEAK_VALUE); settings.Add(ATTRIBUTES_KEY, attributes); return(true); } else { return(false); } } else { attributes = settings[ATTRIBUTES_KEY] as PBXList; } if (weak) { attributes.Add(WEAK_VALUE); } else { attributes.Remove(WEAK_VALUE); } settings.Add(ATTRIBUTES_KEY, attributes); this.Add(SETTINGS_KEY, settings); return(true); }
public bool AddLibrarySearchPaths(PBXList paths) { Debug.Log("AddLibrarySearchPaths " + paths); foreach (KeyValuePair <string, XCBuildConfiguration> buildConfig in buildConfigurations) { buildConfig.Value.AddLibrarySearchPaths(paths); } modified = true; return(modified); }
public bool AddHeaderSearchPaths(PBXList paths, bool recursive) { // Debug.Log ("AddHeaderSearchPaths " + paths); foreach (KeyValuePair <string, XCBuildConfiguration> buildConfig in buildConfigurations) { buildConfig.Value.AddHeaderSearchPaths(paths, recursive); } modified = true; return(modified); }
public bool AddFrameworkSearchPaths(PBXList paths) { xcodeProject.UpdateBuildProperty(targetGUID, "FRAMEWORK_SEARCH_PATHS", (string[])paths.ToArray(typeof(string)), new string[] { }); foreach (KeyValuePair <string, XCBuildConfiguration> buildConfig in buildConfigurations) { buildConfig.Value.AddFrameworkSearchPaths(paths); } modified = true; return(modified); }
public bool AddLibrarySearchPaths(PBXList paths) { xcodeProject.UpdateBuildProperty(targetGUID, "LIBRARY_SEARCH_PATHS", (string[])paths.ToArray(typeof(string)), new string[] { }); // Debug.Log ("AddLibrarySearchPaths " + paths); foreach (KeyValuePair <string, XCBuildConfiguration> buildConfig in buildConfigurations) { buildConfig.Value.AddLibrarySearchPaths(paths); } modified = true; return(modified); }
public XCProject(string filePath) : this() { if (!Directory.Exists(filePath)) { Debug.LogWarning("XCode project path does not exist: " + filePath); return; } if (filePath.EndsWith(".xcodeproj")) { // Debug.Log( "Opening project " + filePath ); this.projectRootPath = Path.GetDirectoryName(filePath); this.filePath = filePath; } else { // Debug.Log( "Looking for xcodeproj files in " + filePath ); string[] projects = Directory.GetDirectories(filePath, "*.xcodeproj"); if (projects.Length == 0) { Debug.LogWarning("Error: missing xcodeproj file"); return; } this.projectRootPath = filePath; //if the path is relative to the project, we need to make it absolute if (!Path.IsPathRooted(projectRootPath)) { projectRootPath = Application.dataPath.Replace("Assets", "") + projectRootPath; } // Debug.Log ("projectRootPath adjusted to " + projectRootPath); this.filePath = projects[0]; } projectFileInfo = new FileInfo(Path.Combine(this.filePath, "project.pbxproj")); StreamReader streamReader = projectFileInfo.OpenText(); string contents = streamReader.ReadToEnd(); streamReader.Close(); // Get xcode project xcodeProject = GetXcodeProject(filePath); targetGUID = GetUnityTargetGUID(); PBXParser parser = new PBXParser(); _datastore = parser.Decode(contents); if (_datastore == null) { throw new System.Exception("Project file not found at file path " + filePath); } if (!_datastore.ContainsKey("objects")) { Debug.Log("Error " + _datastore.Count); return; } _objects = (PBXDictionary)_datastore["objects"]; modified = false; _rootObjectKey = (string)_datastore["rootObject"]; if (!string.IsNullOrEmpty(_rootObjectKey)) { _project = new PBXProject(_rootObjectKey, (PBXDictionary)_objects[_rootObjectKey]); _rootGroup = new PBXGroup(_rootObjectKey, (PBXDictionary)_objects[_project.mainGroupID]); PBXNativeTarget _unityNativeTarget = GetUnityNativeTarget(); _targetBuildPhases = (PBXList)_unityNativeTarget.data["buildPhases"]; } else { Debug.LogWarning("error: project has no root object"); _project = null; _rootGroup = null; } }
public bool AddHeaderSearchPaths(PBXList paths, bool recursive = true) { return(this.AddSearchPaths(paths, HEADER_SEARCH_PATHS_KEY, recursive)); }
public bool AddFrameworkSearchPaths(PBXList paths, bool recursive = true) { return(this.AddSearchPaths(paths, FRAMEWORK_SEARCH_PATHS_KEY, recursive)); }
public bool AddLibrarySearchPaths(PBXList paths, bool recursive = true) { // Debug.Log ("AddLibrarySearchPaths " + paths); return(this.AddSearchPaths(paths, LIBRARY_SEARCH_PATHS_KEY, recursive)); }