Commit Graph

374 Commits

Author SHA1 Message Date
Stephane Nicoll
6ca2dcc5cd Add support for annotating parameters
Closes gh-1002
2023-06-12 10:59:07 +02:00
Stephane Nicoll
eb618d5dd7 Overhaul annotation support for code generation
This commit improves the annotation support so that it handles more
attribute types. An AnnotationContainer is introduced that permits to
further configure an annotation, in particular attribute values can be
added, and an attribute can be removed.

This commit adds a number of deprecations:

* Annotation#getName has been deprecated in favor of
Annotation#getClasName.
* Annotable#annotate has been deprecated in favor of
Annotable#annotations()#add.
* Annotable#getAnnotations has been deprecated in favor of
Annotable#annotations()#values.
* Annotation#name has been deprecated in favor of Annotation#of.
* Annotation.Builder#attribute has been deprecated in favor of
Annotation.Builder#set.

In particular, the type of the attribute does not need to be specified
as it is infered from the specified values. Use Annotation.Builder#add
or Annotation.Builder#set depending on your needs.

Closes gh-1424
2023-06-12 09:15:50 +02:00
Stephane Nicoll
1d9e6b5b7b Introduce class name
Closes gh-1425
2023-06-09 16:46:03 +02:00
Stephane Nicoll
d22201b2d6 Allow CodeBlock to be used by $L 2023-06-08 12:40:35 +02:00
Stephane Nicoll
4c77196504 Avoid imports from current package
Closes gh-1421
2023-06-07 15:44:48 +02:00
Stephane Nicoll
8acbad503a Introduce CodeBlock
This commit introduces a way to build more complex statement, including
multi statements and nested method invocations. CodeBlock is heavily
inspired from Square's JavaPoet project.

A CodeBlock is an immutable piece of code that provide the imports that
are needed and can emit code to an IndentingWriter.

This commit also migrates the use of expressions in Java, Kotlin, and
Groovy to the newly introduced CodeBlock. Those are deprecated in
favor of CodeBlock.

Closes gh-1043
2023-06-07 12:01:43 +02:00
Stephane Nicoll
9995d6a2e9 Polish "Add support for Docker Compose"
See gh-1417
2023-05-31 16:58:29 +02:00
Moritz Halbritter
8f73f6c286 Polish 2023-05-26 15:31:37 +02:00
Stephane Nicoll
5e97a01e99 Upgrade to spring javaformat 0.0.38 2023-04-03 15:21:03 +02:00
Stephane Nicoll
186fdeaa2f Allow arbitrary code snippets to be added in a Gradle build
This commit provides an escape hatch for the DSL that we currently don't
support in a gradle build. Snippets can be added with a callback to an
IndentingWriter. For convenience, imports can be added as well.

Snippets are rendered at the end of the file.

Closes gh-1079
2022-11-12 16:33:01 +01:00
Stephane Nicoll
dd7a704d3b Fix build on Windows 2022-11-12 16:33:01 +01:00
Stephane Nicoll
371a02622c Use test blocks in assertions 2022-11-10 16:37:40 +01:00
Stephane Nicoll
ec48337dac Use Java 17 constructs 2022-11-10 13:25:33 +01:00
Stephane Nicoll
d8c3a13ad5 Upgrade to spring javaformat 0.0.35 2022-10-06 07:55:02 +02:00
Stephane Nicoll
5c6a531c0d Update copyright year of changed files
See gh-1292
2022-01-22 13:26:09 +01:00
Vedran Pavic
27fc9d4067 Ensure Gradle tasks are configured lazily
At present, generated Gradle build scripts that use Groovy DSL configure
tasks eagerly. This is both suboptimal and actually not aligned with the
generated build scripts that use Kotlin DSL, which configures tasks
lazily.

This commit updates `GroovyDslGradleBuildWriter` to ensure tasks are
configured lazily.

See gh-1292
2022-01-22 11:53:52 +01:00
Stephane Nicoll
a961c52450 Add support for configuring a Maven parent relative path
Closes gh-1296
2022-01-22 11:20:06 +01:00
Stephane Nicoll
ffbe0e496a Use self-closed tag for empty attributes in Maven pom
Closes gh-1244
2021-06-10 17:06:40 +02:00
Stephane Nicoll
17df3b9b5d Handle both snapshots and releases enabled flags in Maven Pom
This commit improves the handling of repositories with Maven.
Previously, the writer wrongly assumed that the default for releases
and snapshots are true and false respectively. However, both defaults
are true which means that snapshots repository are considered for
releases, and releases repositories are considered for snapshots.

MavenRepository has now separate flags for those and the writer makes
sure to only update the `enabled` flag if the chosen value is not
true. This doesn't increase the content for repository definitions
while offering better performance for dependencies resolution.

Closes gh-1226
2021-04-20 20:20:41 +02:00
Stephane Nicoll
433d48cc10 Allow to remove dependency from MutableProjectDescription
Closes gh-1207
2021-03-22 16:18:05 +01:00
Stephane Nicoll
d1df1d5241 Add Gradle plugin mapping strategy
This commit adds a mapping strategy for Gradle plugins that don't have
a plugin marker artifact. This is necessary to avoid using a buildScript
section to declare the plugin implementation artifact.

