cleanup

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Make sure we never return `null` from getResolvedPaths

I couldn't reproduce the problem in an integration test, though it

seems there are some situations when projects are configured while

tasks are running (I suppose with configure on demand) that an

observer would see null being returned from

`DefaultBuildOutputCleanupRegistry.getResolvedPaths()`.

My changes to the class (use double checked locking), should

prevent it now from happening.

#9174

    • -13
    • +20
    ./DefaultBuildOutputCleanupRegistry.java
Replace usages of `FileResolver.resolveFile()` with `FileCollectionFactory.resolving()` or `FileOperations.immutable()`, so that `FileResolver` can be responsible only for converting scalar values to File-ish values.

    • -5
    • +5
    ./DefaultBuildOutputCleanupRegistry.java
  1. … 41 more files in changeset.
Replace usages of `FileResolver.resolveFile()` with `FileCollectionFactory.resolving()` or `FileOperations.immutable()`, so that `FileResolver` can be responsible only for converting scalar values to File-ish values.

    • -5
    • +5
    ./DefaultBuildOutputCleanupRegistry.java
  1. … 41 more files in changeset.
Replace usages of `FileResolver.resolveFile()` with `FileCollectionFactory.resolving()` or `FileOperations.immutable()`, so that `FileResolver` can be responsible only for converting scalar values to File-ish values.

    • -5
    • +5
    ./DefaultBuildOutputCleanupRegistry.java
  1. … 41 more files in changeset.
Replace usages of `FileResolver.resolveFile()` with `FileCollectionFactory.resolving()` or `FileOperations.immutable()`, so that `FileResolver` can be responsible only for converting scalar values to File-ish values.

    • -5
    • +5
    ./DefaultBuildOutputCleanupRegistry.java
  1. … 41 more files in changeset.
Apply `Explicit type can be replaced with <>` inspection the whole project

    • -1
    • +1
    ./DefaultBuildOutputCleanupRegistry.java
  1. … 909 more files in changeset.
Change DefaultBuildOutputCleanupRegistry path resolution to be File based

Instead of String based, to make sure the OS case sensitivity is applied to it

    • -12
    • +12
    ./DefaultBuildOutputCleanupRegistry.java
  1. … 1 more file in changeset.
Favor using FileCollection.iterator() over FileCollection.getFiles()

In some cases it's cheaper to create the iterator than a full-blown Set.

    • -1
    • +1
    ./DefaultBuildOutputCleanupRegistry.java
  1. … 28 more files in changeset.
Remove Path usage from DefaultBuildOutputCleanupRegistry

Using path may cause problems on Java 7, since the file system provider

uses `file.encoding` instead of `sun.jnu.encoding`.

See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7050570.

+review REVIEW-6557

    • -11
    • +9
    ./DefaultBuildOutputCleanupRegistry.java
Revert "Remove Path usage from DefaultBuildOutputCleanupRegistry"

Using the `File` API introduced a performance regression

