GetPBXProjectPath() public static method

public static GetPBXProjectPath ( string buildPath ) : string
buildPath string
return string
示例#1
0
    public static void OnPostprocessBuild(string xcodePath, string configPath)
    {
        pluginPath = configPath.Replace("XcodeSetting.json", "");
        string     projPath = PBXProject.GetPBXProjectPath(xcodePath);
        PBXProject proj     = new PBXProject();

        proj.ReadFromString(File.ReadAllText(projPath));

        string        plistPath = xcodePath + "/Info.plist";
        PlistDocument plist     = new PlistDocument();

        plist.ReadFromString(File.ReadAllText(plistPath));
        PlistElementDict rootDict = plist.root;

        //string target = proj.TargetGuidByName(PBXProject.GetUnityTargetName());
        //string target = proj.TargetGuidByName("UnityFramework");
        //string productName = proj.GetBuildPropertyForAnyConfig(target, "PRODUCT_NAME");
        string entitlementFilePath          = Path.Combine(PBXProject.GetUnityTargetName(), "usdk.entitlements");
        ProjectCapabilityManager pcbManager = new ProjectCapabilityManager(proj, projPath, entitlementFilePath, PBXProject.GetUnityTargetName());

        //读取配置文件
        string    json  = File.ReadAllText(configPath);
        Hashtable table = json.hashtableFromJson();

        embedFrameworksTable = table.SGet <Hashtable>("embedframeworks");

        //plist
        SetPlist(proj, rootDict, table.SGet <Hashtable>("plist"));
        plist.WriteToFile(plistPath);

        //lib
        SetLibs(proj, table.SGet <Hashtable>("libs"));
        //framework
        SetFrameworks(proj, table.SGet <Hashtable>("frameworks"));
        //building setting
        SetBuildProperties(proj, table.SGet <Hashtable>("properties"));
        SetShellScriptBuildPhase(proj, table.SGet <Hashtable>("shellscript"));
        //复制文件
        CopyFiles(proj, xcodePath, table.SGet <Hashtable>("files"));
        //复制文件夹
        CopyFolders(proj, xcodePath, table.SGet <Hashtable>("folders"));
        //文件编译符号
        SetFilesCompileFlag(proj, table.SGet <Hashtable>("filesCompileFlag"));
        //加入能力
        SetCapabilitys(pcbManager, table.SGet <Hashtable>("capabilitys"));
        //写入
        File.WriteAllText(projPath, proj.WriteToString());

        Console.WriteLine("***Info.plist*****\n" + File.ReadAllText(plistPath));
    }
示例#2
0
    private static string GetProductName(string xcodePath)
    {
        string projPath = PBXProject.GetPBXProjectPath(xcodePath);

        UnityEditor.iOS.Xcode.Custom.PBXProject proj = new UnityEditor.iOS.Xcode.Custom.PBXProject();
        proj.ReadFromString(File.ReadAllText(projPath));
        string        productName = "usdk";
        string        target      = proj.TargetGuidByName(PBXProject.GetUnityTargetName());
        List <string> names       = proj.GetBuildProperty(target, "PRODUCT_NAME");

        if (names.Count > 0)
        {
            productName = names[0];
        }
        return(productName);
    }