• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ProjectFileCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ProjectFileCollection的典型用法代码示例。如果您正苦于以下问题:C# ProjectFileCollection类的具体用法?C# ProjectFileCollection怎么用?C# ProjectFileCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ProjectFileCollection类属于命名空间,在下文中一共展示了ProjectFileCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Project

		public Project ()
		{
			FileService.FileChanged += OnFileChanged;
			files = new ProjectFileCollection ();
			Items.Bind (files);
			DependencyResolutionEnabled = true;
		}
开发者ID:okrmartin,项目名称:monodevelop,代码行数:7,代码来源:Project.cs


示例2: FakeDotNetProject

		public FakeDotNetProject (string fileName)
			: base (fileName)
		{
			References = new ProjectReferenceCollection ();
			Files = new ProjectFileCollection ();
			CreateEqualsAction ();
		}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:7,代码来源:FakeDotNetProject.cs


示例3: GetFolderContent

		void GetFolderContent (Project project, string folder, out ProjectFileCollection files, out ArrayList folders)
		{
			files = new ProjectFileCollection ();
			folders = new ArrayList ();
			string folderPrefix = folder + Path.DirectorySeparatorChar;
			
			foreach (ProjectFile file in project.Files)
			{
				string dir;

				if (file.Subtype != Subtype.Directory) {
					if (file.DependsOnFile != null)
						continue;
					
					dir = file.IsLink
						? project.BaseDirectory.Combine (file.ProjectVirtualPath).ParentDirectory
						: file.FilePath.ParentDirectory;
						
					if (dir == folder) {
						files.Add (file);
						continue;
					}
				} else
					dir = file.Name;
				
				// add the directory if it isn't already present
				if (dir.StartsWith (folderPrefix)) {
					int i = dir.IndexOf (Path.DirectorySeparatorChar, folderPrefix.Length);
					if (i != -1) dir = dir.Substring (0,i);
					if (!folders.Contains (dir))
						folders.Add (dir);
				}
			}
		}
开发者ID:segaman,项目名称:monodevelop,代码行数:34,代码来源:FolderNodeBuilder.cs


