WowPlugin

class WowPlugin : Plugin<Project>

me.ahoo.wow: builds a domain module (DomainRole.domain). It needs the Kotlin JVM plugin (kotlin("jvm")), also for a module of Java sources only: KSP processes the module's Java sources within the Kotlin compilation, and the models it generates are Kotlin. A module that applies this plugin without it fails to configure, naming the fix, instead of building without models. It

  • adds platform("me.ahoo.wow:wow-bom:<plugin version>") and me.ahoo.wow:wow-kernel to implementation, the kernel unless the module declares it itself, so the module's other Wow dependencies take no version;

  • applies KSP with wow-compiler of the plugin's version (unless ksp declares wow-compiler itself) in generate mode, so the module's aggregates compile into models and its Manifest fragment (META-INF/wow/manifest/<module>.json, the module named by its project path, fragmentName);

  • registers GENERATE_FRAGMENT_TASK (GenerateManifestFragment), which completes the fragment with the schemas Jackson introspection gives; the completed fragment is part of the module's resources in place of the compiler's. A module whose compiler writes no fragment (no model, no processor) contributes nothing;

  • registers GENERATE_CONTRACT_TASK (GenerateContract), which filters the completed fragment down to the peer contract of the module's contexts, offered as the variant CONTRACT_ELEMENTS (empty for a module of no fragment), which an api module declares in CONTRACT_CONFIGURATION (me.ahoo.wow.api, WowApiPlugin); the task fails, naming the line to add, when the classes of a context are in a project that does not pair with the module, and when the module has a context and no WowExtension.contractPackage, the package of its generated code.

It needs Gradle MIN_GRADLE or later and the Kotlin Gradle plugin minKotlin or later, and fails naming both versions otherwise. A failure names the projects and modules involved, not their build directories. No plugin configures another project: a domain module and its api module each configure themselves, so the build may use Gradle's isolated projects; the configuration cache is supported.

Every task that reads or writes a Manifest runs its work over TOOLS_CONFIGURATION, never on the build script's class path: the plugin's jar depends on nothing, so it brings no Wow module, Jackson, victools or Kotlin reflection to the build script, and a build of Wow itself can include it to apply it. GenerateManifestFragment loads the module's compiled classes, so its worker is a process on the module's Java toolchain (a module that compiles for a JDK newer than the one that runs Gradle builds); the others read Manifests and contracts as files, and run in a worker with an isolated class loader in Gradle's JVM. It applies KSP by its id and refers to none of its classes: the markers of me.ahoo.wow and me.ahoo.wow.service bring the KSP Gradle plugin, me.ahoo.wow.api's does not, so the api plugin on a root build's class path leaves a 9.x module of a staged migration free to apply KSP of its own version.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun apply(project: Project)