예제 #1
0
    private static void EditorPlist(string filePath)
    {

        XCPlist list = new XCPlist(filePath);
        string bundle = "com.yusong.momo";

        string PlistAdd = @"  
            <key>CFBundleURLTypes</key>
            <array>
            <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLIconFile</key>
            <string>Icon@2x</string>
            <key>CFBundleURLName</key>
            <string>" + bundle + @"</string>
            <key>CFBundleURLSchemes</key>
            <array>
            <string>ww123456</string>
            </array>
            </dict>
            </array>";

        //在plist里面增加一行       
        list.AddKey(PlistAdd);
        //在plist里面替换一行       
        list.ReplaceKey("<string>com.yusong.${PRODUCT_NAME}</string>", "<string>" + bundle + "</string>");
        list.Save();

    }
예제 #2
0
        public void ProcessPList(Hashtable items)
        {
            Debug.Log("Adding plist items...");
            string  plistPath = this.projectRootPath + "/Info.plist";
            XCPlist plist     = new XCPlist(plistPath);

            plist.Process(items);
        }
예제 #3
0
        public void ApplyMod(XCMod mod)
        {
            PBXGroup modGroup = this.GetGroup(mod.group);

            Debug.Log("Adding libraries...");

            foreach (XCModFile libRef in mod.libs)
            {
                string completeLibPath = System.IO.Path.Combine("usr/lib", libRef.filePath);
                Debug.Log("Adding library " + completeLibPath);
                this.AddFile(completeLibPath, modGroup, "SDKROOT", true, libRef.isWeak);
            }

            Debug.Log("Adding frameworks...");
            PBXGroup frameworkGroup = this.GetGroup("Frameworks");

            foreach (string framework in mod.frameworks)
            {
                string[] filename     = framework.Split(':');
                bool     isWeak       = (filename.Length > 1) ? true : false;
                string   completePath = System.IO.Path.Combine("System/Library/Frameworks", filename[0]);
                this.AddFile(completePath, frameworkGroup, "SDKROOT", true, isWeak);
            }

            Debug.Log("Adding files...");
            foreach (string filePath in mod.files)
            {
                string absoluteFilePath = System.IO.Path.Combine(mod.path, filePath);
                this.AddFile(absoluteFilePath, modGroup);
            }

            Debug.Log("Adding embed binaries...");
            if (mod.embed_binaries != null)
            {
                //1. Add LD_RUNPATH_SEARCH_PATHS for embed framework
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Release");
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Debug");

                foreach (string binary in mod.embed_binaries)
                {
                    string absoluteFilePath = System.IO.Path.Combine(mod.path, binary);
                    this.AddEmbedFramework(absoluteFilePath);
                }
            }

            Debug.Log("Adding folders...");
            foreach (string folderPath in mod.folders)
            {
                string absoluteFolderPath = System.IO.Path.Combine(Application.dataPath, folderPath);
                Debug.Log("Adding folder " + absoluteFolderPath);
                this.AddFolder(absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray(typeof(string)));
            }

            Debug.Log("Adding headerpaths...");
            foreach (string headerpath in mod.headerpaths)
            {
                if (headerpath.Contains("$(inherited)"))
                {
                    Debug.Log("not prepending a path to " + headerpath);
                    this.AddHeaderSearchPaths(headerpath);
                }
                else
                {
                    string absoluteHeaderPath = System.IO.Path.Combine(mod.path, headerpath);
                    this.AddHeaderSearchPaths(absoluteHeaderPath);
                }
            }

            Debug.Log("Adding compiler flags...");
            foreach (string flag in mod.compiler_flags)
            {
                this.AddOtherCFlags(flag);
            }

            Debug.Log("Adding linker flags...");
            foreach (string flag in mod.linker_flags)
            {
                this.AddOtherLinkerFlags(flag);
            }

            Debug.Log("Adding plist items...");
            string  plistPath = this.projectRootPath + "/Info.plist";
            XCPlist plist     = new XCPlist(plistPath);

            plist.Process(mod.plist);

            this.Consolidate();
        }
