Пример #1
0
        /// <nodoc />
        public bool TryWriteFile(
            AbsolutePath destination,
            PipData content,
            WriteFileEncoding encoding,
            string[] tags,
            string description,
            out FileArtifact fileArtifact)
        {
            Contract.Requires(destination.IsValid);
            Contract.Requires(content.IsValid);

            fileArtifact = FileArtifact.CreateSourceFile(destination).CreateNextWrittenVersion();
            var pip = new WriteFile(
                fileArtifact,
                content,
                encoding,
                ToStringIds(tags),
                CreatePipProvenance(description));

            if (PipGraph != null)
            {
                return(PipGraph.AddWriteFile(pip, GetValuePipId()));
            }

            return(true);
        }
Пример #2
0
        private PipStrings(WriteFile writeFilePip, CachedGraph cachedGraph)
        {
            var pathTable = cachedGraph.Context.PathTable;

            m_outputFiles.Add(writeFilePip.Destination.Path.ToString(pathTable));

            if (writeFilePip.Contents.IsValid)
            {
                m_writeFileContents = writeFilePip.Contents.ToString(pathTable);
            }

            m_writeFileEncoding = writeFilePip.Encoding;
        }
Пример #3
0
        /// <summary>
        /// Constructs a WriteFile
        /// </summary>
        public WriteFile(
            FileArtifact destination,
            PipData contents,
            WriteFileEncoding encoding,
            ReadOnlyArray <StringId> tags,
            PipProvenance provenance)
        {
            Contract.Requires(destination.IsValid);
            Contract.Requires(contents.IsValid);
            Contract.Requires(tags.IsValid);
            Contract.Requires(provenance != null);

            Provenance  = provenance;
            Tags        = tags;
            Destination = destination;
            Contents    = contents;
            Encoding    = encoding;
        }