BuildScopeServicesTest.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Change `DefaultServiceRegistry.getAll()` so that it does not return services from parents that have been decorated or overridden by the current registry.

Also change the interaction between parent and child registry so as to avoid assuming a particular parent implementation.

  1. … 13 more files in changeset.
Change `DefaultServiceRegistry.getAll()` so that it does not return services from parents that have been decorated or overridden by the current registry.

Also change the interaction between parent and child registry so as to avoid assuming a particular parent implementation.

  1. … 13 more files in changeset.
Spelling (#8199)

Fix several spelling issues.

  1. … 36 more files in changeset.
Allow the services required by a given class to be queried prior to creating any instances of that class. Use this to allow `ArtifactTransformDependencies` to be injected into artifact transforms using any of the service injection patterns (that is, via a constructor or a getter).

  1. … 127 more files in changeset.
Remove some direct usages of the internals of the instantiator.

  1. … 8 more files in changeset.
Remove direct usages of `ThreadGlobalInstantiator` from tests, replace with test fixtures.

  1. … 9 more files in changeset.
Extract :buildProfile subproject from :core

  1. … 43 more files in changeset.
Revert "Merge pull request #7696 from gradle/marc/insights/extract-buildProfile-subproject"

This reverts commit ed2e38e2e4d6ffb1d15d5e0ffa74275622b063fe, reversing

changes made to 8a73c262ef5feca10ab1050302293b9c1ff14042.

  1. … 43 more files in changeset.
Extract :buildProfile subproject from :core

  1. … 43 more files in changeset.
Named classloaders (#6834)

This should help give some more context while debugging classloading issues.

  1. … 40 more files in changeset.
Split loading and configuring of included builds, so that included builds are loaded during the loading of the root build and configured during configuration of the root build (if required). Previously, included builds were loaded and also configured during loading (if required). This better allocates the work between the relevant top level build operation and also allows further laziness in configuring of included builds to be added later.

  1. … 13 more files in changeset.
Remove unneccessary objects from service registry

This minimizes the memory footprint of service registries

with the following improvements:

The isolation beteen parent and child is now handled by

explicitly checking whether a service came from the same

registry instead of wrapping services in an isolation layer.

The lookup cache has been removed, as the lookup algorithm

is now cheap enough to work without a cache.

The type spec concept has been removed and replaced by a

static "isSatisfiedBy(Type, Type)" method. The cache for the

specs was also removed as a result.

An array of services is only created if there are multiple

implementations for an interface.

Looking up Object.class is no longer supported and it is

no longer tracked as a potential service class.

  1. … 2 more files in changeset.
Optimize ServiceRegistry

The service lookups were showing up as a hot spot in many

configuration time scenarios. The heart of the problem was

that OwnServices was doing too much work on a lookup - it

iterated over all providers, even if their raw type didn't

match the requested type. To work around that we had added

a "hasService" method as well as a CachingProvider in the

past. These somewhat mitigated follow-up requests, but only

made the problem worse on the first lookup of a service.

This change moves the analysis to service registering time.

Services are kept in a multimap structure that associates

them with their raw type. Only the providers with the right

raw type are asked on each lookup. After this change, the

"hasService" method and the CachingProvider were no longer

necessary, as the normal lookup was fast enough.

Another problem was that we created lots of garbage when

walking up the parent hierarchy on a "getAll" request. Each

layer would create a new array list to hold intermediate

results. This has been changed and we now pass the collecting

array from the lowest layer up the parent hierarchy.

The code that was handling cycles in service lookups used a

HashSet, which lead to two problems: We couldn't report the

actual cycle (since we lost the order) and we were paying

the price of hashing, which is not worth it for such tiny

collections. It now uses an ArrayDeque and a "contains" call

instead, which is more efficient and provides better error

reporting.

The handling of service dependencies was also using a HashSet,

which again lead to unnecessary hash operations. An ArrayList

works fine here and uses less CPU cycles.

Finally, CompositeStoppable was crazy expensive, because it used

a CopyOnWriteArrayList and added each Closable one by one. It now

uses simple synchronization instead, greatly reducing GC pressure.

In order to be able to use some of those data structures that are

Java 6+, I moved the Java version check earlier in the chain so we

don't try to set up any services before checking whether we run on

a supported Java version.

The whole DefaultServiceRegistry class should be broken up for

easier understanding, but I didn't go down that path yet to make

this change easier to review.

  1. … 14 more files in changeset.
pluginManagement { repositories {} } is a RepositoryHandler

Remove PluginRepositoriesSpec and related types

Remove internal PluginRepository type hierarchy

Introduce build scoped PluginDependencyResolutionServices

Introduce RepositoryHandler.gradlePluginPortal()

Plugin resolution error messages changed has they now use the regular

ArtifactRepository display name

  1. … 45 more files in changeset.
Strive to keep Gradle's monotonic clock in sync with the system clock

  1. … 71 more files in changeset.
Simplify time handling internally and for build scans (#2857)

* Don't make TimeProvider Serializable.

This isn't safe and generally doesn't make sense.

* Extract and promote the concept of a build timer.

This was previously not well defined and being overlaid with the concept of when a user/tool requested something, which is not always the same thing.

* Pare down the deprecated org.gradle.util.Clock down to the minimum required.

Internal usage is replaced by a `getStartTime()` directly on BuildRequestContext.

What is left is only kept for backwards compatibility with scans.

* Rename TimeProvider to Clock.

* Move BuildExecutionTimer out of baseServices into core, and into a better package.

* Remove unused.

* Simplify the time package by merging types.

* Prevent the client's build started timestamp from being later than when the provider received the build request.

* Provide a dedicated mechanism for conveying the build start time to build scans.

* Consolidate the ways of formatting durations.

  1. … 179 more files in changeset.
Completely separate `BuildLoader` from `SettingsLoader`

- Removed `BuildAndSettingsLoader`, that chained the 2 actions within a

`SettingsLoader` instance.

- Create a `NotifyingBuildLoader` for use directly by `DefaultGradleLauncher`

- Loading the project structure is now performed as part of the build configuration

operation, instead of within the operation for loading init scripts and settings.

- This means that less work needs to be done building the structure for a composite build.

  1. … 12 more files in changeset.
Move FileHasher to base-services

+review REVIEW-6562

  1. … 74 more files in changeset.
Introduce a nanoTime-backed TimeProvider implementation

- Use this TimeProvider for most services

  1. … 8 more files in changeset.
Move ExceptionAnalyzer up to BuildTree scope

  1. … 2 more files in changeset.
Wire Execution scope services into other scopes

  1. … 10 more files in changeset.
Fix mocking of services

  1. … 7 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.

  1. … 180 more files in changeset.
Added a session scoped `ListenerManager` to allow events to be received and to be generated at session scope.

  1. … 1 more file in changeset.
Moved `FileHasher` up to session scope from each build scope.

  1. … 7 more files in changeset.
Fix BuildScopeServicesTest, follow up to #1731

Wrap ScriptPlugin implementations in BuildOperationScriptPlugin

This allows us to track each script application, independent of the

ScriptPlugin implementation, as an build operation.

  1. … 7 more files in changeset.
Use runtime classpath snapshotting for classloader hashing

Previously classloaders were hashed via a custom snapshotter, which were not getting the goodness we were adding to regular runtime classpath snapshotting. Now we use the same implementation for both purposes.

+review REVIEW-6449

  1. … 20 more files in changeset.
Changed the wiring of the listeners that forward events back to the tapi client so that they received events from _all_ builds, not just the root build. This in particular means that progress events are received from `buildSrc` builds, composite builds, and builds started using the `GradleBuild` task.

Cleaned up `BuildScopeServices` so that it is no longer responsible for cleaning up its parent.

  1. … 7 more files in changeset.
Revert "Use same hashing for classloaders as for `@Classpath` task properties"

This reverts commit 8313d74a1af92952f0ca6b8d9adf26b73288eac3.

+review REVIEW-6316

  1. … 20 more files in changeset.