예제 #4
0
파일: XCProject.cs 프로젝트: cn00/XUPorter
        public void ApplyMod(XCMod mod)
        {
            PBXGroup modGroup = this.GetGroup(mod.group);

            Debug.Log("Adding syslibs...");
            if (mod.syslibs != null)
            {
                foreach (XCModFile libRef in mod.syslibs)
                {
                    string completeLibPath = System.IO.Path.Combine("usr/lib", libRef.filePath);
                    Debug.Log("Adding library " + completeLibPath);
                    this.AddFile(completeLibPath, modGroup, "SDKROOT", true, libRef.isWeak);
                }
            }

            Debug.Log("Adding userlibs...");
            if (mod.userlibs != null)
            {
                foreach (string libRef in mod.userlibs)
                {
                    Debug.Log("Adding userlibs " + libRef);
                    this.AddFile(libRef);
                }
            }

            Debug.Log("Adding userframeworks...");
            PBXGroup frameworkGroup = this.GetGroup("Frameworks");

            if (mod.userframeworks != null)
            {
                foreach (string framework in mod.userframeworks)
                {
                    this.AddFile(framework, frameworkGroup);
                }
            }

            Debug.Log("Adding frameworks...");
            if (mod.frameworks != null)
            {
                foreach (string framework in mod.frameworks)
                {
                    string[] filename     = framework.Split(':');
                    bool     isWeak       = (filename.Length > 1) ? true : false;
                    string   completePath = System.IO.Path.Combine("System/Library/Frameworks", filename[0]);
                    this.AddFile(completePath, frameworkGroup, "SDKROOT", true, isWeak);
                }
            }

            Debug.Log("Adding files...");
            if (mod.files != null)
            {
                foreach (string filePath in mod.files)
                {
                    this.AddFile(filePath, modGroup);
                }
            }

            Debug.Log("Adding embed binaries...");
            if (mod.embed_binaries != null)
            {
                //1. Add LD_RUNPATH_SEARCH_PATHS for embed framework
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "all");
                foreach (string binary in mod.embed_binaries)
                {
                    string absoluteFilePath = System.IO.Path.Combine(Application.dataPath, binary);
                    this.AddEmbedFramework(absoluteFilePath);
                }
            }

            Debug.Log("Adding overwriteBuildSetting ...");
            if (mod.overwriteBuildSetting != null)
            {
                foreach (var i in XCPlist.HashtableToDictionary <string, object>(mod.overwriteBuildSetting))
                {
                    var name = i.Key;
                    Debug.Log("all: " + name);
                    foreach (var config in XCPlist.HashtableToDictionary <string, object>((Hashtable)i.Value).Where(ii => ii.Key == "all"))
                    {
                        this.overwriteBuildSetting(name, config.Key, config.Value);
                    }
                    Debug.Log("~all: " + name);
                    foreach (var config in XCPlist.HashtableToDictionary <string, object>((Hashtable)i.Value).Where(ii => ii.Key != "all"))
                    {
                        this.overwriteBuildSetting(name, config.Key, config.Value);
                    }
                }
            }

            Debug.Log("Adding folders...");
            if (mod.folders != null)
            {
                foreach (string folderPath in mod.folders)
                {
                    // string absoluteFolderPath = null;
                    // var split = folderPath.Split(':');
                    // PBXGroup group = modGroup;
                    // if(split.Length < 2)
                    // {
                    //  absoluteFolderPath = Path.GetFullPath(folderPath);
                    // }
                    // else
                    // {
                    //  group = GetGroupByPath(split[0]);
                    //  absoluteFolderPath = Path.GetFullPath(split[1]);
                    // }
                    Debug.Log("Adding folder " + folderPath);
                    this.AddFolder(folderPath, modGroup, (string[])mod.excludes.ToArray(typeof(string)));
                }
            }

            Debug.Log("Adding headerpaths...");
            if (mod.headerpaths != null)
            {
                foreach (string headerpath in mod.headerpaths)
                {
                    if (headerpath.Contains("$(inherited)"))
                    {
                        Debug.Log("not prepending a path to " + headerpath);
                        this.AddHeaderSearchPaths(headerpath);
                    }
                    else
                    {
                        string absoluteHeaderPath = Path.GetFullPath(headerpath);
                        this.AddHeaderSearchPaths(absoluteHeaderPath);
                    }
                }
            }

            Debug.Log("Adding compiler flags...");
            if (mod.compiler_flags != null)
            {
                foreach (string flag in mod.compiler_flags)
                {
                    this.AddOtherCFlags(flag);
                }
            }

            Debug.Log("Adding linker flags...");
            if (mod.linker_flags != null)
            {
                foreach (string flag in mod.linker_flags)
                {
                    this.AddOtherLinkerFlags(flag);
                }
            }

            string plistPath = this.projectRootPath + "/Info.plist";

            Debug.Log("Adding plist items: " + plistPath);
            XCPlist plist = new XCPlist(plistPath);

            if (mod.plist != null)
            {
                plist.Process(mod.plist);
            }

            this.Consolidate();
        }
