IssueRaiser

Make generated type-safe version catalogs accessors accessible from precompiled script plugins

### Context In a similar way to #15382, we want to make the version catalogs accessible to precompiled script plugins. Naively, one might think that it's easier to do because precompiled script plugins are applied to the "main" build scripts, but this isn't necessarily the case: - first, precompiled script plugins can be _published too_, meaning that they are no different from regular plugins in practice - second, precompiled script plugins can be declared in included builds, not just _buildSrc_ Therefore, the "version catalog" that a precompiled script plugin should see cannot be the catalog declared in the "main build". It cannot be, either, the catalog declared in the project which itself declares the precompiled script plugin (typically the settings file of the `buildSrc` project): in particular, the catalogs declared in `buildSrc/settings.gradle` are for the build logic of `buildSrc` itself, not for the "main" build. As a consequence, we cannot guarantee that if we expose the accessors of the main build, somehow, to the precompiled script plugins, it would work when the plugin is applied. One option to solve this problem is to have a section in the build script which defines precompiled script plugins to declare the "target version catalogs". That is to say, we explicitly declare what the expected "schema" is when the plugin will effectively be applied. It's then the build authors responsibility to make sure that it is effectively the case, by sharing the same catal

Posted by melix on Dec 1, 2020, 7:40 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

github (Other)

Make generated type-safe version catalogs accessors accessible from precompiled script plugins

melixDec 1, 2020, 7:40 AM

### Context In a similar way to #15382, we want to make the version catalogs accessible to precompiled script plugins. Naively, one might think that it's easier to do because precompiled script plugins are applied to the "main" build scripts, but this isn't necessarily the case: - first, precompiled script plugins can be _published too_, meaning that they are no different from regular plugins in practice - second, precompiled script plugins can be declared in included builds, not just _buildSrc_ Therefore, the "version catalog" that a precompiled script plugin should see cannot be the catalog declared in the "main build". It cannot be, either, the catalog declared in the project which itself declares the precompiled script plugin (typically the settings file of the `buildSrc` project): in particular, the catalogs declared in `buildSrc/settings.gradle` are for the build logic of `buildSrc` itself, not for the "main" build. As a consequence, we cannot guarantee that if we expose the accessors of the main build, somehow, to the precompiled script plugins, it would work when the plugin is applied. One option to solve this problem is to have a section in the build script which defines precompiled script plugins to declare the "target version catalogs". That is to say, we explicitly declare what the expected "schema" is when the plugin will effectively be applied. It's then the build authors responsibility to make sure that it is effectively the case, by sharing the same catal

Comments (0)

No comments yet. Start the discussion.

Comment on this issue