Ejemplo n.º 1
0
        /// <nodoc />
        public PipResult(
            PipResultStatus status,
            PipExecutionPerformance performanceInfo,
            bool mustBeConsideredPerpetuallyDirty,
            ReadOnlyArray <AbsolutePath> dynamicallyObservedFiles,
            ReadOnlyArray <AbsolutePath> dynamicallyProbedFiles,
            ReadOnlyArray <AbsolutePath> dynamicallyObservedEnumerations,
            ReadOnlyArray <AbsolutePath> dynamicallyObservedAbsentPathProbes,
            int exitCode)
        {
            Contract.Requires(!status.IndicatesExecution() == (performanceInfo == null));
            Contract.Requires(dynamicallyObservedFiles.IsValid);
            Contract.Requires(dynamicallyProbedFiles.IsValid);
            Contract.Requires(dynamicallyObservedEnumerations.IsValid);
            Contract.Requires(dynamicallyObservedAbsentPathProbes.IsValid);

            Status          = status;
            PerformanceInfo = performanceInfo;
            MustBeConsideredPerpetuallyDirty    = mustBeConsideredPerpetuallyDirty;
            DynamicallyObservedFiles            = dynamicallyObservedFiles;
            DynamicallyProbedFiles              = dynamicallyProbedFiles;
            DynamicallyObservedEnumerations     = dynamicallyObservedEnumerations;
            DynamicallyObservedAbsentPathProbes = dynamicallyObservedAbsentPathProbes;
            ExitCode = exitCode;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a <see cref="PipResult"/> indicating that a pip wasn't actually executed. No performance info is attached.
 /// </summary>
 public static PipResult CreateForNonExecution(PipResultStatus status, bool mustBeConsideredPerpetuallyDirty = false)
 {
     Contract.Requires(!status.IndicatesExecution());
     return(new PipResult(
                status,
                null,
                mustBeConsideredPerpetuallyDirty,
                ReadOnlyArray <AbsolutePath> .Empty,
                ReadOnlyArray <AbsolutePath> .Empty));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a <see cref="PipResult"/> with the given status. The performance info is populated
 /// with zero duration (start / stop right now) and no dynamic observed files or enumerations
 /// </summary>
 public static PipResult CreateWithPointPerformanceInfo(PipResultStatus status, bool mustBeConsideredPerpetuallyDirty = false)
 {
     Contract.Requires(status.IndicatesExecution());
     return(new PipResult(
                status,
                PipExecutionPerformance.CreatePoint(status),
                mustBeConsideredPerpetuallyDirty,
                ReadOnlyArray <AbsolutePath> .Empty,
                ReadOnlyArray <AbsolutePath> .Empty));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a <see cref="PipResult"/> with the given status. The performance info is populated
 /// as a duration from <paramref name="executionStart"/> to now without any dynamic observed files or enumerations
 /// </summary>
 public static PipResult Create(PipResultStatus status, DateTime executionStart, bool mustBeConsideredPerpetuallyDirty = false)
 {
     Contract.Requires(status.IndicatesExecution());
     Contract.Requires(executionStart.Kind == DateTimeKind.Utc);
     return(new PipResult(
                status,
                PipExecutionPerformance.Create(status, executionStart),
                mustBeConsideredPerpetuallyDirty,
                ReadOnlyArray <AbsolutePath> .Empty,
                ReadOnlyArray <AbsolutePath> .Empty));
 }
Ejemplo n.º 5
0
        public static PipExecutionLevel ToExecutionLevel(this PipResultStatus result)
        {
            Contract.Requires(result.IndicatesExecution());

            switch (result)
            {
            case PipResultStatus.Succeeded:
                return(PipExecutionLevel.Executed);

            case PipResultStatus.Failed:
            case PipResultStatus.Canceled:
                return(PipExecutionLevel.Failed);

            case PipResultStatus.DeployedFromCache:
            case PipResultStatus.NotMaterialized:     // TODO: This is misleading; should account for eventual materialization.
                return(PipExecutionLevel.Cached);

            case PipResultStatus.UpToDate:
                return(PipExecutionLevel.UpToDate);

            default:
                throw Contract.AssertFailure("Unhandled Pip Result that indicates execution");
            }
        }