예제 #5
0
        public void ApplyMod( XCMod mod )
        {
            PBXGroup modGroup = this.GetGroup( mod.group );

            Debug.Log( "Adding libraries..." );

            foreach( XCModFile libRef in mod.libs ) {
                string completeLibPath = System.IO.Path.Combine( "usr/lib", libRef.filePath );
                Debug.Log ("Adding library " + completeLibPath);
                this.AddFile( completeLibPath, modGroup, "SDKROOT", true, libRef.isWeak );
            }

            Debug.Log( "Adding frameworks..." );
            PBXGroup frameworkGroup = this.GetGroup( "Frameworks" );
            foreach( string framework in mod.frameworks ) {
                string[] filename = framework.Split( ':' );
                bool isWeak = ( filename.Length > 1 ) ? true : false;
                string completePath = System.IO.Path.Combine( "System/Library/Frameworks", filename[0] );
                this.AddFile( completePath, frameworkGroup, "SDKROOT", true, isWeak );
            }

            Debug.Log( "Adding files..." );
            foreach( string filePath in mod.files ) {
                string absoluteFilePath = System.IO.Path.Combine( mod.path, filePath );
                this.AddFile( absoluteFilePath, modGroup );
            }

            Debug.Log( "Adding embed binaries..." );
            if (mod.embed_binaries != null)
            {
                //1. Add LD_RUNPATH_SEARCH_PATHS for embed framework
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Release");
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Debug");

                foreach( string binary in mod.embed_binaries ) {
                    string absoluteFilePath = System.IO.Path.Combine( mod.path, binary );
                    this.AddEmbedFramework(absoluteFilePath);
                }
            }

            Debug.Log( "Adding folders..." );
            foreach( string folderPath in mod.folders ) {
                string absoluteFolderPath = System.IO.Path.Combine( Application.dataPath, folderPath );
                Debug.Log ("Adding folder " + absoluteFolderPath);
                this.AddFolder( absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray( typeof(string) ) );
            }

            Debug.Log( "Adding headerpaths..." );
            foreach( string headerpath in mod.headerpaths ) {
                if (headerpath.Contains("$(inherited)")) {
                    Debug.Log ("not prepending a path to " + headerpath);
                    this.AddHeaderSearchPaths( headerpath );
                } else {
                    string absoluteHeaderPath = System.IO.Path.Combine( mod.path, headerpath );
                    this.AddHeaderSearchPaths( absoluteHeaderPath );
                }
            }

            Debug.Log( "Adding compiler flags..." );
            foreach( string flag in mod.compiler_flags ) {
                this.AddOtherCFlags( flag );
            }

            Debug.Log( "Adding linker flags..." );
            foreach( string flag in mod.linker_flags ) {
                this.AddOtherLinkerFlags( flag );
            }

            Debug.Log ("Adding plist items...");
            string plistPath = this.projectRootPath + "/Info.plist";
            XCPlist plist = new XCPlist (plistPath);
            plist.Process(mod.plist);

            this.Consolidate();
        }
