Plugin extension is ignored when plugin is applied in "plugins" block

I'm used to applying semver-ci in the plugins block. I can't move it outside the block because sometimes I'm applying other plugins that need to know the version at an early stage (e.g. because they're creating publication variants with custom capabilities, each of which is a full set of GAV coordinates).

In these circumstances the semver plugin extension is useless, because it doesn't get read until after everything in the plugins block has been applied. And reading it in an afterEvaluate would interfere with other plugins that need to know the version early.

Attached is a tiny project that presumably doesn't use Git Flow, because it wants its dev branch to be master.

I ran this, simulating a GitLab CI build:

ejj@pipistrelle asdf % export GITLAB_CI=true
ejj@pipistrelle asdf % export CI_COMMIT_REF_NAME=master
ejj@pipistrelle asdf % export CI_PIPELINE_ID=123456
ejj@pipistrelle asdf % gw printVersion                 
Using gradle at '/tmp/asdf/gradlew' to run buildfile '/tmp/asdf/build.gradle.kts':


> Task :printVersion
Project version is 1.0.0-ci.master.123456.

It should have printed Project version is 1.0.0-dev.123456.

Suggestion: remove the plugin extension and read some project properties from gradle.properties instead.