diff --git a/README.md b/README.md index c88a7e1..b3eb793 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ - [🗂 Lib](#%F0%9F%97%82-lib) - [`trap_error_info.sh`](#trap_error_infosh) - [`common_utils.sh`](#common_utilssh) - - [`java_build_utils.sh`](#java_build_utilssh) + - [`maven_utils.sh`](#java_build_utilssh) - [`prepare_jdks.sh`](#prepare_jdkssh) - [⚒️ Tool](#-tool) - [`gen_source_guard`](#gen_source_guard) @@ -76,14 +76,14 @@ api functions: - `jvu::switch_to_jdk` - `jvu::java_cmd` -## [`java_build_utils.sh`](lib/java_build_utils.sh) +## [`maven_utils.sh`](lib/maven_utils.sh) maven util functions for build. api functions: - maven operation functions: - - `jvb::mvn_cmd` + - `mvu::mvn_cmd` ## [`prepare_jdks.sh`](lib/prepare_jdks.sh) diff --git a/lib/java_build_utils.sh b/lib/maven_utils.sh similarity index 69% rename from lib/java_build_utils.sh rename to lib/maven_utils.sh index 7123573..1af85aa 100644 --- a/lib/java_build_utils.sh +++ b/lib/maven_utils.sh @@ -5,11 +5,7 @@ ################################################################################ # api functions: # -# - java operation functions: -# - jvb::get_java_version -# - jvb::java_cmd -# - maven operation functions: -# - jvb::mvn_cmd +# - mvu::mvn_cmd ################################################################################ # #_ source guard begin _# @@ -27,13 +23,13 @@ source "$__source_guard_364DF1B5_9CA2_44D3_9C62_CDF6C2ECB24F/common_utils.sh" # maven operation functions ################################################################################# -readonly JVB_DEFAULT_MVN_OPTS=( +readonly MVU_DEFAULT_MVN_OPTS=( -V --no-transfer-progress ) -jvb::_find_mvn_cmd_path() { - if [ -n "${_JVB_MVN_PATH:-}" ]; then - echo "$_JVB_MVN_PATH" +mvu::_find_mvn_cmd_path() { + if [ -n "${_MVU_MVN_PATH:-}" ]; then + echo "$_MVU_MVN_PATH" return fi @@ -41,8 +37,8 @@ jvb::_find_mvn_cmd_path() { # 1. find the mvnw from project root dir if [[ -n "${PROJECT_ROOT_DIR:-}" && -e "$PROJECT_ROOT_DIR/$maven_wrapper_name" ]]; then - _JVB_MVN_PATH="$PROJECT_ROOT_DIR/$maven_wrapper_name" - echo "$_JVB_MVN_PATH" + _MVU_MVN_PATH="$PROJECT_ROOT_DIR/$maven_wrapper_name" + echo "$_MVU_MVN_PATH" return fi @@ -51,8 +47,8 @@ jvb::_find_mvn_cmd_path() { while true; do local mvnw_path="$d/$maven_wrapper_name" [ -x "$mvnw_path" ] && { - _JVB_MVN_PATH="$mvnw_path" - echo "$_JVB_MVN_PATH" + _MVU_MVN_PATH="$mvnw_path" + echo "$_MVU_MVN_PATH" return } @@ -62,8 +58,8 @@ jvb::_find_mvn_cmd_path() { # 3. find mvn from $PATH if command -v mvn &>/dev/null; then - _JVB_MVN_PATH=mvn - echo "$_JVB_MVN_PATH" + _MVU_MVN_PATH=mvn + echo "$_MVU_MVN_PATH" return fi @@ -76,41 +72,41 @@ jvb::_find_mvn_cmd_path() { )" } -jvb::mvn_cmd() { +mvu::mvn_cmd() { (($# > 0)) || cu::die "${FUNCNAME[0]} requires arguments! But no provided" # FIXME hard code logic for `DISABLE_GIT_DIRTY_CHECK` - cu::log_then_run "$(jvb::_find_mvn_cmd_path)" \ - "${JVB_MVN_OPTS[@]}" \ + cu::log_then_run "$(mvu::_find_mvn_cmd_path)" \ + "${MVU_MVN_OPTS[@]}" \ ${DISABLE_GIT_DIRTY_CHECK+-Dgit.dirty=false} \ "$@" } -jvb::get_mvn_local_repository_dir() { +mvu::get_mvn_local_repository_dir() { (($# == 0)) || cu::die "${FUNCNAME[0]} requires no arguments! But provided $#: $*" - if [ -z "${_JVB_MVN_LOCAL_REPOSITORY_DIR:-}" ]; then - echo "$_JVB_MVN_LOCAL_REPOSITORY_DIR" + if [ -z "${_MVU_MVN_LOCAL_REPOSITORY_DIR:-}" ]; then + echo "$_MVU_MVN_LOCAL_REPOSITORY_DIR" fi - _JVB_MVN_LOCAL_REPOSITORY_DIR="$( - jvb::mvn_cmd --no-transfer-progress help:evaluate -Dexpression=settings.localRepository | + _MVU_MVN_LOCAL_REPOSITORY_DIR="$( + mvu::mvn_cmd --no-transfer-progress help:evaluate -Dexpression=settings.localRepository | grep '^/' )" - [ -n "${_JVB_MVN_LOCAL_REPOSITORY_DIR:-}" ] || cu::die "Fail to find maven local repository directory" + [ -n "${_MVU_MVN_LOCAL_REPOSITORY_DIR:-}" ] || cu::die "Fail to find maven local repository directory" } ################################################################################ # auto run logic when source ################################################################################ -jvb::__auto_run_when_source() { +mvu::__auto_run_when_source() { # set VAR if absent - if [ -z "${JVB_MVN_OPTS[*]:-}" ]; then - JVB_MVN_OPTS=("${JVB_DEFAULT_MVN_OPTS[@]}") + if [ -z "${MVU_MVN_OPTS[*]:-}" ]; then + MVU_MVN_OPTS=("${MVU_DEFAULT_MVN_OPTS[@]}") fi } -jvb::__auto_run_when_source +mvu::__auto_run_when_source diff --git a/templates/integration_test.template.sh b/templates/integration_test.template.sh index 4d14eb9..8e3e952 100644 --- a/templates/integration_test.template.sh +++ b/templates/integration_test.template.sh @@ -22,7 +22,7 @@ readonly PREPARE_JDKS_INSTALL_BY_SDKMAN=( source "$BASH_BUDDY_ROOT/lib/prepare_jdks.sh" -source "$BASH_BUDDY_ROOT/lib/java_build_utils.sh" +source "$BASH_BUDDY_ROOT/lib/maven_utils.sh" ################################################################################ # ci build logic