fix: relocate cwos-portal decompiled output to correct path; remove nested directory

Former-commit-id: dc30d42a8c55ed8b2382a41dc2434233fbed9930
This commit is contained in:
反编译工作区
2026-04-29 12:09:48 +08:00
parent ea8e492076
commit e8672a3c7b
1759 changed files with 547735 additions and 280 deletions
@@ -0,0 +1,80 @@
#!/usr/bin/env bash
# 将 V1 运行包 cw_lib 中的电梯四模块 jar 用 CFR 反编译到本仓库 tools/v1-decompiled/ 下,
# 供与 maven-cw-elevator-application 源码逐类比对(不依赖历史 artifacts 手工目录)。
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MV_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
REPO_ROOT="$(cd "$MV_ROOT/.." && pwd)"
# V1 解压目录(含 cw_lib
: "${V1_RUN_DIR:=${REPO_ROOT}/cw-elevator-application-V1.0.0.20211103}"
CW_LIB="${V1_RUN_DIR}/cw_lib"
# CFR:优先环境变量,其次仓库 artifacts
: "${CFR_JAR:=${REPO_ROOT}/artifacts/decompiled/v1-cfr-compare-20211103/cfr-0.152.jar}"
if [[ ! -f "$CFR_JAR" ]]; then
echo "ERROR: CFR not found: $CFR_JAR" >&2
echo "Set CFR_JAR to a local cfr-*.jar path." >&2
exit 1
fi
# 输出根目录(可用环境变量覆盖)
: "${V1_DECOMP_OUT:=${MV_ROOT}/tools/v1-decompiled/cfr-from-cw-lib}"
TIMESTAMP="$(date +%Y%m%d-%H%M%S)"
OUT="${V1_DECOMP_OUT}-${TIMESTAMP}"
FINAL_LINK="${MV_ROOT}/tools/v1-decompiled/cfr-from-cw-lib-current"
MODULES=(
"cw-elevator-application-common-1.0-SNAPSHOT.jar"
"cw-elevator-application-data-1.0-SNAPSHOT.jar"
"cw-elevator-application-service-1.0-SNAPSHOT.jar"
"cw-elevator-application-web-1.0-SNAPSHOT.jar"
)
echo "V1 cw_lib: $CW_LIB"
echo "CFR: $CFR_JAR"
echo "Output: $OUT"
mkdir -p "$OUT"
for j in "${MODULES[@]}"; do
jar_path="${CW_LIB}/${j}"
if [[ ! -f "$jar_path" ]]; then
echo "WARNING: missing $jar_path — skip"
continue
fi
mod="${j%.jar}"
dest="${OUT}/${mod}"
mkdir -p "$dest"
echo ">>> Decompiling $j -> $dest"
java -jar "$CFR_JAR" "$jar_path" \
--outputdir "$dest" \
--silent true
done
# 可选:V1 fat jar(体积大,默认关闭)
if [[ "${DECOMPILE_V1_FAT_JAR:-0}" == "1" ]]; then
FAT="${V1_RUN_DIR}/cw-elevator-application-V1.0.0.20211103.jar"
if [[ -f "$FAT" ]]; then
echo ">>> Decompiling fat jar (may take several minutes)..."
java -jar "$CFR_JAR" "$FAT" \
--outputdir "${OUT}/cw-elevator-application-V1.0.0.20211103-fat" \
--silent true
else
echo "WARNING: fat jar not found: $FAT"
fi
fi
# 写元数据
{
echo "generated_utc: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo "v1_run_dir: $V1_RUN_DIR"
echo "cfr_jar: $CFR_JAR"
echo "modules:"
for j in "${MODULES[@]}"; do echo " - $j"; done
} > "${OUT}/MANIFEST.txt"
ln -sfn "$OUT" "$FINAL_LINK"
echo ""
echo "Done. Latest symlink: $FINAL_LINK -> $OUT"
echo "Manifest: ${OUT}/MANIFEST.txt"