jmeter/gradle.md

187 lines
4.8 KiB
Markdown
Raw Normal View History

2019-10-03 20:05:11 +08:00
# Gradle Command-Line
2019-02-25 04:51:10 +08:00
2019-10-03 20:05:11 +08:00
Useful commands (`gw` comes from https://github.com/dougborg/gdub, otherwise `./gradlew` can be used instead):
2019-02-25 04:51:10 +08:00
2019-08-03 18:25:15 +08:00
## Build and run
2019-02-25 04:51:10 +08:00
# Build and start JMeter GUI
gw runGui
# Build project and copy relevant jars to rootDir/lib, and start JMeter
gw createDist; ./bin/jmeter
# Build all distributions (source, binary)
gw :src:dist:assemble
2019-08-03 18:25:15 +08:00
## Base project info
2019-02-25 04:51:10 +08:00
# Display all submodules
gw projects
2019-02-25 04:51:10 +08:00
# Different tasks for current module
gw tasks
## List available build parameters
# List all build parameters
gw parameters
2019-08-03 18:25:15 +08:00
## Cleaning build directories
2019-10-03 20:05:11 +08:00
Technically `clean` should not be required, every time it is required it might be a bug.
2021-03-12 03:00:55 +08:00
However, it might be useful to perform a "clean" build:
2019-02-25 04:51:10 +08:00
# Cleans current project (submodule)
gw clean
2019-02-25 04:51:10 +08:00
# Cleans the specified project
gw :src:core:clean
2019-08-03 18:25:15 +08:00
## Dependencies
2019-02-25 04:51:10 +08:00
# Displays dependencies. Gradle's "configurations" are something like different classpaths.
gw dependencies
# Displays dependencies for all projects
gw allDependencies
# Analyze why the project depends on `org.ow2.asm:asm`
gw dependencyInsight --dependency org.ow2.asm:asm
# Verify checksums of dependencies
# Checksum verification is done by default
# Expected checksums are stored in /checksum.properties file
# Actual checksums are stored in /build/checksum/computed.checksum.properties
# Update expected dependencies after updating a dependency version
gw -PupdateExpectedJars check
2019-08-03 18:25:15 +08:00
## Static checks
2019-02-25 04:51:10 +08:00
2019-10-03 20:05:11 +08:00
### Release Audit Tool
2019-02-25 04:51:10 +08:00
# Run RAT
gw rat
2019-10-03 20:05:11 +08:00
### Code Formatting
2019-10-03 20:05:11 +08:00
# Run spotlessApply and checkstyleAll
gw style
2019-10-03 20:05:11 +08:00
# Run checkstlye for all
gw checkstyleAll
2019-10-03 20:05:11 +08:00
#### Fine Grained Formatting Commands
2019-02-25 04:51:10 +08:00
# Run checkstyle for main (non-test) code
gw checkstyleMain
2019-02-25 04:51:10 +08:00
# Run checkstyle for test code
gw checkstyleTest
2019-10-03 20:05:11 +08:00
# Run Spotless checks
gw spotlessCheck
2019-10-03 20:05:11 +08:00
# Fix any issues found by Spotless
gw spotlessApply
2019-02-25 04:51:10 +08:00
2019-10-03 20:05:11 +08:00
## Compiling Code
2019-02-25 04:51:10 +08:00
gw compileJava
gw compileTestJava
...
2019-10-03 20:05:11 +08:00
## Build Project
2019-02-25 04:51:10 +08:00
# Just build jar (see build/libs/*.jar)
gw jar
2019-02-25 04:51:10 +08:00
# "build" is a default task to "execute all the actions"
gw build
2019-02-25 04:51:10 +08:00
# Test might be skipped by `-x test` (Gradle's default way to skip task by name)
gw -x test build
2019-02-25 04:51:10 +08:00
# Build project in parallel
gw build --parallel
2019-08-03 18:25:15 +08:00
## Tests
2019-10-03 20:05:11 +08:00
Gradle automatically tracks task dependencies, so if you modify a file in `/src/jorphan/*`,
then you can invoke `gw check` at project level or in `core`, and Gradle will automatically
build only the required jars and files.
2019-02-25 04:51:10 +08:00
# Runs all the tests (unit tests, checkstyle, etc)
gw check
2019-02-25 04:51:10 +08:00
# Runs just unit tests
gw test
2019-02-25 04:51:10 +08:00
# Runs just core tests
gw :src:core:test
2019-08-03 18:25:15 +08:00
## Coverage
2019-02-25 04:51:10 +08:00
# Generates code coverage report for the test task to build/reports/jacoco/test/html
gw jacocoTestReport -Pcoverage
2019-02-25 04:51:10 +08:00
# Generate combined coverage report
gw jacocoReport -Pcoverage
2019-02-25 04:51:10 +08:00
2019-08-03 18:25:15 +08:00
## Generate Javadocs
2019-02-25 04:51:10 +08:00
# Builds javadoc to build/docs/javadoc subfolder
gw javadoc
2019-02-25 04:51:10 +08:00
# Builds javadoc jar to build/libs/jorphan-javadoc.jar
gw javadocJar
2019-08-03 18:25:15 +08:00
## Site
2019-02-25 04:51:10 +08:00
# Creates preview of a site to src/dist/build/site
2019-02-25 04:51:10 +08:00
gw :src:dist:previewSite
# Builds and publishes site preview to a Git repository
gw :src:dist:pushPreviewSite
2019-08-03 18:25:15 +08:00
## Maven
2019-02-25 04:51:10 +08:00
# publishes Maven artifact to local repository
gw publishToMavenLocal
2019-11-10 19:08:06 +08:00
# Generate all pom files (pom-default.xml)
# The files are placed under the individual src/**/build/publications folders
2019-02-25 04:51:10 +08:00
gw generatePom
2019-10-03 20:05:11 +08:00
## Release Artifacts
2019-02-25 04:51:10 +08:00
# Builds ZIP and TGZ artifacts for the release
gw :src:dist:assemble
2019-08-03 18:25:15 +08:00
## Signing
It is implemented via [gradle signing plugin](https://docs.gradle.org/5.2.1/userguide/signing_plugin.html),
2019-10-03 20:05:11 +08:00
so it is done automatically provided credentials are specified via
[signatory credentials](https://docs.gradle.org/5.2.1/userguide/signing_plugin.html#sec:signatory_credentials)
2019-02-25 04:51:10 +08:00
2019-10-03 20:05:11 +08:00
# Signs all the artifacts of the current module
# see results in build/**/*.asc
2019-02-25 04:51:10 +08:00
gw sign
2021-03-12 03:00:55 +08:00
> **Note:** signing is performed as a part of *release artifact build*, so it will be
2019-10-03 20:05:11 +08:00
> performed with `gw :src:dist:assemble`
2019-08-03 18:25:15 +08:00
## Releasing
2019-02-25 04:51:10 +08:00
2019-10-03 20:05:11 +08:00
# Builds the project, pushes artifacts to svn://.../dev,
# stages artifacts to Nexus staging repository
gw prepareVote -Prc=1
2019-02-25 04:51:10 +08:00
2019-10-03 20:05:11 +08:00
> **Note:** The above step uses [an asf-like release environment](https://github.com/vlsi/asflike-release-environment),
> so it does not alter public repositories
2019-08-03 18:25:15 +08:00
2019-02-25 04:51:10 +08:00
# Prepare another release candidate
gw prepareVote -Prc=2 -Pasf
# Release staged artifacts to SVN and Nexus
gw publishDist -Prc=2 -Pasf