mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 08:20:31 +08:00
chore: 工作区反编译与 Maven/文档/脚本同步到发布分支
- artifacts/decompiled 树与相关源码变更 - maven-cw-elevator-application 业务 docs 与 package-info - scripts 下 formatter 校验与辅助脚本 - 其他子工程/接口与发布线一并纳入版本控制 Made-with: Cursor Former-commit-id: e102e8cab64e575bcd23c9a66a598aa1892bb492
This commit is contained in:
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# Per maven-* reactor: run formatter-maven-plugin validate (Alibaba P3C Eclipse style).
|
||||
# Usage: from repo root, with JDK 8 on PATH: ./scripts/check_maven_formatter_validate.sh
|
||||
# Exit 1 if any project fails.
|
||||
set -euo pipefail
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
export JAVA_HOME="${JAVA_HOME:-/usr/lib/jvm/java-8-openjdk-amd64}"
|
||||
export PATH="${JAVA_HOME}/bin:${PATH}"
|
||||
CONFIG="${REPO_ROOT}/docs/style/alibaba-eclipse-codestyle.xml"
|
||||
# 2.17+ 需 Java 11 跑插件,2.24+ 需 Java 17;与项目 JDK8 一致时用 2.16.x
|
||||
FMT_VER="2.16.0"
|
||||
FMT_GOAL="net.revelc.code.formatter:formatter-maven-plugin:${FMT_VER}:validate"
|
||||
FAIL=0
|
||||
echo "Using JAVA: $(command -v java) ($(java -version 2>&1 | head -1))"
|
||||
echo "Config: ${CONFIG}"
|
||||
echo "-----"
|
||||
for d in "${REPO_ROOT}"/maven-*/; do
|
||||
[ -d "$d" ] || continue
|
||||
name="$(basename "$d")"
|
||||
if [ ! -f "${d}pom.xml" ]; then
|
||||
echo "[SKIP] ${name} (no pom.xml)"
|
||||
continue
|
||||
fi
|
||||
echo ">>> ${name}"
|
||||
if (cd "$d" && mvn -q -DskipTests \
|
||||
-DconfigFile="${CONFIG}" -DlineEnding=LF -Dproject.build.sourceEncoding=UTF-8 \
|
||||
${FMT_GOAL} 2>&1); then
|
||||
echo " [OK] ${name}"
|
||||
else
|
||||
echo " [FAIL] ${name}"
|
||||
FAIL=1
|
||||
fi
|
||||
echo "-----"
|
||||
done
|
||||
if [ "$FAIL" -ne 0 ]; then
|
||||
echo "One or more projects failed formatter:validate. Run formatter:format to fix, then re-validate."
|
||||
exit 1
|
||||
fi
|
||||
echo "All maven-* projects passed formatter:validate."
|
||||
exit 0
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Apply Alibaba Eclipse formatter to all maven-* (same version/config as check_maven_formatter_validate.sh).
|
||||
# Run from repo root with JDK 8. WARNING: rewrites many Java files — commit or review diff first.
|
||||
set -euo pipefail
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
export JAVA_HOME="${JAVA_HOME:-/usr/lib/jvm/java-8-openjdk-amd64}"
|
||||
export PATH="${JAVA_HOME}/bin:${PATH}"
|
||||
CONFIG="${REPO_ROOT}/docs/style/alibaba-eclipse-codestyle.xml"
|
||||
FMT_VER="2.16.0"
|
||||
FMT_GOAL="net.revelc.code.formatter:formatter-maven-plugin:${FMT_VER}:format"
|
||||
for d in "${REPO_ROOT}"/maven-*/; do
|
||||
[ -f "${d}pom.xml" ] || continue
|
||||
echo ">>> $(basename "$d")"
|
||||
(cd "$d" && mvn -q -DskipTests \
|
||||
-DconfigFile="${CONFIG}" -DlineEnding=LF -Dproject.build.sourceEncoding=UTF-8 \
|
||||
${FMT_GOAL})
|
||||
done
|
||||
echo "Done. Run scripts/check_maven_formatter_validate.sh to confirm."
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Scan *.java for block comments in the last N lines (tail noise / orphan */). Read-only."""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
TAIL_LINES = 50
|
||||
REPO = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
def main() -> int:
|
||||
suspicious: list[tuple[Path, str]] = []
|
||||
with_slash: list[Path] = []
|
||||
for p in REPO.rglob("*.java"):
|
||||
sp = str(p)
|
||||
if "/target/" in sp:
|
||||
continue
|
||||
try:
|
||||
t = p.read_text(encoding="utf-8", errors="replace")
|
||||
except OSError:
|
||||
continue
|
||||
lines = t.splitlines()
|
||||
if not lines:
|
||||
continue
|
||||
tail = "\n".join(lines[-TAIL_LINES:])
|
||||
if "/*" in tail or "*/" in tail:
|
||||
with_slash.append(p)
|
||||
low = tail.lower()
|
||||
if "location" in low and "/*" in tail:
|
||||
suspicious.append((p, "Location in tail block"))
|
||||
if "jd-core" in low or "jd core" in low:
|
||||
suspicious.append((p, "jd-core in tail"))
|
||||
if "decompil" in low and "/*" in tail:
|
||||
suspicious.append((p, "decompil+block in tail"))
|
||||
# Trailing */ only: last non-empty line is */
|
||||
nonws = [ln for ln in lines[-20:] if ln.strip()]
|
||||
if len(nonws) >= 1 and nonws[-1].strip() == "*/" and "/**" not in "\n".join(lines[-5:]):
|
||||
# might be orphan closer (rare)
|
||||
if "*/" in tail and tail.count("/*") < tail.count("*/"):
|
||||
suspicious.append((p, "possible orphan */ at EOF"))
|
||||
|
||||
print(f"Scanned under {REPO}")
|
||||
print(f"Files with /* or */ in last {TAIL_LINES} lines: {len(with_slash)}")
|
||||
print(f"Flagged suspicious: {len(suspicious)}")
|
||||
for p, reason in suspicious[:80]:
|
||||
print(f" {reason}: {p.relative_to(REPO)}")
|
||||
if len(suspicious) > 80:
|
||||
print(f" ... and {len(suspicious) - 80} more")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -2,7 +2,7 @@
|
||||
"""
|
||||
Remove JD-Core decompiler noise from Java sources under maven-*:
|
||||
|
||||
- Line prefix comments: /* */ and /* N */ (line numbers)
|
||||
- Line prefix comments: /* */ and /* N */ / /* N */ (line numbers; spaces around N vary)
|
||||
- Trailing metadata block: /* Location: ... JD-Core Version: ... */
|
||||
|
||||
Does not strip normal Javadoc /** ... */ or arbitrary block comments.
|
||||
@@ -15,7 +15,8 @@ import sys
|
||||
from pathlib import Path
|
||||
|
||||
RE_LINE_EMPTY_PREFIX = re.compile(r"^/\* +\*/\s*")
|
||||
RE_LINE_NUM_PREFIX = re.compile(r"^/\* \d+ \*/\s*")
|
||||
# JD-Core often emits "/* 90 */" (extra spaces after /* and/or before */)
|
||||
RE_LINE_NUM_PREFIX = re.compile(r"^/\* *\d+ *\*/\s*")
|
||||
# Ends with line like " */" (space + */) after "* JD-Core Version: ..."
|
||||
RE_TAIL_META = re.compile(
|
||||
r"(?:^|\n)/\* Location:.*?\n\s*\*/\s*",
|
||||
|
||||
Reference in New Issue
Block a user