Contributing
Development Setup
Requirements: - JDK 17+ - Gradle (via wrapper)
Project Structure
aspectk/
├── aspectk-runtime/ # Public API: @Aspect, @Before, @After, @Around, JoinPoint
├── aspectk-core/ # Compiler plugin implementation (K2 IR)
├── aspectk-core-compat/ # Per-Kotlin-version shims for compiler-internal APIs
├── aspectk-plugin/ # Gradle plugin
├── aspectk-core-tests/ # Multiplatform integration tests
├── buildSrc/ # Convention plugins and build logic
└── sample/ # Compose Multiplatform sample app
Running Tests
# All tests
./gradlew test
# Compiler plugin tests
./gradlew :aspectk-core:test
# Multiplatform integration tests (JVM)
./gradlew :aspectk-core-tests:jvmTest
# Full check (tests + formatting)
./gradlew check
Code Style
AspectK uses ktlint via Spotless:
All .kt and .kts files require the Apache 2.0 license header (see spotless/LICENSE.txt).
Making Changes
- Fork the repository and create a branch from
main - Make your changes with tests
- Run
./gradlew checkto make sure tests and formatting pass - Open a Pull Request
IR Transformation Pipeline
- K2 calls
AdviceGenerationExtension.generate()once per module AspectVisitorscans the IR for@Aspectobjects and fillsAspectLookUp- Hints from earlier builds and from upstream modules are merged into
AspectLookUp InheritableVisitorrecords overrides for advice declared withinherits = trueAspectTransformerwalks every function and injects advice into the ones that match- The generators (
MethodSignatureGenerator,JoinPointGenerator,ProceedingJoinPointGenerator,AdviceCallGenerator) produce the IR nodes
The architecture overview covers each stage in
detail. To add a new advice type, start from AspectTransformer and AdviceCallGenerator.
Reporting Issues
Open an issue at GitHub Issues and include: - Kotlin version - AspectK version - Minimal reproduction case - Expected vs actual behavior