예제 #6
0
        public void ApplyMod(XCMod mod)
        {
            PBXGroup modGroup = this.GetGroup(mod.group);

            Debug.Log("Adding libraries...");

            foreach (XCModFile libRef in mod.libs)
            {
                string completeLibPath = System.IO.Path.Combine("usr/lib", libRef.filePath);
                Debug.Log("Adding library " + completeLibPath);
                this.AddFile(completeLibPath, modGroup, "SDKROOT", true, libRef.isWeak);
            }

            Debug.Log("Adding frameworks...");
            PBXGroup frameworkGroup = this.GetGroup("Frameworks");

            foreach (string framework in mod.frameworks)
            {
                string[] filename     = framework.Split(':');
                bool     isWeak       = (filename.Length > 1) ? true : false;
                string   completePath = System.IO.Path.Combine("System/Library/Frameworks", filename[0]);
                this.AddFile(completePath, frameworkGroup, "SDKROOT", true, isWeak);
            }

            Debug.Log("Adding files...");
            foreach (string filePath in mod.files)
            {
                string absoluteFilePath = System.IO.Path.Combine(mod.path, filePath);
                this.AddFile(absoluteFilePath, modGroup);
            }

            Debug.Log("Adding embed binaries...");
            if (mod.embed_binaries != null)
            {
                //1. Add LD_RUNPATH_SEARCH_PATHS for embed framework
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Release");
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Debug");

                foreach (string binary in mod.embed_binaries)
                {
                    string absoluteFilePath = System.IO.Path.Combine(mod.path, binary);
                    this.AddEmbedFramework(absoluteFilePath);
                }
            }

            Debug.Log("Adding folders...");
            foreach (string folderPath in mod.folders)
            {
                string absoluteFolderPath = System.IO.Path.Combine(Application.dataPath, folderPath);
                Debug.Log("Adding folder " + absoluteFolderPath);
                this.AddFolder(absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray(typeof(string)));
            }

            Debug.Log("Adding headerpaths...");
            foreach (string headerpath in mod.headerpaths)
            {
                if (headerpath.Contains("$(inherited)"))
                {
                    Debug.Log("not prepending a path to " + headerpath);
                    this.AddHeaderSearchPaths(headerpath);
                }
                else
                {
                    string absoluteHeaderPath = System.IO.Path.Combine(mod.path, headerpath);
                    this.AddHeaderSearchPaths(absoluteHeaderPath);
                }
            }

            Debug.Log("Adding compiler flags...");
            foreach (string flag in mod.compiler_flags)
            {
                this.AddOtherCFlags(flag);
            }

            Debug.Log("Adding linker flags...");
            foreach (string flag in mod.linker_flags)
            {
                this.AddOtherLinkerFlags(flag);
            }

            Debug.Log("Adding plist items...");
            string  plistPath = this.projectRootPath + "/Info.plist";
            XCPlist plist     = new XCPlist(plistPath);

            plist.Process(mod.plist);

            Debug.Log("Adding I18N name...");
            if (mod.i18n_name != null && mod.i18n_name.Count > 0)
            {
                Dictionary <string, object> dict = (Dictionary <string, object>)PlistCS.Plist.readPlist(plistPath);
                if (dict.ContainsKey("CFBundleDisplayName"))
                {
                    dict.Remove("CFBundleDisplayName");
                }
                dict["LSHasLocalizedDisplayName"] = true;
                PlistCS.Plist.writeXml(dict, plistPath);

                var variant = new PBXVariantGroup("InfoPlist.strings", null, "GROUP");
                // mark variants
                variantGroups.Add(variant);
                // add variant to project
                _rootGroup.AddChild(variant);

                foreach (string entry in mod.i18n_name)
                {
                    string[] filename = entry.Split(':');
                    string   folder   = this.projectRootPath + "/" + filename[0] + ".lproj";
                    if (!Directory.Exists(folder))
                    {
                        Directory.CreateDirectory(folder);
                    }
                    string filePath = folder + "/InfoPlist.strings";
                    string content  = "\"CFBundleDisplayName\" = \"" + filename[1] + "\";\n";
                    content += "\"CFBundleName\" = \"" + filename[1] + "\";\n";
                    File.WriteAllText(filePath, content);

                    var result = AddFile(filePath, variant, "GROUP", true, false, true);
                    foreach (var item in result.Keys)
                    {
                        PBXFileReference fileReference = (PBXFileReference)result[item];
                        fileReference.Remove("name");
                        fileReference.Add("name", filename[1]);
                    }
                }
            }

            this.Consolidate();
        }
