Skip to content

Add support for customising creation of extensions #137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 3, 2025

Conversation

alexander-yevsyukov
Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov commented Jun 2, 2025

This PR improves the API for creating extensions or Gradle DSL. Previously, only the cll to ExtensionContainer.create(String, Class)method was available. Now it is possible to call other methods of ExtensionContainer.

Changes in details

  • An abstract class AbstractPlugin was introduced to encapsulate the general way of adding extensions and remembering a target to which the plugin is applied.
  • SettingsPlugin now descends from AbstractPlugin.
  • ExtensionSpec was renamed to DslSpec and made open for inheritance. Since it is not longer a data class, it got equals(), hashCode(), and toString().
  • The method DslSpec.createIn() was renamed to findOrCreateIn() because this is what it does.
  • Plugin.extensionParent property was renamed to dslParent.
  • SettingsPlugin now uses the DslSpec for creating the extension it adds.

In details:
 * Add `hashCode()`, `equals()`, and `toString()`.
 * Rename `ExtensionSpec.createIn()` to `findOrCreateIn()`
 *
Also:
 * Rename `extensionParent` property to `dslParent`.
 *
Also:
 * Document the `StubPlugin` class.
@alexander-yevsyukov alexander-yevsyukov self-assigned this Jun 2, 2025
@alexander-yevsyukov alexander-yevsyukov changed the title Open create extension fun Add support for customising creation of extensions Jun 3, 2025
@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review June 3, 2025 17:00
@alexander-yevsyukov alexander-yevsyukov merged commit d82fa67 into master Jun 3, 2025
6 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the open-create-extension-fun branch June 3, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants