mirror of
https://github.com/apple/pkl.git
synced 2026-04-24 01:08:34 +02:00
Add Kotlin support for "addGeneratedAnnotation" flag (#1115)
This adds logic so that the Kotlin code generator also supports the "addGeneratedAnnotation" flag. Also: * Add Antora documentation * Adjust names (generated-annotation -> add-generated-annotation) * Adjust doc comments
This commit is contained in:
@@ -190,7 +190,6 @@ public class PklPlugin implements Plugin<Project> {
|
||||
configureBaseSpec(spec);
|
||||
configureCodeGenSpec(spec);
|
||||
|
||||
spec.getAddGeneratedAnnotation().convention(false);
|
||||
spec.getGenerateGetters().convention(false);
|
||||
spec.getGenerateJavadoc().convention(false);
|
||||
// Not using `convention()` so that users can disable generation of
|
||||
@@ -207,7 +206,6 @@ public class PklPlugin implements Plugin<Project> {
|
||||
.configure(
|
||||
task -> {
|
||||
configureCodeGenTask(task, spec);
|
||||
task.getGeneratedAnnotation().set(spec.getAddGeneratedAnnotation());
|
||||
task.getGenerateGetters().set(spec.getGenerateGetters());
|
||||
task.getGenerateJavadoc().set(spec.getGenerateJavadoc());
|
||||
task.getParamsAnnotation().set(spec.getParamsAnnotation());
|
||||
@@ -354,6 +352,8 @@ public class PklPlugin implements Plugin<Project> {
|
||||
|
||||
spec.getImplementSerializable().convention(false);
|
||||
|
||||
spec.getAddGeneratedAnnotation().convention(false);
|
||||
|
||||
configureCodeGenSpecModulePath(spec);
|
||||
}
|
||||
|
||||
@@ -454,6 +454,7 @@ public class PklPlugin implements Plugin<Project> {
|
||||
task.getOutputDir().set(spec.getOutputDir());
|
||||
task.getGenerateSpringBootConfig().set(spec.getGenerateSpringBootConfig());
|
||||
task.getImplementSerializable().set(spec.getImplementSerializable());
|
||||
task.getAddGeneratedAnnotation().set(spec.getAddGeneratedAnnotation());
|
||||
task.getRenames().set(spec.getRenames());
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public abstract class CodeGenTask extends ModulesTask {
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
public abstract Property<Boolean> getGeneratedAnnotation();
|
||||
public abstract Property<Boolean> getAddGeneratedAnnotation();
|
||||
|
||||
@Input
|
||||
public abstract Property<String> getIndent();
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class JavaCodeGenTask extends CodeGenTask {
|
||||
getCliBaseOptions(),
|
||||
getProject().file(getOutputDir()).toPath(),
|
||||
getIndent().get(),
|
||||
getGeneratedAnnotation().get(),
|
||||
getAddGeneratedAnnotation().get(),
|
||||
getGenerateGetters().get(),
|
||||
getGenerateJavadoc().get(),
|
||||
getGenerateSpringBootConfig().get(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,6 +38,7 @@ public abstract class KotlinCodeGenTask extends CodeGenTask {
|
||||
getGenerateKdoc().get(),
|
||||
getGenerateSpringBootConfig().get(),
|
||||
getImplementSerializable().get(),
|
||||
getAddGeneratedAnnotation().get(),
|
||||
getRenames().get()))
|
||||
.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user