ProjectScopeServicesTest.groovy

Clone Tools
  • last updated a few minutes 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.

    • -247
    • +0
    ./ProjectScopeServicesTest.groovy
  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.

    • -247
    • +0
    ./ProjectScopeServicesTest.groovy
  1. … 13 more files in changeset.
Change wiring of the services that set up the instantiators and property walkers for various types so that this happens consistently and is modelled as a 'scheme' for each type.

Also explicitly declare the ignored annotations for a given scheme and disallow `@Console` and `@Internal` on artifact transform actions (but not parameters).

  1. … 20 more files in changeset.
Change wiring of the services that set up the instantiators and property walkers for various types so that this happens consistently and is modelled as a 'scheme' for each type.

Also explicitly declare the ignored annotations for a given scheme and disallow `@Console` and `@Internal` on artifact transform actions (but not parameters).

  1. … 20 more files in changeset.
Change some `FileCollection` construction in various core services to delegate to `FileCollectionFactory`. Also merge some `FileCollection` implementations that do the same thing.

  1. … 14 more files in changeset.
Change some `FileCollection` construction in various core services to delegate to `FileCollectionFactory`. Also merge some `FileCollection` implementations that do the same thing.

  1. … 14 more files in changeset.
Add a factory method to `ObjectFactory` that can be used to create `ConfigurableFileCollection` instances.

This new method is intended to replace the factory methods on `ProjectLayout`, as `ObjectFactory` is available in all scopes whereas a `ProjectLayout` is only available in project scopes. This also simplifies some task and project extension implementations as now only a single service is required to create the properties.

  1. … 15 more files in changeset.
Add a factory method to `ObjectFactory` that can be used to create `ConfigurableFileCollection` instances.

This new method is intended to replace the factory methods on `ProjectLayout`, as `ObjectFactory` is available in all scopes whereas a `ProjectLayout` is only available in project scopes. This also simplifies some task and project extension implementations as now only a single service is required to create the properties.

  1. … 15 more files in changeset.
Move class generation and instantation infrastructure from core to modelCore project.

  1. … 90 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.
Use Java variant derivation strategy for scripts

The script classpath is about building a Java classpath and thus uses

now the `JavaEcosystemVariantDerivationStrategy`.

In practice this should have no visible impact, it however makes sure we

are consistent in resolving in a Java context.

Issue #7826

  1. … 5 more files in changeset.
Replace most direct usages of `DirectInstantiator` with indirect usages via `InstantiatorFactory` or test fixtures instead. This means more consistent behaviour in unit tests because the objects under test will behave more similarly to how they do at runtime. This also allows the decision of how the instantiation should behave to live in as few places as possible, so this can be more easily evolved and contextualized.

  1. … 60 more files in changeset.
Emit build operations around container callback executions (core and dependencyMgmt containers) (#7734)

* Decorate taskcontainer callbacks to track application id

* Decorate plugin container callbacks

* Decorate repositoryContainer callbacks

* Decoreate configurations and configuration.dependencies container callbacks

* Decorate artifactTypesDecorator callbacks

* Dont emit build ops for internal declared callbacks

* Provide usercode context in beforeResolve / afterResolve callbacks

* keep compatibility for nebula.dependency-recommender plugin

* Put domain collection callback build ops behind feature toggle

* Decorate Provider.configure() methods

* Simplify container callback filtering and decoration

Previously, we had three classes collaborating to achieve this but now this is inlined into effectively one. While this creates a more complex implementation, that is still rather simple, it avoids the more problematic complexity of a complicated relationship between the three implementations that also required extra state and details to be propagated through all of the collections.

  1. … 70 more files in changeset.
Move lenient project locking to tooling model builder registry

  1. … 5 more files in changeset.
Merge ProtectApiService into CrossProjectConfigurator

  1. … 18 more files in changeset.
Fix CI failures

  1. … 4 more files in changeset.
Emit build operations for task registration / realization (#5610)

* Wire in op executor to task container

* Add internal task id

* Add binary compatibility exception

* Add as-light-as-possible build ops for eagerly created tasks

* Use op task ids when creating tasks

* Emit light build ops for lazily realized tasks

* Only fire task creation build ops when collecting task stats

* Provide rich details for task creation build ops

* Use groovy method rather than JDK8 method

* Wire in op executor to task container

* Add internal task id

* Add binary compatibility exception

* Add as-light-as-possible build ops for eagerly created tasks

* Use op task ids when creating tasks

* Emit light build ops for lazily realized tasks

* Only fire task creation build ops when collecting task stats

* Provide rich details for task creation build ops

* Use groovy method rather than JDK8 method

* Change test to use new register method

* Make NullBuildOperationExecutor a singleton

* Add note about opt-in to operations being empty

* Consolidate name/type/uniqueId into TaskIdentity

Reduces the number of args flying around, consolidates how identity paths etc. are calculated and enforces only one instance of such paths.

* Don't nest realize op for eagerly created lazy task

* Add test for nesting of task realize build ops

  1. … 25 more files in changeset.
Add support for URI-backed text resources

This can be used to point tasks like Checkstyle

to a remote, shared configuration file without

having to package it into an archive and using

dependency resolution.

The implementation reuses the same caching logic

we have for remote build scripts.

  1. … 20 more files in changeset.
Fix unit tests to expect task statistics

  1. … 1 more file in changeset.
Merge pull request #3665 from gradle/oehme/performance/service-registry

Optimize ServiceRegistry

Changed the process forking infrastructure so that it attempts to reuse threads rather than creating 3 or more threads per process that is forked.

There is now a global `ExecFactory` service that manages the infrastructure, including a pool of threads. It provides various factory methods to create instances of `ExecHandleBuilder`, `ExecAction`, `JavaExecHandleBuilder` and `JavaExecAction` backed by this infrastructure.

Replaced all direct instantiation of these types with usages of these factory methods.

  1. … 44 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.
Use our own hashing architecture, take 2 (#2817)

This replaces Guava's hashing. We need this for two reasons:

- it allows the addition of custom hash functions, like BLAKE2b which would not be possible with Guava's closed design

- it fixes a few performance issues that Guava only fixes in version 20 (which we can't upgrade to right now, because we still need to support Java 5 in places)

  1. … 159 more files in changeset.
Fix merge issues

  1. … 22 more files in changeset.
Make zipTrees faster

zipTrees were unpacked every time they were visited,

which meant 2-4 times for every single build.

This changes the logic to snapshot the zip and only unpack

again if it has changed.

  1. … 12 more files in changeset.
Detangle composite build project from core

- Use a core ScriptClassPathResolver to convert `Configuration` -> `ClassPath`

- Allow modules to contribute initializers to execute when resolving classpath

  1. … 12 more files in changeset.
Execute included builds directly when resolving plugin classpath

Artifacts from included builds that are included in the buildscript

classpath are built "on demand". This does not address issues with

building these artifacts, but does remove this behaviour from

other included build dependencies.

  1. … 14 more files in changeset.
Changed `DependencyInjectingInstantiator` to reuse `CrossBuildInMemoryCacheFactory` to create a cache implementation to handle the requested-class -> constructor lookup caching, rather than using an ad hoc cache.

This change also allows the validation error messages generated by `DependencyInjectingInstantiator` to reference the requested class rather than reporting errors against the generated class.

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

  1. … 7 more files in changeset.