Ejemplo n.º 1
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);
                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 folders...");
            foreach (string folderPath in mod.folders)
            {
                string absoluteFolderPath = System.IO.Path.Combine(mod.path, 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)
            {
                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);
            }

            this.Consolidate();
        }
Ejemplo n.º 2
0
		public void ApplyMod( string pbxmod )
		{
			XCMod mod = new XCMod( pbxmod );
			foreach(var lib in mod.libs){
				Debug.Log("Library: "+lib);
			}
			ApplyMod( mod );
		}
Ejemplo n.º 3
0
        public void ApplySetting(XCMod mod)
        {
            if (mod.development_team != null)
            {
                Debug.Log("Setting development team...");
                this.SetDevelopmentTeam(mod.development_team);
            }

            if (mod.debug_code_sign_identity != null)
            {
                Debug.Log("Setting debug code sign identity...");
                this.SetCodeSignIdentity(true, mod.debug_code_sign_identity);
            }

            if (mod.release_code_sign_identity != null)
            {
                Debug.Log("Setting release code sign identity...");
                this.SetCodeSignIdentity(false, mod.release_code_sign_identity);
            }

            if (mod.debug_provision_file != null)
            {
                Debug.Log("Setting debug provision file...");
                this.SetProvisionFile(true, mod.debug_provision_file);
            }

            if (mod.release_provision_file != null)
            {
                Debug.Log("Setting release provision file...");
                this.SetProvisionFile(false, mod.release_provision_file);
            }

            if (mod.code_sign_entitlements_file != null)
            {
                Debug.Log("Setting code sign entitlements file file...");
                this.SetCodeSignEntitlementsFile(Path.Combine(mod.path, mod.code_sign_entitlements_file));
            }

            if (mod.plist_key_file != null)
            {
                Debug.Log("Setting plist key file file...");
                this.AddPListKey(Path.Combine(this.projectRootPath, "Info.plist"),
                                 Path.Combine(mod.path, mod.plist_key_file));
            }

            this.Consolidate();
        }
        public void ApplyMod(XCMod mod)
        {
            PBXGroup modGroup = this.GetGroup(mod.group);

            Debug.Log("Adding libraries...");
            PBXGroup librariesGroup = this.GetGroup("Libraries");

            foreach (XCModFile libRef in mod.libs)
            {
                string completeLibPath = System.IO.Path.Combine("usr/lib", libRef.filePath);
                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 );
            //
            //
            //				if( filePath.EndsWith(".framework") )
            //					this.AddFile( absoluteFilePath, frameworkGroup, "GROUP", true, false);
            //				else
            //					this.AddFile( absoluteFilePath, modGroup );
            //			}

            //add by suyuancheng

            foreach (XCModSourceFile filePath in mod.files)
            {
                string absoluteFilePath = System.IO.Path.Combine(mod.path, filePath.filePath);
                //	Debug.Log("============================file path:"+filePath.filePath);
                //	Debug.Log("============================flag:"+filePath.compileFlag);

                if (filePath.filePath.EndsWith(".framework"))
                {
                    this.AddFile(absoluteFilePath, frameworkGroup, "GROUP", true, false);
                }
                else
                {
                    this.AddFile(absoluteFilePath, modGroup, "SOURCE_ROOT", true, false, filePath.compileFlag);
                }
            }

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

            Debug.Log("Adding headerpaths...");
            foreach (string headerpath in mod.headerpaths)
            {
                string absoluteHeaderPath = System.IO.Path.Combine(mod.path, headerpath);
                this.AddHeaderSearchPaths(absoluteHeaderPath);
            }

            Debug.Log("Configure build settings...");
            Hashtable buildSettings = mod.buildSettings;

            if (buildSettings.ContainsKey("OTHER_LDFLAGS"))
            {
                Debug.Log("    Adding other linker flags...");
                ArrayList otherLinkerFlags = (ArrayList)buildSettings["OTHER_LDFLAGS"];
                foreach (string linker in otherLinkerFlags)
                {
                    string _linker = linker;
                    if (!_linker.StartsWith("-"))
                    {
                        _linker = "-" + _linker;
                    }
                    this.AddOtherLDFlags(_linker);
                }
            }

            if (buildSettings.ContainsKey("GCC_ENABLE_CPP_EXCEPTIONS"))
            {
                Debug.Log("    GCC_ENABLE_CPP_EXCEPTIONS = " + buildSettings["GCC_ENABLE_CPP_EXCEPTIONS"]);
                this.GccEnableCppExceptions((string)buildSettings["GCC_ENABLE_CPP_EXCEPTIONS"]);
            }

            if (buildSettings.ContainsKey("GCC_ENABLE_OBJC_EXCEPTIONS"))
            {
                Debug.Log("    GCC_ENABLE_OBJC_EXCEPTIONS = " + buildSettings["GCC_ENABLE_OBJC_EXCEPTIONS"]);
                this.GccEnableObjCExceptions((string)buildSettings["GCC_ENABLE_OBJC_EXCEPTIONS"]);
            }

            this.Consolidate();
        }
