Files
amethyst/.claude/skills/gradle-expert/references/build-commands.md
T
2025-12-30 15:45:02 +02:00

5.5 KiB

Build Commands Reference

Table of Contents

Core Build Tasks

Full Project Build

./gradlew build                    # Build all modules
./gradlew clean build              # Clean build
./gradlew assemble                 # Build without tests

Incremental Builds

./gradlew :quartz:build            # Build only quartz module
./gradlew :commons:build           # Build only commons module
./gradlew :desktopApp:build        # Build only desktop app

Module-Specific Builds

Quartz (KMP Library)

./gradlew :quartz:build                           # All targets
./gradlew :quartz:compileKotlinJvm                # JVM target only
./gradlew :quartz:compileDebugKotlinAndroid       # Android target only
./gradlew :quartz:linkDebugFrameworkIosArm64      # iOS framework
./gradlew :quartz:publishToMavenLocal             # Publish locally

Commons (Shared UI)

./gradlew :commons:build                          # All targets
./gradlew :commons:compileKotlinJvm               # Desktop target
./gradlew :commons:compileDebugKotlinAndroid      # Android target

Desktop Tasks

Run Desktop App

./gradlew :desktopApp:run                         # Run desktop app
./gradlew :desktopApp:runDistributable            # Run packaged version

Package Desktop App

./gradlew :desktopApp:createDistributable         # Create runnable package
./gradlew :desktopApp:packageDmg                  # macOS DMG
./gradlew :desktopApp:packageMsi                  # Windows MSI
./gradlew :desktopApp:packageDeb                  # Linux DEB

Distribution Location

  • macOS: desktopApp/build/compose/binaries/main/dmg/
  • Windows: desktopApp/build/compose/binaries/main/msi/
  • Linux: desktopApp/build/compose/binaries/main/deb/

Android Tasks

Compile & Assemble

./gradlew :amethyst:assembleDebug                 # Debug APK
./gradlew :amethyst:assembleRelease               # Release APK
./gradlew :amethyst:bundleRelease                 # Release AAB

Install & Run

./gradlew :amethyst:installDebug                  # Install debug on device
adb shell am start -n com.vitorpamplona.amethyst/.MainActivity

Proguard/R8

./gradlew :quartz:minifyReleaseWithR8             # Test R8 minification

Testing

Unit Tests

./gradlew test                                    # All unit tests
./gradlew :quartz:jvmTest                         # JVM unit tests
./gradlew :quartz:testDebugUnitTest               # Android unit tests
./gradlew :commons:test                           # Commons tests

Android Instrumented Tests

./gradlew :quartz:connectedAndroidTest            # Requires device/emulator

Test Reports

# Reports location: <module>/build/reports/tests/
open quartz/build/reports/tests/jvmTest/index.html

Analysis & Diagnostics

Dependency Analysis

./gradlew dependencies                            # All dependencies
./gradlew :quartz:dependencies                    # Quartz dependencies
./gradlew dependencyInsight --dependency okhttp   # Specific dependency

Build Scan

./gradlew build --scan                            # Upload to scans.gradle.com

Performance Profiling

./gradlew build --profile                         # Generate profile report
# Report: build/reports/profile/profile-<timestamp>.html

Task Dependencies

./gradlew :desktopApp:run --dry-run               # Show task graph
./gradlew :desktopApp:dependencies --scan         # Visualize dependencies

Performance Optimization

Configuration Cache

./gradlew build --configuration-cache             # Enable config cache
./gradlew build --configuration-cache-problems=warn

Build Cache

./gradlew build --build-cache                     # Enable build cache
./gradlew cleanBuildCache                         # Clear build cache

Parallel Execution

./gradlew build --parallel --max-workers=8        # Parallel with 8 workers

Daemon Management

./gradlew --stop                                  # Stop Gradle daemon
./gradlew --status                                # Daemon status

Incremental Compilation

# Already enabled by default in Kotlin, but can verify:
./gradlew :quartz:compileKotlinJvm --info | grep "Incremental"

gradle.properties Optimizations

Add to gradle.properties for faster builds:

# Daemon
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g

# Parallel
org.gradle.parallel=true
org.gradle.workers.max=8

# Caching
org.gradle.caching=true
org.gradle.configuration-cache=true

# Kotlin
kotlin.incremental=true
kotlin.daemon.jvmargs=-Xmx2g

Common Workflows

Full Desktop Build & Run

./gradlew :desktopApp:clean :desktopApp:run

Quick Desktop Iteration

# No clean - incremental compilation
./gradlew :desktopApp:run

Android Release Build

./gradlew :amethyst:clean :amethyst:bundleRelease

Test All KMP Targets

./gradlew :quartz:test :quartz:testDebugUnitTest

Publish Quartz Locally for Testing

./gradlew :quartz:publishToMavenLocal
# Then update version in consumer project to test