Closes gh-1189
2021-03-02 15:29:02 +01:00
Stephane Nicoll
6da6572ccc Polish Maven profile support 2021-01-19 16:30:57 +01:00
Stephane Nicoll
50c1c28b1c Use parameterized test for version range tests 2021-01-16 11:17:17 +01:00
Stephane Nicoll
c4485b6cbd Remove useless resolutionStrategy for Spring Boot plugin
Closes gh-610
2021-01-11 16:56:50 +01:00
Stephane Nicoll
b170523ffa Add support for lists with nested structure
Previously, a nested structure of a Maven Plugin configuration can be
only configured for a single parameter. This commit adds a dedicated
method to add a new entry with a nested structure every time it is
called. This effectively allows to configure nested "list" structure
such as listing dependency exclusions.

Closes gh-1165
2020-12-14 10:05:18 +01:00
Stephane Nicoll
8cef356bcf Fix JavaVersion constant writer to handle recent Java versions
Closes gh-1160
2020-12-04 15:35:21 +01:00
Stephane Nicoll
b8289de7e0 Remove support for Spring Boot 1.x
Closes gh-1152
2020-11-27 17:53:26 +01:00
Stephane Nicoll
a10c830fd5 Allow contributors to be filtered
This commit exposes an additional protected method in ProjectGenerator
that sub-classes can override to alter the list of
`@ProjectGenerationConfiguration`-annotated types that are used to load
candidate contributors.

Closes gh-870
2020-11-24 14:47:20 +01:00
Stephane Nicoll
68f5c04e1d Polish 2020-11-23 14:31:16 +01:00
Stephane Nicoll
d22f820dd4 Polish "Add support for Maven profiles"
See gh-1057
2020-11-23 10:42:03 +01:00
Daniel Pelaez
cbea89910f Add support for Maven profiles
See gh-1057
2020-11-19 16:44:33 +01:00
Stephane Nicoll
eed9c3876f Allow to customize how build writers sort dependencies
Closes gh-1098
2020-11-19 11:50:02 +01:00
Stephane Nicoll
ac9da18440 Polish "Encode usual XML reserved characters"
See gh-1073
2020-11-17 13:56:41 +01:00
Jafer Khan
0cdf11e467 Encode usual XML reserved characters
See gh-1073
2020-11-17 13:55:30 +01:00
Stephane Nicoll
f2accaa7f7 Upgrade to Spring Boot 2.4.0
Closes gh-1145
2020-11-13 06:46:47 +01:00
Stephane Nicoll
c29df3e83c Polish "Add support for Maven defaultGoal"
See gh-1134
2020-10-09 09:25:41 +02:00
Miguel Ortega
db0b33df42 Add support for Maven defaultGoal
See gh-1134
2020-10-09 09:24:49 +02:00
Stephane Nicoll
15157c941f Polish 2020-06-05 10:20:58 +02:00
Stephane Nicoll
bcc70551bb Support version format
This commit clarifies that Version now handles two different formats,
the original one (flagged V1) and a SemVer compliant format (flagged
V2). Both Version and VersionRange can switch from one format to the
other to produce backward compatible content.

See gh-1092
2020-06-02 16:52:29 +02:00
Stephane Nicoll
0b7614c4f0 Add support for SemVer and CalVer versions
This commit improves the version parser to handle qualifiers that are
separated by either a `.` or a `-`. This makes the parsing of
`1.2.0-RC1` or `2020.0.0-M1` possible.

Closes gh-1083
2020-05-26 11:25:32 +02:00
Stephane Nicoll
07b6912535 Polish 2020-03-24 07:38:24 +01:00
Stephane Nicoll
f7ef31d6f4 Polish "Add support for Maven's finalName"
See gh-1052
2020-03-17 08:10:01 +01:00
Joachim Pasquali
0f7196ae02 Add support for Maven's finalName
See gh-1052
2020-03-17 07:57:09 +01:00
Stephane Nicoll
95c306cc9b Polish "Add support for Maven <scm>"
See gh-1051
2020-03-17 06:20:51 +01:00
Joachim Pasquali
4151be0a64 Add support for Maven <scm>
See gh-1051
2020-03-17 05:59:48 +01:00
Stephane Nicoll
835f69986c Polish "Add dependency classifier support"
See gh-1049
2020-03-17 05:57:43 +01:00
Joachim Pasquali
a81e4ef77b Add dependency classifier support
See gh-1049
2020-03-17 05:11:23 +01:00
Stephane Nicoll
945b118b0c Polish 2020-01-01 08:41:11 +01:00
Stephane Nicoll
6c261fd8f1 Make sure ProjectDescriptionDiff is created eagerly
This commit makes sure that the diff instance is created immediately,
taking a snapshot of the ProjectDescription before the customizers are
applied on it.

Previously, the instance was created as part of the supplier and
therefore created only once a component was requiring it.

See gh-1023
2019-12-27 17:40:33 +01:00
Stephane Nicoll
591f6885cb Polish 2019-12-27 17:18:42 +01:00