Ejemplo n.º 1
0
 /// <summary>
 /// Deserialize
 /// </summary>
 internal static SpecFilePip InternalDeserialize(PipReader reader)
 {
     return(new SpecFilePip(
                specFile: reader.ReadFileArtifact(),
                definitionLocation: reader.ReadLocationData(),
                owningModule: reader.ReadModuleId()));
 }
Ejemplo n.º 2
0
        /// <nodoc />
        internal static IpcClientInfo Deserialize(PipReader reader)
        {
            var moniker = reader.ReadStringId();
            var config  = ClientConfig.Deserialize(reader);

            return(new IpcClientInfo(moniker, config));
        }
Ejemplo n.º 3
0
        private static (Pip, PipId) DeserializePipAndPipId(PipReader reader)
        {
            Pip   pip = null;
            PipId pipId;

            try
            {
                pip = Pip.Deserialize(reader);

                // Pip id is not deserialized when pip is deserialized.
                // Pip id must be read separately. To be able to add a pip to the graph, the pip id of the pip
                // is assumed to be unset, and is set when the pip gets inserted into the pip table.
                // Thus, one should not assign the pip id of the deserialized pip with the deserialized pip id.
                // Do not use reader.ReadPipId() for reading the deserialized pip id. The method reader.ReadPipId()
                // remaps the pip id to a new pip id.
                pipId = PipId.Deserialize(reader);

                if (!pipId.IsValid)
                {
                    throw new BuildXLException("Deserialize pip id is invalid");
                }

                return(pip, pipId);
            }
            catch (Exception e)
            {
                string pipType = pip != null?pip.PipType.ToString() : "<NULL>";

                string semiStableHash = pip != null ? pip.FormattedSemiStableHash : "<NULL>";

                throw new BuildXLException($"Failed to deserialize pip (hash: {semiStableHash}, type: {pipType}) and pip id. Please send the fragment file to BuildXL team for further investigation.", e);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Deserialize
 /// </summary>
 internal static ValuePip InternalDeserialize(PipReader reader)
 {
     return(new ValuePip(
                symbol: reader.ReadFullSymbol(),
                qualifier: reader.ReadQualifierId(),
                locationData: reader.ReadLocationData()));
 }
Ejemplo n.º 5
0
 internal static WriteFile InternalDeserialize(PipReader reader)
 {
     return(new WriteFile(
                reader.ReadFileArtifact(),
                reader.ReadPipData(),
                (WriteFileEncoding)reader.ReadByte(),
                reader.ReadReadOnlyArray(reader1 => reader1.ReadStringId()),
                reader.ReadPipProvenance()));
 }
Ejemplo n.º 6
0
 /// <nodoc />
 internal static CopyFile InternalDeserialize(PipReader reader)
 {
     return(new CopyFile(
                reader.ReadFileArtifact(),
                reader.ReadFileArtifact(),
                reader.ReadReadOnlyArray(reader1 => reader1.ReadStringId()),
                reader.ReadPipProvenance(),
                (Options)reader.ReadByte()));
 }
Ejemplo n.º 7
0
        internal static ProcessSemaphoreInfo Deserialize(PipReader reader)
        {
            Contract.Requires(reader != null);

            StringId name  = reader.ReadStringId();
            int      value = reader.ReadInt32Compact();
            int      limit = reader.ReadInt32Compact();

            return(new ProcessSemaphoreInfo(name, value, limit));
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Deserialize
 /// </summary>
 internal static ModulePip InternalDeserialize(PipReader reader)
 {
     return(new ModulePip(
                module: reader.ReadModuleId(),
                identity: reader.ReadStringId(),
                version: reader.ReadStringId(),
                location: LocationData.Deserialize(reader),
                resolverKind: reader.ReadStringId(),
                resolverName: reader.ReadStringId()
                ));
 }
Ejemplo n.º 9
0
 internal static Process InternalDeserialize(PipReader reader)
 {
     return(new Process(
                executable: reader.ReadFileArtifact(),
                workingDirectory: reader.ReadAbsolutePath(),
                arguments: reader.ReadPipData(),
                responseFile: reader.ReadFileArtifact(),
                responseFileData: reader.ReadPipData(),
                environmentVariables: reader.ReadReadOnlyArray(reader1 => ((PipReader)reader1).ReadEnvironmentVariable()),
                standardInput: StandardInput.InternalDeserialize(reader),
                standardOutput: reader.ReadFileArtifact(),
                standardError: reader.ReadFileArtifact(),
                standardDirectory: reader.ReadAbsolutePath(),
                warningTimeout: reader.ReadNullableStruct(reader1 => reader1.ReadTimeSpan()),
                timeout: reader.ReadNullableStruct(reader1 => reader1.ReadTimeSpan()),
                dependencies: reader.ReadReadOnlyArray(reader1 => reader1.ReadFileArtifact()),
                outputs: reader.ReadReadOnlyArray(reader1 => reader1.ReadFileArtifactWithAttributes()),
                directoryDependencies: reader.ReadReadOnlyArray(reader1 => reader1.ReadDirectoryArtifact()),
                directoryOutputs: reader.ReadReadOnlyArray(reader1 => reader1.ReadDirectoryArtifact()),
                orderDependencies: reader.ReadReadOnlyArray(reader1 => ((PipReader)reader1).ReadPipId()),
                untrackedPaths: reader.ReadReadOnlyArray(reader1 => reader1.ReadAbsolutePath()),
                untrackedScopes: reader.ReadReadOnlyArray(reader1 => reader1.ReadAbsolutePath()),
                tags: reader.ReadReadOnlyArray(reader1 => reader1.ReadStringId()),
                successExitCodes: reader.ReadReadOnlyArray(reader1 => reader1.ReadInt32()),
                semaphores: reader.ReadReadOnlyArray(reader1 => ((PipReader)reader1).ReadProcessSemaphoreInfo()),
                provenance: reader.ReadPipProvenance(),
                toolDescription: reader.ReadStringId(),
                additionalTempDirectories: reader.ReadReadOnlyArray(reader1 => reader1.ReadAbsolutePath()),
                warningRegex: reader.ReadRegexDescriptor(),
                errorRegex: reader.ReadRegexDescriptor(),
                enableMultiLineErrorScanning: reader.ReadBoolean(),
                uniqueOutputDirectory: reader.ReadAbsolutePath(),
                uniqueRedirectedDirectoryRoot: reader.ReadAbsolutePath(),
                tempDirectory: reader.ReadAbsolutePath(),
                options: (Options)reader.ReadInt32(),
                serviceInfo: reader.ReadNullable(reader1 => ServiceInfo.InternalDeserialize(reader1)),
                retryExitCodes: reader.ReadReadOnlyArray(r => r.ReadInt32()),
                allowedSurvivingChildProcessNames: reader.ReadReadOnlyArray(reader1 => reader1.ReadPathAtom()),
                nestedProcessTerminationTimeout: reader.ReadNullableStruct(reader1 => reader1.ReadTimeSpan()),
                absentPathProbeMode: (AbsentPathProbeInUndeclaredOpaquesMode)reader.ReadByte(),
                doubleWritePolicy: (DoubleWritePolicy)reader.ReadByte(),
                containerIsolationLevel: (ContainerIsolationLevel)reader.ReadByte(),
                weight: reader.ReadInt32Compact(),
                priority: reader.ReadInt32Compact(),
                preserveOutputWhitelist: reader.ReadReadOnlyArray(r => r.ReadAbsolutePath()),
                changeAffectedInputListWrittenFile: reader.ReadFileArtifact(),
                preserveOutputsTrustLevel: reader.ReadInt32(),
                childProcessesToBreakawayFromSandbox: reader.ReadReadOnlyArray(reader1 => reader1.ReadPathAtom())
                ));
 }
Ejemplo n.º 10
0
        internal static SealDirectory InternalDeserialize(PipReader reader)
        {
            var sealDirectoryType = (SealDirectoryType)reader.ReadByte();

            switch (sealDirectoryType)
            {
            case SealDirectoryType.SealDirectory:
                return(InternalDeserializeSealDirectory(reader));

            case SealDirectoryType.CompositeSharedOpaqueDirectory:
                return(CompositeSharedOpaqueSealDirectory.InternalDeserializeCompositeSharedOpaqueSealDirectory(reader));

            default:
                throw new InvalidOperationException(I($"Unexpected seal directory type '{sealDirectoryType}'"));
            }
        }
Ejemplo n.º 11
0
        internal static IpcPip InternalDeserialize(PipReader reader)
        {
            bool hasProvenance = reader.ReadBoolean();

            return(new IpcPip(
                       ipcInfo: IpcClientInfo.Deserialize(reader),
                       arguments: reader.ReadPipData(),
                       outputFile: reader.ReadFileArtifact(),
                       servicePipDependencies: reader.ReadReadOnlyArray(reader1 => ((PipReader)reader1).ReadPipId()),
                       fileDependencies: reader.ReadReadOnlyArray(reader1 => reader1.ReadFileArtifact()),
                       directoryDependencies: reader.ReadReadOnlyArray(reader1 => reader1.ReadDirectoryArtifact()),
                       skipMaterializationFor: reader.ReadReadOnlyArray(reader1 => reader1.ReadFileOrDirectoryArtifact()),
                       tags: reader.ReadReadOnlyArray(reader1 => reader1.ReadStringId()),
                       isServiceFinalization: reader.ReadBoolean(),
                       mustRunOnMaster: reader.ReadBoolean(),
                       provenance: hasProvenance ? reader.ReadPipProvenance() : null));
        }
Ejemplo n.º 12
0
        /// <nodoc />
        internal static EnvironmentVariable Deserialize(PipReader reader)
        {
            Contract.Requires(reader != null);
            StringId name = reader.ReadStringId();

            if (name.IsValid)
            {
                PipData value         = reader.ReadPipData();
                bool    isPassThrough = reader.ReadBoolean();
                Contract.Assume(value.IsValid ^ isPassThrough);
                return(new EnvironmentVariable(name, value, isPassThrough));
            }
            else
            {
                return(default(EnvironmentVariable));
            }
        }
Ejemplo n.º 13
0
        internal static SealDirectory InternalDeserializeSealDirectory(PipReader reader)
        {
            DirectoryArtifact artifact = reader.ReadDirectoryArtifact();
            var directory = new SealDirectory(
                artifact.Path,
                reader.ReadSortedReadOnlyArray(reader1 => reader1.ReadFileArtifact(), OrdinalFileArtifactComparer.Instance),
                (SealDirectoryKind)reader.ReadByte(),
                reader.ReadPipProvenance(),
                reader.ReadReadOnlyArray(reader1 => reader1.ReadStringId()),
                reader.ReadReadOnlyArray(reader1 => reader1.ReadStringId()),
                reader.ReadBoolean());

            directory.SetDirectoryArtifact(artifact);
            Contract.Assume(directory.IsInitialized && directory.Directory == artifact);

            return(directory);
        }
Ejemplo n.º 14
0
        internal static PipProvenance Deserialize(PipReader reader)
        {
            Contract.Requires(reader != null);

            long         semiStableHash  = reader.ReadInt64();
            ModuleId     moduleId        = reader.ReadModuleId();
            StringId     moduleName      = reader.ReadStringId();
            FullSymbol   outputValueName = reader.ReadFullSymbol();
            LocationData token           = reader.ReadLocationData();
            QualifierId  qualifierId     = new QualifierId(reader.ReadInt32Compact());
            PipData      usage           = reader.ReadPipData();

            return(new PipProvenance(
                       semiStableHash,
                       moduleId,
                       moduleName,
                       outputValueName,
                       token,
                       qualifierId,
                       usage));
        }
Ejemplo n.º 15
0
        internal static PipData Deserialize(PipReader reader)
        {
            Contract.Requires(reader != null);
            var              entriesBinarySegmentPointer = reader.ReadPipDataEntriesPointer();
            PipDataEntry     headerEntry;
            PipDataEntryList entries;

            if (entriesBinarySegmentPointer.IsValid)
            {
                headerEntry = PipDataEntry.Deserialize(reader);

                // Use the string table to get the raw bytes to back the entries
                entries = new PipDataEntryList(reader.StringTable.GetBytes(entriesBinarySegmentPointer));
            }
            else
            {
                var count = reader.ReadInt32Compact();
                if (count == 0)
                {
                    return(Invalid);
                }

                headerEntry = PipDataEntry.Deserialize(reader);
                var entriesArray = new PipDataEntry[count];
                for (int i = 0; i < count; i++)
                {
                    entriesArray[i] = PipDataEntry.Deserialize(reader);
                }

                entries = PipDataEntryList.FromEntries(entriesArray);
            }

            Contract.Assume(headerEntry.EntryType == PipDataEntryType.NestedDataHeader);
            Contract.Assume(headerEntry.Escaping != PipDataFragmentEscaping.Invalid);
            return(new PipData(headerEntry, entries, entriesBinarySegmentPointer));
        }
        internal static CompositeSharedOpaqueSealDirectory InternalDeserializeCompositeSharedOpaqueSealDirectory(PipReader reader)
        {
            DirectoryArtifact artifact = reader.ReadDirectoryArtifact();
            var directory = new CompositeSharedOpaqueSealDirectory(
                artifact.Path,
                reader.ReadArray(reader1 => reader1.ReadDirectoryArtifact()),
                reader.ReadPipProvenance(),
                reader.ReadReadOnlyArray(reader1 => reader1.ReadStringId()));

            directory.SetDirectoryArtifact(artifact);
            Contract.Assume(directory.IsInitialized && directory.Directory == artifact);

            return(directory);
        }
Ejemplo n.º 17
0
 internal static Options Deserialize(PipReader reader)
 {
     Contract.Requires(reader != null);
     return(new Options((PathRenderingOption)reader.ReadByte()));
 }
Ejemplo n.º 18
0
 /// <nodoc />
 internal static HashSourceFile InternalDeserialize(PipReader reader)
 {
     return(new HashSourceFile(
                reader.ReadFileArtifact()));
 }
        internal static CompositeSharedOpaqueSealDirectory InternalDeserializeCompositeSharedOpaqueSealDirectory(PipReader reader)
        {
            DirectoryArtifact artifact = reader.ReadDirectoryArtifact();
            var directory = new CompositeSharedOpaqueSealDirectory(
                artifact.Path,
                reader.ReadArray(reader1 => reader1.ReadDirectoryArtifact()),
                reader.ReadPipProvenance(),
                reader.ReadReadOnlyArray(reader1 => reader1.ReadStringId()),
                reader.ReadBoolean()
                    ? new SealDirectoryContentFilter((SealDirectoryContentFilter.ContentFilterKind)reader.ReadByte(), reader.ReadString())
                    : (SealDirectoryContentFilter?)null,
                (SealDirectoryCompositionActionKind)reader.ReadByte());

            directory.SetDirectoryArtifact(artifact);
            Contract.Assume(directory.IsInitialized && directory.Directory == artifact);

            return(directory);
        }