Ejemplo n.º 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 );
                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 folders..." );
            foreach( string folderPath in mod.folders ) {
                string absoluteFolderPath = System.IO.Path.Combine( mod.path, folderPath );
                this.AddFolder( absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray( typeof(string) ) );
            }

            Debug.Log( "Adding headerpaths..." );
            foreach( string headerpath in mod.headerpaths ) {
                string absoluteHeaderPath = System.IO.Path.Combine( mod.path, headerpath );
                this.AddHeaderSearchPaths( absoluteHeaderPath );
            }

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

            this.Consolidate();
        }
Ejemplo n.º 6
0
        public void ApplyMod(string pbxmod)
        {
            XCMod mod = new XCMod(pbxmod);

            ApplyMod(mod);
        }
Ejemplo n.º 7
0
		public void ApplyMod( XCMod mod )
		{
			PBXGroup modGroup = this.GetGroup( mod.group );
			
			foreach( XCModFile libRef in mod.libs ) {
				string completeLibPath;
				if(libRef.sourceTree.Equals("SDKROOT")) {
					completeLibPath = System.IO.Path.Combine( "usr/lib", libRef.filePath );
				}
				else {
					completeLibPath = System.IO.Path.Combine( mod.path, libRef.filePath );
				}
					
				this.AddFile( completeLibPath, modGroup, libRef.sourceTree, true, libRef.isWeak );
			}
			
			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 );
			}
			
			foreach( string filePath in mod.files ) {
				string absoluteFilePath = System.IO.Path.Combine( mod.path, filePath );
				this.AddFile( absoluteFilePath, modGroup );
			}
			
			foreach( string folderPath in mod.folders ) {
				string absoluteFolderPath = AddXcodeQuotes(System.IO.Path.Combine( mod.path, folderPath ));
				this.AddFolder( absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray(  ) );
			}
			
			
			foreach( string headerpath in mod.headerpaths ) {
				string absoluteHeaderPath = AddXcodeQuotes( System.IO.Path.Combine( mod.path, headerpath ) );
				this.AddHeaderSearchPaths( absoluteHeaderPath );
			}
			
			foreach( string librarypath in mod.librarysearchpaths ) {
				string absolutePath = AddXcodeQuotes(System.IO.Path.Combine( mod.path, librarypath ));
				this.AddLibrarySearchPaths( absolutePath );
			}
			
			if(mod.frameworksearchpath != null)
			{
				foreach( string frameworksearchpath in mod.frameworksearchpath ) {
					string absoluteHeaderPath = AddXcodeQuotes(System.IO.Path.Combine( mod.path, frameworksearchpath ));
					this.AddFrameworkSearchPaths( absoluteHeaderPath );
				}
			}
			
			this.Consolidate();
		}
