public static void OnPostProcessBuild(BuildTarget target, string path) { // If integrating with facebook on any platform, throw a warning if the app id is invalid if (!FBSettings.IsValidAppId) { Debug.LogWarning("You didn't specify a Facebook app ID. Please add one using the Facebook menu in the main Unity editor."); } bool needsNewClassnames = IsVersion42OrLater (); if (target == BuildTarget.iPhone) { UnityEditor.XCodeEditor.XCProject project = new UnityEditor.XCodeEditor.XCProject (path); // Find and run through all projmods files to patch the project string projModPath = System.IO.Path.Combine (Application.dataPath, "Facebook/Editor/iOS"); var files = System.IO.Directory.GetFiles (projModPath, "*.projmods", System.IO.SearchOption.AllDirectories); foreach (var file in files) { project.ApplyMod (Application.dataPath, file); } project.Save (); PlistMod.UpdatePlist (path, FBSettings.AppId); FixupFiles.FixSimulator (path); if(needsNewClassnames) FixupFiles.AddVersionDefine (path); } }
public static void OnPostProcessBuild( BuildTarget target, string pathToBuiltProject ) { if (target != BuildTarget.iPhone) { Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run"); return; } // Create a new project object from build target XCProject project = new XCProject( pathToBuiltProject ); // Find and run through all projmods files to patch the project. // Please pay attention that ALL projmods files in your project folder will be excuted! string[] files = Directory.GetFiles( Application.dataPath, "*.projmods", SearchOption.AllDirectories ); foreach( string file in files ) { UnityEngine.Debug.Log("ProjMod File: "+file); project.ApplyMod( file ); } //TODO implement generic settings as a module option project.overwriteBuildSetting("CODE_SIGN_IDENTITY[sdk=iphoneos*]", "iPhone Distribution", "Release"); // Finally save the xcode project project.Save(); }
public static void OnPostProcessBuild( BuildTarget target, string pathToBuiltProject ) { if (target != BuildTarget.iPhone) { Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run"); return; } Debug.Log("build dir is:" + pathToBuiltProject); int index = pathToBuiltProject.LastIndexOf("/"); string folder = pathToBuiltProject.Substring(index + 1); Debug.Log("build folder is:" + folder); string[] sdks = folder.Split(new char[] { '_' }); // Create a new project object from build target XCProject project = new XCProject( pathToBuiltProject ); // Find and run through all projmods files to patch the project. // Please pay attention that ALL projmods files in your project folder will be excuted! string[] files = Directory.GetFiles( Path.Combine(Application.dataPath,"XUPorter"), "*.projmods", SearchOption.AllDirectories ); foreach( string file in files ) { string filename = Path.GetFileNameWithoutExtension(file); Debug.Log("found ProjMod:" + filename); bool ismeet = false; if (filename == "common") ismeet = true; else { int meet = 0; string[] modsdks = filename.Split(new char[] { '_' }); foreach (string modsdk in modsdks) { foreach (string sdk in sdks) { if (sdk == modsdk) { ++meet; break; } } if(meet==0) break; } ismeet = meet == modsdks.Length; } string info = string.Format("ProjMod {0}: {1}", ismeet ? "accepted" : "ignored", file); UnityEngine.Debug.Log(info); if(ismeet) project.ApplyMod( file ); } //TODO implement generic settings as a module option //project.overwriteBuildSetting("CODE_SIGN_IDENTITY[sdk=iphoneos*]", "iPhone Distribution", "Release"); // Finally save the xcode project project.Save(); }
public static void OnPostProcessBuild(BuildTarget target2, string path) { #if UNITY_5 || UNITY_5_3_OR_NEWER if (target2 == BuildTarget.iOS) #else if (target2 == BuildTarget.iPhone) #endif { UnityEditor.XCodeEditor.XCProject proj = new UnityEditor.XCodeEditor.XCProject(path); string projmodsPath = System.IO.Path.Combine(Application.dataPath, "SDKPackage/PSSDK/Plugins/IOS/PostProcessBuild"); string[] projmods = System.IO.Directory.GetFiles(projmodsPath, "PSSDK.projmods", System.IO.SearchOption.AllDirectories); if (projmods.Length == 0) { Debug.LogWarning("[PSSDKPostBuild] PSSDK.projmods not found!"); } foreach (string p in projmods) { proj.ApplyMod(p); } proj.AddOtherLinkerFlags("-ObjC"); //proj.AddOtherLinkerFlags ("-fobjc-arc"); proj.Save(); // add info.plist string infoPlistPath = Path.Combine(Path.GetFullPath(path), "info.plist"); var plist = new PlistDocument(); plist.ReadFromString(File.ReadAllText(infoPlistPath)); PlistElementDict root = plist.root; // NSAppTransportSecurity root.CreateDict("NSAppTransportSecurity").SetBoolean("NSAllowsArbitraryLoads", true); // Version PlistElementDict versionDict = (PlistElementDict)root["PackageSDKVersion"]; if (versionDict == null) { versionDict = root.CreateDict("PackageSDKVersion"); } PlistElementDict sdkVersionDict = versionDict.CreateDict("PSSDK"); string iOS_SDK_Version = PSSDKApi.iOS_SDK_Version; string Android_SDK_Version = PSSDKApi.Android_SDK_Version; string Unity_Package_Version = PSSDKApi.Unity_Package_Version; sdkVersionDict.SetString("PSSDK_iOS_SDK_Version", iOS_SDK_Version); sdkVersionDict.SetString("PSSDK_Android_SDK_Version", Android_SDK_Version); sdkVersionDict.SetString("PSSDK_Unity_Package_Version", Unity_Package_Version); File.WriteAllText(infoPlistPath, plist.WriteToString()); } }
public static void OnPostProcessBuild(BuildTarget target, string path) { // If integrating with facebook on any platform, throw a warning if the app id is invalid if (!FBSettings.IsValidAppId) { Debug.LogWarning("You didn't specify a Facebook app ID. Please add one using the Facebook menu in the main Unity editor."); } #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 if (target == BuildTarget.iPhone) #else if (target == BuildTarget.iOS) #endif { UnityEditor.XCodeEditor.XCProject project = new UnityEditor.XCodeEditor.XCProject(path); // Find and run through all projmods files to patch the project string projModPath = System.IO.Path.Combine(Application.dataPath, "Facebook/Editor/iOS"); var files = System.IO.Directory.GetFiles(projModPath, "*.projmods", System.IO.SearchOption.AllDirectories); foreach (var file in files) { project.ApplyMod(Application.dataPath, file); } project.Save(); UpdatePlist(path); FixupFiles.FixSimulator(path); FixupFiles.AddVersionDefine(path); FixupFiles.FixColdStart(path); } if (target == BuildTarget.Android) { // The default Bundle Identifier for Unity does magical things that causes bad stuff to happen if (PlayerSettings.bundleIdentifier == "com.Company.ProductName") { Debug.LogError("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly."); } if (!FacebookAndroidUtil.IsSetupProperly()) { Debug.LogError("Your Android setup is not correct. See Settings in Facebook menu."); } if (!ManifestMod.CheckManifest()) { // If something is wrong with the Android Manifest, try to regenerate it to fix it for the next build. ManifestMod.GenerateManifest(); } } }
static void DebugTest() { string projectPath = Path.Combine(Directory.GetParent(Application.dataPath).ToString(), "XCode"); // Debug.Log( "XcodePath: " + projectPath ); // XCProject currentProject = new XCProject( projectPath ); XCProject.ApplyMod(projectPath, "/Users/Elyn/Projects/UnityPlugins/Unity Sandbox Project/Assets/Modules/GameCenter/Editor/iOS/GameCenter.projmods"); //Debug.Log( // PBXDictionary test = new PBXDictionary(); // bool result = false; // if( test is Dictionary<string, object> ) // result = true; // // Debug.Log( result ); // PBXType type = new PBXType(); // Debug.Log( "TYPE: " + type["isa"] ); // // PBXBuildFile build = new PBXBuildFile( "" ); // Debug.Log( "BUILDFILE: " + build["isa"] ); // Debug.Log( PBXObject.GenerateGuid().ToUpper() ); // PBXList testList = currentProject.GetObjectOfType( "XCBuildConfiguration" ); // Debug.Log( testList.Count ); // Debug.Log( currentProject.rootGroup.guid + " " + currentProject.rootGroup.name + " " + currentProject.rootGroup.path); // string path1 = "Data/mainData"; // string path2 = "/Users/Elyn/Projects/UnityPlugins/Modules/GameCenter/Editor/iOS/"; // Debug.Log( "Objects: " + currentProject._objects.Count ); // Debug.Log( "Files: " + currentProject.buildFiles.Count ); // Debug.Log( "Groups: " + currentProject.groups.Count ); // string[] excludes = new string[] {"^.*\\.meta$", "^.*\\.mdown^", "^.*\\.pdf$"}; // currentProject.AddFolder( path2, null, excludes ); // currentProject.Consolidate(); // Debug.Log( "Objects: " + currentProject._objects.Count ); // currentProject.Save(); //ALTRO // currentProject.AddOtherCFlags( "TEST_FLAG" ); // // foreach( KeyValuePair<string, XCBuildConfiguration> config in currentProject.buildConfigurations ) { // Debug.Log( "C: " + config.Value.buildSettings["OTHER_CFLAGS"] ); // foreach( string keys in (PBXList)config.Value.buildSettings["OTHER_CFLAGS"] ) // Debug.Log( keys ); // } // currentProject.Save(); }
public static void OnPostProcessBuild(BuildTarget target, string path) { Debug.Log("XUnityDeploy Post Process ...."); if (target == BuildTarget.iOS) { var project = new UnityEditor.XCodeEditor.XCProject(path); var xcodeConfigPath = Path.Combine(Application.dataPath.Replace("Assets", ""), "XUnityDeploy/configs/xcode"); var buildFilePath = Path.Combine(xcodeConfigPath, "main.build.json"); Debug.Log("buildPath : " + buildFilePath); string buildContent = System.IO.File.ReadAllText(buildFilePath); var buildData = MiniJSON.jsonDecode(buildContent) as Hashtable; var projmodList = buildData["projmods"] as ArrayList; // Find and run through all projmods files to patch the project // string projModPath = System.IO.Path.Combine(Application.dataPath, "Editor/iOS"); var projModPath = xcodeConfigPath; for (int index = 0; index < projmodList.Count; ++index) { var file = System.IO.Path.Combine(projModPath, projmodList[index].ToString()); Debug.Log(String.Format("Project ApplyMode : {0}", file)); try { project.ApplyMod(file); } catch (System.Exception ex) { //log Debug.LogError("Project ApplyMode Exception : " + ex.Message + ex.StackTrace); throw ex; } } project.Save(); var info = buildData["info"] as string; var infoPath = System.IO.Path.Combine(projModPath, info); var infoContent = System.IO.File.ReadAllText(infoPath); var infoData = MiniJSON.jsonDecode(infoContent) as Hashtable; PlistMod.UpdatePlist_Extend(path, infoData); } if (target == BuildTarget.Android) { //TODO } }
public static void OnPostProcessBuild(BuildTarget target, string path) { // If integrating with facebook on any platform, throw a warning if the app id is invalid if (!FBSettings.IsValidAppId) { Debug.LogWarning("You didn't specify a Facebook app ID. Please add one using the Facebook menu in the main Unity editor."); } if (target == BuildTarget.iPhone) { UnityEditor.XCodeEditor.XCProject project = new UnityEditor.XCodeEditor.XCProject(path); // Find and run through all projmods files to patch the project string projModPath = System.IO.Path.Combine(Application.dataPath, "Facebook/Editor/iOS"); var files = System.IO.Directory.GetFiles(projModPath, "*.projmods", System.IO.SearchOption.AllDirectories); foreach (var file in files) { project.ApplyMod(Application.dataPath, file); } project.Save(); PlistMod.UpdatePlist(path, FBSettings.AppId); FixupFiles.FixSimulator(path); FixupFiles.AddVersionDefine(path); FixupFiles.FixColdStart(path); } if (target == BuildTarget.Android) { // The default Bundle Identifier for Unity does magical things that causes bad stuff to happen if (PlayerSettings.bundleIdentifier == "com.Company.ProductName") { Debug.LogError("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly."); } if (!FacebookAndroidUtil.IsSetupProperly()) { Debug.LogError("Your Android setup is not correct. See Settings in Facebook menu."); } if (!ManifestMod.CheckManifest()) { // If something is wrong with the Android Manifest, try to regenerate it to fix it for the next build. ManifestMod.GenerateManifest(); } } }
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { #if UNITY_IOS //set a flag, next time biuld process if the flag exist, rebuild string flagPath = System.IO.Path.Combine(pathToBuiltProject, "unity_built_flag"); if (!System.IO.File.Exists(flagPath)) { System.IO.File.WriteAllText(flagPath, "built_time:" + System.DateTime.Now); } else { //adjusted the proj file, ignore return; } UnityEditor.XCodeEditor.XCProject project = new UnityEditor.XCodeEditor.XCProject(pathToBuiltProject); // Find and run through all projmods files to patch the project string projModPath = System.IO.Path.Combine(Application.dataPath, "Scripts/Editor"); project.ApplyMod(Path.Combine(projModPath, "YoumeTalk.projmods")); // project.overwriteBuildSetting("CODE_SIGN_IDENTITY[sdk=iphoneos*]", "iPhone Distribution", "Release"); project.overwriteBuildSetting("ENABLE_BITCODE", "NO", "Release"); project.overwriteBuildSetting("ENABLE_BITCODE", "NO", "Debug"); Debug.Log("saving modified xcode proj file"); project.Save(); // const string fileName = "Info.plist"; // string plistFilePath = System.IO.Path.Combine(pathToBuiltProject, fileName); //scheme is a string like: "wx|sdf3423sdfiopf" // InfoPlistEditor plistEditor = new InfoPlistEditor(); // plistEditor.ReadFile(plistFilePath); //string[] tokens = s.Split('|'); // string id = tokens[0]; // string url = tokens[1]; // plistEditor.AppendUrlScheme(id, url); // plistEditor.AppendKeyValue(key,value); // plistEditor.Save(plistFilePath); #endif }
public static void OnPostProcessBuild(BuildTarget target, string path) { // If integrating with facebook on any platform, throw a warning if the app id is invalid if (!FBSettings.IsValidAppId) { Debug.LogWarning("You didn't specify a Facebook app ID. Please add one using the Facebook menu in the main Unity editor."); } bool needsNewClassnames = IsVersion42OrLater(); if (target == BuildTarget.iPhone) { UnityEditor.XCodeEditor.XCProject project = new UnityEditor.XCodeEditor.XCProject(path); // Find and run through all projmods files to patch the project string projModPath = System.IO.Path.Combine(Application.dataPath, "Facebook/Editor/iOS"); var files = System.IO.Directory.GetFiles(projModPath, "*.projmods", System.IO.SearchOption.AllDirectories); foreach (var file in files) { project.ApplyMod(Application.dataPath, file); } project.Save(); PlistMod.UpdatePlist(path, FBSettings.AppId); FixupFiles.FixSimulator(path); if (needsNewClassnames) { FixupFiles.AddVersionDefine(path); } } if (target == BuildTarget.Android) { // The default Bundle Identifier for Unity does magical things that causes bad stuff to happen if (PlayerSettings.bundleIdentifier == "com.Company.ProductName") { Debug.LogError("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly."); } } }
public static void OnPostProcessBuild( BuildTarget target, string path ) { if (target != BuildTarget.iPhone) { Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run"); return; } // Create a new project object from build target XCProject project = new XCProject( path ); // Find and run through all projmods files to patch the project. //Please pay attention that ALL projmods files in your project folder will be excuted! string[] files = Directory.GetFiles( Application.dataPath, "*.projmods", SearchOption.AllDirectories ); foreach( string file in files ) { project.ApplyMod( file ); } // Finally save the xcode project project.Save(); }
public static void EdittingPbxProj(string pathToBuiltProject) { // Xcode 프로젝트 불러오기.(project.pbxproj 수정 용도.) XCProject prj = new XCProject(pathToBuiltProject); // .projmods적용. 외부 프래임워크 추가, 파일 복사(폴더). string[] files = Directory.GetFiles(Application.dataPath + "/Editor/XcodeProjectMods", "*.projmods", SearchOption.AllDirectories); foreach( string file in files ) prj.ApplyMod( file ); // 테스트로 아무 프로비저닝이나 추가함. prj.overwriteBuildSetting("CODE_SIGN_NAME_IDENTITY[sdk=iphoneos*]", CODE_SIGN_NAME, "Release"); prj.overwriteBuildSetting("CODE_SIGN_NAME_IDENTITY[sdk=iphoneos*]", CODE_SIGN_NAME, "Debug"); prj.overwriteBuildSetting("CODE_SIGN_NAME_IDENTITY", CODE_SIGN_NAME, "Release"); prj.overwriteBuildSetting("CODE_SIGN_NAME_IDENTITY", CODE_SIGN_NAME, "Debug"); prj.overwriteBuildSetting("PROVISIONING_PROFILE", PROVISIONING_UUID, "Release"); prj.overwriteBuildSetting("PROVISIONING_PROFILE", PROVISIONING_UUID, "Debug"); // 설정이 변경된 프로젝트 저장. prj.Save(); }
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject) { if (target != BuildTarget.iOS) { Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run"); return; } //得到xcode工程的路径 string path = Path.GetFullPath(pathToBuiltProject); // Create a new project object from build target XCProject project = new XCProject(pathToBuiltProject); // Find and run through all projmods files to patch the project. // Please pay attention that ALL projmods files in your project folder will be excuted! //在这里面把frameworks添加在你的xcode工程里面 string[] files = Directory.GetFiles(Application.dataPath, "*.projmods", SearchOption.AllDirectories); foreach (string file in files) { project.ApplyMod(file); } ////增加一个编译标记。。没有的话sharesdk会报错。。 //project.AddOtherLinkerFlags("-licucore"); ////设置签名的证书, 第二个参数 你可以设置成你的证书 //project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "xxxxxx", "Release"); //project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "xxxxxx", "Debug"); //// 编辑plist 文件 //EditorPlist(path); ////编辑代码文件 //EditorCode(path); // Finally save the xcode project project.Save(); }
public static void OnPostprocessBuild( BuildTarget target, string path ) { if (BuildTarget.iPhone == target) { // Create a new project object from build target XCodeEditor.XCProject project = new XCodeEditor.XCProject (path); //Debug.Log ("project has been created using path: "+path); // Find and run through all projmods files to patch the project //Debug.Log ("searching for projmods files in:" +Application.dataPath); var files = System.IO.Directory.GetFiles (Application.dataPath+"/Editor/iOS", "*.projmods", SearchOption.AllDirectories); foreach (var file in files) { Debug.Log (file.ToString()); project.ApplyMod (file); } if (files.Length <= 0) { Debug.Log ("no .projmods files found"); } // Finally save the xcode project project.Save (); } }
public static void OnPostProcessBuild(BuildTarget target, string path) { if (target == BuildTarget.iOS) { // Create a new project object from build target UnityEditor.XCodeEditor.XCProject project = new UnityEditor.XCodeEditor.XCProject(path); string projModPath = System.IO.Path.Combine(Application.dataPath, "XCodeEditor"); // Find and run through all projmods files to patch the project var files = System.IO.Directory.GetFiles(projModPath, "*.projmods", SearchOption.AllDirectories); foreach (var file in files) { project.ApplyMod(file); } // Finally save the xcode project project.Save(); // Update 7plist for Facebook // UnityEditor.FacebookEditor.XCodePostProcess.UpdatePlist(path); } }
public static void OnPostProcessBuild(BuildTarget target2, string path) { #if UNITY_5 || UNITY_5_3_OR_NEWER if (target2 == BuildTarget.iOS) #else if (target2 == BuildTarget.iPhone) #endif { UnityEditor.XCodeEditor.XCProject proj = new UnityEditor.XCodeEditor.XCProject(path); string[] projmods = System.IO.Directory.GetFiles( System.IO.Path.Combine(System.IO.Path.Combine(Application.dataPath, "PolyADSDK"), "Plugins"), "PolyADSDK.projmods", System.IO.SearchOption.AllDirectories); if (projmods.Length == 0) { Debug.LogWarning("[PolyPostBuild]PolyADSDK.projmods not found!"); } foreach (string p in projmods) { proj.ApplyMod(p); } proj.AddOtherLinkerFlags("-ObjC"); proj.AddOtherLinkerFlags("-fobjc-arc"); proj.Save(); // delete android assets file of avidly string avidlypath = System.IO.Path.Combine(System.IO.Path.Combine(proj.projectRootPath, "Data"), "Raw"); Debug.Log("==> path1:" + avidlypath); if (System.IO.Directory.Exists(avidlypath)) { avidlypath = System.IO.Path.Combine(avidlypath, "avidly_android"); Debug.Log("==> path2:" + avidlypath); if (System.IO.Directory.Exists(avidlypath)) { Debug.Log("==> exist avidly_android, will delete allfiles"); string [] avidlyfiles = System.IO.Directory.GetFiles(avidlypath); foreach (string p in avidlyfiles) { Debug.Log("==> to del:" + p); if (System.IO.File.Exists(p)) { System.IO.File.Delete(p); Debug.Log("==> to del finish"); } } } } string filePath = Path.GetFullPath(path); Debug.Log("==> filePath " + filePath); string infofilePath = Path.Combine(filePath, "info.plist"); Debug.Log("==> infofilePath " + infofilePath); if (!System.IO.File.Exists(infofilePath)) { Debug.LogError(infofilePath + ", 路径下文件不存在"); return; } Dictionary <string, object> dict = (Dictionary <string, object>)PlistCS.Plist.readPlist(infofilePath); string dkey = "AppLovinSdkKey"; if (!dict.ContainsKey(dkey)) { dict.Add(dkey, "e-4s7LbXsuJb2oXtoW10amMsJ9scHJhwHmmP6LxzEEZH159qbBqBxA2FKvsbCXWUIHuPdqMs2w840HucShoOtq"); PlistCS.Plist.writeXml(dict, infofilePath); Debug.Log("==> add " + dkey + " :" + dict [dkey]); } else { Debug.Log("==> exist " + dkey + " :" + dict[dkey]); } dkey = "NSAppTransportSecurity"; if (!dict.ContainsKey(dkey)) { Dictionary <string, bool> dv = new Dictionary <string, bool>(); dv.Add("NSAllowsArbitraryLoads", true); dict.Add(dkey, dv); Debug.Log("==> add " + dkey + " :" + dict [dkey]); } else { Debug.Log("==> exist " + dkey + " :" + dict[dkey]); } string pluginspath = System.IO.Path.Combine(System.IO.Path.Combine(Application.dataPath, "PolyADSDK"), "Plugins"); Debug.Log("==> pluginspath " + pluginspath); if (System.IO.File.Exists(pluginspath)) { string iospath = System.IO.Path.Combine(pluginspath, "IOS"); Debug.Log("==> iospath " + iospath); if (System.IO.File.Exists(iospath)) { string fmpath = System.IO.Path.Combine(iospath, "frameworks"); if (System.IO.File.Exists(fmpath)) { string adcolonypath = System.IO.Path.Combine(fmpath, "AdColony.framework"); if (System.IO.File.Exists(adcolonypath)) { System.IO.File.Delete(adcolonypath); Debug.Log("==> del exist " + adcolonypath); } string delfmpath = System.IO.Path.Combine(fmpath, "FBAudienceNetwork.framework"); if (System.IO.File.Exists(delfmpath)) { System.IO.File.Delete(delfmpath); Debug.Log("==> del exist " + delfmpath); } delfmpath = System.IO.Path.Combine(fmpath, "GoogleMobileAds.framework"); if (System.IO.File.Exists(delfmpath)) { System.IO.File.Delete(delfmpath); Debug.Log("==> del exist " + delfmpath); } delfmpath = System.IO.Path.Combine(fmpath, "MVSDK.framework"); if (System.IO.File.Exists(delfmpath)) { System.IO.File.Delete(delfmpath); Debug.Log("==> del exist " + delfmpath); } delfmpath = System.IO.Path.Combine(fmpath, "MVSDKReward.framework"); if (System.IO.File.Exists(delfmpath)) { System.IO.File.Delete(delfmpath); Debug.Log("==> del exist " + delfmpath); } delfmpath = System.IO.Path.Combine(fmpath, "UnityAds.framework"); if (System.IO.File.Exists(delfmpath)) { System.IO.File.Delete(delfmpath); Debug.Log("==> del exist " + delfmpath); } delfmpath = System.IO.Path.Combine(fmpath, "VungleSDK.framework"); if (System.IO.File.Exists(delfmpath)) { System.IO.File.Delete(delfmpath); Debug.Log("==> del exist " + delfmpath); } } } } //在plist里面增加一行 //list.AddKey(PlistAdd); //在plist里面替换一行 //list.ReplaceKey("<string>com.yusong.${PRODUCT_NAME}</string>","<string>"+bundle+"</string>"); //保存 //list.Save(); //string projPath = PBXProject.GenerateGuid (); //PBXProject pbxProject = new PBXProject (); // proj.AddEmbedFramework ("WebKit.framework"); // proj.AddEmbedFramework ("libsqlite3.tbd"); // proj.AddEmbedFramework ("libz.tbd"); // proj.AddOtherLinkerFlags("-ObjC"); // proj.Save(); // string projPath = PBXProject.GetPBXProjectPath (path); // PBXProject proj = new PBXProject (); // // // proj.ReadFromString (File.ReadAllText (projPath)); // string target = proj.TargetGuidByName ("Unity-iPhone"); // // // add extra framework(s) // proj.AddFrameworkToProject (target, "WebKit.framework", true); // proj.AddFrameworkToProject (target, "libsqlite3.tbd", true); // proj.AddFrameworkToProject (target, "libz.tbd", true); // proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-ObjC"); // // File.WriteAllText(projPath, proj.WriteToString()); // project.overwriteBuildSetting("ENABLE_BITCODE", "NO", "Release"); // project.overwriteBuildSetting("ENABLE_BITCODE", "NO", "Debug"); //project.AddOtherLinkerFlags("-ObjC"); //project.Save(); } }
static void DebugTest() { string projectPath = Path.Combine( Directory.GetParent( Application.dataPath ).ToString(), "XCode" ); // Debug.Log( "XcodePath: " + projectPath ); // Create a new project object from build target XCProject project = new XCProject( projectPath ); Debug.Log( Application.dataPath ); // Find and run through all projmods files to patch the project var files = System.IO.Directory.GetFiles( Application.dataPath, "*.projmod", SearchOption.AllDirectories ); foreach( var file in files ) { Debug.Log ( file.ToString() ); project.ApplyMod( file ); } // XCProject currentProject = new XCProject( projectPath ); // XCProject.ApplyMod( projectPath, "/Users/Elyn/Projects/UnityPlugins/Unity Sandbox Project/Assets/Modules/GameCenter/Editor/iOS/GameCenter.projmods" ); //Debug.Log( // PBXDictionary test = new PBXDictionary(); // bool result = false; // if( test is Dictionary<string, object> ) // result = true; // // Debug.Log( result ); // PBXType type = new PBXType(); // Debug.Log( "TYPE: " + type["isa"] ); // // PBXBuildFile build = new PBXBuildFile( "" ); // Debug.Log( "BUILDFILE: " + build["isa"] ); // Debug.Log( PBXObject.GenerateGuid().ToUpper() ); // PBXList testList = currentProject.GetObjectOfType( "XCBuildConfiguration" ); // Debug.Log( testList.Count ); // Debug.Log( currentProject.rootGroup.guid + " " + currentProject.rootGroup.name + " " + currentProject.rootGroup.path); // string path1 = "Data/mainData"; // string path2 = "/Users/Elyn/Projects/UnityPlugins/Modules/GameCenter/Editor/iOS/"; // Debug.Log( "Objects: " + currentProject._objects.Count ); // Debug.Log( "Files: " + currentProject.buildFiles.Count ); // Debug.Log( "Groups: " + currentProject.groups.Count ); // string[] excludes = new string[] {"^.*\\.meta$", "^.*\\.mdown^", "^.*\\.pdf$"}; // currentProject.AddFolder( path2, null, excludes ); // currentProject.Consolidate(); // Debug.Log( "Objects: " + currentProject._objects.Count ); // currentProject.Save(); //ALTRO // currentProject.AddOtherCFlags( "TEST_FLAG" ); // // foreach( KeyValuePair<string, XCBuildConfiguration> config in currentProject.buildConfigurations ) { // Debug.Log( "C: " + config.Value.buildSettings["OTHER_CFLAGS"] ); // foreach( string keys in (PBXList)config.Value.buildSettings["OTHER_CFLAGS"] ) // Debug.Log( keys ); // } // currentProject.Save(); }