Beispiel #1
0
 /// <inheritdoc />
 public bool AddIpcPip(IpcPip ipcPip, PipId valuePip)
 {
     Contract.Requires(ipcPip != null, "Argument pip cannot be null");
     Tracing.Logger.Log.CannotAddCreatePipsDuringConfigOrModuleEvaluation(m_loggingContext);
     return(false);
 }
 /// <summary>
 /// Adds a dataflow dependency from <paramref name="from"/> to <paramref name="to"/>
 /// (signifying
 /// </summary>
 public void AddDataflowDependency(PipId from, PipId to)
 {
     m_dataflowGraph.Add(from, to);
 }
 public Pip HydratePip(PipId pipId, PipQueryContext queryContext)
 {
     return(m_pips[pipId]);
 }
Beispiel #4
0
 public IEnumerable <PipId> GetDependents(PipId pipId)
 {
     Contract.Requires(pipId.IsValid);
     return(m_pipDependentsGetter?.Invoke(pipId) ?? Enumerable.Empty <PipId>());
 }
Beispiel #5
0
        /// <inheritdoc />
        public override DirectoryArtifact AddSealDirectory([NotNull] SealDirectory sealDirectory, PipId valuePip)
        {
            var result = base.AddSealDirectory(sealDirectory, valuePip);

            AddFileDependents(sealDirectory.Contents, sealDirectory);
            AddDirectoryDependents(sealDirectory.ComposedDirectories, sealDirectory);

            return(result);
        }
Beispiel #6
0
 public PipType GetPipType(PipId pipId)
 {
     Contract.Requires(pipId.IsValid);
     return(HydratePip(pipId).PipType);
 }
Beispiel #7
0
 public Pip HydratePip(PipId pipId)
 {
     Contract.Requires(pipId.IsValid);
     return(m_pipHydrator(pipId));
 }
Beispiel #8
0
        private static PipId ReadPipId(BuildXLReader reader)
        {
            var pipId = new PipId(reader.ReadUInt32());

            return((reader is PipReader pipReader) ? pipReader.RemapPipId(pipId) : pipId);
        }
Beispiel #9
0
 /// <summary>
 /// Called when a cacheable pip completes so state about the pip can be cleaned up
 /// </summary>
 public virtual void CompletePip(PipId pipId)
 {
 }
Beispiel #10
0
 internal static ServiceInfo Service(PipId shutdownPipId)
 {
     return(new ServiceInfo(ServicePipKind.Service, shutdownProcessPipId: shutdownPipId));
 }
Beispiel #11
0
 private static void WritePipId(BuildXLWriter writer, PipId pipId) => writer.Write(pipId.Value);
Beispiel #12
0
 /// <inheritdoc />
 public override PipId RemapPipId(PipId pipId) => m_pipGraphFragmentContext.RemapPipId(pipId);
Beispiel #13
0
 /// <inheritdoc />
 public DirectoryArtifact AddSealDirectory(SealDirectory sealDirectory, PipId valuePip)
 {
     Contract.Requires(sealDirectory != null);
     Tracing.Logger.Log.CannotAddCreatePipsDuringConfigOrModuleEvaluation(m_loggingContext);
     return(DirectoryArtifact.Invalid);
 }
Beispiel #14
0
 /// <inheritdoc />
 public bool AddWriteFile(WriteFile writeFile, PipId valuePip)
 {
     Contract.Requires(writeFile != null, "Argument writeFile cannot be null");
     Tracing.Logger.Log.CannotAddCreatePipsDuringConfigOrModuleEvaluation(m_loggingContext);
     return(false);
 }
Beispiel #15
0
 /// <inheritdoc />
 public bool AddWriteFile(WriteFile writeFile, PipId valuePip)
 {
     Contract.Requires(writeFile != null, "Argument writeFile cannot be null");
     return(PipAlreadyReloaded(writeFile) || m_builder.AddWriteFile(writeFile));
 }
Beispiel #16
0
 /// <nodoc />
 public PipExecutionPerformance TryGetPipExePerf(PipId pipId)
 {
     return(Pip2Perf.TryGetValue(pipId, out var result) ? result : null);
 }
Beispiel #17
0
 /// <summary>
 /// Transitions the state of the given pip on the worker
 /// </summary>
 public virtual void Transition(PipId pipId, WorkerPipState state)
 {
     m_workerPipStateManager.Transition(pipId, state);
 }