示例4: Compile

		public override ICompilerResult Compile (
			ProjectFileCollection projectFiles,
		    ProjectPackageCollection packages,
		    CProjectConfiguration configuration,
		    IProgressMonitor monitor)
		{
			CompilerResults cr = new CompilerResults (new TempFileCollection ());
			bool res = true;
			string args = GetCompilerFlags (configuration);
			
			string outputName = Path.Combine (configuration.OutputDirectory,
			                                  configuration.CompiledOutputName);
			
			// Precompile header files and place them in .prec/<config_name>/
			string precdir = Path.Combine (configuration.SourceDirectory, ".prec");
			if (!Directory.Exists (precdir))
				Directory.CreateDirectory (precdir);
			precdir = Path.Combine (precdir, configuration.Name);
			if (!Directory.Exists (precdir))
				Directory.CreateDirectory (precdir);
			
			PrecompileHeaders (projectFiles, configuration, args);
			
			foreach (ProjectFile f in projectFiles) {
				if (f.Subtype == Subtype.Directory) continue;
				
				if (f.BuildAction == BuildAction.Compile) {
					if (configuration.UseCcache || NeedsCompiling (f))
						res = DoCompilation (f, args, packages, monitor, cr, configuration.UseCcache);
				}
				else
					res = true;
				
				if (!res) break;
			}

			if (res) {
				switch (configuration.CompileTarget)
				{
				case CBinding.CompileTarget.Bin:
					MakeBin (
						projectFiles, packages, configuration, cr, monitor, outputName);
					break;
				case CBinding.CompileTarget.StaticLibrary:
					MakeStaticLibrary (
						projectFiles, monitor, outputName);
					break;
				case CBinding.CompileTarget.SharedLibrary:
					MakeSharedLibrary (
						projectFiles, packages, configuration, cr, monitor, outputName);
					break;
				}
			}
			
			return new DefaultCompilerResult (cr, "");
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:56,代码来源:GNUCompiler.cs


示例5: PrecompileHeaders

		private bool PrecompileHeaders (ProjectFileCollection projectFiles,
		                                CProjectConfiguration configuration,
		                                string args,
		                                IProgressMonitor monitor,
		                                CompilerResults cr)
		{
			monitor.BeginTask (GettextCatalog.GetString ("Precompiling headers"), 1);
			bool success = true;
			
			foreach (ProjectFile file in projectFiles) {
				if (file.Subtype == Subtype.Code && CProject.IsHeaderFile (file.Name)) {
					string precomp = Path.Combine (configuration.SourceDirectory, ".prec");
					precomp = Path.Combine (precomp, configuration.Id);
					precomp = Path.Combine (precomp, Path.GetFileName (file.Name) + ".ghc");
					if (file.BuildAction == BuildAction.Compile) {
						if (!File.Exists (precomp) || configuration.UseCcache || File.GetLastWriteTime (file.Name) > File.GetLastWriteTime (precomp)) {
							if (DoPrecompileHeader (file, precomp, args, monitor, cr) == false) {
								success = false;
								break;
							}
						}
					} else {
						//remove old files or they'll interfere with the build
						if (File.Exists (precomp))
							File.Delete (precomp);
					}
				}
				
			}
			if (success)
				monitor.Step (1);
			monitor.EndTask ();
			return success;
		}
开发者ID:thild,项目名称:monodevelop,代码行数:34,代码来源:GNUCompiler.cs


示例6: MakeStaticLibrary

		private void MakeStaticLibrary (Project project,
		                                ProjectFileCollection projectFiles,
		                                CProjectConfiguration configuration,
		                                ProjectPackageCollection packages,
		                                CompilerResults cr,
		                                IProgressMonitor monitor, string outputName)
		{
			if (!NeedsUpdate (projectFiles, configuration, outputName)) return;
			
			string objectFiles = string.Join (" ", ObjectFiles (projectFiles, configuration, true));
			string args = string.Format ("rcs \"{0}\" {1}", outputName, objectFiles);
			
			monitor.BeginTask (GettextCatalog.GetString ("Generating static library {0} from object files", Path.GetFileName (outputName)), 1);
			
			string errorOutput;
			int exitCode = ExecuteCommand ("ar", args, Path.GetDirectoryName (outputName), monitor, out errorOutput);
			if (exitCode == 0)
				monitor.Step (1);
			monitor.EndTask ();
			
			ParseCompilerOutput (errorOutput, cr);
			ParseLinkerOutput (errorOutput, cr);
			CheckReturnCode (exitCode, cr);
		}
开发者ID:thild,项目名称:monodevelop,代码行数:24,代码来源:GNUCompiler.cs


示例7: Compile

		public BuildResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration, IProgressMonitor monitor)
		{
			return compilerServices.Compile (projectFiles, references, configuration, monitor);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:4,代码来源:NemerleLanguageBinding.cs


示例8: NeedsUpdate

		/// <summary>
		/// Determines whether the target needs to be updated
		/// </summary>
		/// <param name="projectFiles">
		/// The project's files
		/// <see cref="ProjectFileCollection"/>
		/// </param>
		/// <param name="target">
		/// The target
		/// <see cref="System.String"/>
		/// </param>
		/// <returns>
		/// true if target needs to be updated
		/// <see cref="System.Boolean"/>
		/// </returns>
		private bool NeedsUpdate (ProjectFileCollection projectFiles,
								  string target)
		{
			return true;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:20,代码来源:ValaCompiler.cs


示例9: CreateErrorFromErrorString

		/// <summary>
		/// Creates a compiler error from an output string
		/// </summary>
		/// <param name="errorString">
		/// The error string to be parsed
		/// <see cref="System.String"/>
		/// </param>
		/// <returns>
		/// A newly created CompilerError
		/// <see cref="CompilerError"/>
		/// </returns>
		private CompilerError CreateErrorFromErrorString (string errorString, ProjectFileCollection projectFiles)
		{
			Match errorMatch = null;
			foreach (Regex regex in new Regex[]{errorRegex, gccRegex})
				if ((errorMatch = regex.Match (errorString)).Success)
					break;
			
			if (!errorMatch.Success)
				return null;

			CompilerError error = new CompilerError ();
			
			foreach (ProjectFile pf in projectFiles) {
				if (Path.GetFileName (pf.Name) == errorMatch.Groups["file"].Value) {
					error.FileName = pf.FilePath;
					break;
				}
			}// check for fully pathed file
			if (string.Empty == error.FileName) {
				error.FileName = errorMatch.Groups["file"].Value;
			}// fallback to exact match
			error.Line = int.Parse (errorMatch.Groups["line"].Value);
			if (errorMatch.Groups["column"].Success)
				error.Column = int.Parse (errorMatch.Groups["column"].Value);
			error.IsWarning = !errorMatch.Groups["level"].Value.Equals (GettextCatalog.GetString ("error"), StringComparison.Ordinal);
			error.ErrorText = errorMatch.Groups["message"].Value;
			
			return error;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:40,代码来源:ValaCompiler.cs


示例10: Clean

		/// <summary>
		/// Cleans up intermediate files
		/// </summary>
		/// <param name="projectFiles">
		/// The project's files
		/// <see cref="ProjectFileCollection"/>
		/// </param>
		/// <param name="configuration">
		/// Project configuration
		/// <see cref="ValaProjectConfiguration"/>
		/// </param>
		/// <param name="monitor">
		/// The progress monitor to be used
		/// <see cref="IProgressMonitor"/>
		/// </param>
		public void Clean (ProjectFileCollection projectFiles, ValaProjectConfiguration configuration, IProgressMonitor monitor)
		{
			/// Clean up intermediate files
			/// These should only be generated for libraries, but we'll check for them in all cases
			foreach (ProjectFile file in projectFiles) {
				if (file.BuildAction == BuildAction.Compile) {
					string cFile = Path.Combine (configuration.OutputDirectory, Path.GetFileNameWithoutExtension (file.Name) + ".c");
					if (File.Exists (cFile)){ File.Delete (cFile); }
						
					string hFile = Path.Combine (configuration.OutputDirectory, Path.GetFileNameWithoutExtension (file.Name) + ".h");
					if (File.Exists (hFile)){ File.Delete (hFile); }
				}
			}
			
			string vapiFile = Path.Combine (configuration.OutputDirectory, configuration.Output + ".vapi");
			if (File.Exists (vapiFile)){ File.Delete (vapiFile); }
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:32,代码来源:ValaCompiler.cs


示例11: ObjectFiles

		private string[] ObjectFiles (ProjectFileCollection projectFiles)
		{
			List<string> objectFiles = new List<string> ();
			
			foreach (ProjectFile f in projectFiles) {
				if (f.BuildAction == BuildAction.Compile) {
					objectFiles.Add (Path.ChangeExtension (f.Name, ".o"));
				}
			}
			
			return objectFiles.ToArray ();
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:12,代码来源:GNUCompiler.cs


示例12: ObjectFiles

		/// <summary>
		/// Gets the files that get compiled into object code.
		/// </summary>
		/// <param name="projectFiles">
		/// A <see cref="ProjectFileCollection"/>
		/// The project's files, extracts from here the files that get compiled into object code.
		/// </param>
		/// <param name="configuration">
		/// A <see cref="CProjectConfiguration"/>
		/// The configuration to get the object files for...
		/// </param>
		/// <param name="withQuotes">
		/// A <see cref="System.Boolean"/>
		/// If true, it will surround each object file with quotes 
		/// so that gcc has no problem with paths that contain spaces.
		/// </param>
		/// <returns>
		/// An array of strings, each string is the name of a file
		/// that will get compiled into object code. The file name
		/// will already have the .o extension.
		/// </returns>
		private string[] ObjectFiles (ProjectFileCollection projectFiles, CProjectConfiguration configuration, bool withQuotes)
		{
			if(projectFiles.Count == 0)
				return new string[] {};

			List<string> objectFiles = new List<string> ();
			
			foreach (ProjectFile f in projectFiles) {
				if (f.BuildAction == BuildAction.Compile) {
					string PathName = Path.Combine(configuration.OutputDirectory, Path.GetFileNameWithoutExtension(f.Name) + ".o");

					if(File.Exists(PathName) == false)
						continue;
					
					if (!withQuotes)
						objectFiles.Add (PathName);
					else
						objectFiles.Add ("\"" + PathName + "\"");
				}
			}
			
			return objectFiles.ToArray ();
		}
开发者ID:thild,项目名称:monodevelop,代码行数:44,代码来源:GNUCompiler.cs


示例13: MakeStaticLibrary

		private void MakeStaticLibrary (ProjectFileCollection projectFiles,
		                                IProgressMonitor monitor, string outputName)
		{
			if (!NeedsUpdate (projectFiles, outputName)) return;
			
			string objectFiles = StringArrayToSingleString (ObjectFiles (projectFiles));
			
			monitor.Log.WriteLine ("Generating static library...");
			monitor.Log.WriteLine ("using: ar rcs " + outputName + " " + objectFiles);
			
			Process p = Runtime.ProcessService.StartProcess (
				"ar", "rcs " + outputName + " " + objectFiles,
				null, null);
			p.WaitForExit ();
			p.Close ();
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:16,代码来源:GNUCompiler.cs


示例14: MakeSharedLibrary

		private void MakeSharedLibrary(ProjectFileCollection projectFiles,
		                               ProjectPackageCollection packages,
		                               CProjectConfiguration configuration,
		                               CompilerResults cr,
		                               IProgressMonitor monitor, string outputName)
		{
			if (!NeedsUpdate (projectFiles, outputName)) return;
			
			string objectFiles = StringArrayToSingleString (ObjectFiles (projectFiles));
			string pkgargs = GeneratePkgLinkerArgs (packages);
			StringBuilder args = new StringBuilder ();
			CCompilationParameters cp =
				(CCompilationParameters)configuration.CompilationParameters;
			
			if (cp.ExtraLinkerArguments != null && cp.ExtraLinkerArguments.Length > 0) {
				string extraLinkerArgs = cp.ExtraLinkerArguments.Replace ('\n', ' ');
				args.Append (extraLinkerArgs + " ");
			}
			
			if (configuration.LibPaths != null)
				foreach (string libpath in configuration.LibPaths)
					args.Append ("-L" + libpath + " ");
			
			if (configuration.Libs != null)
				foreach (string lib in configuration.Libs)
					args.Append ("-l" + lib + " ");
			
			monitor.Log.WriteLine ("Generating shared object...");
			
			string linker_args = string.Format ("-shared -o {0} {1} {2} {3}",
			    outputName, objectFiles, args.ToString (), pkgargs);
			
			monitor.Log.WriteLine ("using: " + linkerCommand + " " + linker_args);
			
			ProcessWrapper p = Runtime.ProcessService.StartProcess (linkerCommand, linker_args, null, null);

			p.WaitForExit ();
			
			string line;
			StringWriter error = new StringWriter ();
			
			while ((line = p.StandardError.ReadLine ()) != null)
				error.WriteLine (line);
			
			monitor.Log.WriteLine (error.ToString ());
			
			ParseCompilerOutput (error.ToString (), cr);
			
			error.Close ();
			p.Close ();
			
			ParseLinkerOutput (error.ToString (), cr);
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:53,代码来源:GNUCompiler.cs


示例15: PrecompileHeaders

		private void PrecompileHeaders (ProjectFileCollection projectFiles,
		                                CProjectConfiguration configuration,
		                                string args)
		{
			foreach (ProjectFile file in projectFiles) {
				if (file.Subtype == Subtype.Code && CProject.IsHeaderFile (file.Name)) {
					string precomp = Path.Combine (configuration.SourceDirectory, ".prec");
					precomp = Path.Combine (precomp, configuration.Name);
					precomp = Path.Combine (precomp, Path.GetFileName (file.Name) + ".ghc");
					
					if (!File.Exists (precomp)) {
						DoPrecompileHeader (file, precomp, args);
						continue;
					}
					
					if (configuration.UseCcache || File.GetLastWriteTime (file.Name) > File.GetLastWriteTime (precomp)) {
						DoPrecompileHeader (file, precomp, args);
					}
				}
			}
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:21,代码来源:GNUCompiler.cs


示例16: Compile

        /// <summary>
        /// Compiles a D project.
        /// </summary>
        public static BuildResult Compile(
            DProject Project,
            ProjectFileCollection FilesToCompile,
            DProjectConfiguration BuildConfig,
            IProgressMonitor monitor)
        {
            var relObjDir = "objs";
            var objDir = Path.Combine(Project.BaseDirectory, relObjDir);

            if(!Directory.Exists(objDir))
                Directory.CreateDirectory(objDir);

            // List of created object files
            var BuiltObjects = new List<string>();
            var compilerResults = new CompilerResults(new TempFileCollection());
            var buildResult = new BuildResult(compilerResults, "");
            bool succesfullyBuilt = true;
            bool modificationsDone = false;

            var Compiler = Project.Compiler;
            var Commands = Compiler.GetTargetConfiguration(Project.CompileTarget);
            var Arguments= Commands.GetArguments(BuildConfig.DebugMode);

            /// The target file to which all objects will be linked to
            var LinkTarget = BuildConfig.OutputDirectory.Combine(BuildConfig.CompiledOutputName);

            monitor.BeginTask("Build Project", FilesToCompile.Count + 1);

            var SourceIncludePaths=new List<string>(Compiler.GlobalParseCache.DirectoryPaths);
                SourceIncludePaths.AddRange(Project.LocalIncludeCache.DirectoryPaths);

            #region Compile sources to objects
            foreach (var f in FilesToCompile)
            {
                if (monitor.IsCancelRequested)
                    return buildResult;

                // If not compilable, skip it
                if (f.BuildAction != BuildAction.Compile || !File.Exists(f.FilePath))
                    continue;

                // a.Check if source file was modified and if object file still exists
                if (Project.LastModificationTimes.ContainsKey(f) &&
                    Project.LastModificationTimes[f] == File.GetLastWriteTime(f.FilePath) &&
                    File.Exists(f.LastGenOutput))
                {
                    // File wasn't edited since last build
                    // but add the built object to the objs array
                    BuiltObjects.Add(f.LastGenOutput);
                    monitor.Step(1);
                    continue;
                }
                else
                    modificationsDone=true;

                #region Resource file
                if(f.Name.EndsWith(".rc",StringComparison.OrdinalIgnoreCase))
                {
                    var res = Path.Combine(objDir, Path.GetFileNameWithoutExtension(f.FilePath))+ ".res";

                    if(File.Exists(res))
                        File.Delete(res);

                    // Build argument string
                    var resCmpArgs = FillInMacros(Win32ResourceCompiler.Instance.Arguments,
                        new Win32ResourceCompiler.ArgProvider{
                            RcFile=f.FilePath.ToString(),
                            ResFile=res
                        });

                    // Execute compiler
                    string output;
                    int _exitCode = ExecuteCommand(Win32ResourceCompiler.Instance.Executable,
                        resCmpArgs,
                        Project.BaseDirectory,
                        monitor,
                        out output);

                    // Error analysis
                    if(!string.IsNullOrEmpty(output))
                        compilerResults.Errors.Add(new CompilerError{ FileName=f.FilePath, ErrorText=output});
                    CheckReturnCode(_exitCode, compilerResults);

                    monitor.Step(1);

                    if (_exitCode != 0)
                    {
                        buildResult.FailedBuildCount++;
                        succesfullyBuilt = false;
                        break;
                    }
                    else
                    {
                        f.LastGenOutput = res;
                        buildResult.BuildCount++;
                        Project.LastModificationTimes[f] = File.GetLastWriteTime(f.FilePath);

//.........这里部分代码省略.........
开发者ID:nazriel,项目名称:Mono-D,代码行数:101,代码来源:DCompiler.cs


示例17: Compile

		public BuildResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection projectReferences, DotNetProjectConfiguration configuration, IProgressMonitor monitor)
		{
			NemerleParameters cp = (NemerleParameters) configuration.CompilationParameters;
			if (cp == null) cp = new NemerleParameters ();
			
			string references = "";
			string files   = "";
			
			foreach (ProjectReference lib in projectReferences)
				foreach (string a in lib.GetReferencedFileNames())
					references += " -r \"" + a + "\"";
			
			foreach (ProjectFile f in projectFiles)
				if (f.Subtype != Subtype.Directory)
					switch (f.BuildAction)
					{
						case BuildAction.Compile:
							files += " \"" + f.Name + "\"";
						break;
					}

			if (!Directory.Exists (configuration.OutputDirectory))
				Directory.CreateDirectory (configuration.OutputDirectory);
			
			string args = "-q -no-color " + GetOptionsString (configuration, cp) + references + files  + " -o " + configuration.CompiledOutputName;
			return DoCompilation (args);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:27,代码来源:NemerleBindingCompilerServices.cs


示例18: MakeSharedLibrary

		private void MakeSharedLibrary(Project project,
		                               ProjectFileCollection projectFiles,
		                               CProjectConfiguration configuration,
		                               ProjectPackageCollection packages,
		                               CompilerResults cr,
		                               IProgressMonitor monitor, string outputName)
		{
			if (!NeedsUpdate (projectFiles, configuration, outputName)) return;
			
			string objectFiles = string.Join (" ", ObjectFiles (projectFiles, configuration, true));
			string pkgargs = GeneratePkgLinkerArgs (packages);
			StringBuilder args = new StringBuilder ();
			
			if (configuration.ExtraLinkerArguments != null && configuration.ExtraLinkerArguments.Length > 0) {
				string extraLinkerArgs = ExpandBacktickedParameters(configuration.ExtraLinkerArguments.Replace ('\n', ' '));
				args.Append (extraLinkerArgs + " ");
			}
			
			if (configuration.LibPaths != null)
				foreach (string libpath in configuration.LibPaths)
					args.Append ("-L\"" + StringParserService.Parse (libpath, GetStringTags (project)) + "\" ");
			
			if (configuration.Libs != null) {
				foreach (string lib in configuration.Libs) {
					string directory = Path.GetDirectoryName(lib);
					string library = Path.GetFileName(lib);

					// Is this a 'standard' (as in, uses an orthodox naming convention) library..?
					string link_lib = String.Empty;
					if(IsStandardLibrary(configuration, directory, library, ref link_lib))
						args.Append ("-l\"" + link_lib + "\" ");
					// If not, reference the library by it's full pathname.
					else
						args.Append ("\"" + lib + "\" ");
				}
			}
			
			string linker_args = string.Format ("-shared -o \"{0}\" {1} {2} {3}",
			    outputName, pkgargs, objectFiles, args.ToString ());
			
			monitor.BeginTask (GettextCatalog.GetString ("Generating shared object \"{0}\" from object files", Path.GetFileName (outputName)), 1);
			
			string errorOutput;
			int exitCode = ExecuteCommand (linkerCommand , linker_args, Path.GetDirectoryName (outputName), monitor, out errorOutput);
			if (exitCode == 0)
				monitor.Step (1);
			monitor.EndTask ();
			
			ParseCompilerOutput (errorOutput, cr);
			ParseLinkerOutput (errorOutput, cr);
			CheckReturnCode (exitCode, cr);
		}
开发者ID:thild,项目名称:monodevelop,代码行数:52,代码来源:GNUCompiler.cs


示例19: NeedsUpdate

		private bool NeedsUpdate (ProjectFileCollection projectFiles, CProjectConfiguration configuration, string target)
		{
			if (!File.Exists (target))
				return true;
			
			foreach (string obj in ObjectFiles (projectFiles, configuration, false))
				if (File.GetLastWriteTime (obj) > File.GetLastWriteTime (target))
					return true;
			
			return false;
		}
开发者ID:thild,项目名称:monodevelop,代码行数:11,代码来源:GNUCompiler.cs


示例20: Compile

		public override BuildResult Compile (
		    Project project,
		    ProjectFileCollection projectFiles,
		    ProjectPackageCollection packages,
		    CProjectConfiguration configuration,
		    IProgressMonitor monitor)
		{
			if (!appsChecked) {
				appsChecked = true;
				compilerFound = CheckApp (compilerCommand);
				linkerFound = CheckApp (linkerCommand);
			}
				
			if (!compilerFound) {
				BuildResult cres = new BuildResult ();
				cres.AddError ("Compiler not found: " + compilerCommand);
				return cres;
			}
			
			if (!linkerFound) {
				BuildResult cres = new BuildResult ();
				cres.AddError ("Linker not found: " + linkerCommand);
				return cres;
			}
			
			CompilerResults cr = new CompilerResults (new TempFileCollection ());
			bool success = true;
			string compilerArgs = GetCompilerFlags (project, configuration) + " " + GeneratePkgCompilerArgs (packages);
			
			string outputName = Path.Combine (configuration.OutputDirectory,
			                                  configuration.CompiledOutputName);
			
			// Precompile header files and place them in .prec/<config_name>/
			if (configuration.PrecompileHeaders) {
				string precDir = Path.Combine (configuration.SourceDirectory, ".prec");
				string precConfigDir = Path.Combine (precDir, configuration.Id);
				if (!Directory.Exists (precDir))
					Directory.CreateDirectory (precDir);
				if (!Directory.Exists (precConfigDir))
					Directory.CreateDirectory (precConfigDir);
				
				if (!PrecompileHeaders (projectFiles, configuration, compilerArgs, monitor, cr))
					success = false;
			} else {
				//old headers could interfere with the build
				CleanPrecompiledHeaders (configuration);
			}
			
			//compile source to object files
			monitor.BeginTask (GettextCatalog.GetString ("Compiling source to object files"), 1);
			foreach (ProjectFile f in projectFiles) {
				if (!success) break;
				if (f.Subtype == Subtype.Directory || f.BuildAction != BuildAction.Compile || CProject.IsHeaderFile (f.FilePath))
					continue;
				
				if (configuration.UseCcache || NeedsCompiling (f, configuration))
					success = DoCompilation (f, configuration, compilerArgs, monitor, cr, configuration.UseCcache);
			}
			if (success)
				monitor.Step (1);
			monitor.EndTask ();

			if (success) {
				switch (configuration.CompileTarget)
				{
				case CBinding.CompileTarget.Bin:
					MakeBin (project, projectFiles, configuration, packages, cr, monitor, outputName);
					break;
				case CBinding.CompileTarget.StaticLibrary:
					MakeStaticLibrary (project, projectFiles, configuration, packages, cr, monitor, outputName);
					break;
				case CBinding.CompileTarget.SharedLibrary:
					MakeSharedLibrary (project, projectFiles, configuration, packages, cr, monitor, outputName);
					break;
				}
			}
			
			return new BuildResult (cr, "");
		}
开发者ID:thild,项目名称:monodevelop,代码行数:79,代码来源:GNUCompiler.cs



注:本文中的ProjectFileCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ProjectId类代码示例发布时间:2022-05-24
下一篇:
C# ProjectEnum类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap