Class VersionCatalogueService

java.lang.Object
io.github.joke.conventionalversion.VersionCatalogueService
All Implemented Interfaces:
org.gradle.api.services.BuildService<VersionCatalogueService.Parameters>

public abstract class VersionCatalogueService extends Object implements org.gradle.api.services.BuildService<VersionCatalogueService.Parameters>
The one calculated catalogue, shared by every project in the build.

A build service because the plugin can now be applied per project: with the settings plugin as the only entry point the single calculation followed from there being one application, and it no longer does.

The sharing is entirely registerIfAbsent: every project builds its own VersionValueSource provider, but only the first is ever stored on this service's parameters, and only a stored provider is ever resolved. One service, one parameter, one provider, one read of git - so this holds no state of its own and needs no lock. Measured rather than assumed: five projects each applying the plugin produce exactly one obtain(), with and without isolated projects.

It does not read git. Its parameter is set from the value source's provider, so the value source remains what Gradle re-executes to decide whether a configuration cache entry is still valid. A service that called git directly would bake the answer into the entry and keep publishing a version derived from an older commit.

  • Constructor Details

    • VersionCatalogueService

      public VersionCatalogueService()
  • Method Details