Beispiel #18
0
 /// <nodoc />
 public ProcessExecutionMonitoringReportedEventData?TryGetProcessMonitoringData(PipId pipId)
 {
     if (m_processMonitoringData.TryGetValue(pipId, out var result))
     {
         return(result);
     }
     else
     {
         return(null);
     }
 }
Beispiel #19
0
 public long GetSemiStableHash(PipId pipId)
 {
     Contract.Requires(pipId.IsValid);
     return(HydratePip(pipId).SemiStableHash);
 }
Beispiel #20
0
 /// <nodoc />
 public PipReference AsPipReference(PipId pipId)
 {
     return(new PipReference(PipTable, pipId, PipQueryContext.ViewerAnalyzer));
 }
Beispiel #21
0
 public IEnumerable <PipId> GetDependencies(PipId pipId)
 {
     Contract.Requires(pipId.IsValid);
     return(m_pipDependenciesGetter(pipId));
 }
        private bool TryScheduleIpcPip(Context context, ObjectLiteral obj, bool allowUndefinedTargetService, bool isServiceFinalization, out FileArtifact outputFile, out PipId pipId)
        {
            // IpcClientInfo
            IIpcMoniker moniker          = Converter.ExtractRef <IIpcMoniker>(obj, m_ipcSendMoniker, allowUndefined: false);
            int?        numRetries       = Converter.ExtractNumber(obj, m_ipcSendMaxConnectRetries, allowUndefined: true);
            int?        retryDelayMillis = Converter.ExtractNumber(obj, m_ipcSendConnectRetryDelayMillis, allowUndefined: true);
            var         clientConfig     = new ClientConfig(numRetries, retryDelayMillis);
            var         ipcClientInfo    = new IpcClientInfo(moniker.ToStringId(context.StringTable), clientConfig);

            // target service pip
            PipId?servicePipId = Converter.ExtractValue <PipId>(obj, m_ipcSendTargetServicePip, allowUndefined: allowUndefinedTargetService);

            // arguments
            PipData arguments;
            ReadOnlyArray <FileArtifact>      fileDependencies;
            ReadOnlyArray <DirectoryArtifact> directoryDependencies;

            using (var ipcProcessBuilder = ProcessBuilder.Create(context.PathTable, context.FrontEndContext.GetPipDataBuilder()))
            {
                // process arguments
                ArrayLiteral argumentsArrayLiteral = Converter.ExtractArrayLiteral(obj, m_ipcSendMessageBody);
                TransformerExecuteArgumentsProcessor.ProcessArguments(context, ipcProcessBuilder, argumentsArrayLiteral);

                // input file dependencies
                var dependenciesArray = Converter.ExtractArrayLiteral(obj, m_ipcSendDependencies, allowUndefined: true);
                if (dependenciesArray != null)
                {
                    for (int i = 0; i < dependenciesArray.Length; i++)
                    {
                        ProcessImplicitDependency(ipcProcessBuilder, dependenciesArray[i], convContext: new ConversionContext(pos: i, objectCtx: dependenciesArray));
                    }
                }

                arguments             = ipcProcessBuilder.ArgumentsBuilder.ToPipData(" ", PipDataFragmentEscaping.CRuntimeArgumentRules);
                fileDependencies      = ipcProcessBuilder.GetInputFilesSoFar();
                directoryDependencies = ipcProcessBuilder.GetInputDirectoriesSoFar();
            }

            // output
            AbsolutePath output = Converter.ExtractPath(obj, m_ipcSendOutputFile, allowUndefined: true);

            if (!output.IsValid)
            {
                output = context.GetPipConstructionHelper().GetUniqueObjectDirectory(m_ipcObjectFolderName).Path.Combine(context.PathTable, m_ipcOutputFileName);
            }

            // tags
            string[] tags      = null;
            var      tagsArray = Converter.ExtractArrayLiteral(obj, m_executeTags, allowUndefined: true);

            if (tagsArray != null && tagsArray.Count > 0)
            {
                tags = new string[tagsArray.Count];
                for (int i = 0; i < tagsArray.Count; i++)
                {
                    tags[i] = Converter.ExpectString(tagsArray[i], context: new ConversionContext(pos: i, objectCtx: tagsArray));
                }
            }

            // skip materialization for files
            FileOrDirectoryArtifact[] skipMaterializationArtifacts = CollectionUtilities.EmptyArray <FileOrDirectoryArtifact>();
            ArrayLiteral skipMaterializationLiteral = Converter.ExtractArrayLiteral(obj, m_ipcSendLazilyMaterializedDependencies, allowUndefined: true);

            if (skipMaterializationLiteral != null)
            {
                skipMaterializationArtifacts = new FileOrDirectoryArtifact[skipMaterializationLiteral.Length];
                for (int i = 0; i < skipMaterializationLiteral.Length; i++)
                {
                    Converter.ExpectFileOrStaticDirectory(
                        skipMaterializationLiteral[i],
                        out var fileArtifact,
                        out var staticDirectory,
                        context: new ConversionContext(pos: i, objectCtx: skipMaterializationLiteral));

                    Contract.Assert(fileArtifact.IsValid ^ staticDirectory != null);

                    skipMaterializationArtifacts[i] = fileArtifact.IsValid
                        ? FileOrDirectoryArtifact.Create(fileArtifact)
                        : FileOrDirectoryArtifact.Create(staticDirectory.Root);
                }
            }

            // must run on master
            var mustRunOnMaster = Converter.ExtractOptionalBoolean(obj, m_ipcSendMustRunOnMaster) == true;

            outputFile = FileArtifact.CreateOutputFile(output);

            // create IPC pip and add it to the graph
            return(context.GetPipConstructionHelper().TryAddIpc(
                       ipcClientInfo,
                       arguments,
                       outputFile,
                       servicePipDependencies: servicePipId != null ? ReadOnlyArray <PipId> .From(new[] { servicePipId.Value }) : ReadOnlyArray <PipId> .Empty,
                       fileDependencies: fileDependencies,
                       directoryDependencies: directoryDependencies,
                       skipMaterializationFor: ReadOnlyArray <FileOrDirectoryArtifact> .FromWithoutCopy(skipMaterializationArtifacts),
                       isServiceFinalization: isServiceFinalization,
                       mustRunOnMaster: mustRunOnMaster,
                       tags: tags,
                       out pipId));
        }
