From c4be449ae3c886cc99b84a93f0a6a88f9768053f Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 16 Feb 2016 19:18:03 -0800 Subject: [PATCH] Indent. --- plug-in-development/index.html | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/plug-in-development/index.html b/plug-in-development/index.html index a814660..c48bfbf 100644 --- a/plug-in-development/index.html +++ b/plug-in-development/index.html @@ -275,35 +275,35 @@ interface IProjectAffinity { */ fun affinity(project: Project, context: KobaltContext) : Int } -

- For example, the JavaPlugin implements the ICompilerContributor interface and then overrides - the affinity() method to make sure it gets run for Java projects but ignored for others: -

+

+For example, the JavaPlugin implements the ICompilerContributor interface and then overrides +the affinity() method to make sure it gets run for Java projects but ignored for others: +

 override fun affinity(project: Project, context: KobaltContext) =
 if (project.sourceSuffix == ".java") 1 else 0
-

Directives

-

- Directives are functions that users of your plug-in can use in their build file in order to configure your plug-in. These can be any kind of Kotlin function but in the interest of preserving a clean syntax in the build file, it's recommended to use the type safe builder pattern, as described here. -

-

- Imagine that you want to offer a boolean parameter publish to users of your plug-in, you start by creating a class to hold that parameter: -

+

Directives

+

+Directives are functions that users of your plug-in can use in their build file in order to configure your plug-in. These can be any kind of Kotlin function but in the interest of preserving a clean syntax in the build file, it's recommended to use the type safe builder pattern, as described here. +

+

+Imagine that you want to offer a boolean parameter publish to users of your plug-in, you start by creating a class to hold that parameter: +

 class Info(val publish: Boolean)
 
-

- Next, you create a directive that returns such a class and which also allows to configure it via the type safe builder pattern: -

+

+Next, you create a directive that returns such a class and which also allows to configure it via the type safe builder pattern: +

 @Directive
 public fun myConfig(init: Info.() -> Unit) = Info().apply { init() }
-

- The @Directive annotation is not enforced but you should always use it in order to help future tools (e.g. an IDEA plug-in) identify Kobalt directives so they can be treated differently from regular Kotlin functions. The code above defines a myConfig function that accepts a closure as an argument. It creates an Info - object, calls the init() function on it (which runs all the code inside that closure) and then return that Info object. -

-

- Users can now specify the following in their build file: +

+The @Directive annotation is not enforced but you should always use it in order to help future tools (e.g. an IDEA plug-in) identify Kobalt directives so they can be treated differently from regular Kotlin functions. The code above defines a myConfig function that accepts a closure as an argument. It creates an Info +object, calls the init() function on it (which runs all the code inside that closure) and then return that Info object. +

+

+Users can now specify the following in their build file:

 // Build.kt