/// <nodoc /> public bool TrySealDirectory( AbsolutePath directoryRoot, SortedReadOnlyArray <FileArtifact, OrdinalFileArtifactComparer> contents, SortedReadOnlyArray <DirectoryArtifact, OrdinalDirectoryArtifactComparer> outputDirectorycontents, SealDirectoryKind kind, string[] tags, string description, string[] patterns, out DirectoryArtifact sealedDirectory, bool scrub = false) { Contract.Requires(directoryRoot.IsValid); Contract.Requires(contents.IsValid); Contract.Requires(outputDirectorycontents.IsValid); PipData usage = PipDataBuilder.CreatePipData(Context.StringTable, string.Empty, PipDataFragmentEscaping.NoEscaping, description != null ? new PipDataAtom[] { description } : new PipDataAtom[] { "'", directoryRoot, "' [", contents.Length.ToString(CultureInfo.InvariantCulture), " files - ", outputDirectorycontents.Length.ToString(CultureInfo.InvariantCulture), " output directories]" }); var pip = new SealDirectory( directoryRoot, contents, outputDirectorycontents, kind, CreatePipProvenance(usage), ToStringIds(tags), ToStringIds(patterns), scrub); if (PipGraph != null) { sealedDirectory = PipGraph.AddSealDirectory(pip, GetValuePipId()); if (!sealedDirectory.IsValid) { return(false); } } else { sealedDirectory = DirectoryArtifact.CreateWithZeroPartialSealId(directoryRoot); } return(true); }
/// <nodoc/> public bool TryComposeSharedOpaqueDirectory( AbsolutePath directoryRoot, IReadOnlyList <DirectoryArtifact> contents, SealDirectoryContentFilter?contentFilter, [CanBeNull] string description, [CanBeNull] string[] tags, out DirectoryArtifact sharedOpaqueDirectory) { Contract.Requires(directoryRoot.IsValid); Contract.Requires(contents != null); if (PipGraph == null) { sharedOpaqueDirectory = DirectoryArtifact.CreateWithZeroPartialSealId(directoryRoot); return(true); } PipData usage = PipDataBuilder.CreatePipData(Context.StringTable, string.Empty, PipDataFragmentEscaping.NoEscaping, description != null ? new PipDataAtom[] { description } : new PipDataAtom[] { "'", directoryRoot, "' [", contents.Count.ToString(CultureInfo.InvariantCulture), " shared opaque directories, filter: ", contentFilter.HasValue ? $"'{contentFilter.Value.Regex}' (kind: {Enum.GetName(typeof(SealDirectoryContentFilter.ContentFilterKind), contentFilter.Value.Kind)})" : "''", "]" }); sharedOpaqueDirectory = PipGraph.ReserveSharedOpaqueDirectory(directoryRoot); var pip = new CompositeSharedOpaqueSealDirectory( directoryRoot, contents, CreatePipProvenance(usage), ToStringIds(tags), contentFilter); // The seal directory is ready to be initialized, since the directory artifact has been reserved already pip.SetDirectoryArtifact(sharedOpaqueDirectory); sharedOpaqueDirectory = PipGraph.AddSealDirectory(pip, GetValuePipId()); if (!sharedOpaqueDirectory.IsValid) { return(false); } return(true); }