mirror of
https://github.com/alibaba/arthas.git
synced 2026-10-21 12:32:38 +00:00
as-package.sh support --fast
This commit is contained in:
@@ -27,6 +27,8 @@ Please refer to [README.MD at killercoda branch](https://github.com/alibaba/arth
|
||||
|
||||
Recommend to use [`as-package.sh`](as-package.sh) to package, which will auto-install the latest Arthas to local `~/.arthas` and when debugging, Arthas will auto-load the latest version.
|
||||
|
||||
Tip: for faster local iteration, you can use `./as-package.sh --fast` (skip `clean` and skip documentation front-end build in `site` module). If you need to rebuild docs, run without `--fast` or use `./mvnw clean package -DskipTests -P full`.
|
||||
|
||||
* To support jni, cpp compiling environment support is required
|
||||
* mac needs to install xcode
|
||||
* windows need to install gcc
|
||||
@@ -92,6 +94,8 @@ Tip: you can use `--versions` to list all available versions.
|
||||
|
||||
本地开发时,推荐执行`as-package.sh`来打包,会自动安装最新版本的arthas到`~/.arthas`目录里。debug时会自动使用最新版本。
|
||||
|
||||
提示:本地快速迭代可以执行 `./as-package.sh --fast`(跳过 `clean`,并跳过 `site` 模块的文档前端构建)。如果需要重建文档,请不要使用 `--fast`,或者执行 `./mvnw clean package -DskipTests -P full`。
|
||||
|
||||
* 代码里要编译jni,需要cpp编译环境支持
|
||||
* mac需要安装xcode
|
||||
* windows需要安装gcc
|
||||
|
||||
+75
-2
@@ -2,6 +2,65 @@
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") [options] [-- <extra mvn args>]
|
||||
|
||||
Options:
|
||||
--fast 本地快速打包:不执行 clean + 跳过 site 前端构建 + Maven 并行构建(-T 1C)
|
||||
--no-clean 不执行 Maven clean(保留各模块 target 缓存)
|
||||
--skip-site 跳过 site 模块的前端构建(vuepress/yarn),不影响默认打包产物
|
||||
-T, --threads <arg> 传给 Maven 的并行线程数(如 1C/4)
|
||||
-h, --help 显示帮助
|
||||
EOF
|
||||
}
|
||||
|
||||
NO_CLEAN=false
|
||||
SKIP_SITE=false
|
||||
MVN_THREADS=""
|
||||
MVN_EXTRA_ARGS=()
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--fast)
|
||||
NO_CLEAN=true
|
||||
SKIP_SITE=true
|
||||
[[ -z "${MVN_THREADS}" ]] && MVN_THREADS="1C"
|
||||
shift
|
||||
;;
|
||||
--no-clean)
|
||||
NO_CLEAN=true
|
||||
shift
|
||||
;;
|
||||
--skip-site)
|
||||
SKIP_SITE=true
|
||||
shift
|
||||
;;
|
||||
-T|--threads)
|
||||
if [[ $# -lt 2 ]]; then
|
||||
echo "Missing value for $1" 1>&2
|
||||
usage 1>&2
|
||||
exit 2
|
||||
fi
|
||||
MVN_THREADS="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
MVN_EXTRA_ARGS+=("$@")
|
||||
break
|
||||
;;
|
||||
*)
|
||||
MVN_EXTRA_ARGS+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
get_local_maven_project_version()
|
||||
{
|
||||
"$DIR/mvnw" org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \
|
||||
@@ -33,7 +92,21 @@ exit_on_err()
|
||||
}
|
||||
|
||||
# maven package the arthas
|
||||
"$DIR/mvnw" clean package -Dmaven.test.skip=true -DskipTests=true -Dmaven.javadoc.skip=true -f $DIR/pom.xml \
|
||||
MVN_ARGS=(-f "$DIR/pom.xml" -Dmaven.test.skip=true -DskipTests=true -Dmaven.javadoc.skip=true)
|
||||
if [[ -n "${MVN_THREADS}" ]]; then
|
||||
MVN_ARGS+=(-T "${MVN_THREADS}")
|
||||
fi
|
||||
if [[ "${SKIP_SITE}" == "true" ]]; then
|
||||
MVN_ARGS+=(-Darthas.site.frontend.skip=true)
|
||||
fi
|
||||
if [[ "${NO_CLEAN}" == "true" ]]; then
|
||||
MVN_GOALS=(package)
|
||||
else
|
||||
MVN_GOALS=(clean package)
|
||||
fi
|
||||
|
||||
# maven package the arthas
|
||||
"$DIR/mvnw" "${MVN_ARGS[@]}" "${MVN_EXTRA_ARGS[@]}" "${MVN_GOALS[@]}" \
|
||||
|| exit_on_err 1 "package arthas failed."
|
||||
|
||||
rm -r "$DIR/core/src/main/resources/com/taobao/arthas/core/res/version"
|
||||
@@ -46,4 +119,4 @@ unzip ${packaging_bin_path} -d "${NEWEST_ARTHAS_LIB_HOME}/"
|
||||
|
||||
# print ~/.arthas directory size
|
||||
arthas_dir_size="$(du -hs ${HOME}/.arthas | cut -f1)"
|
||||
echo "${HOME}/.arthas size: ${arthas_dir_size}"
|
||||
echo "${HOME}/.arthas size: ${arthas_dir_size}"
|
||||
|
||||
+3
-1
@@ -17,6 +17,7 @@
|
||||
<node.download.url>https://npmmirror.com/mirrors/node/</node.download.url>
|
||||
<node.version>v16.13.2</node.version>
|
||||
<yarn.version>v1.22.15</yarn.version>
|
||||
<arthas.site.frontend.skip>false</arthas.site.frontend.skip>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
@@ -75,6 +76,7 @@
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<skip>${arthas.site.frontend.skip}</skip>
|
||||
<nodeVersion>${node.version}</nodeVersion>
|
||||
<yarnVersion>${yarn.version}</yarnVersion>
|
||||
|
||||
@@ -85,4 +87,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user