Beispiel #1
0
        /// <summary>
        /// Creates an IpcPip from a single string representing IPC operation payload.
        ///
        /// The standard output property of the created pip is set to <paramref name="workingDir"/>\stdout.txt
        /// </summary>
        internal static IpcPip CreateFromStringPayload(
            PipExecutionContext context,
            AbsolutePath workingDir,
            IpcClientInfo ipcInfo,
            string operationPayload,
            PipProvenance provenance,
            FileArtifact outputFile = default(FileArtifact),
            IEnumerable <PipId> servicePipDependencies            = null,
            IEnumerable <FileArtifact> fileDependencies           = null,
            IEnumerable <DirectoryArtifact> directoryDependencies = null,
            IEnumerable <StringId> tags = null,
            bool isServiceFinalization  = false,
            bool mustRunOnMaster        = false)
        {
            var stdoutPath = workingDir.Combine(context.PathTable, PathAtom.Create(context.StringTable, "stdout.txt"));
            var stdoutFile = outputFile.IsValid ? outputFile : FileArtifact.CreateOutputFile(stdoutPath);

            var pipDataBuilder = new PipDataBuilder(context.StringTable);

            pipDataBuilder.Add(operationPayload);

            return(new IpcPip(
                       ipcInfo,
                       arguments: pipDataBuilder.ToPipData(" ", PipDataFragmentEscaping.NoEscaping),
                       outputFile: stdoutFile,
                       servicePipDependencies: ToReadOnlyArray(servicePipDependencies),
                       fileDependencies: ToReadOnlyArray(fileDependencies),
                       directoryDependencies: ToReadOnlyArray(directoryDependencies),
                       skipMaterializationFor: ReadOnlyArray <FileOrDirectoryArtifact> .Empty,
                       tags: ToReadOnlyArray(tags),
                       isServiceFinalization: isServiceFinalization,
                       mustRunOnMaster: mustRunOnMaster,
                       provenance: provenance));
        }
Beispiel #2
0
            protected override BinaryStringSegment ReadBinaryStringSegment(ref byte[] buffer)
            {
                int count = ReadInt32Compact();

                return(PipDataBuilder.WriteEntries(GetEntries(), count, ref m_pipDatabuffer));

                IEnumerable <PipDataEntry> GetEntries()
                {
                    for (int i = 0; i < count; i++)
                    {
                        yield return(PipDataEntry.Deserialize(m_baseInliningReader));
                    }
                }
            }
Beispiel #3
0
            public override BinaryStringSegment ReadStringIdValue(InlinedStringKind kind, ref byte[] buffer)
            {
                if (kind == InlinedStringKind.PipData)
                {
                    int count = ReadInt32Compact();

                    return(PipDataBuilder.WriteEntries(GetEntries(), count, ref m_pipDatabuffer));

                    IEnumerable <PipDataEntry> GetEntries()
                    {
                        for (int i = 0; i < count; i++)
                        {
                            yield return(PipDataEntry.Deserialize(this));
                        }
                    }
                }
                else
                {
                    return(base.ReadStringIdValue(kind, ref buffer));
                }
            }
Beispiel #4
0
            protected override BinaryStringSegment ReadBinaryStringSegment(ref byte[] buffer)
            {
                var(count, entries) = PipDataEntryList.Deserialize(m_baseInliningReader);

                return(PipDataBuilder.WriteEntries(entries, count, ref m_pipDatabuffer));
            }