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

Add Taskfile tasks for build and test commands. #49

Merged
merged 2 commits into from
Jul 21, 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
53 changes: 29 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
clp-ffi-java is a library to encode log messages with
clp-ffi-java is a library to encode log messages with
[CLP](https://github.com/y-scope/clp), and work with the encoded messages using
a foreign function interface (FFI).

# Requirements

* A C++ compiler that supports C++-17
* CMake 3.5.1 or higher
* [Task]

# Setup

Expand All @@ -17,32 +18,37 @@ a foreign function interface (FFI).

# Common build commands

* Build and test
```shell
mvn package
```
* Build without any extras
```shell
mvn package -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip
```
* Generate the JNI headers
```shell
mvn generate-sources
```
* Build the native library
```shell
mvn generate-resources
```
* Build and package the native library
```shell
mvn generate-resources validate assembly:single@assemble-lib-dir
```
* The validate phase is necessary to remove spaces from the OS name
Build and test:
```shell
task
# or task package-and-test
```

Build without testing:
```shell
task package
```

Build without any extras:
```shell
task package-basic
```

Generate the JNI headers:
```shell
task jni-headers
```

Build and package the native library:
```shell
task native-lib
```

# Testing

Run tests:
```shell
mvn test
task test
```

# Linting
Expand All @@ -61,7 +67,6 @@ To run the linting tools, besides commonly installed tools like `tar`, you'll ne
* `md5sum`
* Python 3.8 or newer
* python3-venv
* [Task]

## Running the linters

Expand Down
19 changes: 18 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ vars:
G_LINT_VENV_DIR: "{{.G_BUILD_DIR}}/lint-venv"

tasks:
default:
deps: ["package-and-test"]

package-and-test: "mvn package"

package: "mvn package -DskipTests"

package-basic: "mvn package -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip"

jni-headers: "mvn generate-sources"

native-lib:
# NOTE: `validate` is necessary to remove spaces from the OS name
cmd: "mvn generate-resources validate assembly:single@assemble-lib-dir"

test: "mvn test"

lint:
deps: ["lint-venv"]
cmds:
Expand All @@ -20,7 +37,7 @@ tasks:
Taskfile.yml

clean:
cmds: ["rm -rf '{{.G_BUILD_DIR}}'"]
cmds: ["rm -rf '{{.G_BUILD_DIR}}' '{{.G_LINT_VENV_DIR}}'"]

lint-venv:
internal: true
Expand Down
Loading