Skip to main content

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

id("com.nomanr.plugin.lumo")

Implementation

Package: com.nomanr.lumo.plugin Class: LumoGradlePlugin The plugin automatically registers a task named lumo on the root project when applied.
class LumoGradlePlugin : Plugin<Project> {
    override fun apply(project: Project) {
        val rootProject = project.rootProject
        rootProject.tasks.register(TASK_NAME, LumoTask::class.java)
    }
}
Location: 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

--init
boolean
default:"false"
Initialize the Lumo UI Plugin by creating the default lumo.properties configuration file.
--setup
boolean
default:"false"
Setup the theme component to get started and verify your configurations are correct.
--required-deps
boolean
default:"false"
Display the required dependencies that need to be added to your build.gradle.kts file.
--plugin-help
boolean
default:"false"
Display help message for the Lumo UI Plugin with all available options.
--add
string
Add a specific Lumo UI component by name (e.g., Button, TextField, Card).
--add-all
boolean
default:"false"
Add all available Lumo UI components to your project at once.
--available-components
boolean
default:"false"
List all available components that can be generated.

Usage Example

# Initialize the plugin
./gradlew lumo --init

# Setup theme and verify configuration
./gradlew lumo --setup

# Add a specific component
./gradlew lumo --add Button

# List all available components
./gradlew lumo --available-components

# Add all components
./gradlew lumo --add-all

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
themeName
String
required
The name of your application theme (e.g., AppTheme).
componentsDir
String
required
Relative path from the project root to the components directory where files will be generated.
packageName
String
required
The package name for generated component files.
kotlinMultiplatform
Boolean
default:"false"
Enable Kotlin Multiplatform support for component generation.

PropertyLoader

Handles loading and creating the lumo.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

loadProperties
LumoConfig
Loads the configuration from lumo.properties file. Throws LumoException if the file doesn’t exist or required properties are missing.
createDefaultPropertiesFile
void
Creates a default lumo.properties file in the project root with placeholder values.
hasPropertiesFile
Boolean
Checks if the lumo.properties file exists in the project root.
configFilePath
String
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

validate
Boolean
Validates that:
  • The components directory exists
  • The directory path matches the package name structure
  • Package names with backticks are properly normalized
Returns 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

init
void
Initializes the plugin by creating the default configuration file and displaying required dependencies.
validateConfigs
Boolean
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

execute(componentName: String)
void
Generates a component by name. Throws LumoException if the component name is invalid.
execute(component: SupportedComponents)
void
Generates a component using the enum value.
executeAll
void
Generates all available components.
printAllAvailableComponents
void
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

rootDir
File
required
The root directory of the project.
config
LumoConfig
required
The plugin configuration.

Methods

validateAndGenerate
void
Validates and generates a component with all its dependencies and supporting files. Handles both common and platform-specific files for Kotlin Multiplatform projects.
generateAll
void
Generates all components available in the template provider.

Properties

templateProvider
TemplateProvider
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

getTemplate
Template
Returns the template for a specific component.
getFlattenedTemplate
Template
Returns a template with all dependencies flattened and resolved into supporting files.
getAllComponents
List<SupportedComponents>
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
componentFiles
List<String>
required
List of main component file paths relative to the template directory.
supportingFiles
List<String>
default:"emptyList()"
List of supporting files required by the component.
dependsOn
List<SupportedComponents>
default:"emptyList()"
List of component dependencies that will be included as supporting files.
platformSpecificFiles
Map<MultiplatformSourceSet, List<String>>
default:"emptyMap()"
Platform-specific component files for Kotlin Multiplatform projects.
platformSpecificSupportingFiles
Map<MultiplatformSourceSet, List<String>>
default:"emptyMap()"
Platform-specific supporting files for Kotlin Multiplatform projects.
requirements
String?
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

  • Accordion
  • AlertDialog
  • Badge
  • Button
  • Card
  • Checkbox
  • Chip
  • Divider
  • Icon
  • IconButton
  • ModalBottomSheet
  • NavigationBar
  • OTPTextField
  • ProgressIndicators
  • RadioButton
  • Scaffold
  • Slider
  • Surface
  • Snackbar
  • Switch
  • SystemBars
  • Text
  • TextField
  • Theme
  • Tooltip
  • TopBar

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

printFormattedDependencies
void
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

error
void
Logs an error message in red.
warn
void
Logs a warning message in yellow.
success
void
Logs a success message in green.
info
void
Logs an info message in blue.
debug
void
Logs a debug message in cyan.
log
void
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 templates
  • templates/multiplatform/ - Multiplatform templates
Template files use placeholders:
  • {{packageName}} - Replaced with the configured package name
  • {{themeName}} - Replaced with the configured theme name

Configuration Extension

The LumoConfig data class can be extended to support additional configuration options by modifying the PropertyLoader class.

Component Registry

New components can be added by:
  1. Adding the component to the SupportedComponents enum
  2. Creating template files in the appropriate template directory
  3. Registering the template in AndroidTemplates, MultiplatformTemplates, or CommonTemplates

Maven Coordinates

id("com.nomanr.plugin.lumo") version "1.2.5"
Group: com.nomanr Artifact: lumo Latest Version: 1.2.5 Repository: Maven Central

See Also

Build docs developers (and LLMs) love