Declares that the associated class declares a ComponentModel The following example demonstrates how to register a custom component using a plugin with a ComponentModel annotation. Furthermore the plugin creates an instance of SampleLibrary named 'sampleLib'.
import org.gradle.model.*
import org.gradle.model.collection.*
interface SampleLibrary extends LibrarySpec {}
class DefaultSampleLibrary extends DefaultLibrarySpec implements SampleLibrary {}
apply plugin: MySamplePlugin
class MySamplePlugin implements Plugin {
void apply(final Project project) {}- RuleSource:
- @ComponentModel(type = SampleLibrary.class, implementation = DefaultSampleLibrary.class)
static class Rules {
- Mutate:
- void createSampleLibraryComponents(NamedItemCollectionBuilder
componentSpecs) {
componentSpecs.create("sampleLib")
}
}
}
| Type | Name and Description |
|---|---|
Class<? extends LibrarySpec> |
implementationDenotes the implementation class of the LibrarySpec. |
Class<? extends LibrarySpec> |
typeDenotes the type of the LibrarySpec. |
Denotes the implementation class of the LibrarySpec.
Denotes the type of the LibrarySpec.