Inheritance: ExternalProgramBase
示例#1
0
        /// <summary>
        /// Executes the task.
        /// </summary>
        protected override void ExecuteTask()
        {
            if (!this.DoxygenBinary.Exists) {
                this.Log (Level.Error, "Doxygen cannot be found.");
                return;
            }

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

                String configuration;
                if (docSet != null) {
                    configuration = Path.Combine (baseFolder, docSet.Name, f.name, "doxygen.cfg");
                } else {
                    configuration = Path.Combine (baseFolder, f.name, "doxygen.cfg");
                }

                if (File.Exists (configuration)) {
                    continue;
                }

                this.Log (Level.Info, "Generating Doxygen files for '{0}'...", f.name);

                ExportConfiguration (configuration);

                ExecTask execTask = new ExecTask ();
                execTask.Project = this.Project;
                execTask.FailOnError = true;
                execTask.FileName = this.DoxygenBinary.ToString ();
                execTask.CommandLineArguments = Path.GetFileName (configuration);
                execTask.WorkingDirectory = new DirectoryInfo (Path.GetDirectoryName (configuration));

                execTask.Execute ();

                GenerateDescriptor (baseFolder, f);
            }
        }
示例#2
0
 /// <summary>
 /// Factory method to return a new instance of ExecTask
 /// </summary>
 /// <param name="stream"></param>
 /// <returns></returns>
 private ExecTask GetTask(Stream stream) {
     ExecTask execTask = new ExecTask();
     execTask.Parent = Project;
     execTask.Project = Project;
     execTask.FileName = "pkg-config";
     execTask.Threshold = Level.None;
     execTask.ErrorWriter = execTask.OutputWriter = new StreamWriter(stream);
     return execTask;
 }
示例#3
0
        private void RunNMake(string nmakeCommand)
        {
            // store current directory
            string originalCurrentDirectory = Directory.GetCurrentDirectory();

            try {
                // change current directory to directory containing
                // project file
                Directory.SetCurrentDirectory(ProjectDirectory.FullName);

                // execute command
                ExecTask nmakeTask = new ExecTask();
                nmakeTask.Project = SolutionTask.Project;
                nmakeTask.Parent = SolutionTask;
                nmakeTask.Verbose = SolutionTask.Verbose;
                nmakeTask.CommandLineArguments =
                    "/c \"" + nmakeCommand + "\"";
                nmakeTask.FileName = "cmd.exe";
                ExecuteInProjectDirectory(nmakeTask);
            } finally {
                // restore original current directory
                Directory.SetCurrentDirectory(originalCurrentDirectory);
            }
        }
示例#4
0
        private void CheckVCExecReditPackage()
        {
            if (!MsiFunctions.IsProductInstalled("F37207D363F3FBE43901D6914195B624"))
            {
                Log(Level.Info, "Installing VC++ 2008 runtime...");
                ExecTask execTask = new ExecTask();
                CopyTo(execTask);
                execTask.Parent = this;

                string workingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                string vcredistPath = Path.Combine(workingDirectory, "vcredist_x86.exe");
                execTask.FileName = vcredistPath;
                execTask.Execute();
            }
        }
        /// <summary>
        /// Creates a .cab file with all source files included.
        /// </summary>
        /// <param name="database">The MSI database.</param>
        private void CreateCabFile(InstallerDatabase database) {
            Log(Level.Info, "Compressing Files...");

            string shortCabDir = GetShortDir(Path.Combine(Project.BaseDirectory, msi.sourcedir));
            string cabFilePath = shortCabDir + @"\" + CabFileName;

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

            // holds output buffer
            MemoryStream ms = new MemoryStream();

            // create task for creating cab file
            ExecTask cabarcTask = new ExecTask();
            cabarcTask.Project = Project;
            cabarcTask.Parent = task;
            cabarcTask.Verbose = Verbose;
            // write output to (Memory)Stream
            cabarcTask.ErrorWriter = cabarcTask.OutputWriter = new StreamWriter(ms);
            // set tool to execute
            cabarcTask.FileName = "cabarc";
            // set command line arguments
            cabarcTask.CommandLineArguments = "-r N " + cabFilePath + " *";
            // use directory containing files to add as working directory
            cabarcTask.WorkingDirectory = new DirectoryInfo(TempFolderPath);

            try {
                // increment indentation level
                cabarcTask.Project.Indent();

                // execute task
                cabarcTask.Execute();
            } catch (Exception ex) {
                // read output of cabarc
                ms.Position = 0;
                StreamReader sr = new StreamReader(ms);
                string output = sr.ReadToEnd();
                sr.Close();

                // if anything was output, log it as warning
                if (output.Length != 0) {
                    cabarcTask.Log(Level.Warning, output);
                }
                
                string path = Environment.GetEnvironmentVariable ("PATH");
                if (path != null) {
                    Console.WriteLine ("PATH=" + path);
                    PathScanner scanner = new PathScanner ();
                    scanner.Add ("cabarc.exe");
                    StringCollection files = scanner.Scan ();
                    if (files.Count > 0) {
                        foreach (string file in files)
                            Console.WriteLine ("FILE=" + file);
                    } else {
                            Console.WriteLine ("NOT FOUND IN PATH!");
                    }
                }

                // signal error
                throw new BuildException("Error creating cab file.", Location, ex);
            } finally {
                // restore indentation level
                cabarcTask.Project.Unindent();

                // close MemoryStream
                ms.Close();
            }

            if (File.Exists(cabFilePath)) {
                Log(Level.Verbose, "Storing Cabinet in Installer Database...");

                using (InstallerTable cabTable = database.OpenTable("_Streams")) {
                    cabTable.InsertRecord(Path.GetFileName(cabFilePath), 
                        new InstallerStream(cabFilePath));
                }
            } else {
                throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                    "Cabinet file '{0}' does not exist.", cabFilePath), Location);
            }
        }