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.

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 in a worker with an isolated class loader over TOOLS_CONFIGURATION: the plugin itself depends on the KSP Gradle plugin only, 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.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Functions

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