Menu

1 / 3

GitHub - Kotlin/analysis-api-quickstart: Template for writing command-line tools on top of the Kotlin Analysis API

GitHub Public Timeline Feed·Kotlin·6 days ago
#agLqVldT
Reading 0:00
15s threshold

A small Gradle project for writing command-line tools on top of the Kotlin Analysis API .

Use it as a starting point: replace the sample logic with your own analysis or code generation, and run it against any module right from the build.

What's inside

tool is the tool itself: a regular CLI application that sets up a standalone Analysis API session from command-line arguments and runs the actual logic. The sample implementation dumps the public API of a module.

tool-plugin is a Gradle plugin that runs the tool for a module. It collects source roots, the compilation classpath and compiler settings, and passes them to the tool as arguments. The tool runs in a separate JVM, so the Analysis API and its dependencies never clash with Gradle's own classpath.

sandbox is a module with the plugin applied. Put code there and see what the tool makes of it.

Try it

The sandbox is configured to run the tool right after compilation, and the report lands in sandbox/api.txt .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.