Skip to content

Support buildParameters in a build that defines buildParameters (dogfooding scenario) #262

@jjohannes

Description

@jjohannes

If I use a generated build parameters plugin together with this (the meta) plugin, I get an exception:

plugins {
  id("build-parmeters") // a previously generated plugin
  id("org.gradlex.build-parameters") version "1.4.4"
}

This gives:

> Failed to apply plugin 'org.gradlex.build-parameters'.
   > Cannot add extension with name 'buildParameters', as there is an extension already registered with that name.

This is, because the extension to define build parameters and the generated extension to access build parameters are both called buildParameters.

I think this is fine in the commons scenarios where both are used in isolation. To still support the "dogfooding" case, I would suggest to check if the name buildParameters is already used, and if yes, register the extension for defining build parameters under a different name – for example buildParametersDefinition.

https://github.com/gradlex-org/build-parameters/blob/main/src/main/java/org/gradlex/buildparameters/BuildParametersPlugin.java#L44-L45

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions