Example #1
0
        /// <summary>
        /// Execute the task.
        /// </summary>
        /// <param name="Job">Information about the current job</param>
        /// <param name="BuildProducts">Set of build products produced by this node.</param>
        /// <param name="TagNameToFileSet">Mapping from tag names to the set of files they include</param>
        /// <returns>True if the task succeeded</returns>
        public override bool Execute(JobContext Job, HashSet <FileReference> BuildProducts, Dictionary <string, HashSet <FileReference> > TagNameToFileSet)
        {
            // Get the cloud directory
            DirectoryReference CloudDir = ResolveDirectory(Parameters.CloudDir);

            // Set the patch generation options
            BuildPatchToolBase.ManifestMergeOptions Options = new BuildPatchToolBase.ManifestMergeOptions();
            Options.ManifestA    = FileReference.Combine(CloudDir, String.Format("{0}{1}-{2}.manifest", Parameters.AppName, Parameters.BaseVersion, Parameters.Platform)).FullName;
            Options.ManifestB    = FileReference.Combine(CloudDir, String.Format("{0}{1}-{2}.manifest", Parameters.AppName, Parameters.PatchVersion, Parameters.Platform)).FullName;
            Options.ManifestC    = FileReference.Combine(CloudDir, String.Format("{0}{1}-{2}.manifest", Parameters.AppName, Parameters.FinalVersion, Parameters.Platform)).FullName;
            Options.BuildVersion = Parameters.FinalVersion;

            // Run the chunking
            BuildPatchToolBase.Get().Execute(Options);
            return(true);
        }
        /// <summary>
        /// Execute the task.
        /// </summary>
        /// <param name="Job">Information about the current job</param>
        /// <param name="BuildProducts">Set of build products produced by this node.</param>
        /// <param name="TagNameToFileSet">Mapping from tag names to the set of files they include</param>
        /// <returns>True if the task succeeded</returns>
        public override bool Execute(JobContext Job, HashSet <FileReference> BuildProducts, Dictionary <string, HashSet <FileReference> > TagNameToFileSet)
        {
            // Get the build directory
            DirectoryReference InputDir = ResolveDirectory(Parameters.InputDir);

            // If there's a set of files specified, generate a temporary ignore list.
            FileReference IgnoreList = null;

            if (Parameters.Files != null)
            {
                // Find the files which are to be included
                HashSet <FileReference> IncludeFiles = ResolveFilespec(InputDir, Parameters.Files, TagNameToFileSet);

                // Create a file to store the ignored file list
                IgnoreList = new FileReference(LogUtils.GetUniqueLogName(Path.Combine(CommandUtils.CmdEnv.LogFolder, Parameters.AppName + "-Ignore")));
                using (StreamWriter Writer = new StreamWriter(IgnoreList.FullName))
                {
                    DirectoryInfo InputDirInfo = new DirectoryInfo(InputDir.FullName);
                    foreach (FileInfo File in InputDirInfo.EnumerateFiles("*", SearchOption.AllDirectories))
                    {
                        string       RelativePath          = new FileReference(File).MakeRelativeTo(InputDir);
                        const string Iso8601DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffZ";
                        Writer.WriteLine("\"{0}\"\t{1}", RelativePath, File.LastWriteTimeUtc.ToString(Iso8601DateTimeFormat));
                    }
                }
            }

            // Create the staging info
            BuildPatchToolStagingInfo StagingInfo = new BuildPatchToolStagingInfo(Job.OwnerCommand, Parameters.AppName, 1, Parameters.BuildVersion, Parameters.Platform, Parameters.CloudDir);

            // Set the patch generation options
            BuildPatchToolBase.PatchGenerationOptions Options = new BuildPatchToolBase.PatchGenerationOptions();
            Options.StagingInfo      = StagingInfo;
            Options.BuildRoot        = ResolveDirectory(Parameters.InputDir).FullName;
            Options.FileIgnoreList   = (IgnoreList != null)? IgnoreList.FullName : null;
            Options.AppLaunchCmd     = Parameters.Launch ?? "";
            Options.AppLaunchCmdArgs = Parameters.LaunchArgs ?? "";
            Options.AppChunkType     = BuildPatchToolBase.ChunkType.Chunk;

            // Run the chunking
            BuildPatchToolBase.Get().Execute(Options);
            return(true);
        }