diff --git a/docs/annotations/index.md b/docs/annotations/index.md index fc6d693..419c0b2 100644 --- a/docs/annotations/index.md +++ b/docs/annotations/index.md @@ -25,6 +25,10 @@ Cloud Annotations is available through [Maven Central](https://central.sonatype. {{ dependency_listing("annotations", "core") }} +In order to for Cloud to obtain the parameter names for arguments you'll need to add the parameter flag to your Java/Kotlin compilation step. + +{{ javac_parameters() }} + You then need to create an {{ javadoc("https://javadoc.io/doc/org.incendo/cloud-annotations/latest/org/incendo/cloud/annotations/AnnotationParser.html", "AnnotationParser") }} instance. diff --git a/main.py b/main.py index f52f999..86555f5 100644 --- a/main.py +++ b/main.py @@ -101,6 +101,79 @@ def shade_dependency() -> str: ``` """ + @env.macro + def javac_parameters() -> str: + return """ +=== "Maven" + + ```xml + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + + -parameters + + + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + 1.9.0 + + + compile + + compile + + + + -java-parameters + + + + + + + + ``` + +=== "Gradle (Kotlin)" + + ```kotlin + tasks.withType { + options.compilerArgs.add("-parameters") + } + + // only needed if your project uses Kotlin + tasks.withType { + compilerOptions { + freeCompilerArgs.add("-java-parameters") + } + } + ``` + +=== "Gradle (Groovy)" + + ```groovy + tasks.withType(JavaCompile) { + options.compilerArgs << "-parameters" + } + + // only needed if your project uses Kotlin + tasks.withType(KotlinCompile) { + kotlinOptions { + freeCompilerArgs << "-java-parameters" + } + } + ``` +""" + @env.macro def javadoc(link: str, title: str = None) -> str: if title is None: