コード例 #1
0
ファイル: BuildFrame.cs プロジェクト: swax/CodePerspective
        public void SetStep(BuildStep step)
        {
            switch (step)
            {
                case BuildStep.Files:
                    CurrentPanel = new BuildStepFiles(this, Model);
                    break;

                case BuildStep.TrackingOptions:
                    CurrentPanel = new BuildStepTrackingOptions(this, Model);
                    break;

                case BuildStep.BuildOptions:
                    CurrentPanel = new BuildStepBuildOptions(this, Model);
                    break;

                case BuildStep.ViewerOptions:
                    CurrentPanel = new BuildStepViewerOptions(this, Model);
                    break;

                case BuildStep.Compile:
                    CurrentPanel = new BuildStepCompile(this, Model);
                    break;

                case BuildStep.Run:
                    CurrentPanel = new BuildStepRun(this, Model);
                    break;
            }

            CurrentPanel.Dock = DockStyle.Fill;

            Controls.Clear();
            Controls.Add(CurrentPanel);
        }
コード例 #2
0
ファイル: ExecutionPoint.cs プロジェクト: modulexcite/SHFB-1
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="buildStep">The step in which the plug-in should run.</param>
        /// <param name="behavior">The behavior of the plug-in when it is ran.</param>
        /// <exception cref="ArgumentException">This is thrown if an attempt is made to set the Before or After
        /// behavior with the InsteadOf behavior.  It is also thrown for invalid combinations of build step and
        /// behavior, i.e. Initializing with Before or InsteadOf.  See the help file for a full list.</exception>
        /// <overloads>There are two overloads for the constructor.</overloads>
        public ExecutionPoint(BuildStep buildStep, ExecutionBehaviors behavior)
        {
            bool isValid = true;

            this.BuildStep = buildStep;
            this.Behavior = behavior;
            this.Priority = DefaultPriority;

            // Don't allow Before or After if InsteadOf is specified
            if((behavior & ExecutionBehaviors.InsteadOf) != 0 &&
              (behavior & ExecutionBehaviors.BeforeAndAfter) != 0)
                throw new ArgumentException("Before and/or After cannot be specified with InsteadOf", "behavior");

            if(buildStep == BuildStep.None)
                throw new ArgumentException("None is not a valid build step for a plug-in", "buildStep");

            // This was getting messy so it's broken up to be more readable

            // Before and InsteadOf can't be used with Initializing, Canceled, or Failed.
            if((behavior & (ExecutionBehaviors.Before | ExecutionBehaviors.InsteadOf)) != 0 &&
              (buildStep == BuildStep.Initializing || buildStep > BuildStep.Completed))
                isValid = false;

            // InsteadOf cannot be used with or Completed, Canceled, or Failed.
            if(behavior == ExecutionBehaviors.InsteadOf && buildStep >= BuildStep.Completed)
                isValid = false;

            if(!isValid)
                throw new ArgumentException("The specified combination of build step and execution behavior " +
                    "is not valid.  See the help file for details.", "behavior");
        }
コード例 #3
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="buildStep">The current build step.</param>
        /// <param name="behavior">The behavior of the plug-in for the current context.</param>
        /// <exception cref="ArgumentException">This is thrown if an attempt is made to specify more than one
        /// behavior type.</exception>
        internal ExecutionContext(BuildStep buildStep, ExecutionBehaviors behavior)
        {
            this.BuildStep = buildStep;
            this.Behavior = behavior;
            this.Executed = true;

            // Don't allow more than one behavior type
            if(behavior != ExecutionBehaviors.Before && behavior != ExecutionBehaviors.After &&
              behavior != ExecutionBehaviors.InsteadOf)
                throw new ArgumentException("Combinations of behavior are not allowed for the execution " +
                    "context", "behavior");
        }
コード例 #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="plugInBuildStep">The current build step.</param>
        /// <param name="plugInBehavior">The behavior of the plug-in for the
        /// current context.</param>
        /// <exception cref="ArgumentException">This is thrown if an attempt
        /// is made to specify more than one behavior type.</exception>
        internal ExecutionContext(BuildStep plugInBuildStep,
          ExecutionBehaviors plugInBehavior)
        {
            buildStep = plugInBuildStep;
            behavior = plugInBehavior;
            executed = true;

            // Don't allow more than one behavior type
            if(behavior != ExecutionBehaviors.Before && behavior !=
             ExecutionBehaviors.After && behavior != ExecutionBehaviors.InsteadOf)
                throw new ArgumentException("Combinations of behavior are " +
                    "not allowed for the execution context", "plugInBehavior");
        }