Ejemplo n.º 8
0
 public void ApplyMod( string pbxmod )
 {
     XCMod mod = new XCMod( pbxmod );
     foreach(var lib in mod.libs){
         Debug.Log("Library: "+lib);
     }
     ApplyMod( mod );
 }
Ejemplo n.º 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 = 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();
        }
Ejemplo n.º 10
0
        public void ApplySetting(string pbxmod)
        {
            XCMod mod = new XCMod(pbxmod);

            ApplySetting(mod);
        }
Ejemplo n.º 11
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();
        }
Ejemplo n.º 12
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();
        }
Ejemplo n.º 13
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
                // CONFLIC TO POD METHOD
                // 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);
                if (!Directory.Exists(folderPath))
                {
                    absoluteFolderPath = System.IO.Path.Combine(mod.path, 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 settings ...");
            foreach (DictionaryEntry kv in mod.settings)
            {
                string k = (string)kv.Key;
                string v = (string)kv.Value;
                if (k == null || k.Trim().Length == 0 || null == v)
                {
                    Debug.Log(string.Format("setting item error(k:{0} v:{1} mod:{2})",
                                            k == null ? "[null]" : k, v == null ? "[null]" :v,
                                            mod.group));
                    continue;
                }

                this.overwriteBuildSetting(k.Trim(), v.Trim());
            }
            this.ProcessPList(mod.plist);
            this.ProcessTextModify(mod.textModify);
            this.Consolidate();
        }
Ejemplo n.º 14
0
        public static void UpdatePlist(string xcodePath, string infoFile)
        {
            XCMod info = new XCMod(infoFile);

            UpdatePlist(xcodePath, info.DataStore);
        }
Ejemplo n.º 15
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();
        }
Ejemplo n.º 16
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 = CombinePaths("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);
                    string   completePath = CombinePaths("System/Library/Frameworks", filename[0]);
                    this.AddFile(completePath, "", frameworkGroup, "SDKROOT", true, isWeak);
                }
            }

            if (mod.files != null)
            {
                Debug.Log("Adding files...");

                foreach (XCModFile file in mod.files)
                {
                    string absoluteFilePath = CombinePaths(mod.path, file.filePath);
                    this.AddFile(absoluteFilePath, file.fileFlags, modGroup);
                }
            }

            if (mod.folders != null)
            {
                Debug.Log("Adding folders...");

                foreach (XCModFolder folderPath in mod.folders)
                {
                    string absoluteFolderPath = CombinePaths(Application.dataPath, folderPath.folderPath);
                    Debug.Log("Adding folder " + absoluteFolderPath);
                    this.AddFolder(absoluteFolderPath, folderPath.folderFlags, 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 = CombinePaths(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);
                }
            }

            this.Consolidate();
        }
Ejemplo n.º 17
0
		public void ApplyMod( XCMod mod )
		{	
			PBXGroup modGroup = this.GetGroup( mod.group );
			
			Debug.Log( "Adding libraries..." );
			string rootAbsPath = System.IO.Path.Combine(Application.dataPath, "../../");
			
			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;
				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(rootAbsPath, filePath);
				this.AddFile( absoluteFilePath, modGroup );
			}
		
//mod.path	
			Debug.Log( "Adding folders..." );
			foreach( string folderPath in mod.folders ) {
				string absoluteFolderPath = System.IO.Path.Combine(rootAbsPath, 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(rootAbsPath, 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 );
			}

			if (mod.configs != null)
			{
				Debug.Log("Adding configs...---------------------------------------------------------------");
				foreach (string config in mod.configs)
				{
					string[] values = config.Split(new char[] { '=' });
					overwriteBuildSetting(values[0], values[1]);
				}
			}
			
			this.Consolidate();
		}
