Esempio n. 1
0
        /// <summary>
        /// Executes <see cref="RegisterFilesForBuildManifestCommand"/>. Checks if Cache contains build manifest hashes for given <see cref="BuildManifestEntry"/>.
        /// Else checks if local files exist and computes their ContentHash.
        /// Returns an empty array on success. Any failing BuildManifestEntries are returned for logging.
        /// If build manifest hashes are not available, the files are materialized using <see cref="ExecuteMaterializeFileAsync"/>, the build manifest hashes are computed and stored into cache.
        /// </summary>
        private async Task <IIpcResult> ExecuteRecordBuildManifestHashesAsync(RegisterFilesForBuildManifestCommand cmd)
        {
            Contract.Requires(cmd != null);

            var tasks = cmd.BuildManifestEntries
                        .Select(buildManifestEntry => ExecuteRecordBuildManifestHashWithXlgAsync(cmd.DropName, buildManifestEntry))
                        .ToArray();

            var result = await TaskUtilities.SafeWhenAll(tasks);

            if (result.Any(value => !value.IsValid))
            {
                BuildManifestEntry[] failures = result.Where(value => !value.IsValid)
                                                .Select(value => new BuildManifestEntry(value.RelativePath, value.AzureArtifactsHash, "Invalid", FileArtifact.Invalid)) // FullFilePath is unused by the caller
                                                .ToArray();

                return(IpcResult.Success(cmd.RenderResult(failures)));
            }
            else
            {
                m_executionLog.RecordFileForBuildManifest(new Tracing.RecordFileForBuildManifestEventData(result.ToList()));

                return(IpcResult.Success(cmd.RenderResult(Array.Empty <BuildManifestEntry>())));
            }
        }
Esempio n. 2
0
 private void RecordFileForBuildManifestInXLG(string dropName, string relativePath, ContentHash azureArtifactsHash, ContentHash buildManifestHash)
 {
     Tracing.RecordFileForBuildManifestEventData data = new Tracing.RecordFileForBuildManifestEventData(dropName, relativePath, azureArtifactsHash, buildManifestHash);
     m_executionLog.RecordFileForBuildManifest(data);
 }