コード例 #5
0
ファイル: BuildProcess.cs プロジェクト: julianhaslinger/SHFB
        /// <summary>
        /// This is used to report an error that will abort the build
        /// </summary>
        /// <param name="step">The current build step</param>
        /// <param name="errorCode">The error code</param>
        /// <param name="message">The message to report</param>
        /// <param name="args">A list of arguments to format into the message text</param>
        /// <remarks>This just reports the error.  The caller must abort the build</remarks>
        private void ReportError(BuildStep step, string errorCode, string message, params object[] args)
        {
            string errorMessage = String.Format(CultureInfo.CurrentCulture, message, args);

            this.ReportProgress(step, "\r\nSHFB: Error {0}: {1}\r\n", errorCode, errorMessage);
        }
コード例 #6
0
 /// <summary>
 /// This is called by the build process thread to update the application with the current build step
 /// </summary>
 /// <param name="sender">The sender of the event</param>
 /// <param name="e">The event arguments</param>
 private void buildProcess_BuildStepChanged(object sender, BuildProgressEventArgs e)
 {
     builder.ReportProgress(e.BuildStep.ToString());
     lastBuildStep = e.BuildStep;
 }
コード例 #7
0
ファイル: Utility.cs プロジェクト: modulexcite/SHFB-1
        /// <summary>
        /// This is used to obtain the execution priority for a plug-in in the given build step and behavior
        /// </summary>
        /// <param name="executionPoints">An enumerable list of execution points to search</param>
        /// <param name="step">The build step</param>
        /// <param name="behavior">The behavior</param>
        /// <returns>The execution priority is used to determine the order in which the plug-ins will be
        /// executed.  Those with a higher priority value will be executed before those with a lower value.
        /// Those with an identical priority may be executed in any order within their group.</returns>
        public static int PriorityFor(this IEnumerable<ExecutionPoint> executionPoints, BuildStep step,
          ExecutionBehaviors behavior)
        {
            var point = executionPoints.FirstOrDefault(p => p.BuildStep == step && (p.Behavior & behavior) != 0);

            if(point != null)
                return point.Priority;

            return ExecutionPoint.DefaultPriority;
        }
コード例 #8
0
ファイル: ExecutionPoint.cs プロジェクト: modulexcite/SHFB-1
 /// <summary>
 /// This constructor is used to set a specific execution priority.
 /// </summary>
 /// <param name="buildStep">The step in which the plug-in should run.</param>
 /// <param name="behavior">The behavior of the plug-in when it is ran.</param>
 /// <param name="priority">The execution priority for the plug-in.</param>
 public ExecutionPoint(BuildStep buildStep, ExecutionBehaviors behavior, int priority) :
   this(buildStep, behavior)
 {
     this.Priority = priority;
 }
コード例 #9
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="buildStep">The current build step</param>
        /// <param name="stepChanged">True if the build step has changed, false if not</param>
        /// <param name="message">The message to report</param>
        public BuildProgressEventArgs(BuildStep buildStep, bool stepChanged, string message)
        {
            this.BuildStep = buildStep;
            this.StepChanged = stepChanged;
            this.Message = (message ?? String.Empty);
        }
コード例 #10
0
 /// <summary>
 /// This constructor is used to set a specific execution priority.
 /// </summary>
 /// <param name="plugInBuildStep">The step in which the plug-in
 /// should run.</param>
 /// <param name="plugInBehavior">The behavior of the plug-in when it
 /// is ran.</param>
 /// <param name="plugInPriority">The execution priority for the
 /// plug-in.</param>
 public ExecutionPoint(BuildStep plugInBuildStep,
   ExecutionBehaviors plugInBehavior, int plugInPriority)
     : this(plugInBuildStep, plugInBehavior)
 {
     priority = plugInPriority;
 }
