ModelRuleInspectorTest.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Rename ModelRuleInspector to ModelRuleExtractor.

+review REVIEW-5353

  1. … 11 more files in changeset.
Push the class to rule extractor into the registry, to allow nodes etc. to accept RuleSource classes.

While it bothers me slightly that we are pushing knowledge of a particular type of rule representation into the registry, it saves having to cart some extra stuff around.

+review REVIEW-5353

  1. … 38 more files in changeset.
Require rule sources to directly extend org.gradle.model.RuleSource

+review REVIEW-5359

  1. … 4 more files in changeset.
Collection mutation rule specifies input taking mutation rule for particular model element

+review REVIEW-5353

  1. … 68 more files in changeset.
Liberate some model registry test support from DefaultModelRegistryTest.

Includes some new/renamed API on ModelRegistry.

+review REVIEW-5350

  1. … 21 more files in changeset.
Revert selective task closing work.

Too much breakage.

+review REVIEW-5350

  1. … 67 more files in changeset.
Wire the model registry into the “task selector”, effectively enabling configure-on-demand for rule based task declarations.

Rather than eagerly “realize” the whole task container and its contents, we now only realize the container itself.

This means that we know of all the tasks that will exist without actually creating them.

If a task (declared by rules) is not needed for a build (i.e. not selected, not depended on) it will not be created.

However, our rule based plugins at this time contain coarse rules that don't allow this feature to be leveraged.

Benefits will only be seen right now for contrived domains.

  1. … 63 more files in changeset.
Eagerly instantiate rule source classes at extraction time to make sure that it can be done

+review REVIEW-5341

  1. … 3 more files in changeset.
Remove unnecessary annotation

+review REVIEW-5335

Don't decorate the ManagedSet implementation used for node's private value, as the view is now always used to get at the collection, and this is decorated (enough).

  1. … 4 more files in changeset.
Rules are extracted from plugins once and cached globally

+review REVIEW-5335

  1. … 27 more files in changeset.
Revert "Revert "Prepare for caching extracted model rules - don't hold strong references to methods and thus rule types in DefaultMethodRuleDefinition" because it fails the build on Java 8."

This reverts commit 6bfdf13e5e567fec178fe5b04f574878a3441415.

Conflicts:

subprojects/model-core/src/main/java/org/gradle/model/internal/inspect/DefaultMethodRuleDefinition.java

  1. … 10 more files in changeset.
Revert "Prepare for caching extracted model rules - don't hold strong references to methods and thus rule types in DefaultMethodRuleDefinition" because it fails the build on Java 8.

This reverts commit ef81d6f699a8a681794f4e1929e5d5f2ab4798e5.

  1. … 10 more files in changeset.
Prepare for caching extracted model rules - don't hold strong references to methods and thus rule types in DefaultMethodRuleDefinition

+review REVIEW-5335

  1. … 10 more files in changeset.
Rename rule definition handlers to rule extractors

+review REVIEW-5335

  1. … 52 more files in changeset.
Prepare for caching extracted model rules - ModelRuleInspector.inspect() now returns a list of ModelRuleRegistrations

+review REVIEW-5335

  1. … 22 more files in changeset.
Managed type is implemented as an abstract class

+review REVIEW-5330

  1. … 13 more files in changeset.
Attach generated implementation classes (weakly) to schema objects, instead of using a global cache.

This is done to avoid having to go through another cache and acquire a lock every time we need to instantiate a managed type.

This does make unit testing slightly more inconvenient in that a singleton schema store has to be used for all tests, but I deemed this an acceptable trade off.

+review REVIEW-5329

  1. … 19 more files in changeset.
Renamed ModelAction.mutate() to execute(), and ModelRegistrar.mutate() to apply()

  1. … 21 more files in changeset.
Renamed CollectionBuilder.finalizeAll() to afterEach(), and MutationType to ModelActionRole.

  1. … 28 more files in changeset.
Fixed broken unit test

Added `@Defaults` annotation, can be applied to a method to define a rule that applied defaults to the subject. Works the same as `@Mutate` and `@Finalize` but runs first.

  1. … 8 more files in changeset.
Introduce a parameter to describe which lifecycle stage a mutation rule should apply to, rather than baking it into the method name. The lifecycle is still hard-coded in the implementation.

  1. … 22 more files in changeset.
Renamed methods on ModelPromise to match the names used on ModelProjection.

  1. … 4 more files in changeset.
Include the rule descriptor in error messages for illegal mutations.

+review REVIEW-5321

  1. … 14 more files in changeset.
Use weak references in model schema store and reuse it and model rule source detector across builds.

Daemon test coverage to follow.

+review REVIEW-5313

  1. … 14 more files in changeset.
Enforce that all parameterized type usages are declared with type parameters in model rules.

+review REVIEW-5283

  1. … 4 more files in changeset.
Validate paths specified for module rule method parameters

+review REVIEW-5283

  1. … 2 more files in changeset.
Only allow void as the return type for mutation model rules

+review REVIEW-5283

  1. … 2 more files in changeset.
Report all types declaring an invalid property instead of just a random one.

+review REVIEW-5265

  1. … 6 more files in changeset.