Contributing
Thank you for your interest in contributing to AspectK!
Development Setup
Requirements: - JDK 17+ - Gradle (via wrapper)
Project Structure
aspectk/
├── aspectk-runtime/ # Public API: @Aspect, @Before, JoinPoint, etc.
├── aspectk-core/ # Compiler plugin implementation (K2 IR)
├── aspectk-plugin/ # Gradle plugin
├── aspectk-core-tests/ # Multiplatform integration tests
├── buildSrc/ # Convention plugins and build logic
└── sample/ # Example projects
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 ensure tests and formatting pass - Open a Pull Request
IR Transformation Pipeline
The compiler plugin works as follows:
AdviceGenerationExtension.generate()is called by K2AspectVisitorscans IR for@Aspectclasses → populatesAspectLookUpAspectTransformerwalks IR functions, prepends advice calls for matching functions- Generators (
MethodSignatureGenerator,JoinPointGenerator,AdviceCallGenerator) produce IR nodes
When adding new advice types (@After, @Around), start from AspectTransformer and
add the corresponding injection logic.
Reporting Issues
Please open issues at GitHub Issues. Include: - Kotlin version - AspectK version - Minimal reproduction case - Expected vs actual behavior