diff --git a/plug-in-development/index.html b/plug-in-development/index.html index 851afdf..cfa9a4e 100644 --- a/plug-in-development/index.html +++ b/plug-in-development/index.html @@ -94,7 +94,7 @@

All plug-in actors are interfaces that extend IPluginActor. Plug-ins extend IPlugin, - interceptors extend IInterceptor and contributors extend IContributor. When Kobalt parses your + interceptors extend IInterceptor and contributors extend IContributor. When Kobalt parses your kobalt-plugin.xml, it instantiates all the classes found in the <plugin-actors> tag and then introspects them to find out which IPluginActor interfaces that class implements. @@ -130,52 +130,54 @@ Description - IBuildDirectoryInterceptor - IInterceptor + IBuildDirectoryInterceptor + IInterceptor Plug-ins that need to generate class files in a different directory than the default one should implement this interface. - IClasspathContributor - IContributor + IClasspathContributor + + IContributor Classpath contributors let you specify additional jar files or directories that will be used by the "compile" task. - IClasspathInterceptor - IInterceptor + IClasspathInterceptor + + IInterceptor Plug-ins that want to modify the classpath before Kobalt uses it should implement this interface. - ICompilerContributor - IContributor + ICompilerContributor + IContributor Plug-ins that know how to turn files into bytecodes should implement this interface. - ICompilerInterceptor - IInterceptor + ICompilerInterceptor + IInterceptor Plug-ins that implement this interface get a chance to alter the dependencies of a project (dependencies{}, dependenciesTest{}, ...) before Kobalt sees them. - IDocContributor - IContributor + IDocContributor + IContributor Plug-ins that know how to generate documentation out of source files should implement this interface. - IInitContributor - IContributor + IInitContributor + IContributor Kobalt supports the --init command line parameter, which generates a default build file based on the files found in the current directory. Any plug-in that wants to be part of this process need to implement this interface. In this case, both the Java and Kotlin plug-ins define such a contributor @@ -183,15 +185,15 @@ - IProjectContributor - IContributor + IProjectContributor + IContributor Some plug-ins produce projects (Java, Kotlin) while others don't (Packaging, Application, etc...). The ones that do need to register themselves as project contributors. This is how Kobalt collects all the projects defined after a build file was parsed. - IRepoContributor - IContributor + IRepoContributor + IContributor Some plug-ins might want to add their own repository to the list of repositories that Kobalt already supports. This is the case of the Android plug-in which, once the ANDROID_HOME environment variable has been @@ -200,22 +202,24 @@ - ISourceDirectoryInterceptor - IInterceptor + + ISourceDirectoriesInterceptor + IInterceptor Plug-ins that wamt to add, remove or alter the source directories should implement this interface. - IRunnerContributor - IContributor + IRunnerContributor + IContributor Plug-ins that can operate when the "run" task gets invoked should implement that interface. - ITestRunnerContributor - IContributor + + ITestRunnerContributor + IContributor Plug-ins that can operate when the "test" task gets invoked should implement that interface. @@ -256,7 +260,8 @@ class JavaBuildGenerator: IInitContributor {

Several plug-ins might want to contribute to a specific task where only one participant only should be allowed, such as running tests or generating documentation. Even the simple task of compiling should probably only - ever be performed by no more than one plug-in. Therefore, when comes the time to compile a project, + ever be performed by no more than one plug-in for a given project. Therefore, when comes the time to + compile a project, Kobalt needs to find which plug-in is the most suitable for that task and pick it. In order to do that, plug-ins that contribute to tasks that can only be performed by one candidate need to declare their affinity to that task for a given project. @@ -266,14 +271,15 @@ class JavaBuildGenerator: IInitContributor {

 interface IAffinity {
-/**
- * @return an integer indicating the affinity of your actor for the given project. The actor that returns
- * the highest affinity gets selected.
- */
-fun affinity(project: Project, context: KobaltContext) : Int
+ /** + * @return an integer indicating the affinity of your actor for the given project. + * The actor that returns the highest affinity gets selected. + */ + 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: + the affinity() method to make sure it gets run for Java projects but ignored for others:

 override fun affinity(project: Project, context: KobaltContext) =