/// <nodoc /> public bool TryCopyFile( FileArtifact source, AbsolutePath destination, CopyFile.Options options, string[] tags, string description, out FileArtifact fileArtifact) { Contract.Requires(source.IsValid); Contract.Requires(destination.IsValid); fileArtifact = FileArtifact.CreateSourceFile(destination).CreateNextWrittenVersion(); var pip = new CopyFile( source, fileArtifact, ToStringIds(tags), CreatePipProvenance(description), options); if (PipGraph != null) { return(PipGraph.AddCopyFile(pip, GetValuePipId())); } return(true); }
public FileArtifact CopyFile( FileArtifact source, AbsolutePath destination, string description = null, string[] tags = null, CopyFile.Options options = default) { if (!PipConstructionHelper.TryCopyFile( source, destination, global::BuildXL.Pips.Operations.CopyFile.Options.None, tags, description, out var result)) { throw new BuildXLTestException("Failed to add copyfile pip"); } return(result); }
private static EvaluationResult CopyFile(Context context, ModuleLiteral env, EvaluationStackFrame args) { var source = Args.AsFile(args, 0); var destination = Args.AsPath(args, 1); var tags = Args.AsStringArrayOptional(args, 2); var description = Args.AsStringOptional(args, 3); var writable = Args.AsBoolOptional(args, 4); CopyFile.Options options = default; if (writable) { options = BuildXL.Pips.Operations.CopyFile.Options.OutputsMustRemainWritable; } FileArtifact result; if (!context.GetPipConstructionHelper().TryCopyFile(source, destination, options, tags, description, out result)) { // Error has been logged return(EvaluationResult.Error); } return(new EvaluationResult(result)); }