@Override
 public FileCollectionSnapshot snapshot(
     FileCollection files,
     TaskFilePropertyCompareType compareType,
     TaskFilePropertyPathSensitivityType pathSensitivity) {
   return new OutputFilesCollectionSnapshot(
       getRoots(files), snapshotter.snapshot(files, compareType, pathSensitivity));
 }
 public void registerSerializers(SerializerRegistry registry) {
   DefaultSerializerRegistry nested = new DefaultSerializerRegistry();
   snapshotter.registerSerializers(nested);
   registry.register(
       OutputFilesCollectionSnapshot.class,
       new OutputFilesCollectionSnapshot.SerializerImpl(
           nested.build(FileCollectionSnapshot.class), stringInterner));
 }
Ejemplo n.º 3
0
  public TaskUpToDateState(
      TaskInternal task,
      TaskHistoryRepository.History history,
      FileCollectionSnapshotter outputFilesSnapshotter,
      FileCollectionSnapshotter inputFilesSnapshotter,
      FileCollectionSnapshotter discoveredFilesSnapshotter) {
    TaskExecution thisExecution = history.getCurrentExecution();
    TaskExecution lastExecution = history.getPreviousExecution();

    noHistoryState = NoHistoryStateChangeRule.create(task, lastExecution);
    taskTypeState = TaskTypeStateChangeRule.create(task, lastExecution, thisExecution);
    inputPropertiesState =
        InputPropertiesStateChangeRule.create(task, lastExecution, thisExecution);

    // Capture outputs state
    try {
      outputFilesState =
          caching(
              OutputFilesStateChangeRule.create(
                  task, lastExecution, thisExecution, outputFilesSnapshotter));
    } catch (UncheckedIOException e) {
      throw new UncheckedIOException(
          String.format(
              "Failed to capture snapshot of output files for task '%s' during up-to-date check.",
              task.getName()),
          e);
    }

    // Capture inputs state
    try {
      FileCollectionSnapshot inputFilesSnapshot =
          inputFilesSnapshotter.snapshot(task.getInputs().getFiles());
      this.inputFilesSnapshot = inputFilesSnapshot.getSnapshot();
      inputFilesState =
          caching(
              InputFilesStateChangeRule.create(lastExecution, thisExecution, inputFilesSnapshot));
    } catch (UncheckedIOException e) {
      throw new UncheckedIOException(
          String.format(
              "Failed to capture snapshot of input files for task '%s' during up-to-date check.",
              task.getName()),
          e);
    }

    // Capture discovered inputs state from previous execution
    try {
      discoveredInputFilesState =
          DiscoveredInputFilesStateChangeRule.create(
              lastExecution, thisExecution, discoveredFilesSnapshotter);
    } catch (UncheckedIOException e) {
      throw new UncheckedIOException(
          String.format(
              "Failed to capture snapshot of input files for task '%s' during up-to-date check.",
              task.getName()),
          e);
    }

    allTaskChanges =
        new SummaryTaskStateChanges(
            MAX_OUT_OF_DATE_MESSAGES,
            noHistoryState,
            taskTypeState,
            inputPropertiesState,
            outputFilesState,
            inputFilesState,
            caching(discoveredInputFilesState));
    rebuildChanges =
        new SummaryTaskStateChanges(
            1, noHistoryState, taskTypeState, inputPropertiesState, outputFilesState);
  }
 @Override
 public FileCollectionSnapshot snapshot(TaskFilePropertySpec propertySpec) {
   return new OutputFilesCollectionSnapshot(
       getRoots(propertySpec.getPropertyFiles()), snapshotter.snapshot(propertySpec));
 }
 public FileCollectionSnapshot emptySnapshot() {
   return new OutputFilesCollectionSnapshot(
       Collections.<String, Boolean>emptyMap(), snapshotter.emptySnapshot());
 }
 @Override
 public FileCollectionSnapshot snapshot(
     FileCollection files, boolean allowReuse, TaskFilePropertyCompareType compareType) {
   return new OutputFilesSnapshot(
       getRoots(files), snapshotter.snapshot(files, allowReuse, compareType));
 }