ExtensionContainerTest.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Moved a bunch of dynamic object related types from core to live in modelCore.

  1. … 104 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 direct usages of `ThreadGlobalInstantiator` from tests, replace with test fixtures.

  1. … 9 more files in changeset.
Prefer first non-synthetic extension public type

when inferring the public type

Signed-off-by: Paul Merlin <paul@gradle.com>

  1. … 1 more file in changeset.
Can configure extensions by name

Before this commit there was no way to configure a @DeferredConfigurable

extension by name. This commit adds a method to ExtensionContainer in

this regard.

See gradle/gradle-script-kotlin#328

  1. … 2 more files in changeset.
Replace `TypeToken<T>` by `ModelType<T>` in `TypeOf<T>`

And introduce `TypeOf.Visitor`.

  1. … 6 more files in changeset.
Prove `(get|find)ByType` can distinguish generic type arguments

Rename `TypeOf.{of => typeOf}` and favour use via static import

  1. … 4 more files in changeset.
Allow extension public types to be specified via “type token”

and by being so, faithfully represent generic types.

  1. … 9 more files in changeset.
Refine ExtensionContainer

Less parameterized types.

Reorder new methods parameters to prevent potential conflicts.

Favor iterating over entry set for Maps.

Add some words to release notes.

  1. … 9 more files in changeset.
Register extensions public types

- ExtraPropertiesExtension

- PlatformContainer

- BuildTypeContainer

- FlavorContainer

- NativeToolChainRegistry

- DistributionContainer

- PublishingExtension

  1. … 5 more files in changeset.
ExtensionContainer allows to declare extensions public type

Only extensions public types are considered with addressing them by

type.

Each ExtensionContainer exposes its “schema”: all registered extensions

types keyed by extension name.

This change is backward compatible, existing methods are unchanged and

their contract is to use the instantiated or instance extension type as

public type.

  1. … 4 more files in changeset.
Docs: adding extension with existing name throws

Document that an IllegalArgumentException will be thrown if someone

tries to add an extension with a name that already exists. For

ExtensionContainer#add(..) this behavior is already covered by the test

"cannot replace an extension" in ExtensionContainerTest. Added the same

test for ExtensionContainer#create(..).

  1. … 1 more file in changeset.
Expose ComponentSpec.source() as a node backed model map, instead of a domain object collection wrapped model map.

+review REVIEW-5498

  1. … 39 more files in changeset.
Remove @author tags and names from source code.

- Added checkstyle check for @author

- Added not to CONTRIBUTING.md saying that we don't use names in the codebase

  1. … 1213 more files in changeset.
Rename ExtensionContainer.addDecorated to .create

  1. … 20 more files in changeset.
Rename DynamicPropertiesExtension to ExtraPropertiesExtension.

  1. … 21 more files in changeset.
Rename DynamicExtension to DynamicPropertiesExtension.

  1. … 19 more files in changeset.
Made the dynamic extension an implicit facet of all extension containers.

Previously, it was managed by ExtensibleDynamicObject. This makes it more obvious in the documentation, among other benefits.

  1. … 5 more files in changeset.
Remove several direct instantiations of DefaultConvention, preferring to let DynamicObjectHelper create it.

  1. … 11 more files in changeset.
Deprecate ExtensionContainer.add(String, Class, Object...) as it's too ambigous with add(String, Object), and added addDecorated(String, Class, Object...)

  1. … 6 more files in changeset.
Add ExtensionContainer.add(String name, Class type, Object... constructionArgs) for adding dynamic extensions.

This method is backed by the class generator and the instantiator, meaning that code like:

project.extensions.add("foo", project.services.get(Instantiator).newInstance(Foo, "bar")

can be replaced with:

project.extensions.add("foo", Foo, "bar")

  1. … 9 more files in changeset.
Add ExtensionContainer.add(String name, Class type, Object... constructionArgs) for adding dynamic extensions.

This method is backed by the class generator and the instantiator, meaning that code like:

project.extensions.add("foo", project.services.get(Instantiator).newInstance(Foo, "bar")

can be replaced with:

project.extensions.add("foo", Foo, "bar")

  1. … 9 more files in changeset.
- Changed DefaultConvention to separate the properties and methods contributed to the target object (eg project) from the dynamic properties and methods on the DefaultConvention object itself. Now, only extensions are visible on the DefaultConvention object, as write-once properties. - Convention no longer extends DynamicObject. - Extensions cannot be replaced. - Removed DynamicObjectAware.setConvention().

  1. … 16 more files in changeset.
Fixed inverse use of isAssignableFrom that prevented an extension from being retrieved from the container by an interface that it implements.

  1. … 1 more file in changeset.
GRADLE-1641 Made it possible to find/get extensions. Very useful if one develops plugin in java and wants to access extension instances.

  1. … 3 more files in changeset.
Added basic support for DSL extensions for gradle projects. They work slightly differently then the convention plugins. DSL extensions are namespaced which means they have to be qualified by the extension name. This avoids property/method name clashes. See the examples of usage of the ExtensionContainer in our plugins to get the picture.

    • -0
    • +64
    ./ExtensionContainerTest.groovy
  1. … 6 more files in changeset.