コード例 #11
0
ファイル: Compiler.cs プロジェクト: Myvar/OsDevKit
        private static string DoReplacements(string val, BuildStep stp, string fl)
        {
            //val = val.Replace("","");
            if (!string.IsNullOrEmpty(fl))
            {
                var f1 = new FileInfo(fl);

                val = val.Replace("{name}",(f1.Name.Split('.')[0]));
                val = val.Replace("{buildedname}", f1.Name.Split('.')[0] + DateTime.Now.ToFileTime() + ".o");
                val = val.Replace("{filepath}", Path.GetFullPath(Path.Combine(Global.CurrentProjectFilePath, "files", fl)));
                val = val.Replace("{build}", Path.GetFullPath(BuildFolder));

                var incl = Path.GetFullPath(Path.Combine(Global.CurrentProjectFilePath, "files", "include"));
                val = val.Replace("{include}", incl);

            }
            var locimg = Path.Combine(Global.CurrentProjectFilePath, "Bin", "Boot.img");
            val = val.Replace("{img}", Path.GetFullPath(locimg));
            val = val.Replace("{opt}", stp.OPT);
            val = val.Replace("{projectpath}", Global.CurrentProjectFilePath + "\\");
            val = val.Replace("{build}", BuildFolder + "\\");
            val = val.Replace("{dls}", "./Factory\\linker.ld");
            val = val.Replace("{buildfilels}", Global.CurrentBuildFile.LinkerScriptPath);
            val = val.Replace("{nasm}", "./Factory\\nasm.exe");
            val = val.Replace("{git}", "./Factory\\GrubImgTool.exe");
            val = val.Replace("{gcc}", "./Tools\\bin\\gcc.exe");
            val = val.Replace("{g++}", "./Tools\\bin\\g++.exe");
            val = val.Replace("{ld}", "./Tools\\bin\\ld.exe");
            val = val.Replace("{fcb}", "./freebasic\\fbc.exe");
            val = val.Replace("{qemu}", "./Factory\\qemu\\qemu.exe");

            return val;
        }
コード例 #12
0
 public ItemProgressEventArgs(BuildStep buildStep, ContentItem item)
 {
     this.BuildStep = buildStep;
     this.Item      = item;
 }
コード例 #13
0
ファイル: Utility.cs プロジェクト: sharwell/SHFB-unofficial
        //=====================================================================

        /// <summary>
        /// This is used to determine if the enumerable list of execution points contains an entry for the
        /// specified build step and behavior.
        /// </summary>
        /// <param name="executionPoints">An enumerable list of execution points to check</param>
        /// <param name="step">The build step</param>
        /// <param name="behavior">The behavior</param>
        /// <returns>True if the enumerable list of execution points contains an entry for the specified build
        /// step and behavior or false if it does not.</returns>
        public static bool RunsAt(this IEnumerable <ExecutionPoint> executionPoints, BuildStep step,
                                  ExecutionBehaviors behavior)
        {
            return(executionPoints.Any(p => p.BuildStep == step && (p.Behavior & behavior) != 0));
        }
コード例 #14
0
 public void GetIsShown_WithPipelineType_IsValid()
 {
     Assert.That(BuildStep.GetIsShown <BuildPipeline>(), Is.False);
 }
コード例 #15
0
 public void GetIsShown_WithInvalidType_Throws()
 {
     Assert.Throws <ArgumentNullException>(() => BuildStep.GetIsShown(null));
     Assert.Throws <InvalidOperationException>(() => BuildStep.GetIsShown(typeof(object)));
     Assert.Throws <InvalidOperationException>(() => BuildStep.GetIsShown(typeof(TestInvalidBuildStep)));
 }
コード例 #16
0
 public void GetIsShown_IsValid()
 {
     Assert.That(BuildStep.GetIsShown <TestBuildStep>(), Is.False);
     Assert.That(BuildStep.GetIsShown <TestBuildStepWithRequirements>(), Is.False);
 }
コード例 #17
0
 public void GetCategory_WithPipelineType_IsValid()
 {
     Assert.That(BuildStep.GetCategory <BuildPipeline>(), Is.EqualTo(string.Empty));
 }
コード例 #18
0
 public void GetCategory_IsValid()
 {
     Assert.That(BuildStep.GetCategory <TestBuildStep>(), Is.EqualTo("this is a category"));
     Assert.That(BuildStep.GetCategory <TestBuildStepWithRequirements>(), Is.EqualTo(string.Empty));
 }
コード例 #19
0
 /// <summary>
 /// This can be used by plug-ins using the
 /// <see cref="ExecutionBehaviors.InsteadOf" /> execution behavior to
 /// execute plug-ins that want to run before the plug-in executes its
 /// main processing.
 /// </summary>
 /// <remarks>This will only run once per step.  Any subsequent calls by
 /// other plug-ins will be ignored.</remarks>
 public void ExecuteBeforeStepPlugIns()
 {
     // Only execute once per step
     if(lastBeforeStep != progressArgs.BuildStep)
     {
         this.ExecutePlugIns(ExecutionBehaviors.Before);
         lastBeforeStep = progressArgs.BuildStep;
     }
 }