Ejemplo n.º 18
0
        public void ApplyMod(XCMod mod)
        {
            Debug.Log("Applying mod " + mod);
            PBXGroup modGroup = this.GetGroup(mod.group);

            Debug.Log("Adding libraries..." + mod.libs.Count);
            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 folders...");
            foreach (string folderPath in mod.folders)
            {
                string absoluteFolderPath = System.IO.Path.Combine(mod.path, 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 build setting");
            foreach (string key in mod.build_settings.Keys)
            {
                var value = mod.build_settings[key] as string;
                this.overwriteBuildSetting(key, value);
            }
            this.Consolidate();
        }
Ejemplo n.º 19
0
        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();
        }
Ejemplo n.º 20
0
		public void ApplyMod( XCMod mod )
		{	
			PBXGroup modGroup = this.GetGroup( mod.group );
			
			Debug.Log( "Adding libraries..." );
			//PBXGroup librariesGroup = this.GetGroup( "Libraries" );
			foreach( XCModFile libRef in mod.libs ) {
				string completeLibPath = System.IO.Path.Combine( "usr/lib", libRef.filePath );
				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 );


				if( filePath.EndsWith(".framework") )
					this.AddFile( absoluteFilePath, frameworkGroup, "GROUP", true, false);
				else
					this.AddFile( absoluteFilePath, modGroup );
			}
			
			Debug.Log( "Adding folders..." );
			foreach( string folderPath in mod.folders ) {
				string absoluteFolderPath = System.IO.Path.Combine( mod.path, folderPath );
				this.AddFolder( absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray( typeof(string) ) );
			}
			
			Debug.Log( "Adding headerpaths..." );
			foreach( string headerpath in mod.headerpaths ) {
				string absoluteHeaderPath = System.IO.Path.Combine( mod.path, headerpath );
				this.AddHeaderSearchPaths( absoluteHeaderPath );
			}

			Debug.Log( "Configure build settings..." );
			Hashtable buildSettings = mod.buildSettings;
			if( buildSettings.ContainsKey("OTHER_LDFLAGS") )
			{
				Debug.Log( "    Adding other linker flags..." );
				ArrayList otherLinkerFlags = (ArrayList) buildSettings["OTHER_LDFLAGS"];
				foreach( string linker in otherLinkerFlags ) 
				{
					string _linker = linker;
					if( !_linker.StartsWith("-") )
						_linker = "-" + _linker;
					this.AddOtherLDFlags( _linker );
				}
			}

			if( buildSettings.ContainsKey("GCC_ENABLE_CPP_EXCEPTIONS") )
			{
				Debug.Log( "    GCC_ENABLE_CPP_EXCEPTIONS = " + buildSettings["GCC_ENABLE_CPP_EXCEPTIONS"] );
				this.GccEnableCppExceptions( (string) buildSettings["GCC_ENABLE_CPP_EXCEPTIONS"] );
			}

			if( buildSettings.ContainsKey("GCC_ENABLE_OBJC_EXCEPTIONS") )
			{
				Debug.Log( "    GCC_ENABLE_OBJC_EXCEPTIONS = " + buildSettings["GCC_ENABLE_OBJC_EXCEPTIONS"] );
				this.GccEnableObjCExceptions( (string) buildSettings["GCC_ENABLE_OBJC_EXCEPTIONS"] );
			}

			this.Consolidate();
		}
Ejemplo n.º 21
0
		public void ApplyMod( string rootPath, string pbxmod )
		{
			XCMod mod = new XCMod( rootPath, pbxmod );
			ApplyMod( mod );
		}
Ejemplo n.º 22
0
        public void ApplyMod(string rootPath, string pbxmod)
        {
            XCMod mod = new XCMod(rootPath, pbxmod);

            ApplyMod(mod);
        }
