/// <nodoc /> public bool TryAddProcess(ProcessBuilder processBuilder, out ProcessOutputs processOutputs, out Process pip) { // Applying defaults can fail if, for example, a source sealed directory cannot be // created because it is not under a mount. That error must be propagated, because // otherwise an error will be logged but the evaluation will succeed. if (PipGraph?.ApplyCurrentOsDefaults(processBuilder) == false) { pip = null; processOutputs = null; return(false); } if (!processBuilder.TryFinish(this, out pip, out processOutputs)) { return(false); } if (PipGraph != null) { var success = PipGraph.AddProcess(pip, GetValuePipId()); processOutputs.ProcessPipId = pip.PipId; return(success); } return(true); }
/// <nodoc /> public bool TryAddProcess(ProcessBuilder processBuilder, out ProcessOutputs processOutputs, out Process pip) { if (!TryFinishProcessApplyingOSDefaults(processBuilder, out processOutputs, out pip)) { return(false); } return(TryAddFinishedProcessToGraph(pip, processOutputs)); }
/// <nodoc /> public bool TryAddProcess(ProcessBuilder processBuilder, out ProcessOutputs processOutputs, out Process pip) { if (!processBuilder.TryFinish(this, out pip, out processOutputs)) { return(false); } return(true); }
/// <nodoc/> public ProjectCreationResult(TProject project, Pips.Operations.Process process, ProcessOutputs outputs) { Contract.RequiresNotNull(process); Contract.RequiresNotNull(outputs); Project = project; Process = process; Outputs = outputs; }
/// <summary> /// Adds a process finished by <see cref="TryFinishProcessApplyingOSDefaults(ProcessBuilder, out ProcessOutputs, out Process)"/> to /// the pip graph and updates its process outputs with the pip id that the graph assigns to the added process it /// </summary> public bool TryAddFinishedProcessToGraph(Process pip, ProcessOutputs processOutputs) { if (PipGraph != null) { var success = PipGraph.AddProcess(pip, GetValuePipId()); processOutputs.ProcessPipId = pip.PipId; return(success); } return(true); }
/// <nodoc /> public bool TryAddProcess(ProcessBuilder processBuilder, out ProcessOutputs processOutputs, out Process pip) { if (!processBuilder.TryFinish(this, out pip, out processOutputs)) { return(false); } if (PipGraph != null) { var success = PipGraph.AddProcess(pip, GetValuePipId()); processOutputs.ProcessPipId = pip.PipId; return(success); } return(true); }
private bool TryExecuteArgumentsToPipBuilder( RushProject project, QualifierId qualifierId, out string failureDetail, out Process process) { // TODO: don't do it here but in CanSchedule if (string.IsNullOrEmpty(project.BuildCommand)) { m_processOutputsPerProject[project] = new ProcessOutputs(new Dictionary <AbsolutePath, FileArtifactWithAttributes>(), new Dictionary <AbsolutePath, StaticDirectory>()); failureDetail = string.Empty; process = default; return(true); } // We create a pip construction helper for each project var pipConstructionHelper = GetPipConstructionHelperForProject(project, qualifierId); using (var processBuilder = ProcessBuilder.Create(PathTable, m_context.GetPipDataBuilder())) { // Configure the process to add an assortment of settings: arguments, response file, etc. ConfigureProcessBuilder(processBuilder, project); // Process all predicted outputs and inputs, including the predicted project dependencies ProcessInputs(project, processBuilder); ProcessOutputs(project, processBuilder); // Try to schedule the process pip if (!pipConstructionHelper.TryAddProcess(processBuilder, out ProcessOutputs outputs, out process)) { failureDetail = "Failed to schedule the pip"; return(false); } m_processOutputsPerProject[project] = outputs; failureDetail = string.Empty; return(true); } }
private ObjectLiteral BuildExecuteOutputs(Context context, ModuleLiteral env, ProcessOutputs processOutputs, bool isService) { var entry = context.TopStack; using (var empty = EvaluationStackFrame.Empty()) { var getOutputFile = new Closure( env, FunctionLikeExpression.CreateAmbient(ExecuteResultGetOutputFile, m_getOutputFileSignature, GetOutputFile, m_getOutputFileStatistic), frame: empty); var getOutputDirectory = new Closure( env, FunctionLikeExpression.CreateAmbient(ExecuteResultGetOutputDirectory, m_getOutputDirectorySignature, GetOutputDirectory, m_getOutputDirectoryStatistic), frame: empty); var getOutputFiles = new Closure( env, FunctionLikeExpression.CreateAmbient(ExecuteResultGetOutputFiles, m_getOutputFilesSignature, GetOutputFiles, m_getOutputFilesStatistic), frame: empty); var getRequiredOutputFiles = new Closure( env, FunctionLikeExpression.CreateAmbient(ExecuteResultGetRequiredOutputFiles, m_getRequiredOutputFilesSignature, GetRequiredOutputFiles, m_getRequiredOutputFilesStatistic), frame: empty); var bindings = new List <Binding>(isService ? 6 : 5) { new Binding(ExecuteResultGetOutputFile, getOutputFile, location: default), new Binding(ExecuteResultGetOutputDirectory, getOutputDirectory, location: default), new Binding(ExecuteResultGetOutputFiles, getOutputFiles, location: default), new Binding(ExecuteResultGetRequiredOutputFiles, getRequiredOutputFiles, location: default), new Binding(ExecuteResultProcessOutputs, new EvaluationResult(processOutputs), location: default), }; if (isService) { bindings.Add(new Binding(CreateServiceResultServiceId, processOutputs.ProcessPipId, location: default)); } return(ObjectLiteral.Create(bindings, entry.InvocationLocation, entry.Path)); } // Local functions EvaluationResult GetOutputFile(Context contextArg, ModuleLiteral envArg, EvaluationStackFrame args) { var outputPath = Args.AsPathOrUndefined(args, 0, false); if (outputPath.IsValid && processOutputs.TryGetOutputFile(outputPath, out var file)) { return(EvaluationResult.Create(file)); } return(EvaluationResult.Undefined); } EvaluationResult GetOutputDirectory(Context contextArg, ModuleLiteral envArg, EvaluationStackFrame args) { var outputDir = Args.AsDirectory(args, 0); if (outputDir.IsValid && processOutputs.TryGetOutputDirectory(outputDir.Path, out var output)) { return(EvaluationResult.Create(output)); } return(EvaluationResult.Undefined); } EvaluationResult GetOutputFiles(Context contextArg, ModuleLiteral envArg, EvaluationStackFrame args) { var outputFiles = processOutputs.GetOutputFiles().Select(f => EvaluationResult.Create(f)).ToArray(); return(EvaluationResult.Create(ArrayLiteral.CreateWithoutCopy(outputFiles, entry.InvocationLocation, entry.Path))); } EvaluationResult GetRequiredOutputFiles(Context contextArg, ModuleLiteral envArg, EvaluationStackFrame args) { var outputFiles = processOutputs.GetRequiredOutputFiles().Select(f => EvaluationResult.Create(f)).ToArray(); return(EvaluationResult.Create(ArrayLiteral.CreateWithoutCopy(outputFiles, entry.InvocationLocation, entry.Path))); } }