Beispiel #23
0
        private string RunSchedulerAndGetOutputContents(FileArtifact output, bool cacheHitAssert, PipId id)
        {
            if (cacheHitAssert)
            {
                RunScheduler().AssertCacheHit(id);
            }
            else
            {
                RunScheduler().AssertCacheMiss(id);
            }

            return(File.ReadAllText(ArtifactToString(output)));
        }
Beispiel #24
0
 /// <inheritdoc />
 public bool AddCopyFile(CopyFile copyFile, PipId valuePip)
 {
     Contract.Requires(copyFile != null, "Argument copyFile cannot be null");
     return(PipAlreadyReloaded(copyFile) || m_builder.AddCopyFile(copyFile));
 }
Beispiel #25
0
 /// <inheritdoc />
 public override bool AddWriteFile([NotNull] WriteFile writeFile, PipId valuePip)
 {
     return(base.AddWriteFile(writeFile, valuePip));
 }
Beispiel #26
0
 /// <inheritdoc />
 public bool AddIpcPip(IpcPip ipcPip, PipId valuePip)
 {
     Contract.Requires(ipcPip != null, "Argument pip cannot be null");
     return(PipAlreadyReloaded(ipcPip) || m_builder.AddIpcPip(ipcPip, valuePip));
 }
 private IReadOnlyList <PipId> GetOutgoingNodes(PipId node)
 {
     return(m_dataflowGraph.TryGetValue(node, out var outNodes) && outNodes != null
         ? outNodes
         : EmptyPipIdList);
 }
Beispiel #28
0
 /// <inheritdoc />
 public bool AddProcess(Process process, PipId valuePip)
 {
     Contract.Requires(process != null, "Argument process cannot be null");
     return(PipAlreadyReloaded(process) || m_builder.AddProcess(process, valuePip));
 }
 public RewritePolicy GetRewritePolicy(PipId pipId)
 {
     return(((Process)m_pips[pipId]).RewritePolicy);
 }
Beispiel #30
0
 /// <inheritdoc />
 public bool AddProcess(Process process, PipId valuePip)
 {
     Contract.Requires(process != null, "Argument process cannot be null");
     Tracing.Logger.Log.CannotAddCreatePipsDuringConfigOrModuleEvaluation(m_loggingContext);
     return(false);
 }