// Copy and add a framework (Link Phase) to a PBXProject // // PBXProject project: the project to modify // string target: the target project's GUID // string framework: the path to the framework to add // string projectPath: the path to add the framework in the project, relative to the project root private static void AddFrameworkToProject(PBXProject project, string target, string framework, string buildPath, string projectPath) { Fabric.Internal.Editor.Utils.DirectoryCopy(framework, Path.Combine(buildPath, projectPath), true); string guid = project.AddFile (projectPath, projectPath); project.AddFileToBuild(target, guid); }
private static void AddFabricFrameworkSearchPath(string projPath) { PBXProject project = new PBXProject(); project.ReadFromString(File.ReadAllText(projPath)); string target = project.TargetGuidByName("Unity-iPhone"); Utils.Log ("Adding Framework Search Paths to Xcode project"); project.AddBuildProperty(target, "FRAMEWORK_SEARCH_PATHS", "$(SRCROOT)/Frameworks/" + fabricPluginsPath); File.WriteAllText(projPath, project.WriteToString()); }
protected static void AddFrameworksToProject(string[] frameworks, string buildPath, PBXProject project, string target) { #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 string frameworksDir = Path.Combine(Directory.GetCurrentDirectory (), "Assets/" + fabricPluginsPath); string pluginFrameworksDir = "Frameworks/" + fabricPluginsPath + "/"; foreach (string framework in frameworks) { string pluginFrameworkDir = pluginFrameworksDir + framework; if (!Directory.Exists (Path.Combine(buildPath, pluginFrameworkDir))) { Utils.Log ("Adding {0} to Xcode project", framework); AddFrameworkToProject(project, target, Path.Combine (frameworksDir, framework), buildPath, pluginFrameworkDir); } } #else // Unity 5 and above should already take care of copying and linking non-platform frameworks #endif }
private static void PrepareProject (string buildPath) { string projPath = Path.Combine (buildPath, "Unity-iPhone.xcodeproj/project.pbxproj"); PBXProject project = new PBXProject(); project.ReadFromString (File.ReadAllText(projPath)); string target = project.TargetGuidByName ("Unity-iPhone"); AddPlatformFrameworksToProject (platformFrameworks, project, target); AddFrameworksToProject (frameworks, buildPath, project, target); AddPlatformLibsToProject (platformLibs, project, target); AddLibsToProject (libs, project, target, buildPath); Fabric.Internal.Editor.Utils.Log ("Setting Debug Information Format to DWARF with dSYM File in Xcode project."); project.SetBuildProperty (target, "DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym"); File.WriteAllText (projPath, project.WriteToString()); if (!Enabled ()) { Fabric.Internal.Editor.Utils.Log ("{0} disabled. Crashlytics will not be initialized on app launch.", Name); } }
protected static void AddLibsToProject(string[] libs, PBXProject project, string target, string buildPath) { #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 string fabricPluginsFullPath = Path.Combine(Directory.GetCurrentDirectory (), "Assets/" + fabricPluginsPath); foreach (string lib in libs) { string libPathInProject = Path.Combine ("Libraries", Path.GetFileName (lib)); string libFullPathInProject = Path.Combine (buildPath, libPathInProject); if (!File.Exists (libFullPathInProject)) { File.Copy (Path.Combine (fabricPluginsFullPath, lib), libFullPathInProject); string libGUID = project.AddFile (libFullPathInProject, libPathInProject, PBXSourceTree.Absolute); project.AddFileToBuild (target, libGUID); } } #else // Unity 5 and above should already take care of copying and linking non-platform frameworks #endif }
private static void PrepareProject (string buildPath) { Settings settings = Settings.Instance; if (string.IsNullOrEmpty(settings.Organization.ApiKey) || string.IsNullOrEmpty(settings.Organization.BuildSecret)) { Utils.Error ("Unable to find API Key or Build Secret. Fabric was not added to the player."); return; } string projPath = Path.Combine (buildPath, "Unity-iPhone.xcodeproj/project.pbxproj"); PBXProject project = new PBXProject(); project.ReadFromString(File.ReadAllText(projPath)); string target = project.TargetGuidByName("Unity-iPhone"); Utils.Log ("Adding Framework Search Paths to Xcode project"); project.AddBuildProperty(target, "FRAMEWORK_SEARCH_PATHS", "$(inherited) $(PROJECT_DIR)/Frameworks/" + fabricPluginsPath); File.WriteAllText(projPath, project.WriteToString()); AddFabricRunScriptBuildPhase(projPath); }
private static void PrepareProject(string buildPath) { string projPath = Path.Combine (buildPath, "Unity-iPhone.xcodeproj/project.pbxproj"); PBXProject project = new PBXProject (); project.ReadFromString (File.ReadAllText(projPath)); string target = project.TargetGuidByName ("Unity-iPhone"); AddPlatformFrameworksToProject (platformFrameworks, project, target); AddFrameworksToProject (frameworks, buildPath, project, target); AddLibsToProject (libs, project, target, buildPath); File.WriteAllText (projPath, project.WriteToString()); }
protected static void AddBuildProperty(PBXProject project, string target, string property, string value) { project.AddBuildProperty (target, property, value); }
protected static void AddPlatformLibsToProject(string[] libs, PBXProject project, string target) { foreach (string lib in libs) { string libGUID = project.AddFile ("usr/lib/" + lib, "Libraries/" + lib, PBXSourceTree.Sdk); project.AddFileToBuild (target, libGUID); } }
protected static void AddPlatformFrameworksToProject(string[] frameworks, PBXProject project, string target) { foreach (string framework in frameworks) { if (!project.HasFramework (framework)) { Utils.Log ("Adding {0} to Xcode project", framework); project.AddFrameworkToProject (target, framework, false); } } }