コード例 #20
0
ファイル: Utility.cs プロジェクト: sharwell/SHFB-unofficial
        /// <summary>
        /// This is used to obtain the execution priority for a plug-in in the given build step and behavior
        /// </summary>
        /// <param name="executionPoints">An enumerable list of execution points to search</param>
        /// <param name="step">The build step</param>
        /// <param name="behavior">The behavior</param>
        /// <returns>The execution priority is used to determine the order in which the plug-ins will be
        /// executed.  Those with a higher priority value will be executed before those with a lower value.
        /// Those with an identical priority may be executed in any order within their group.</returns>
        public static int PriorityFor(this IEnumerable <ExecutionPoint> executionPoints, BuildStep step,
                                      ExecutionBehaviors behavior)
        {
            var point = executionPoints.FirstOrDefault(p => p.BuildStep == step && (p.Behavior & behavior) != 0);

            if (point != null)
            {
                return(point.Priority);
            }

            return(ExecutionPoint.DefaultPriority);
        }
コード例 #21
0
 public void GetDescription_WithPipelineType_IsValid()
 {
     Assert.That(BuildStep.GetDescription <BuildPipeline>(), Is.EqualTo($"Running {BuildStep.GetName<BuildPipeline>()}"));
 }
コード例 #22
0
 public void GetName_WithPipelineType_IsValid()
 {
     Assert.That(BuildStep.GetName <BuildPipeline>(), Is.EqualTo(nameof(BuildPipeline)));
 }
コード例 #23
0
ファイル: Compiler.cs プロジェクト: Myvar/OsDevKit
        public static void StartProcces(string name, string args, string path, BuildStep st,string fl, bool waitfor = true )
        {
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            // p.StartInfo.WorkingDirectory = new DirectoryInfo( path).FullName ;

             p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;
            p.StartInfo.CreateNoWindow = true;
            p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

            p.StartInfo.FileName = name;
            p.StartInfo.Arguments = args;
               // p.StartInfo.WorkingDirectory = ".";

            p.Start();
            if (waitfor)
            {
                p.WaitForExit();
            }
            else
            {
                return;
            }

            var x =  p.StandardOutput.ReadToEnd() + "\n" + p.StandardError.ReadToEnd();
            var ret = x;

            Global.OutPut += "----------------------------------------\n" + DoReplacements( st.OutPutRegex,st, fl) + "\n" + ret + "\n\n";
            File.WriteAllText("Log.txt", Global.OutPut);
            Application.DoEvents();
        }
コード例 #24
0
ファイル: SkyboxAssetCompiler.cs プロジェクト: Aggror/Stride
        protected override void Prepare(AssetCompilerContext context, AssetItem assetItem, string targetUrlInStorage, AssetCompilerResult result)
        {
            var asset = (SkyboxAsset)assetItem.Asset;

            var colorSpace = context.GetColorSpace();

            result.BuildSteps = new AssetBuildStep(assetItem);

            var prereqs = new Queue <BuildStep>();

            // build the textures for windows (needed for skybox compilation)
            foreach (var dependency in asset.GetDependencies())
            {
                var dependencyItem = assetItem.Package.Assets.Find(dependency.Id);
                if (dependencyItem?.Asset is TextureAsset)
                {
                    var textureAsset = (TextureAsset)dependencyItem.Asset;

                    // Get absolute path of asset source on disk
                    var assetSource = GetAbsolutePath(dependencyItem, textureAsset.Source);

                    // Create a synthetic url
                    var textureUrl = SkyboxGenerator.BuildTextureForSkyboxGenerationLocation(dependencyItem.Location);

                    var gameSettingsAsset = context.GetGameSettingsAsset();
                    var renderingSettings = gameSettingsAsset.GetOrCreate <RenderingSettings>(context.Platform);

                    // Select the best graphics profile
                    var graphicsProfile = renderingSettings.DefaultGraphicsProfile >= GraphicsProfile.Level_10_0 ? renderingSettings.DefaultGraphicsProfile : GraphicsProfile.Level_10_0;

                    var textureAssetItem = new AssetItem(textureUrl, textureAsset);

                    // Create and add the texture command.
                    var textureParameters = new TextureConvertParameters(assetSource, textureAsset, PlatformType.Windows, GraphicsPlatform.Direct3D11, graphicsProfile, gameSettingsAsset.GetOrCreate <TextureSettings>().TextureQuality, colorSpace);
                    var prereqStep        = new AssetBuildStep(textureAssetItem);
                    prereqStep.Add(new TextureAssetCompiler.TextureConvertCommand(textureUrl, textureParameters, assetItem.Package));
                    result.BuildSteps.Add(prereqStep);
                    prereqs.Enqueue(prereqStep);
                }
            }

            // add the skybox command itself.
            IEnumerable <ObjectUrl> InputFilesGetter()
            {
                var skyboxAsset = (SkyboxAsset)assetItem.Asset;

                foreach (var dependency in skyboxAsset.GetDependencies())
                {
                    var dependencyItem = assetItem.Package.Assets.Find(dependency.Id);
                    if (dependencyItem?.Asset is TextureAsset)
                    {
                        yield return(new ObjectUrl(UrlType.Content, dependency.Location));
                    }
                }
            }

            var assetStep = new CommandBuildStep(new SkyboxCompileCommand(targetUrlInStorage, asset, assetItem.Package)
            {
                InputFilesGetter = InputFilesGetter
            });

            result.BuildSteps.Add(assetStep);
            while (prereqs.Count > 0)
            {
                var prereq = prereqs.Dequeue();
                BuildStep.LinkBuildSteps(prereq, assetStep);
            }
        }
