/// <summary> /// Executes the task. /// </summary> protected override void ExecuteTask() { String baseFolder = this.CreateBaseDir (); DocSet docSet = this.CreateDocSet (); IEnumerable<Framework> frameworks = this.CreateFrameworks (docSet); foreach (var f in frameworks) { if (f.source != DocumentOrigin.Doxygen) { continue; } this.Log(Level.Info, "Copying header files for '{0}'...", f.name); FileSet fileSet = new FileSet(); fileSet.BaseDirectory = new DirectoryInfo(f.path); fileSet.Includes.Add("**/*.h"); CopyTask copyTask = new CopyTask(); copyTask.Project = this.Project; copyTask.FailOnError = true; if (docSet != null) { copyTask.ToDirectory = new DirectoryInfo(Path.Combine(baseFolder, docSet.Name, f.name, DocumentType.Source.ToString())); } else { copyTask.ToDirectory = new DirectoryInfo(Path.Combine(baseFolder, f.name, DocumentType.Source.ToString())); } copyTask.CopyFileSet = fileSet; copyTask.Filters = this.Filters; copyTask.Execute(); } }
/// <summary> /// Updates the <see cref="ProcessStartInfo" /> of the specified /// <see cref="Process"/>. /// </summary> /// <param name="process">The <see cref="Process" /> of which the <see cref="ProcessStartInfo" /> should be updated.</param> protected override void PrepareProcess(Process process) { if (!SupportsAssemblyReferences) { // create instance of Copy task CopyTask ct = new CopyTask(); // inherit project from current task ct.Project = Project; // inherit namespace manager from current task ct.NamespaceManager = NamespaceManager; // parent is current task ct.Parent = this; // inherit verbose setting from license task ct.Verbose = Verbose; // only output warning messages or higher, unless we're running // in verbose mode if (!ct.Verbose) { ct.Threshold = Level.Warning; } // make sure framework specific information is set ct.InitializeTaskConfiguration(); // set parent of child elements ct.CopyFileSet.Parent = ct; // inherit project from solution task for child elements ct.CopyFileSet.Project = ct.Project; // inherit namespace manager from solution task ct.CopyFileSet.NamespaceManager = ct.NamespaceManager; // set base directory of fileset ct.CopyFileSet.BaseDirectory = Assemblies.BaseDirectory; // copy all files to base directory itself ct.Flatten = true; // copy referenced assemblies foreach (string file in Assemblies.FileNames) { ct.CopyFileSet.Includes.Add(file); } // copy command line tool to working directory ct.CopyFileSet.Includes.Add(base.ProgramFileName); // set destination directory ct.ToDirectory = BaseDirectory; // increment indentation level ct.Project.Indent(); try { // execute task ct.Execute(); } finally { // restore indentation level ct.Project.Unindent(); } // change program to execute the tool in working directory as // that will allow this tool to resolve assembly references // using assemblies stored in the same directory _programFileName = Path.Combine(BaseDirectory.FullName, Path.GetFileName(base.ProgramFileName)); // determine target directory string targetDir = Path.GetDirectoryName(Path.Combine( BaseDirectory.FullName, Target)); // ensure target directory exists if (!String.IsNullOrEmpty(targetDir) && !Directory.Exists(targetDir)) { Directory.CreateDirectory(targetDir); } } else { foreach (string assembly in Assemblies.FileNames) { Arguments.Add(new Argument(string.Format(CultureInfo.InvariantCulture, "/i:\"{0}\"", assembly))); } } // further delegate preparation to base class base.PrepareProcess(process); }
/// <summary> /// Copies the specified file if the destination file does not exist, or /// the source file has been modified since it was previously copied. /// </summary> /// <param name="srcFile">The file to copy.</param> /// <param name="destFile">The destination file.</param> /// <param name="parent">The <see cref="Task" /> in which context the operation will be performed.</param> protected void CopyFile(FileInfo srcFile, FileInfo destFile, Task parent) { // create instance of Copy task CopyTask ct = new CopyTask(); // parent is solution task ct.Parent = parent; // inherit project from parent task ct.Project = parent.Project; // inherit namespace manager from parent task ct.NamespaceManager = parent.NamespaceManager; // inherit verbose setting from parent task ct.Verbose = parent.Verbose; // only output warning messages or higher, unless // we're running in verbose mode if (!ct.Verbose) { ct.Threshold = Level.Warning; } // make sure framework specific information is set ct.InitializeTaskConfiguration(); // set parent of child elements ct.CopyFileSet.Parent = ct; // inherit project for child elements from containing task ct.CopyFileSet.Project = ct.Project; // inherit namespace manager from containing task ct.CopyFileSet.NamespaceManager = ct.NamespaceManager; // set file to copy ct.SourceFile = srcFile; // set file ct.ToFile = destFile; // increment indentation level ct.Project.Indent(); try { // execute task ct.Execute(); } finally { // restore indentation level ct.Project.Unindent(); } }
/// <summary> /// Updates the <see cref="ProcessStartInfo" /> of the specified /// <see cref="Process"/>. /// </summary> /// <param name="process">The <see cref="Process" /> of which the <see cref="ProcessStartInfo" /> should be updated.</param> protected override void PrepareProcess(Process process) { // avoid copying the assembly references (and regasm) to a // temporary directory if not necessary if (References.FileNames.Count == 0) { // further delegate preparation to base class base.PrepareProcess(process); // no further processing required return; } // create instance of Copy task CopyTask ct = new CopyTask(); // inherit project from current task ct.Project = Project; // inherit namespace manager from current task ct.NamespaceManager = NamespaceManager; // parent is current task ct.Parent = this; // inherit verbose setting from resgen task ct.Verbose = Verbose; // only output warning messages or higher, unless we're running // in verbose mode if (!ct.Verbose) { ct.Threshold = Level.Warning; } // make sure framework specific information is set ct.InitializeTaskConfiguration(); // set parent of child elements ct.CopyFileSet.Parent = ct; // inherit project from solution task for child elements ct.CopyFileSet.Project = ct.Project; // inherit namespace manager from solution task ct.CopyFileSet.NamespaceManager = ct.NamespaceManager; // set base directory of fileset ct.CopyFileSet.BaseDirectory = Assemblies.BaseDirectory; // copy all files to base directory itself ct.Flatten = true; // copy referenced assemblies foreach (string file in References.FileNames) { ct.CopyFileSet.Includes.Add(file); } // copy assemblies to register foreach (string file in Assemblies.FileNames) { ct.CopyFileSet.Includes.Add(file); } if (AssemblyFile != null) { ct.CopyFileSet.Includes.Add(AssemblyFile.FullName); } // copy command line tool to working directory ct.CopyFileSet.Includes.Add(base.ProgramFileName); // set destination directory ct.ToDirectory = BaseDirectory; // increment indentation level ct.Project.Indent(); try { // execute task ct.Execute(); } finally { // restore indentation level ct.Project.Unindent(); } // change program to execute the tool in working directory as // that will allow this tool to resolve assembly references // using assemblies stored in the same directory _programFileName = Path.Combine(BaseDirectory.FullName, Path.GetFileName(base.ProgramFileName)); // further delegate preparation to base class base.PrepareProcess(process); }