예제 #7
0
 static void WritePlistFile(string path)
 {
     if (JoyYouSDKPlugin.PlatformSDK == ProjectPlatform.PP)
     {
         XCPlist list =new XCPlist(path);
         string ppKeyStr = @"
     <key>CFBundleURLTypes</key>
     <array>
     <dict>
     <key>CFBundleURLName</key>
     <string></string>
     <key>CFBundleURLSchemes</key>
     <array>
         <string>teiron%appId%</string>
     </array>
     </dict>
     </array>";
         string s_appId = "";
         foreach (var attr in typeof(JoyYouSDK).GetCustomAttributes(false))
         {
             InitPPSDKParamAttribute ppSDKParams = attr as InitPPSDKParamAttribute;
             if (ppSDKParams != null)
             {
                 s_appId = ppSDKParams.appId.ToString();
                 break;
             }
         }
         ppKeyStr = ppKeyStr.Replace ("%appId%", s_appId);
         list.AddKey (ppKeyStr);
         list.Save ();
     }
 }
예제 #8
0
        public void ApplyMod(XCMod mod)
        {
            PBXGroup modGroup = this.GetGroup(mod.group);

            if (mod.libs != null)
            {
                Debug.Log("Adding libraries...");
                foreach (XCModFile libRef in mod.libs)
                {
                    string completeLibPath = System.IO.Path.Combine("usr/lib", libRef.filePath);
                    Debug.Log("Adding library " + completeLibPath);
                    this.AddFile(completeLibPath, modGroup, "SDKROOT", true, libRef.isWeak);
                }
            }

            if (mod.frameworks != null)
            {
                Debug.Log("Adding frameworks...");
                PBXGroup frameworkGroup = this.GetGroup("Frameworks");
                foreach (string framework in mod.frameworks)
                {
                    string[] filename     = framework.Split(':');
                    bool     isWeak       = (filename.Length > 1) ? true : false;
                    string   completePath = System.IO.Path.Combine("System/Library/Frameworks", filename[0]);
                    this.AddFile(completePath, frameworkGroup, "SDKROOT", true, isWeak);
                }
            }

            if (mod.files != null)
            {
                Debug.Log("Adding files...");
                foreach (string filePath in mod.files)
                {
                    string absoluteFilePath = combinePathWithCheck(mod.path, filePath);
                    this.AddFile(absoluteFilePath, modGroup);
                }
            }

            if (mod.embed_binaries != null)
            {
                Debug.Log("Adding embed binaries...");
                //1. Add LD_RUNPATH_SEARCH_PATHS for embed framework
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Release");
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Debug");

                foreach (string binary in mod.embed_binaries)
                {
                    string absoluteFilePath = System.IO.Path.Combine(mod.path, binary);
                    this.AddEmbedFramework(absoluteFilePath);
                }
            }

            if (mod.folders != null)
            {
                Debug.Log("Adding folders...");
                foreach (string folderPath in mod.folders)
                {
                    string parentPath = Application.dataPath;
                    parentPath = parentPath.Substring(0, parentPath.Length - 7);

                    string absoluteFolderPath = System.IO.Path.Combine(parentPath, System.IO.Path.Combine(mod.path, folderPath));
                    Debug.Log("Adding folder " + absoluteFolderPath);
                    this.AddFolder(absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray(typeof(string)));
                }
            }

            if (mod.headerpaths != null)
            {
                Debug.Log("Adding headerpaths...");
                foreach (string headerpath in mod.headerpaths)
                {
                    if (headerpath.Contains("$(inherited)"))
                    {
                        Debug.Log("not prepending a path to " + headerpath);
                        this.AddHeaderSearchPaths(headerpath);
                    }
                    else
                    {
                        string absoluteHeaderPath = System.IO.Path.Combine(mod.path, headerpath);
                        this.AddHeaderSearchPaths(absoluteHeaderPath);
                    }
                }
            }

            if (mod.compiler_flags != null)
            {
                Debug.Log("Adding compiler flags...");
                foreach (string flag in mod.compiler_flags)
                {
                    this.AddOtherCFlags(flag);
                }
            }

            if (mod.linker_flags != null)
            {
                Debug.Log("Adding linker flags...");
                foreach (string flag in mod.linker_flags)
                {
                    this.AddOtherLinkerFlags(flag);
                }
            }

            Debug.Log("Adding plist items...");
            string  plistPath = this.projectRootPath + "/Info.plist";
            XCPlist plist     = new XCPlist(plistPath);

            plist.Process(mod.plist);

            // Kanglai: for localization
            if (mod.variants != null)
            {
                foreach (string variantPath in mod.variants)
                {
                    string absoluteFolderPath = System.IO.Path.Combine(mod.path, variantPath);
                    if (!Directory.Exists(absoluteFolderPath))
                    {
                        Debug.LogWarning("VariantGroup: folder not exists");
                        continue;
                    }
                    DirectoryInfo directory   = new DirectoryInfo(absoluteFolderPath);
                    string        variantName = directory.Name;

                    var variant = new PBXVariantGroup(variantName, null, "GROUP");
                    // mark variants
                    variantGroups.Add(variant);
                    // add variant to project
                    _rootGroup.AddChild(variant);
                    // add variant in build process
                    PBXBuildFile buildFile = new PBXBuildFile(variant);
                    buildFiles.Add(buildFile);
                    foreach (KeyValuePair <string, PBXResourcesBuildPhase> currentObject in resourcesBuildPhases)
                    {
                        currentObject.Value.AddBuildFile(buildFile);
                    }

                    foreach (var dir in directory.GetDirectories())
                    {
                        string dirName = dir.Name;
                        int    split   = dirName.Length - 6;
                        if (split <= 0 || !dirName.Substring(split).Equals(".lproj"))
                        {
                            Debug.LogWarning("VariantGroup: folder should end with .lproj");
                            continue;
                        }
                        string languangeName   = dirName.Substring(0, split);
                        string variantFilePath = System.IO.Path.Combine(dir.FullName, variantName);
                        if (!File.Exists(variantFilePath))
                        {
                            Debug.LogWarning("VariantGroup: file under folder not exists");
                            continue;
                        }

                        var result = AddFile(variantFilePath, variant, createBuildFiles: false, ignoreSameFilename: false);
                        PBXFileReference fileReference = (PBXFileReference)result.Values.First();
                        fileReference.Remove("name");
                        fileReference.Add("name", languangeName);
                    }
                }
            }

            this.Consolidate();
        }
