diff --git a/plug-in-development/index.html b/plug-in-development/index.html index 86c12f8..a258218 100644 --- a/plug-in-development/index.html +++ b/plug-in-development/index.html @@ -58,10 +58,10 @@ Kobalt plug-ins are usually made of several parts:
kotlinProject
or dependencies
. These functions typically configure some data that your plug-in will later use to perform its functions.kotlinProject
or dependencies
. These functions typically configure some data that your plug-in will later use to perform its functions.
+ Properties are the mechanism that plug-ins can use to export values and also read values that other
+ plug-ins have exported. The PluginProperties
instance can be found on the KobaltContext
+ object that your plug-in receives in its apply()
method. Once you have an instance of this
+ class, you can read or write variables into it:
+
+override fun apply(project: Project, context: KobaltContext) { + // Export a property for other plug-ins to use + context.pluginProperties.put(name, BUILD_DIR, project.buildDirectory) + + // Read a property from another plug-in + val sourceDir = context.pluginProperties.get("somePlugin", "someProperty") +} ++
+ Plug-ins that define properties should annotate them with the @ExportedProperty
annotation:
+
+ companion object { + @ExportedProperty + const val BUILD_DIR = "buildDir" ++