Ejemplo n.º 23
0
        public void ApplyMod(XCMod mod)
        {
            PBXGroup modGroup = this.GetGroup(mod.group);

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

            Debug.Log("Adding frameworks...");
            PBXGroup frameworkGroup = this.GetGroup("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)
                {
                    string absoluteFilePath = System.IO.Path.Combine(mod.path, filePath);


                    if (filePath.EndsWith(".framework"))
                    {
                        this.AddFile(absoluteFilePath, frameworkGroup, "GROUP", true, false);
                    }
                    else
                    {
                        this.AddFile(absoluteFilePath, modGroup);
                    }
                }
            }

            Debug.Log("Adding folders...");
            if (mod.folders != null)
            {
                foreach (string folderPath in mod.folders)
                {
                    string absoluteFolderPath = System.IO.Path.Combine(mod.path, folderPath);
                    this.AddFolder(absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray(typeof(string)));
                }
            }

            Debug.Log("Adding headerpaths...");
            if (mod.headerpaths != null)
            {
                foreach (string headerpath in mod.headerpaths)
                {
                    string absoluteHeaderPath = System.IO.Path.Combine(mod.path, headerpath);
                    this.AddHeaderSearchPaths(absoluteHeaderPath);
                }
            }

            Debug.Log("Adding librarysearchpaths...");
            if (mod.librarysearchpaths != null)
            {
                foreach (string librarypath in mod.librarysearchpaths)
                {
                    string absolutePath = System.IO.Path.Combine(mod.path, librarypath);
                    this.AddLibrarySearchPaths(absolutePath);
                }
            }

            Debug.Log("Adding frameworksearchpath...");
            if (mod.frameworksearchpath != null)
            {
                foreach (string frameworksearchpath in mod.frameworksearchpath)
                {
                    string absoluteHeaderPath = System.IO.Path.Combine(mod.path, frameworksearchpath);
                    this.AddFrameworkSearchPaths(absoluteHeaderPath);
                }
            }

            Debug.Log("Configure build settings...");
            if (mod.buildSettings != null)
            {
                Hashtable buildSettings = mod.buildSettings;

                if (buildSettings.ContainsKey("OTHER_LDFLAGS"))
                {
                    Debug.Log("    Adding other linker flags...");
                    ArrayList otherLinkerFlags = (ArrayList)buildSettings["OTHER_LDFLAGS"];
                    foreach (string linker in otherLinkerFlags)
                    {
                        string _linker = linker;
                        if (!_linker.StartsWith("-"))
                        {
                            _linker = "-" + _linker;
                        }
                        this.AddOtherLDFlags(_linker);
                    }
                }

                if (buildSettings.ContainsKey("GCC_ENABLE_CPP_EXCEPTIONS"))
                {
                    Debug.Log("    GCC_ENABLE_CPP_EXCEPTIONS = " + buildSettings["GCC_ENABLE_CPP_EXCEPTIONS"]);
                    this.GccEnableCppExceptions((string)buildSettings["GCC_ENABLE_CPP_EXCEPTIONS"]);
                }

                if (buildSettings.ContainsKey("GCC_ENABLE_OBJC_EXCEPTIONS"))
                {
                    Debug.Log("    GCC_ENABLE_OBJC_EXCEPTIONS = " + buildSettings["GCC_ENABLE_OBJC_EXCEPTIONS"]);
                    this.GccEnableObjCExceptions((string)buildSettings["GCC_ENABLE_OBJC_EXCEPTIONS"]);
                }

                if (buildSettings.ContainsKey("ENABLE_BITCODE"))
                {
                    Debug.Log("    ENABLE_BITCODE = " + buildSettings["ENABLE_BITCODE"]);
                    this.EnableBitCode((string)buildSettings["ENABLE_BITCODE"]);
                }
            }

            Debug.Log("Adding linkers...");
            if (mod.linkers != null)
            {
                foreach (string linker in mod.linkers)
                {
                    string _linker = linker;
                    if (!_linker.StartsWith("-"))
                    {
                        _linker = "-" + _linker;
                    }
                    this.AddOtherLDFlags(_linker);
                }
            }

            this.Consolidate();

            Debug.Log("Adding plist...");
            if (mod.plist != null)
            {
                foreach (string plistMod in mod.plist)
                {
                    UnityEditor.XCodeEditor.XCInfoPlist.UpdatePlist(projectRootPath, plistMod);
                }
            }
        }
