public void ApplyMod(string pbxmod)
        {
            XCMod mod = new XCMod(pbxmod);

//			foreach(var lib in mod.libs){
//				Debug.Log("Library: "+lib);
//			}
            ApplyMod(mod);
        }
Exemple #2
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 file in mod.files)
            {
                string[] args             = file.Split(':');
                string   filePath         = args[0];
                string   compilerFlags    = (args.Length > 1) ? args[1] : null;
                string   absoluteFilePath = System.IO.Path.Combine(mod.path, filePath);
                this.AddFile(absoluteFilePath, modGroup, compilerFlags: compilerFlags);
            }

            Debug.Log("Adding folders...");
            foreach (string folder in mod.folders)
            {
                string[] args               = folder.Split(':');
                string   folderPath         = args[0];
                string   compilerFlags      = (args.Length > 1) ? args[1] : null;
                string   absoluteFolderPath = System.IO.Path.Combine(mod.path, folderPath);
                Debug.Log("Adding folder " + absoluteFolderPath);
                this.AddFolder(absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray(typeof(string)), compilerFlags: compilerFlags);
            }

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

            this.Consolidate();
        }
		public void ApplyMod( XCMod mod )
		{	
			PBXGroup modGroup 		= this.GetGroup( mod.group );
#if !XCODE_PROJECT_USES_SOFT_LINKS
			string groupFolderPath	= Path.Combine (Path.Combine (projectRootPath, "Plugins"), mod.group);	
#endif

			Debug.Log( "Adding libraries..." );
			foreach( XCModFile libRef in mod.libs ) {
				string completeLibPath = 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 = Path.Combine( "System/Library/Frameworks", filename[0] );
				this.AddFile( completePath, frameworkGroup, "SDKROOT", true, isWeak );
			}
			
			Debug.Log ( "Adding files..." );
			foreach (string file in mod.files) {
				string[] args				= file.Split (':');
				string fileRelativePath		= args[0];
				string compilerFlags		= (args.Length > 1) ? args[1] : null;
				string fileAbsolutePath 	= Path.Combine (mod.path, fileRelativePath);

#if XCODE_PROJECT_USES_SOFT_LINKS
				// Will create reference to this file 
				this.AddFile (fileAbsolutePath, modGroup, compilerFlags: compilerFlags);
#else
				// Create a hard copy of the file, placed at build folder
				string finalFileAbsolutePath	= Path.Combine (groupFolderPath, fileRelativePath);

				if (File.Exists (fileAbsolutePath))
				{
					CopyFileFrom (fileAbsolutePath, finalFileAbsolutePath);
				}
				else if (Directory.Exists (fileAbsolutePath))
				{
					IOExtensions.CopyFilesRecursively (fileAbsolutePath, finalFileAbsolutePath, true);
				}
				else
				{
					continue;
				}

				// Now add this new copy to xcode project
				this.AddFile (finalFileAbsolutePath, modGroup, compilerFlags: compilerFlags);
#endif
			}
			
			Debug.Log ( "Adding folders..." );
			foreach (string folder in mod.folders) {
				string[] args				= folder.Split (':');
				string folderRelativePath	= args[0];
				string compilerFlags		= (args.Length > 1) ? args[1] : null;
				string folderAbsolutePath 	= Path.Combine (mod.path, folderRelativePath);

#if XCODE_PROJECT_USES_SOFT_LINKS
				// Will create reference to this folder
				this.AddFolder (folderAbsolutePath, modGroup, (string[])mod.excludes.ToArray( typeof(string) ), compilerFlags:compilerFlags);
#else
				// Check if source folder exist
				if (!Directory.Exists (folderAbsolutePath))
					continue;

				// Make a hard copy of this folder
				string finalFolderAbsolutePath	= Path.Combine (groupFolderPath, folderRelativePath);

				IOExtensions.CopyFilesRecursively (folderAbsolutePath, finalFolderAbsolutePath, true); 

				// Now add this new copy to xcode project
				this.AddFolder (finalFolderAbsolutePath, modGroup, (string[])mod.excludes.ToArray( typeof(string) ), compilerFlags:compilerFlags);
#endif
			}
			
			Debug.Log( "Adding headerpaths..." );
			foreach( string headerpath in mod.headerpaths ) {
				string[] args			= headerpath.Split( ':' );
				bool recursive			= args.Length > 1 ? args[1].Equals("recursive") : false;

				if (args[0].Contains("$(inherited)")) {
					Debug.Log ("not prepending a path to " + args[0]);
					this.AddHeaderSearchPaths( args[0], recursive );
				} else {
#if XCODE_PROJECT_USES_SOFT_LINKS
					string absoluteHeaderPath = Path.Combine (mod.path, args[0]);
#else
					string absoluteHeaderPath = Path.Combine (Path.Combine ("$(SRCROOT)/Plugins", mod.group), args[0] );
#endif
					this.AddHeaderSearchPaths (absoluteHeaderPath, recursive);
				}
			}

			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();
		}
		public void ApplyMod( string pbxmod )
		{
			XCMod mod = new XCMod( pbxmod );
			foreach(var lib in mod.libs){
				Debug.Log("Library: "+lib);
			}
			ApplyMod( mod );
		}
        public void ApplyMod(XCMod mod)
        {
            PBXGroup modGroup = this.GetGroup(mod.group);

#if !XCODE_PROJECT_USES_SOFT_LINKS
            string groupFolderPath = Path.Combine(Path.Combine(projectRootPath, "Plugins"), mod.group);
#endif

//			Debug.Log( "Adding libraries..." );
            foreach (XCModFile libRef in mod.libs)
            {
                string completeLibPath = 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 = Path.Combine("System/Library/Frameworks", filename[0]);
                this.AddFile(completePath, frameworkGroup, "SDKROOT", true, isWeak);
            }

//			Debug.Log ( "Adding files..." );
            foreach (string file in mod.files)
            {
                string[] args             = file.Split(':');
                string   fileRelativePath = args[0];
                string   compilerFlags    = (args.Length > 1) ? args[1] : null;
                string   fileAbsolutePath = Path.Combine(mod.path, fileRelativePath);

#if XCODE_PROJECT_USES_SOFT_LINKS
                // Will create reference to this file
                this.AddFile(fileAbsolutePath, modGroup, compilerFlags: compilerFlags);
#else
                // Create a hard copy of the file, placed at build folder
                string finalFileAbsolutePath = Path.Combine(groupFolderPath, fileRelativePath);

                if (File.Exists(fileAbsolutePath))
                {
                    CopyFileFrom(fileAbsolutePath, finalFileAbsolutePath);
                }
                else if (Directory.Exists(fileAbsolutePath))
                {
                    IOExtensions.CopyFilesRecursively(fileAbsolutePath, finalFileAbsolutePath, true);
                }
                else
                {
                    continue;
                }

                // Now add this new copy to xcode project
                this.AddFile(finalFileAbsolutePath, modGroup, compilerFlags: compilerFlags);
#endif
            }

//			Debug.Log ( "Adding folders..." );
            foreach (string folder in mod.folders)
            {
                string[] args = folder.Split(':');
                string   folderRelativePath = args[0];
                string   compilerFlags      = (args.Length > 1) ? args[1] : null;
                string   folderAbsolutePath = Path.Combine(mod.path, folderRelativePath);

#if XCODE_PROJECT_USES_SOFT_LINKS
                // Will create reference to this folder
                this.AddFolder(folderAbsolutePath, modGroup, (string[])mod.excludes.ToArray(typeof(string)), compilerFlags: compilerFlags);
#else
                // Check if source folder exist
                if (!Directory.Exists(folderAbsolutePath))
                {
                    continue;
                }

                // Make a hard copy of this folder
                string finalFolderAbsolutePath = Path.Combine(groupFolderPath, folderRelativePath);

                IOExtensions.CopyFilesRecursively(folderAbsolutePath, finalFolderAbsolutePath, true);

                // Now add this new copy to xcode project
                this.AddFolder(finalFolderAbsolutePath, modGroup, (string[])mod.excludes.ToArray(typeof(string)), compilerFlags: compilerFlags);
#endif
            }

//			Debug.Log( "Adding headerpaths..." );
            foreach (string headerpath in mod.headerpaths)
            {
                string[] args      = headerpath.Split(':');
                bool     recursive = args.Length > 1 ? args[1].Equals("recursive") : false;

                if (args[0].Contains("$(inherited)"))
                {
//					Debug.Log ("not prepending a path to " + args[0]);
                    this.AddHeaderSearchPaths(args[0], recursive);
                }
                else
                {
#if XCODE_PROJECT_USES_SOFT_LINKS
                    string absoluteHeaderPath = Path.Combine(mod.path, args[0]);
#else
                    string absoluteHeaderPath = Path.Combine(Path.Combine("$(SRCROOT)/Plugins", mod.group), args[0]);
#endif
                    Debug.Log("Adding header path " + absoluteHeaderPath + " Recursive " + recursive);
                    this.AddHeaderSearchPaths(absoluteHeaderPath, recursive);
                }
            }

//			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();
        }
        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 file in mod.files ) {
                string[] args			= file.Split( ':' );
                string filePath			= args[0];
                string compilerFlags	= (args.Length > 1) ? args[1] : null;
                string absoluteFilePath = System.IO.Path.Combine( mod.path, filePath );
                this.AddFile( absoluteFilePath, modGroup, compilerFlags: compilerFlags);
            }

            Debug.Log( "Adding folders..." );
            foreach( string folder in mod.folders ) {
                string[] args			= folder.Split( ':' );
                string folderPath		= args[0];
                string compilerFlags	= (args.Length > 1) ? args[1] : null;
                string absoluteFolderPath = System.IO.Path.Combine( mod.path, folderPath );
                Debug.Log ("Adding folder " + absoluteFolderPath);
                this.AddFolder( absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray( typeof(string) ), compilerFlags:compilerFlags);
            }

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

            this.Consolidate();
        }