in "create many empty projects" :(

I need to investigate what is causing this.

This reverts commit 925c297424970f65ed625b352f15c270e75e4686.

+review REVIEW-6557

    • -9
    • +11
    ./DefaultBuildOutputCleanupRegistry.java
Remove Path usage from DefaultBuildOutputCleanupRegistry

Using path may cause problems on Java 7, since the file system provider

uses `file.encoding` instead of `sun.jnu.encoding`.

See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7050570.

+review REVIEW-6557

    • -11
    • +9
    ./DefaultBuildOutputCleanupRegistry.java
Cleanup stale output files during execution (#2572)

We now keep a registry of all the outputs generated by Gradle which will be reset on each version change. If Gradle encounters an existing output file, then it will remove it if is not part of the registered outputs and owned by Gradle/the build. We do also not remove directories containing outputs from different tasks.

The check to delete the stale outputs happens now just before the task executes and not up-front as it did before.

The `build` directory and all delete targets of the `clean` task are registered as owned by Gradle and are considered safe to delete.

Currently, the set of recorded task output files is only growing if we do not change the Gradle version. In the future we can improve on this by also detecting that some directories where removed (e.g. by running a clean task) and reflect this in the registry.

Fixes #1168

Fixes #973

+review REVIEW-6557

    • -54
    • +0
    ./BuildOperationBuildOutputDeleterDecorator.java
    • -81
    • +0
    ./DefaultBuildOutputCleanupCache.java
    • -4
    • +38
    ./DefaultBuildOutputCleanupRegistry.java
  1. … 25 more files in changeset.
Make progress display name mostly consistent

It should be sentence case and continuous present tense. I adjusted the

Javadoc examples and fixed the simple to fix cases.

`DefaultConfiguration` and `DefaultLenientConfiguration` still do not

adhere to the convention (`Resolve ...`), but fixing those is a higher

effort since some tests (including tooling API tests) depend on it.

    • -1
    • +1
    ./BuildOperationBuildOutputDeleterDecorator.java
  1. … 1 more file in changeset.
Show stale output cleanup message on info level

    • -2
    • +4
    ./BuildOperationBuildOutputDeleterDecorator.java
  1. … 3 more files in changeset.
Move "Deleted" message to info and stale outputs to incremental section

+review REVIEW-6521

  1. … 3 more files in changeset.
Change default log level to WARN (#1952)

  1. … 44 more files in changeset.
Only produce extra message when Gradle will actually delete something

+review REVIEW-6521

Clarify messages produced when deleting old output directories

+review REVIEW-6521

  1. … 4 more files in changeset.
Unify BuildOperationExecutor and BuildOperationProcessor APIs

This introduces the following `BuildOperationExecutor`

interface (as outlined in gradle/gradle#1676):

void run(RunnableBuildOperation buildOperation);

<T> T call(CallableBuildOperation<T> buildOperation);

<O extends RunnableBuildOperation> void runAll(

Action<BuildOperationQueue<O>> schedulingAction);

<O extends BuildOperation> void runAll(

BuildOperationWorker<O> worker,

Action<BuildOperationQueue<O>> schedulingAction);

To accomplish this, the following changes were performed:

- Various representation of build operations have been merged into

1) BuildOperation (with sub-interfaces)

-> declare and describe a build operation

2) BuildOperationDescriptor (BuildOperationDescriptor.Builder)

-> describe a build operation

3) BuildOperationState

-> represents a running build operation, with run state, start time,

parent relationship information, and description

- The DefaultBuildOperationExecutor and DefaultBuildOperationProcessor

implementations have been merged in DefaultBuildOperationExecutor,

which is now build session scoped.

    • -9
    • +10
    ./BuildOperationBuildOutputDeleterDecorator.java
  1. … 180 more files in changeset.
Some tweaks to build operation display names, for consistency.

    • -1
    • +1
    ./BuildOperationBuildOutputDeleterDecorator.java
  1. … 4 more files in changeset.
Use a unique display name for cleaning stale outputs

+review REVIEW-6424

    • -2
    • +5
    ./BuildOperationBuildOutputDeleterDecorator.java
  1. … 2 more files in changeset.
Add BuildOutputCleanup implementation

- Detect Gradle version changes by keeping a `built.bin` in the project cache dir

- Register a listener that triggers clean up at the end of the configuration phase

- The build output cleanup cache only invokes the deleter when the marker file is missing

- Provide a registry that plugins can contribute output files to

- In LifecycleBasePlugin (the base plugin), register the buildDir and clean task target files

- Use a build operation when cleaning stale output files

+review REVIEW-6424

    • -0
    • +48
    ./BuildOperationBuildOutputDeleterDecorator.java
    • -0
    • +29
    ./BuildOutputCleanupCache.java
    • -0
    • +28
    ./BuildOutputCleanupListener.java
    • -0
    • +32
    ./BuildOutputCleanupRegistry.java
    • -0
    • +24
    ./BuildOutputDeleter.java
    • -0
    • +81
    ./DefaultBuildOutputCleanupCache.java
    • -0
    • +44
    ./DefaultBuildOutputCleanupRegistry.java
    • -0
    • +56
    ./DefaultBuildOutputDeleter.java
  1. … 11 more files in changeset.