예제 #9
0
        public void ApplyMod(XCMod mod)
        {
            PBXGroup modGroup = this.GetGroup(mod.group);

            Debug.Log("Adding libraries...");

            foreach (XCModFile libRef in mod.libs)
            {
                string completeLibPath = "";
                string root            = "";
                //modify for xcode7
                if (libRef.filePath.Contains(".dylib"))
                {
                    completeLibPath = System.IO.Path.Combine("/usr/lib", libRef.filePath);
                    root            = "SOURCE_ROOT";
                }
                else if (libRef.filePath.Contains(".tbd"))
                {
                    completeLibPath = System.IO.Path.Combine("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib", libRef.filePath);
                    root            = "SOURCE_ROOT";
                }
                else
                {
                    completeLibPath = System.IO.Path.Combine("usr/lib", libRef.filePath);
                    root            = "SDKROOT";
                }
                Debug.Log("Adding library " + completeLibPath);
                this.AddFile(completeLibPath, modGroup, root, true, libRef.isWeak);
            }

            Debug.Log("Adding frameworks...");
            PBXGroup frameworkGroup = this.GetGroup("Frameworks");

            foreach (string framework in mod.frameworks)
            {
                string[] filename     = framework.Split(':');
                bool     isWeak       = (filename.Length > 1);
                string   completePath = System.IO.Path.Combine("System/Library/Frameworks", filename[0]);
                this.AddFile(completePath, frameworkGroup, "SDKROOT", true, isWeak);
            }

            Debug.Log("Adding files...");
            foreach (string filePath in mod.files)
            {
                var    cfLastIndex   = filePath.LastIndexOf(":");
                string compilerFlags = null;
                var    fPath         = filePath;
                if (cfLastIndex > 0)
                {
                    compilerFlags = fPath.Substring(cfLastIndex + 1, fPath.Length - cfLastIndex - 1);
                    fPath         = fPath.Substring(0, cfLastIndex);
                }

                string absoluteFilePath = System.IO.Path.Combine(mod.path, fPath);
                this.AddFile(absoluteFilePath, modGroup, "SOURCE_ROOT", true, false,
                             compilerFlags);
            }

            Debug.Log("Adding embed binaries...");
            if (mod.embed_binaries != null)
            {
                //1. Add LD_RUNPATH_SEARCH_PATHS for embed framework
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Release");
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Debug");

                foreach (string binary in mod.embed_binaries)
                {
                    string absoluteFilePath = System.IO.Path.Combine(mod.path, binary);
                    this.AddEmbedFramework(absoluteFilePath);
                }
            }

            Debug.Log("Adding folders...");
            foreach (string folderPath in mod.folders)
            {
                var    cfLastIndex   = folderPath.LastIndexOf(":");
                string compilerFlags = null;
                string fPath         = folderPath;
                if (cfLastIndex > 0)
                {
                    compilerFlags = fPath.Substring(cfLastIndex + 1, fPath.Length - cfLastIndex - 1);
                    fPath         = fPath.Substring(0, cfLastIndex);
                }

                string absoluteFolderPath = System.IO.Path.Combine(mod.path, fPath);
                Debug.Log("Adding folder " + absoluteFolderPath);

                this.AddFolder(absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray(typeof(string)),
                               true, true, compilerFlags);
            }

            Debug.Log("Adding headerpaths...");
            foreach (string headerpath in mod.headerpaths)
            {
                if (headerpath.Contains("$"))                   //old version is "$(inherited)"
                {
                    Debug.Log("not prepending a path to " + headerpath);
                    this.AddHeaderSearchPaths(headerpath);
                }
                else
                {
                    string absoluteHeaderPath = System.IO.Path.Combine(mod.path, headerpath);
                    this.AddHeaderSearchPaths(absoluteHeaderPath);
                }
            }

            Debug.Log("Adding compiler flags...");
            foreach (string flag in mod.compiler_flags)
            {
                this.AddOtherCFlags(flag);
            }

            Debug.Log("Adding linker flags...");
            foreach (string flag in mod.linker_flags)
            {
                this.AddOtherLinkerFlags(flag);
            }

            Debug.Log("Adding plist items...");
            string  plistPath = this.projectRootPath + "/Info.plist";
            XCPlist plist     = new XCPlist(plistPath);

            plist.Process(mod.plist);

            this.Consolidate();
        }