| | |
| | | using System.IO; |
| | | using UnityEditor; |
| | | using UnityEditor.iOS.Xcode.Custom; |
| | | using UnityEditor.iOS.Xcode.Custom.Extensions; |
| | | using UnityEngine; |
| | | |
| | | public class XCodeProjectMod |
| | | { |
| | | |
| | | #if UNITY_IOS |
| | | private const string CODE_SIGN_DEVELOPER = ""; |
| | | private const string CODE_SIGN_DISTRIBUTION = ""; |
| | | private const string PROVISIONING_DEVELOPER = ""; |
| | | private const string PROVISIONING_DISTRIBUTION = ""; |
| | | private const string TEAM = "5X26T385YZ"; |
| | | |
| | | #if UNITY_IOS |
| | | [UnityEditor.Callbacks.PostProcessBuild(999)] |
| | | public static void OnPostprocessBuild(BuildTarget buildTarget, string path) |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | string _projectPath = PBXProject.GetPBXProjectPath(path); |
| | | |
| | |
| | | _project.AddFileToBuild(_targetGUID, _project.AddFile("/usr/lib/libiconv.tbd", "Frameworks/libiconv.tbd", PBXSourceTree.Sdk)); |
| | | _project.AddFileToBuild(_targetGUID, _project.AddFile("/usr/lib/libresolv.tbd", "Frameworks/libresolv.tbd", PBXSourceTree.Sdk)); |
| | | |
| | | // 针对猫儿sdk的处理 |
| | | HandleMrSDK(_project); |
| | | // mr_sdk |
| | | HandleMrSDK(_project, _targetGUID); |
| | | |
| | | // sp_sdk |
| | | HandleSpSDK(_project, _targetGUID); |
| | | |
| | | File.WriteAllText(_projectPath, _project.WriteToString()); |
| | | |
| | |
| | | ModifyFile(path); |
| | | } |
| | | } |
| | | #endif |
| | | |
| | | private static void BuildPlist(string path) |
| | | { |
| | |
| | | BuildPipeline.BuildPlayer(ClientPackage.baseLevels, GetBuildPath(), BuildTarget.iOS, BuildOptions.Il2CPP); |
| | | } |
| | | |
| | | #if UNITY_IOS |
| | | [MenuItem("Build/ipa")] |
| | | public static void BuildIPA() |
| | | { |
| | |
| | | _p.Start(); |
| | | _p.WaitForExit(); |
| | | } |
| | | private static void HandleMrSDK(PBXProject project) |
| | | |
| | | private static void HandleMrSDK(PBXProject project, string targetGUID) |
| | | { |
| | | string _mrPlistPath = Application.dataPath + "/Plugins/iOS/MyMRSDK/MRSDKInfo.plist"; |
| | | if (File.Exists(_mrPlistPath)) |
| | | { |
| | | string _targetGUID = project.TargetGuidByName(PBXProject.GetUnityTargetName()); |
| | | string _fileGUID = project.AddFile(_mrPlistPath, "Frameworks/Plugins/iOS/MyMRSDK/MRSDKInfo.plist"); |
| | | project.AddFileToBuild(_targetGUID, _fileGUID); |
| | | project.AddFileToBuild(targetGUID, _fileGUID); |
| | | } |
| | | } |
| | | |
| | | private static void HandleSpSDK(PBXProject project, string targetGUID) |
| | | { |
| | | string _filePath = Application.dataPath + "/Plugins/iOS/SPYOUSDK/GDTActionSDK.framework"; |
| | | if (Directory.Exists(_filePath)) |
| | | { |
| | | string _frameworkGUID = project.FindFileGuidByProjectPath("Frameworks/Plugins/iOS/SPYOUSDK/GDTActionSDK.framework"); |
| | | PBXProjectExtensions.AddFileToEmbedFrameworks(project, targetGUID, _frameworkGUID); |
| | | } |
| | | } |
| | | |
| | | #endif |
| | | |
| | | } |