Daz DeBoer

Allow property replacement in version strings in the `plugins` block

Fixes #1697

Allow property replacement in version strings in the `plugins` block

Fixes #1697

Remove short-circuit in `ResourceVersionLister`

Merge pull request #9802 from gradle/dd/plugins-block

Extract plugin requests by invoking the `plugins` block

Polish comment

Fix bug in recursive Ivy confMapping

Provide the line-number of the plugins block when invoking

Remove unused `BuildScriptMetadata`

Execute the `plugins` block in order to extract plugin requests

Previously, we were extracting `PluginRequests` when compiling a build script,

using AST transforms. This prevented any sort of dynamic behaviour within the

plugins block, such as reading plugin versions from a properties file.

This behaviour was by design, and the syntax of the plugins block was explicitly

restricted to ensure the plugin requests were statically defined.

This restricted syntax has been the cause of much user angst, and the expected

benefits of a truly imperative plugins block have not eventuated. Furthermore,

the implementation of `plugins` in the Kotlin DSL does not add the same

restrictions.

With this change, the `plugins` block is actually invoked to extract any plugin

requests. While the restricted syntax remains (for now), this change opens up

the possibility of supporting property replacement for version numbers and other

dynamic behaviour.

One limitation of this change is that the line number of each plugin request

is not captured correctly: the line number is always reportes as 0 for any

request. Several tests are failing due to this limitation.

Record line numbers for each plugin request

When compiling, transform each `id(String)` method call into

`id(String, int)`, allowing the line number to be captured.

As the syntax of the plugins block is still completely restricted,

there is no risk of another `id` method being incorrectly transformed.

If/when we decide to relax the restrictions on syntax, we'll need to

do something smarter here.

Validate plugin request values when invoking plugins block

This is a further change toward allowing the plugins block to support

property replacement or other dynamic features. Instead of validating

the plugin id and version values when compiling the script, we now

perform this validation when these values are extracted, during

invocation of the `plugins` block.

Use AST to record plugin application line numbers

Use AST to record plugin application line numbers

Use AST to record plugin application line numbers

Hacky way to preserve line numbers

Use pluginsBlock line number

Ignore test

imports

Remove spurious println

Disable line number checks (and some other things)

Hacky change to plugins block

Hacky change to plugins block

Hacky change to plugins block

Mention `pluginManagement.plugins` in release notes

    • -0
    • +16
    /subprojects/docs/src/docs/release/notes.md
Mention `pluginManagement.plugins` in release notes

    • -0
    • +16
    /subprojects/docs/src/docs/release/notes.md
Mention `pluginManagement.plugins` in release notes

    • -0
    • +16
    /subprojects/docs/src/docs/release/notes.md
Document `pluginManagement.plugins` in the user guide

  1. … 12 more files in changeset.
Document `pluginManagement.plugins` in the user guide

  1. … 12 more files in changeset.
Document `pluginManagement.plugins` in the user guide

  1. … 12 more files in changeset.
Add `pluginManagement.plugins` to DSL reference

    • -0
    • +3
    /subprojects/docs/src/docs/dsl/org.gradle.plugin.management.PluginManagementSpec.xml