Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Morfly committed Dec 11, 2023
1 parent 465c2f0 commit d2810f5
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,59 @@ kt_android_library(
)
```
## Feature components
Every feature component is an abstract class that extends the FeatureComponent base class and implements 2 functions, canProcess and onInvoke.

```kotlin
abstract class JetpackComposeFeature : FeatureComponent() {

override fun canProcess(project: Project): Boolean {...}

override fun FeatureContext.onInvoke(module: GradleModule) {...}
}
```
`canProcess` is invoked during the Gradle Configuration phase and is aimed to filter Gradle modules to which this component is applicable.

`onInvoke` is invoked during the Gradle Execution phase and contains the main logic of the component. Its purpose is to modify Bazel files generated by a related module component as well as manage the dependencies of the module.

### Dependency overrides
### Configuration overrides
### Bazel file modifiers
### File modifiers
## Shared components
The purpose of shared components is to enable feature components to contribute into multiple module components.

There could be multiple types of shared components.
- **Shared module component** — receives contributions from every shared feature component, even if it is not directly included in it.
- **Shared feature component** — contributes to every shared module component.
- **Top-level feature component** — does not belong to any module component specifically and contributes to all module components, even non-shared ones.

- This is how they are declared in a Gradle plugin.

```kotlin
// root build.gradle.kts
airin {
register<AndroidLibraryModule> {
// shared feature component
include<HiltFeature> { shared = true }
}

// shared module component
register<RootModule> { shared = true }

// top-level feature component
include<AllPublicFeature>()
}
```
Let's analyze the example above.
- `HiltFeature` - configures Hilt for a Bazel module.
- Contributes to `AndroidLibraryModule` because they are directly connected.
- Contributes to `RootModule` because they are both shared.
- `AllPublicFeature`
- contributes to `AndroidLibraryModule` and `RootModule` because it's a top-level feature component.


## Properties
### Shared properties

## Decorators

## License
Expand Down

0 comments on commit d2810f5

Please sign in to comment.