From 10e59b4b3eb64a9da12ce672d249f1e9bf15656d Mon Sep 17 00:00:00 2001 From: kaklakariada Date: Mon, 18 May 2026 15:53:26 +0200 Subject: [PATCH] Add OFT wrapper script --- .github/workflows/run_shellcheck.sh | 1 + .gitignore | 1 + README.md | 6 ++++++ product/oftw.sh | 25 +++++++++++++++++++++++++ 4 files changed, 33 insertions(+) create mode 100755 product/oftw.sh diff --git a/.github/workflows/run_shellcheck.sh b/.github/workflows/run_shellcheck.sh index c4442f7e..fc40c169 100755 --- a/.github/workflows/run_shellcheck.sh +++ b/.github/workflows/run_shellcheck.sh @@ -9,6 +9,7 @@ base_dir="$( cd "$(dirname "$0")/../.." >/dev/null 2>&1 ; pwd -P )" shellcheck --enable=all --severity=warning --check-sourced --color=auto \ "$base_dir/.github/workflows/run_shellcheck.sh" \ "$base_dir/.github/workflows/github_release.sh" \ + "$base_dir/product/oftw.sh" \ "$base_dir/oft" \ "$base_dir/oft-self-trace.sh" diff --git a/.gitignore b/.gitignore index c7879cc8..9ff75142 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ doc/**/*.html *.iml pom.xml.versionsBackup .DS_Store +/.serena/ diff --git a/README.md b/README.md index a4f32df2..757f1452 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,8 @@ If you just want to run OFT: ## Running OpenFastTrace +### Run JAR File + The most basic variant to run OpenFastTrace is directly from the JAR file via the command line: ```sh @@ -107,6 +109,10 @@ If you want to run OFT automatically as part of a continuous build, we recommend For more details about how to run OFT please consult the [user guide](doc/user_guide.md). +### Download and Execute in Continuous Integration + +If you want to run OFT in a CI build, you can use the OFT wrapper script [oftw.sh](product/oftw.sh). The script only requires Java 17 and Maven and downloads the OFT JAR from Maven Central if it is not yet available in the local Maven repository `$HOME/.m2/repository`. + ## Development If you want to learn how to build OpenFastTrace, please check our [Developer Guide](doc/developer_guide.md). diff --git a/product/oftw.sh b/product/oftw.sh new file mode 100755 index 00000000..e65bb15c --- /dev/null +++ b/product/oftw.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +set -o errexit +set -o nounset + +readonly version="4.4.0" +readonly default_local_repo="${HOME}/.m2/repository" + +if [ -d "$default_local_repo" ]; then + local_repo="$default_local_repo" +else + echo "Default local Maven repository not found at $default_local_repo. Attempting to determine it from Maven settings..." + local_repo=$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout) +fi +readonly local_repo +readonly jar_file="$local_repo/org/itsallcode/openfasttrace/openfasttrace/$version/openfasttrace-$version.jar" + +if [ ! -f "$jar_file" ]; then + echo "JAR file $jar_file not found in local Maven repository. Downloading it..." + mvn --batch-mode org.apache.maven.plugins:maven-dependency-plugin:3.10.0:get \ + -Dartifact=org.itsallcode.openfasttrace:openfasttrace:"$version" \ + -Dtransitive=false +fi + +exec java -jar "$jar_file" "$@"