Overview
The Lumo UI Gradle Plugin provides a CLI-based component generation system for Jetpack Compose projects. It allows you to generate and customize UI components through Gradle tasks.LumoGradlePlugin
The main plugin class that registers the Lumo task in your Gradle project.Plugin ID
Implementation
Package:com.nomanr.lumo.plugin
Class: LumoGradlePlugin
The plugin automatically registers a task named lumo on the root project when applied.
lumo-ui/plugin/src/main/java/com/nomanr/lumo/plugin/LumoGradlePlugin.kt:6
Core Classes
LumoTask
The main Gradle task that handles all plugin operations. Package:com.nomanr.lumo.plugin
Class: LumoTask
Extends: DefaultTask
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/plugin/LumoTask.kt:16
Task Options
Initialize the Lumo UI Plugin by creating the default
lumo.properties configuration file.Setup the theme component to get started and verify your configurations are correct.
Display the required dependencies that need to be added to your
build.gradle.kts file.Display help message for the Lumo UI Plugin with all available options.
Add a specific Lumo UI component by name (e.g.,
Button, TextField, Card).Add all available Lumo UI components to your project at once.
List all available components that can be generated.
Usage Example
LumoConfig
Data class representing the plugin configuration. Package:com.nomanr.lumo.plugin.configs
Class: LumoConfig
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/plugin/configs/LumoConfig.kt:3
The name of your application theme (e.g.,
AppTheme).Relative path from the project root to the components directory where files will be generated.
The package name for generated component files.
Enable Kotlin Multiplatform support for component generation.
PropertyLoader
Handles loading and creating thelumo.properties configuration file.
Package: com.nomanr.lumo.plugin.configs
Class: PropertyLoader
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/plugin/configs/PropertyLoader.kt:10
Methods
Loads the configuration from
lumo.properties file. Throws LumoException if the file doesn’t exist or required properties are missing.Creates a default
lumo.properties file in the project root with placeholder values.Checks if the
lumo.properties file exists in the project root.Returns the formatted file path to the configuration file.
ConfigurationValidator
Validates the plugin configuration before generating components. Package:com.nomanr.lumo.plugin.configs
Class: ConfigurationValidator
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/plugin/configs/ConfigurationValidator.kt:7
Methods
Validates that:
- The components directory exists
- The directory path matches the package name structure
- Package names with backticks are properly normalized
true if validation passes, false otherwise.Initialiser
Handles plugin initialization and configuration validation. Package:com.nomanr.lumo.plugin.actions
Class: Initialiser
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/plugin/actions/Initialiser.kt:8
Methods
Initializes the plugin by creating the default configuration file and displaying required dependencies.
Validates the current configuration and returns whether it’s valid.
GenerateComponent
Handles component generation operations. Package:com.nomanr.lumo.plugin.actions
Class: GenerateComponent
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/plugin/actions/GenerateComponent.kt:10
Methods
Generates a component by name. Throws
LumoException if the component name is invalid.Generates a component using the enum value.
Generates all available components.
Prints a list of all available components to the console.
ComponentGenerator
Core component generation logic with template processing. Package:com.nomanr.lumo.plugin.template
Class: ComponentGenerator
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/plugin/template/ComponentGenerator.kt:13
Constructor Parameters
The root directory of the project.
The plugin configuration.
Methods
Validates and generates a component with all its dependencies and supporting files. Handles both common and platform-specific files for Kotlin Multiplatform projects.
Generates all components available in the template provider.
Properties
Provides access to component templates based on the project type (Android or Multiplatform).
TemplateProvider
Provides component templates and handles dependency resolution. Package:com.nomanr.lumo.plugin.template.templateregistry
Class: TemplateProvider
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/plugin/template/templateregistry/TemplateProvider.kt:3
Methods
Returns the template for a specific component.
Returns a template with all dependencies flattened and resolved into supporting files.
Returns a list of all available components.
Template
Data class representing a component template. Package:com.nomanr.lumo.plugin.template.templateregistry
Class: Template
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/plugin/template/templateregistry/Template.kt:3
List of main component file paths relative to the template directory.
List of supporting files required by the component.
List of component dependencies that will be included as supporting files.
Platform-specific component files for Kotlin Multiplatform projects.
Platform-specific supporting files for Kotlin Multiplatform projects.
Additional requirements or instructions displayed after generation.
SupportedComponents
Enum of all supported components. Package:com.nomanr.lumo.plugin.template.templateregistry
Enum: SupportedComponents
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/plugin/template/templateregistry/SupportedComponents.kt:3
Available Components
AccordionAlertDialogBadgeButtonCardCheckboxChipDividerIconIconButtonModalBottomSheetNavigationBarOTPTextFieldProgressIndicatorsRadioButtonScaffoldSliderSurfaceSnackbarSwitchSystemBarsTextTextFieldThemeTooltipTopBar
PluginDependencyProvider
Provides required dependencies for Android and Multiplatform projects. Package:com.nomanr.lumo.provider
Class: PluginDependencyProvider
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/provider/PluginDependencyProvider.kt:5
Methods
Prints formatted dependency declarations based on whether the project uses Kotlin Multiplatform.
Logger
Provides colored logging output for the plugin. Package:com.nomanr.lumo.utils
Class: Logger
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/utils/Logger.kt:3
Methods
Logs an error message in red.
Logs a warning message in yellow.
Logs a success message in green.
Logs an info message in blue.
Logs a debug message in cyan.
Logs a plain message without coloring.
LumoException
Custom exception class for plugin errors. Package:com.nomanr.lumo.exceptions
Class: LumoException
Location: lumo-ui/plugin/src/main/java/com/nomanr/lumo/exceptions/LumoException.kt:6
All error messages from LumoException are displayed in red for better visibility.
Extension Points
The plugin is designed with extension points for customization:Template Customization
Templates are stored in the plugin resources under:templates/android/- Android-specific templatestemplates/multiplatform/- Multiplatform templates
{{packageName}}- Replaced with the configured package name{{themeName}}- Replaced with the configured theme name
Configuration Extension
TheLumoConfig data class can be extended to support additional configuration options by modifying the PropertyLoader class.
Component Registry
New components can be added by:- Adding the component to the
SupportedComponentsenum - Creating template files in the appropriate template directory
- Registering the template in
AndroidTemplates,MultiplatformTemplates, orCommonTemplates
Maven Coordinates
com.nomanr
Artifact: lumo
Latest Version: 1.2.5
Repository: Maven Central