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

Do not run the Gradle tests when using -DquicklyDocs and add some useful workflow tips #44329

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,53 @@ Thus, it is recommended to use the following approach:
Due to Quarkus being a large repository, having to rebuild the entire project every time a change is made isn't very
productive. The following Maven tips can vastly speed up development when working on a specific extension.

#### Using mvnd

[mvnd](https://github.com/apache/maven-mvnd) is a daemon for Maven providing faster builds.
It parallelizes your builds by default and makes sure the output is consistent even for a parallelized build.

You can https://github.com/apache/maven-mvnd?tab=readme-ov-file#how-to-install-mvnd[install mvnd] with SDKMAN!, Homebrew...

mvnd is a good companion for your Quarkus builds.

Make sure you install the latest mvnd 1.0.x which embeds Maven 3.x as Quarkus does not support Maven 4 yet.
Once it is installed, you can use `mvnd` in your Maven command lines instead of the typical `mvn` or `./mvnw`.

If anything goes wrong, you can stop the daemon and start fresh with `mvnd --stop`.

#### Using aliases

While building with `-Dquickly` or `-DquicklyDocs` is practical when contributing your first patches,
if you contribute to Quarkus often, it is recommended to have your own aliases - for instance to make sure your build is parallelized.

Here are a couple of useful aliases that are good starting points - and that you will need to adapt to your environment:

- `build-fast`: build the Quarkus artifacts and install them
- `build-docs`: run from the root of the project, build the documentation
- `format`: format the source code following our coding conventions
- `qss`: run the Quarkus CLI from a snapshot (make sure you build the artifacts first)

- If using mvnd

```sh
alias build-fast="mvnd -e -DskipDocs -DskipTests -DskipITs -Dinvoker.skip -DskipExtensionValidation -Dskip.gradle.tests -Dtruststore.skip clean install"
alias build-docs="mvnd -e -DskipTests -DskipITs -Dinvoker.skip -DskipExtensionValidation -Dskip.gradle.tests -Dtruststore.skip -Dno-test-modules -Dasciidoctor.fail-if=DEBUG clean install"
alias format="mvnd process-sources -Denforcer.skip -Dprotoc.skip"
alias qss="java -jar ${HOME}/git/quarkus/devtools/cli/target/quarkus-cli-999-SNAPSHOT-runner.jar"
```

- If using plain Maven

```sh
alias build-fast="mvn -T0.8C -e -DskipDocs -DskipTests -DskipITs -Dinvoker.skip -DskipExtensionValidation -Dskip.gradle.tests -Dtruststore.skip clean install"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • skipDocs, skipTests, skipITs, skipExtensionValidation
  • invoker.skip, truststore.skip
  • skip.gradle.tests

Yup, we got all three naming conventions, can't think of any other :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conventions are not ours. They are coming from the Maven plugins we are using (except skip.gradle.tests which is indeed not ideal).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured :(

alias build-docs="mvn -T0.8C -e -DskipTests -DskipITs -Dinvoker.skip -DskipExtensionValidation -Dskip.gradle.tests -Dtruststore.skip -Dno-test-modules -Dasciidoctor.fail-if=DEBUG clean install"
alias format="mvn -T0.8C process-sources -Denforcer.skip -Dprotoc.skip"
alias qss="java -jar ${HOME}/git/quarkus/devtools/cli/target/quarkus-cli-999-SNAPSHOT-runner.jar"
```

Using `./mvnw` is often not practical in this case as you might want to call these aliases from a nested directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to use gum for solving that issue.

https://andresalmiray.com/gum-the-gradle-maven-wrapper/

then have alias mvn=gm which then locates ./mvnw if in root.

[gum](https://andresalmiray.com/gum-the-gradle-maven-wrapper/) might be useful in this case.

#### Building all modules of an extension

Let's say you want to make changes to the `Jackson` extension. This extension contains the `deployment`, `runtime`
Expand Down
11 changes: 11 additions & 0 deletions devtools/gradle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,17 @@
<gradle.task>assemble</gradle.task>
</properties>
</profile>
<profile>
<id>quickly-docs-build</id>
<activation>
<property>
<name>quicklyDocs</name>
</property>
</activation>
<properties>
<gradle.task>assemble</gradle.task>
</properties>
</profile>
<profile>
<!-- separate "quickly" profile for CI to keep local "quickly" demands separated from CI demands -->
<id>quick-build-ci</id>
Expand Down
Loading