コード例 #25
0
        /// <summary>
        /// This is called to build a project
        /// </summary>
        /// <param name="project">The project to build</param>
        /// <param name="workingPath">The working path for the project</param>
        /// <returns>Returns true if successful, false if not</returns>
        private bool BuildProject(SandcastleProject project, string workingPath)
        {
            BuildProcess buildProcess;

            lastBuildStep = BuildStep.None;

            builder.ReportProgress("\r\nBuilding {0}", project.Filename);

            try
            {
                // For the plug-in, we'll override some project settings
                project.SandcastlePath = new FolderPath(builder.SandcastleFolder, true, project);
                project.HtmlHelp1xCompilerPath = new FolderPath(builder.Help1CompilerFolder, true, project);
                project.HtmlHelp2xCompilerPath = new FolderPath(builder.Help2CompilerFolder, true, project);
                project.WorkingPath = new FolderPath(workingPath, true, project);
                project.OutputPath = new FolderPath(workingPath + @"..\PartialBuildLog\", true, project);

                buildProcess = new BuildProcess(project, true);

                buildProcess.BuildStepChanged += buildProcess_BuildStepChanged;

                // Since this is a plug-in, we'll run it directly rather
                // than in a background thread.
                buildProcess.Build();

                // Add the list of the comments files in the other project to
                // this build.
                foreach(XmlCommentsFile comments in buildProcess.CommentsFiles)
                    builder.CommentsFiles.Insert(0, comments);
            }
            catch(Exception ex)
            {
                throw new BuilderException("VBP0005", String.Format(CultureInfo.InvariantCulture,
                    "Fatal error, unable to compile project '{0}': {1}", project.Filename, ex.ToString()));
            }

            return (lastBuildStep == BuildStep.Completed);
        }
コード例 #26
0
 /// <summary>
 /// This is called by the build process thread to update the application with the current build step.
 /// </summary>
 /// <param name="sender">The sender of the event</param>
 /// <param name="e">The event arguments</param>
 private void buildProcess_BuildStepChanged(object sender, BuildProgressEventArgs e)
 {
     builder.ReportProgress(e.BuildStep.ToString());
     lastBuildStep = e.BuildStep;
 }
コード例 #27
0
 public void GetName_IsValid()
 {
     Assert.That(BuildStep.GetName <TestBuildStep>(), Is.EqualTo("this is a name"));
     Assert.That(BuildStep.GetName <TestBuildStepWithRequirements>(), Is.EqualTo(nameof(TestBuildStepWithRequirements)));
 }
コード例 #28
0
ファイル: FastBuild.cs プロジェクト: ClxS/FASTBuild-UE4
        private static string GenerateFBuildFileString(BuildStep step, List<BuildComponent> actions)
        {
            var sb = new StringBuilder();
            sb.Append(FASTBuildCommon.EntryArguments);
            if (step == BuildStep.CompileObjects || step == BuildStep.CompileAndLink)
            {
                sb.Append(GenerateFBuildCompilers());
            }

            if (step == BuildStep.CompileAndLink)
            {
                sb.Append(GenerateFBuildNodeList("DLLListAlias", actions));
                sb.Append(GenerateFBuildTargets(false, actions.Any()));
            }
            else
            {
                if (actions.Count > 0)
                {
                    sb.Append(GenerateFBuildNodeList(step == BuildStep.CompileObjects ? "ObjectsListsAlias" : "DLLListAlias", actions));
                }
                sb.Append(GenerateFBuildTargets(step == BuildStep.CompileObjects && actions.Any(),
                                                        step == BuildStep.Link && actions.Any()));
            }
            return sb.ToString();
        }
コード例 #29
0
        /// <summary>
        /// This is called to build a project
        /// </summary>
        /// <param name="project">The project to build</param>
        /// <param name="workingPath">The working path for the project</param>
        /// <returns>Returns true if successful, false if not</returns>
        private bool BuildProject(SandcastleProject project, string workingPath)
        {
            BuildProcess buildProcess;

            lastBuildStep = BuildStep.None;

            builder.ReportProgress("\r\nBuilding {0}", project.Filename);

            try
            {
                // For the plug-in, we'll override some project settings
                project.HtmlHelp1xCompilerPath = new FolderPath(builder.Help1CompilerFolder, true, project);
                project.HtmlHelp2xCompilerPath = new FolderPath(builder.Help2CompilerFolder, true, project);
                project.WorkingPath = new FolderPath(workingPath, true, project);
                project.OutputPath = new FolderPath(workingPath + @"..\PartialBuildLog\", true, project);

                // If the current project has defined OutDir, pass it on to the sub-project.
                string outDir = builder.CurrentProject.MSBuildProject.GetProperty("OutDir").EvaluatedValue;

                if(!String.IsNullOrEmpty(outDir) && outDir != @".\")
                    project.MSBuildOutDir = outDir;

                buildProcess = new BuildProcess(project, PartialBuildType.GenerateReflectionInfo);

                buildProcess.BuildStepChanged += buildProcess_BuildStepChanged;

                // Since this is a plug-in, we'll run it directly rather than in a background thread
                buildProcess.Build();

                // Add the list of the comments files in the other project to this build
                if(lastBuildStep == BuildStep.Completed)
                    foreach(XmlCommentsFile comments in buildProcess.CommentsFiles)
                        builder.CommentsFiles.Insert(0, comments);
            }
            catch(Exception ex)
            {
                throw new BuilderException("VBP0004", String.Format(CultureInfo.InvariantCulture,
                    "Fatal error, unable to compile project '{0}': {1}", project.Filename, ex.ToString()));
            }

            return (lastBuildStep == BuildStep.Completed);
        }
コード例 #30
0
ファイル: FastBuild.cs プロジェクト: ClxS/FASTBuild-UE4
        private static ExecutionResult RunFBuild(BuildStep step, string bffString)
        {
            ExecutionResult result;
            try
            {
                var watch = Stopwatch.StartNew();
                Log.TraceInformation(step == BuildStep.CompileObjects ? "Building Objects" : "Linking Objects");

                var distScriptFilename = Path.Combine(BuildConfiguration.BaseIntermediatePath, "fbuild.bff");
                var distScriptFileStream = new FileStream(distScriptFilename, FileMode.Create, FileAccess.ReadWrite, FileShare.Read);

                var scriptFile = new StreamWriter(distScriptFileStream)
                {
                    AutoFlush = true
                };
                scriptFile.WriteLine(ActionThread.ExpandEnvironmentVariables(bffString));
                scriptFile.Flush();
                scriptFile.Close();
                scriptFile.Dispose();
                scriptFile = null;

                result = DispatchFBuild();
                watch.Stop();
                var elapsedMs = watch.ElapsedMilliseconds;
                Log.TraceInformation((step == BuildStep.CompileObjects ? "Object Compilation" : "Object Linking") + " Finished. Execution Time: "+elapsedMs);                
            }
            catch (Exception)
            {
                result = ExecutionResult.TasksFailed;
            }

            return result;
        }
コード例 #31
0
ファイル: Utility.cs プロジェクト: modulexcite/SHFB-1
        //=====================================================================

        /// <summary>
        /// This is used to determine if the enumerable list of execution points contains an entry for the
        /// specified build step and behavior.
        /// </summary>
        /// <param name="executionPoints">An enumerable list of execution points to check</param>
        /// <param name="step">The build step</param>
        /// <param name="behavior">The behavior</param>
        /// <returns>True if the enumerable list of execution points contains an entry for the specified build
        /// step and behavior or false if it does not.</returns>
        public static bool RunsAt(this IEnumerable<ExecutionPoint> executionPoints, BuildStep step,
          ExecutionBehaviors behavior)
        {
            return executionPoints.Any(p => p.BuildStep == step && (p.Behavior & behavior) != 0);
        }
コード例 #32
0
        //private static PluginResolver pluginManager;
        private static void BuildStepsRecursively(BuildEngine.Builder builder, ICollection <BuildStep> steps, int stepsPerLevel, int maxLevel, BuildStep curParent = null, int curLevel = 0)
        {
            if (curLevel == maxLevel)
            {
                return;
            }

            for (var i = 0; i < stepsPerLevel; ++i)
            {
                BuildStep step = builder.Root.Add(new DoNothingCommand());
                if (curParent != null)
                {
                    BuildStep.LinkBuildSteps(curParent, step);
                }
                BuildStepsRecursively(builder, steps, stepsPerLevel, maxLevel, step, curLevel + 1);
                steps.Add(step);
            }
        }
コード例 #33
0
ファイル: BuildProcess.cs プロジェクト: modulexcite/SHFB-1
        /// <summary>
        /// This is used to report progress during the build process and possibly update the current step
        /// </summary>
        /// <param name="step">The current build step</param>
        /// <param name="message">The message to report</param>
        /// <param name="args">A list of arguments to format into the message text</param>
        /// <event cref="BuildStepChanged">This event fires when the current build step changes</event>
        /// <event cref="BuildProgress">This event fires to report progress information</event>
        protected void ReportProgress(BuildStep step, string message, params object[] args)
        {
            TimeSpan runtime;

            bool stepChanged = (progressArgs.BuildStep != step);

            if(stepChanged)
            {
                // Don't bother for the initialization steps
                if(step > BuildStep.GenerateSharedContent)
                {
                    runtime = DateTime.Now - stepStart;
                    progressArgs.Message = String.Format(CultureInfo.CurrentCulture, "    Last step " +
                        "completed in {0:00}:{1:00}:{2:00.0000}", Math.Floor(runtime.TotalSeconds / 3600),
                        Math.Floor((runtime.TotalSeconds % 3600) / 60), (runtime.TotalSeconds % 60));

                    if(swLog != null)
                        swLog.WriteLine(progressArgs.Message);

                    this.OnBuildProgress(progressArgs);
                }

                progressArgs.Message = "-------------------------------";
                this.OnBuildProgress(progressArgs);

                stepStart = DateTime.Now;
                progressArgs.BuildStep = step;

                if(swLog != null)
                    swLog.WriteLine("</buildStep>\r\n<buildStep step=\"{0}\">", step);
            }

            progressArgs.Message = String.Format(CultureInfo.CurrentCulture, message, args);

            // Save the message to the log file
            if(swLog != null)
                swLog.WriteLine(HttpUtility.HtmlEncode(progressArgs.Message));

            // Report progress first and then the step change so that any final information gets saved to the log
            // file.
            this.OnBuildProgress(progressArgs);

            if(stepChanged)
                OnBuildStepChanged(progressArgs);

            if(this.BuildCanceled && !progressArgs.HasCompleted)
                throw new BuilderException("BUILD CANCELLED");
        }
コード例 #34
0
ファイル: BuildHelp.cs プロジェクト: modulexcite/SHFB-1
        /// <summary>
        /// This is called by the build process thread to update the application with the current build step
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void buildProcess_BuildStepChanged(object sender, BuildProgressEventArgs e)
        {
            string outputPath;

            if(!this.Verbose)
                Log.LogMessage(MessageImportance.High, e.BuildStep.ToString());

            if(e.HasCompleted)
            {
                // If successful, report the location of the help file/website
                if(e.BuildStep == BuildStep.Completed)
                {
                    outputPath = buildProcess.OutputFolder + buildProcess.ResolvedHtmlHelpName;

                    switch(sandcastleProject.HelpFileFormat)
                    {
                        case HelpFileFormats.HtmlHelp1:
                            outputPath += ".chm";
                            break;

                        case HelpFileFormats.MSHelp2:
                            outputPath += ".hxs";
                            break;

                        case HelpFileFormats.MSHelpViewer:
                            outputPath += ".mshc";
                            break;

                        case HelpFileFormats.OpenXml:
                            outputPath += ".docx";
                            break;

                        default:
                            break;
                    }

                    // Report single file or multi-format output location
                    if(File.Exists(outputPath))
                        Log.LogMessage(MessageImportance.High, "The help file is located at: {0}", outputPath);
                    else
                        Log.LogMessage(MessageImportance.High, "The help output is located at: {0}", buildProcess.OutputFolder);
                }

                if(File.Exists(buildProcess.LogFilename))
                    Log.LogMessage(MessageImportance.High, "Build details can be found in {0}", buildProcess.LogFilename);
            }

            lastBuildStep = e.BuildStep;
        }
コード例 #35
0
ファイル: BuildProcess.cs プロジェクト: julianhaslinger/SHFB
        /// <summary>
        /// This is used to report progress during the build process and possibly update the current step
        /// </summary>
        /// <param name="step">The current build step</param>
        /// <param name="message">The message to report</param>
        /// <param name="args">A list of arguments to format into the message text</param>
        protected void ReportProgress(BuildStep step, string message, params object[] args)
        {
            BuildProgressEventArgs pa;
            TimeSpan runtime;

            if(this.CancellationToken != CancellationToken.None && !buildCancelling)
                this.CancellationToken.ThrowIfCancellationRequested();

            bool stepChanged = (this.CurrentBuildStep != step);

            if(stepChanged)
            {
                // Don't bother reporting elapsed time for the initialization steps
                if(step > BuildStep.GenerateSharedContent)
                {
                    runtime = DateTime.Now - stepStart;

                    pa = new BuildProgressEventArgs(this.CurrentBuildStep, false,
                        String.Format(CultureInfo.CurrentCulture, "    Last step completed in " +
                        "{0:00}:{1:00}:{2:00.0000}", Math.Floor(runtime.TotalSeconds / 3600),
                        Math.Floor((runtime.TotalSeconds % 3600) / 60), (runtime.TotalSeconds % 60)));

                    if(swLog != null)
                        swLog.WriteLine(pa.Message);

                    if(this.ProgressReportProvider != null)
                        this.ProgressReportProvider.Report(pa);
                }

                if(this.ProgressReportProvider != null)
                    this.ProgressReportProvider.Report(new BuildProgressEventArgs(this.CurrentBuildStep, false,
                        "-------------------------------"));

                stepStart = DateTime.Now;
                this.CurrentBuildStep = step;

                if(swLog != null)
                    swLog.WriteLine("</buildStep>\r\n<buildStep step=\"{0}\">", step);
            }

            pa = new BuildProgressEventArgs(this.CurrentBuildStep, stepChanged,
                String.Format(CultureInfo.CurrentCulture, message, args));

            // Save the message to the log file
            if(swLog != null)
                swLog.WriteLine(HttpUtility.HtmlEncode(pa.Message));

            if(this.ProgressReportProvider != null)
                this.ProgressReportProvider.Report(pa);
        }
コード例 #36
0
 /// <summary>
 /// This can be used by plug-ins using the <see cref="ExecutionBehaviors.InsteadOf" /> execution behavior
 /// to execute plug-ins that want to run before the plug-in executes its main processing.
 /// </summary>
 /// <remarks>This will only run once per step.  Any subsequent calls by other plug-ins will be ignored.</remarks>
 public void ExecuteBeforeStepPlugIns()
 {
     if(lastBeforeStep != this.CurrentBuildStep)
     {
         this.ExecutePlugIns(ExecutionBehaviors.Before);
         lastBeforeStep = this.CurrentBuildStep;
     }
 }
コード例 #37
0
        /// <summary>
        /// This is called by the build process thread to update the main
        /// window with the current build step.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void buildProcess_BuildStepChanged(object sender,
          BuildProgressEventArgs e)
        {
            if(this.InvokeRequired)
            {
                // Ignore it if we've already shut down or it hasn't
                // completed yet.
                if(!this.IsDisposed)
                    this.Invoke(new EventHandler<BuildProgressEventArgs>(buildProcess_BuildStepChanged),
                        new object[] { sender, e });
            }
            else
            {
                lblLoading.Text = e.BuildStep.ToString();

                if(e.HasCompleted)
                {
                    // Restore the current project's base path
                    Directory.SetCurrentDirectory(Path.GetDirectoryName(currentProject.Filename));
                    lastBuildStep = e.BuildStep;
                }
            }
        }
コード例 #38
0
 public void GetDescription_IsValid()
 {
     Assert.That(BuildStep.GetDescription <TestBuildStep>(), Is.EqualTo("this is a description"));
     Assert.That(BuildStep.GetDescription <TestBuildStepWithRequirements>(), Is.EqualTo($"Running {BuildStep.GetName<TestBuildStepWithRequirements>()}"));
 }