Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Allow build operation listeners to log (#4693)

This change moves build operation listening out of the standard listener infrastructure, to remove serialisation guarantees. As logging output now causes build operation notifications, whenever a build operation listener logged something it would fail due to the listener manager blocking overlapping signals.

By moving build operation listening out, overlapping and concurrent signals are now allowed.

This places more responsibility on listener implementations (e.g. thread safety), but there are few and they are all internal.

Additionally, listeners will now never receive progress notifications before start notifications and after finish notifications for that operation.

    • -0
    • +43
    ./BuildOperationListenerManager.java
    • -0
    • +131
    ./DefaultBuildOperationListenerManager.java
  1. … 16 more files in changeset.
Emit build operation progress events for logging output (#4537)

* Tweak BuildOperationListener#progress api

* Use build operation id to reference progress

* Add workaround for tracing log output via build operation progress for composite builds

* Replace some Object typing of operation identifiers with OperationIdentifier.

* Associate all progress logging with the current build operation.

* Update logic to accommodate for all progress events now having build operation IDs.

* Don't allow ProgressStartEvent.buildOperationCategory to be null.

** Default it to uncategorized.

  1. … 50 more files in changeset.
Add files missed from bad merge.

    • -0
    • +26
    ./BuildOperationCategory.java
    • -0
    • +154
    ./BuildOperationDescriptor.java
    • -0
    • +31
    ./BuildOperationListener.java
    • -0
    • +27
    ./BuildOperationRef.java
    • -0
    • +48
    ./CurrentBuildOperationPreservingRunnable.java
    • -0
    • +59
    ./CurrentBuildOperationRef.java
    • -0
    • +38
    ./DefaultBuildOperationRef.java
    • -0
    • +53
    ./DelegatingBuildOperationExecutor.java
    • -0
    • +51
    ./OperationFinishEvent.java
    • -0
    • +39
    ./OperationProgressEvent.java
    • -0
    • +29
    ./OperationStartEvent.java
  1. … 5 more files in changeset.
Rationalise handling of “current” build operation and build operation ID

For an upcoming change to emit console logging as build operation progress events, we need to associate all progress logging with the build operation. This pulled a thread on some long overdue cleanup.

The end result is:

1. Base build operation infrastructure is consolidated org.gradle.internal.operations.

2. Mechanism for passing thread global current build operation is more test friendly, and better named.

3. A consistent mechanism is used for binding the current operation to the thread, instead of two mechanisms.

4. Build operation IDs are typed to OperationIdentifier.

There is no public API or user behaviour change.

    • -45
    • +0
    ./BuildOperationIdentifierPreservingRunnable.java
    • -39
    • +0
    ./BuildOperationIdentifierRegistry.java
  1. … 144 more files in changeset.
rename interface to fix Checkstyle

    • -0
    • +47
    ./notify/BuildOperationNotificationListener2.java
    • -1
    • +1
    ./notify/BuildOperationNotificationListenerRegistrar.java
    • -47
    • +0
    ./notify/BuildOperationNotificationListener_2.java
  1. … 2 more files in changeset.
Introduce build operation progress events, only used for conveying test output to build scans currently.

    • -1
    • +1
    ./notify/BuildOperationNotificationListener.java
    • -1
    • +9
    ./notify/BuildOperationNotificationListenerRegistrar.java
    • -0
    • +47
    ./notify/BuildOperationNotificationListener_2.java
    • -0
    • +53
    ./notify/BuildOperationProgressNotification.java
  1. … 19 more files in changeset.
Minus 1 when submit `max-workers` to thread pool (#3281)

Fix https://github.com/gradle/gradle/issues/3273

Currently, we allow main thread (i.e. the thread which is waiting for build operation queue's completion)

to execute some work. The consequence is, the actual worker number is max-workers number +1. Since we

can't set --max-workers=0 via command line, that means the work would always be executed parallelly.

This commit only submit `max-workers`-1 threads to thread pool to avoid this issue.

* Remove @Ignore of DependencyUnresolvedModuleIntegrationTest

We fixed the possible issue with `max-workers` (see #3273),

this commit removes @Ignore in DependencyUnresolvedModuleIntegrationTest

  1. … 1 more file in changeset.
some minor cleanup

  1. … 3 more files in changeset.
Simplify test emmitting build operations to only emmit to BuildOperationListener without touching BuildOperationExecutor

  1. … 9 more files in changeset.
simplify emmitting child build operations

  1. … 2 more files in changeset.
Simplify emitting test output build operations

  1. … 3 more files in changeset.
Add build operation for text output in test

  1. … 3 more files in changeset.
Initial spike

    • -0
    • +25
    ./BuildOperationExecHandle.java
  1. … 9 more files in changeset.
Add some since and such to things used by build scans.

    • -0
    • +2
    ./notify/BuildOperationNotificationListenerRegistrar.java
  1. … 4 more files in changeset.
Expose operation start/finish timestamps on notifications. (#2834)

* Expose operation start/finish timestamps on notifications.

* Add since.

    • -0
    • +7
    ./notify/BuildOperationFinishedNotification.java
    • -0
    • +7
    ./notify/BuildOperationStartedNotification.java
  1. … 2 more files in changeset.
Rename new interface method

    • -1
    • +1
    ./notify/BuildOperationNotificationListenerRegistrar.java
  1. … 3 more files in changeset.
Make BuildOperationNotificationListenerRegistrar compatible to build scan plugin 1.8

    • -1
    • +9
    ./notify/BuildOperationNotificationListenerRegistrar.java
  1. … 3 more files in changeset.
Update integration test for recorded buildop notifications

- Verify more operations, including those emitted before the

listener is attached.

- Remove use of init script to attach listener, as this is no

longer required.

Update integration test for recorded events

- No longer need to use an init script to get events for nested builds.

    • -0
    • +4
    ./notify/BuildOperationNotificationListenerRegistrar.java
  1. … 1 more file in changeset.
Clean up build operations queue

- Move signal to happen on operation completion

- Rename the condition to better represent operation completion

    • -17
    • +17
    ./DefaultBuildOperationQueue.java
Simplify build operations queue

    • -67
    • +56
    ./DefaultBuildOperationQueue.java
Guard against failures when build operation queue runs work

    • -11
    • +15
    ./DefaultBuildOperationQueue.java
Build operation queue wait thread can execute operations

This fixes an issue where when multiple tasks are running

concurrently and submitting work to the build operation queue,

performance can actually be worse worker leases and the

executor thread pool compete with each other. This fixes the

issue by allowing the thread waiting for work to complete to

also execute some of that work.

    • -33
    • +74
    ./DefaultBuildOperationQueue.java
  1. … 2 more files in changeset.
Introduce BuildOperationIdFactory in global scope service for unique ids

This ensures that IDs are unique among all nested builds of

one execution.

#2622

    • -0
    • +28
    ./BuildOperationIdFactory.java
    • -0
    • +30
    ./DefaultBuildOperationIdFactory.java
  1. … 10 more files in changeset.
Replace usages of org.gradle.api.Nullable

With javax.annotation.Nullable.

    • -1
    • +1
    ./BuildOperationIdentifierRegistry.java
    • -1
    • +2
    ./notify/BuildOperationFinishedNotification.java
    • -1
    • +2
    ./notify/BuildOperationStartedNotification.java
  1. … 456 more files in changeset.
Require that all rich build operations have result objects.

Later changing from no result to having a result is awkward for listeners to deal with.

So, always use a result type and just have it be empty if there is nothing to convey right now.

There always might be something to convey in the future.

  1. … 13 more files in changeset.
Expose rich build operations for build cache activities (#2227)

  1. … 56 more files in changeset.
Log headers from unmanaged progress loggers (#2153)

  1. … 13 more files in changeset.
Expose the task up to date messages to scans (#2146)

This change makes the existing “execute task” build operation a “rich” operation (i.e. visible to scans) and uses it to convey the up to date messages.

Other task result data that was on TaskStateInternal for the sake of scans has been moved to the result of this op.

As part of this change, the scan plugin no longer uses TaskStateInternal, TaskExecutionListener or InternalTaskExecutionListener. The latter existed just for build scans, so it has now been removed.

    • -0
    • +13
    ./notify/BuildOperationFinishedNotification.java
  1. … 27 more files in changeset.
Replace Executor in WorkerLease convenience methods with Callable/Runnable

  1. … 9 more files in changeset.
Simplify executor relationships

    • -2
    • +2
    ./DefaultBuildOperationQueueFactory.java
  1. … 45 more files in changeset.