Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade ktlint-maven-plugin to 3.0.0 (bumps ktlint from 0.39.0 to 1.0.0 #98

Merged
merged 3 commits into from
Jan 21, 2024

Conversation

ZzAve
Copy link
Collaborator

@ZzAve ZzAve commented Jan 21, 2024

As a follow up of #96 , here we apply the changes correctly to master (missed it due to PR / rebase hell).

Feature

Improved ktlint handling:

  • runs at verify phase (instead of compile)
  • at default, only performs check
  • format can be run with mvn ktlint:format@ktlint-format
  • want to skip ktlint (and other quality steps)?: use -Dquality.skip

Bonus

Added 3 local build improvement flags (besides quality.skip):

  • <gpg.skip>true</gpg.skip> - by default don't try to gpg sign the created jar in the verify step. Also, this doesn't work for everybody because gpg needs to be set up. Not needed for local development.
  • <dokka.skip>true</dokka.skip> - by default, don't create a javaDocJar. This is only needed when doing a release (and maybe during CI, just for regression sake.
  • <kotlin.compiler.incremental>true</kotlin.compiler.incremental> - don't compile stuff again, if you already have the results. The incremental compiler of kotlin allows you to run multiple mvn compile (or later phases like package or install) and reuse the classes in the target folder. This can speed up local builds with 20-30% easily.

I ran a benchmark for the dokka plugin with mvnd : mvnd clean install -Dmvnd.buildTime -Dsmartbuilder.profiling=true -Ddokka.skip=false, and surprise, this save about 60% compiler time (this is cumulative time spent per module, executions may have been done in parallel).

[INFO] ------------------------------------------------------------------------
[INFO]   dokka-maven-plugin:javadocJar (default) .................. [68,022s]
[INFO]   maven-surefire-plugin:test (default-test) ................ [31,496s]
[INFO]   kotlin-maven-plugin:compile (compile) .................... [10,864s]
[INFO]   kotlin-maven-plugin:test-compile (test-compile) .......... [3,195s]
[INFO]   ktlint-maven-plugin:check (ktlint-check) ................. [1,951s]
[INFO]   maven-clean-plugin:clean (default-clean) ................. [0,298s]
[INFO]   maven-jar-plugin:jar (default-jar) ....................... [0,267s]
[INFO]   maven-source-plugin:jar (attach-sources) ................. [0,217s]
[INFO]   maven-install-plugin:install (default-install) ........... [0,118s]
[INFO]   maven-jar-plugin:test-jar (default) ...................... [0,113s]
[INFO]   maven-compiler-plugin:compile (default-compile) .......... [0,048s]
[INFO]   maven-compiler-plugin:testCompile (default-testCompile) .. [0,028s]
[INFO]   maven-resources-plugin:resources (default-resources) ..... [0,024s]
[INFO]   graphql-simple-bindings-maven-plugin:generate (default) .. [0,018s]
[INFO]   maven-gpg-plugin:sign (sign-artifacts) ................... [0,018s]
[INFO]   build-helper-maven-plugin:add-source (add-source) ........ [0,013s]
[INFO]   maven-resources-plugin:testResources (default-testResource [0,010s]
[INFO]   build-helper-maven-plugin:add-resource (add-resource) .... [0,009s]
[INFO]   build-helper-maven-plugin:add-test-source (add-test-source [0,008s]

Julius van Dis added 3 commits January 21, 2024 17:27
Improved ktlint handling:

- runs at `verify` phase (instead of compile)
- at default, only performs `check`
- format can be run with `mvn ktlint:format@ktlint-format`
- want to skip ktlint (and other quality steps)?: use `-Dquality.skip`
Happy ktlint, happy flock?
@ZzAve ZzAve changed the title x Upgrade ktlint-maven-plugin to 3.0.0 (bumps ktlint from 0.39.0 to 1.0.0 Jan 21, 2024
@wilmveel wilmveel merged commit 6c1dcec into master Jan 21, 2024
3 checks passed
@wilmveel wilmveel deleted the ktlint-fix branch January 21, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants