Skip to content

Plugin Configuration

Complete reference for configuring the Fakt Gradle plugin.


Complete Configuration Reference

All available configuration options in your module’s build.gradle.kts:

// build.gradle.kts
import com.rsicarelli.fakt.compiler.api.LogLevel

plugins {
    alias(libs.plugins.fakt)
}

fakt {
    // Enable or disable the plugin (default: true)
    enabled.set(true)

    // Control logging verbosity (default: INFO)
    logLevel.set(LogLevel.INFO)  // Options: QUIET, INFO, DEBUG

    // Multi-module: Collect fakes from another module (default: not set)
    @OptIn(com.rsicarelli.fakt.compiler.api.ExperimentalFaktMultiModule::class)
    collectFakesFrom(projects.core.analytics)
}

Configuration Properties

FlagDefaultExample
enabled true
fakt {
    enabled.set(false)
}
logLevel INFO
fakt {
    logLevel.set(LogLevel.DEBUG)
}
collectFrom Not set
fakt {
    @OptIn(ExperimentalFaktMultiModule::class)
    collectFakesFrom(projects.core.analytics)
}

Log Level Details

LevelDescriptionExample
INFO
(default)
Concise summary with key metrics. Use for local development and monitoring cache effectiveness.
fakt {
    logLevel.set(LogLevel.INFO)
}
Output:
Fakt: 101 fakes generated in 35ms (50 cached)
  Interfaces: 101 | Classes: 0
  FIR: 6ms | IR: 29ms
  Cache: 50/101 (49%)
DEBUG Detailed FIR + IR phase timing. Use for troubleshooting, performance analysis, and bug reports.
fakt {
    logLevel.set(LogLevel.DEBUG)
}
Output:
Registering FIR extension
Registering IR extension with FIR metadata access
Built IR class map with 149 classes
FIR→IR Transformation (interfaces: 101/101, took 1ms)
FIR + IR trace
├─ Total FIR time: 6ms
├─ Total IR time: 58ms
│  ├─ FIR analysis: 1 type parameters, 6 members (55µs)
│  └─ IR generation: FakeDataCacheImpl 83 LOC (766µs)
│  ├─ FIR analysis: 2 type parameters, 1 members (23µs)
│  └─ IR generation: FakeMapTransformerImpl 23 LOC (335µs)
QUIET No output except errors. Use for CI/CD pipelines and production builds.
fakt {
    logLevel.set(LogLevel.QUIET)
}
Output: None (silent)

Multi-Module Configuration

ModeExample
Type-safe accessor
fakt {
    @OptIn(ExperimentalFaktMultiModule::class)
    collectFakesFrom(projects.core.analytics)
}
String-based path
fakt {
    @OptIn(ExperimentalFaktMultiModule::class)
    collectFakesFrom(project(":core:analytics"))
}

For complete multi-module documentation, see Multi-Module Guide.


IDE Integration

IntelliJ IDEA / Android Studio

Generated fakes appear in build/generated/fakt/ and are automatically indexed.

Enable K2 Mode for better autocomplete:

  1. SettingsLanguages & FrameworksKotlin
  2. Enable K2 mode
  3. Restart IDE

K2 mode improves factory function autocomplete and type inference.

Generated Sources Location

Source Set Generated Output
commonTest/ build/generated/fakt/commonTest/kotlin/
jvmTest/ build/generated/fakt/jvmTest/kotlin/
iosTest/ build/generated/fakt/iosTest/kotlin/
androidUnitTest/ build/generated/fakt/androidUnitTest/kotlin/

Next Steps