Skip to content

Commit

Permalink
Add Taskfile tasks for build and test commands. (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkrodrigues authored Jul 21, 2024
1 parent 0f6e1d6 commit 0cb779c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 25 deletions.
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

0 comments on commit 0cb779c

Please sign in to comment.