少年修仙传客户端基础资源
leonard Wu
2018-08-02 cc7db021dd09248131ad546f5bc5806cdb2eb418
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
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.iPhone) {
#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 ) {
            UnityEngine.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");
 
        //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();
 
    }
#endif
 
    public static void Log(string message)
    {
        UnityEngine.Debug.Log("PostProcess: "+message);
    }
}