-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXCodePostProcess.cs
More file actions
133 lines (102 loc) · 4.88 KB
/
XCodePostProcess.cs
File metadata and controls
133 lines (102 loc) · 4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.XCodeEditor;
#endif
using System.IO;
public static class XCodePostProcess
{
#if UNITY_EDITOR
[PostProcessBuild(999)]
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
{
#if UNITY_5
if (target != BuildTarget.iOS)
{
#else
if (target != BuildTarget.iOS) {
#endif
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)
{
Debug.Log("ProjMod File: " + file);
project.ApplyMod(file);
}
////TODO disable the bitcode for iOS 9
//project.overwriteBuildSetting("ENABLE_BITCODE", "NO", "Release");
//project.overwriteBuildSetting("ENABLE_BITCODE", "NO", "Debug");
//关闭bitcode
project.overwriteBuildSetting("ENABLE_BITCODE", "NO");
Debug.LogError(" ����֤��~~~~~~~~~~~ ");
//TODO implement generic settings as a module option
//project.overwriteBuildSetting("CODE_SIGN_IDENTITY[sdk=iphoneos*]", "iPhone Distribution", "Release");
//project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "iPhone Developer: wang ke (LYDZ2B92D4)", "Release");
//project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "iPhone Developer: wang ke (LYDZ2B92D4)", "Debug");
//project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "iPhone Developer: client Tgame (8NK3ABPV64)", "Release");
//project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "iPhone Developer: client Tgame (8NK3ABPV64)", "Debug");
#if AUDIT
#region krly
project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "iPhone Distribution: BeiJing TianShenHuDong Science and Technology Co., Ltd. (9ZK4D6KRR3)", "Release");
project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "iPhone Developer: wang ke (LYDZ2B92D4)", "Debug");
project.overwriteBuildSetting("PROVISIONING_PROFILE", "tfkrly-dev");
project.overwriteBuildSetting("PROVISIONING_PROFILE_SPECIFIER", "tfkrly-dis");
#endregion
#elif NORMAL
#region tgame
project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "iPhone Distribution: BeiJing TianShenHuDong Science and Technology Co., Ltd.", "Release");
project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "iPhone Developer: Hengli Liu (98M285BSQB)", "Debug");
project.overwriteBuildSetting("PROVISIONING_PROFILE", "tgame-dev");
project.overwriteBuildSetting("PROVISIONING_PROFILE_SPECIFIER", "Tgame-dis");
#endregion
#endif
project.overwriteBuildSetting("GCC_ENABLE_OBJC_EXCEPTIONS", "YES", "Release");
project.overwriteBuildSetting("GCC_ENABLE_OBJC_EXCEPTIONS", "YES", "Debug");
project.overwriteBuildSetting("GCC_ENABLE_CPP_EXCEPTIONS", "YES", "Release");
project.overwriteBuildSetting("GCC_ENABLE_CPP_EXCEPTIONS", "YES", "Debug");
project.overwriteBuildSetting("GCC_ENABLE_CPP_RTTI", "YES", "Release");
project.overwriteBuildSetting("GCC_ENABLE_CPP_RTTI", "YES", "Debug");
#if AUDIT
project.overwriteBuildSetting("PRODUCT_BUNDLE_IDENTIFIER", "com.zeus.awesome.krly");
project.overwriteBuildSetting("PRODUCT_NAME","krly");
#elif NORMAL
project.overwriteBuildSetting("PRODUCT_BUNDLE_IDENTIFIER","com.tianshen.shuguang.tgame");
project.overwriteBuildSetting("PRODUCT_NAME", "krly");
#endif
//TODO implement generic settings as a module option
// project.overwriteBuildSetting("CODE_SIGN_IDENTITY[sdk=iphoneos*]", "iPhone Distribution", "Release");
var pbxproj = project.project;
var attrs = pbxproj.attributes;
var targetAttrs = (PBXDictionary)attrs["TargetAttributes"];
PBXDictionary targetSetting = new PBXDictionary();
targetSetting["ProvisioningStyle"] = "Manual";
var targets = pbxproj.targets;
foreach (var t in targets)
{
var targetID = (string)t;
if (targetAttrs.ContainsKey(targetID))
{
var TargetAttr = (PBXDictionary)targetAttrs[targetID];
TargetAttr.Append(targetSetting);
}
else
{
targetAttrs[targetID] = targetSetting;
}
}
// Finally save the xcode project
project.Save();
}
#endif
public static void Log(string message)
{
Debug.Log("PostProcess: " + message);
}
}