Ejemplo n.º 24
0
        public void ApplyMod(XCMod mod)
        {
            PBXGroup modGroup = this.GetGroup(mod.group);

            foreach (XCModFile libRef in mod.libs)
            {
                string completeLibPath;
                if (libRef.sourceTree.Equals("SDKROOT"))
                {
                    completeLibPath = System.IO.Path.Combine("usr/lib", libRef.filePath);
                }
                else
                {
                    completeLibPath = System.IO.Path.Combine(mod.path, libRef.filePath);
                }

                this.AddFile(completeLibPath, modGroup, libRef.sourceTree, true, libRef.isWeak);
            }

            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);
            }

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

            foreach (string folderPath in mod.folders)
            {
                string absoluteFolderPath = AddXcodeQuotes(System.IO.Path.Combine(mod.path, folderPath));
                this.AddFolder(absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray(  ));
            }


            foreach (string headerpath in mod.headerpaths)
            {
                string absoluteHeaderPath = AddXcodeQuotes(System.IO.Path.Combine(mod.path, headerpath));
                this.AddHeaderSearchPaths(absoluteHeaderPath);
            }

            foreach (string librarypath in mod.librarysearchpaths)
            {
                string absolutePath = AddXcodeQuotes(System.IO.Path.Combine(mod.path, librarypath));
                this.AddLibrarySearchPaths(absolutePath);
            }

            if (mod.frameworksearchpath != null)
            {
                foreach (string frameworksearchpath in mod.frameworksearchpath)
                {
                    string absoluteHeaderPath = AddXcodeQuotes(System.IO.Path.Combine(mod.path, frameworksearchpath));
                    this.AddFrameworkSearchPaths(absoluteHeaderPath);
                }
            }

            this.Consolidate();
        }
Ejemplo n.º 25
0
 public void ApplyMod( string pbxmod )
 {
     XCMod mod = new XCMod( pbxmod );
     ApplyMod( mod );
 }
Ejemplo n.º 26
0
        public void ApplyMod( XCMod mod )
        {
            PBXGroup modGroup = this.GetGroup( mod.group );

            //Debug.Log( "Adding libraries..." );
            PBXGroup librariesGroup = this.GetGroup( "Libraries" );
            foreach( XCModFile libRef in mod.libs ) {
                string completeLibPath = System.IO.Path.Combine( "usr/lib", libRef.filePath );
                this.AddFile( completeLibPath, librariesGroup, "SDKROOT", true, libRef.isWeak );
                //Debug.Log(mod.group + ": Adding lib " + completeLibPath);
            }

            //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(mod.group + ": Adding framework " + completePath + (isWeak ? " (weak linked)" : ""));
            }

            //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(mod.group + ": Adding file " + absoluteFilePath);
            }

            //Add all files with known extensions
            foreach(string extension in new ArrayList() {"*.h", "*.c", "*.cc", "*.cpp", "*.m", "*.mm", "*.a", "*.bundle", "*.framework"}) {
                var files = System.IO.Directory.GetFiles( mod.path, extension, System.IO.SearchOption.AllDirectories );
                foreach( string file in files ) {
                    this.AddFile( file, modGroup );
                    //Debug.Log(mod.group + ": Adding file " + file);
                }
            }

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

            //Debug.Log( "Adding headerpaths..." );
            foreach( string headerpath in mod.headerpaths ) {
                string absoluteHeaderPath = System.IO.Path.Combine( mod.path, headerpath );
                this.AddHeaderSearchPaths( absoluteHeaderPath );
                //Debug.Log(mod.group + ": Adding header path " + absoluteHeaderPath);
            }

            this.Consolidate();
        }
Ejemplo n.º 27
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();
        }
Ejemplo n.º 28
0
        public void ApplyMod(string rootPath, string pbxmod)
        {
            XCMod mod = new XCMod(System.IO.Path.GetFullPath(rootPath), pbxmod);

            ApplyMod(mod);
        }