From 4c3798735b713a23b6286d67c811cc17cb2ddf2e Mon Sep 17 00:00:00 2001 From: xiaozhou233 Date: Thu, 15 Oct 2026 20:09:37 +0800 Subject: [PATCH] Docs: add v5.0.0 release notes and changelog - docs/update: add v5.0.0 release notes (bilingual) covering the v1 -> v2 breaking config change, migration steps and the BuiltIn / CustomJar modes - docs/update: add CHANGELOG starting from v4.1.2 --- docs/update/CHANGELOG.md | 95 +++++++++++++++++++++++ docs/update/v5.0.0.md | 163 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 258 insertions(+) create mode 100644 docs/update/CHANGELOG.md create mode 100644 docs/update/v5.0.0.md diff --git a/docs/update/CHANGELOG.md b/docs/update/CHANGELOG.md new file mode 100644 index 0000000..6cdaad0 --- /dev/null +++ b/docs/update/CHANGELOG.md @@ -0,0 +1,95 @@ +# Changelog / 更新日志 + +本文件记录 JuiceAgent 的版本变更。更早的版本请见 [GitHub Releases](https://github.com/xiaozhou233/JuiceAgent/releases)。 + +This file records notable changes to JuiceAgent. For older releases, see [GitHub Releases](https://github.com/xiaozhou233/JuiceAgent/releases). + +## 中文 + +### [5.0.0] - 2026-10-15 + +#### ⚠️ 破坏性变更 + +- 配置 schema 由 v1 升级到 v2(`CONFIG_VERSION = 2`):旧配置会被版本校验拒绝,需按 [v5.0.0 发布说明](v5.0.0.md) 迁移。 + +#### ✨ 新功能 + +- 新增 `JarLoader.Mode`:`BuiltIn`(内置 JuiceAgent-API)与 `CustomJar`(直接加载自定义 JAR)两种加载模式。 +- 新增 `JarLoader.Enabled` 开关,可在 `BuiltIn` 模式下关闭 JarLoader 模块。 +- 新增配置解析与访问的错误日志。 + +#### 🐛 修复 + +- 自定义 JAR 入口类名规范化(`.` → `/`),修复 `NoClassDefFoundError`。 +- `tests/copy-bin.bat` 在被占用时会静默失败的问题。 +- `GetClassBytesByName` 集成测试未先加载目标类的问题。 + +#### 🔧 内部改动 + +- TOML 解析器由 `toml11` 迁移到 `toml++`。 +- 移除未使用的 `LoaderConfig` 相关辅助函数。 + +#### 📝 文档 + +- 新增 `docs/config.md`(v2 配置参考)。 +- 重写 `docs/advanced.md`;README 与示例文档升级到 v2。 + +### [4.1.2] - 2026-10-11 + +#### ✨ 新功能 + +- 新增基于版本的打包脚本(`script/package.bat` + `script/package.cmake`)。 +- `Version.txt` 改为 `Major` / `Minor` / `Patch` 结构化格式。 + +#### 🐛 修复 + +- 修复 `getClassBytesByName` 在部分环境下无法获取类的问题(改用 JVMTI 的 `findLoadedClass`)。 + +#### 📝 文档 + +- 新增 `docs/Inject.md`;修正文档路径。 + +## English + +### [5.0.0] - 2026-10-15 + +#### ⚠️ Breaking Changes + +- Configuration schema upgraded from v1 to v2 (`CONFIG_VERSION = 2`): older configs are rejected by the version check and must be migrated (see the [v5.0.0 release notes](v5.0.0.md)). + +#### ✨ Features + +- New `JarLoader.Mode`: `BuiltIn` (embedded JuiceAgent-API) and `CustomJar` (load your own JAR directly). +- New `JarLoader.Enabled` switch to turn the JarLoader module off in `BuiltIn` mode. +- Added logging for config parse and access errors. + +#### 🐛 Fixes + +- Normalize custom-jar entry class names (`.` → `/`), fixing `NoClassDefFoundError`. +- `tests/copy-bin.bat` no longer fails silently when a target file is locked. +- `GetClassBytesByName` integration test now loads the target class first. + +#### 🔧 Internal + +- Migrate the TOML parser from `toml11` to `toml++`. +- Remove the unused `LoaderConfig` helpers. + +#### 📝 Docs + +- Add `docs/config.md` (v2 configuration reference). +- Rewrite `docs/advanced.md`; update the READMEs and example guides to v2. + +### [4.1.2] - 2026-10-11 + +#### ✨ Features + +- Add a version-based packaging script (`script/package.bat` + `script/package.cmake`). +- `Version.txt` now uses a structured `Major` / `Minor` / `Patch` format. + +#### 🐛 Fixes + +- Fix `getClassBytesByName` failing in some environments (use JVMTI `findLoadedClass`). + +#### 📝 Docs + +- Add `docs/Inject.md`; fix documentation paths. diff --git a/docs/update/v5.0.0.md b/docs/update/v5.0.0.md new file mode 100644 index 0000000..a660e54 --- /dev/null +++ b/docs/update/v5.0.0.md @@ -0,0 +1,163 @@ +# JuiceAgent 5.0.0 Release Notes + +## 中文 + +### ⚠️ 破坏性变更 + +- **配置文件升级到 v2**:`CONFIG_VERSION` 提升为 `2`。加载器启动时会校验 `JuiceAgent.Version`,版本不匹配将直接拒绝加载,因此旧版 v1 配置必须先迁移。 + +v1(不再支持): + +```toml +[JuiceAgent] +Version = 1 + +[JuiceAgent.Loader] +JuiceAgentNativeLibraryPath = "" + +[JuiceAgent.Modules] + +[JuiceAgent.Modules.JarLoader] +Enabled = true +InjectionDir = "./injection" +JarPath = "./MyCustomJar.jar" +EntryClass = "Example.Main" +EntryMethod = "run" +``` + +v2(当前): + +```toml +[JuiceAgent] +Version = 2 +JuiceAgentNativeLibraryPath = "" + +[JarLoader] +Enabled = true +Mode = "BuiltIn" +InjectionDir = "./injection" +JarPath = "./MyCustomJar.jar" +EntryClass = "Example.Main" +EntryMethod = "run" +``` + +迁移要点: + +- `Version` 由 `1` 改为 `2`。 +- `JuiceAgentNativeLibraryPath` 由 `[JuiceAgent.Loader]` 移到 `[JuiceAgent]`。 +- 原 `[JuiceAgent.Modules.JarLoader]` 展平为顶层 `[JarLoader]`。 +- 新增必填项 `Mode`(`BuiltIn` 或 `CustomJar`)。 +- 完整说明见 [docs/config.md](../config.md)。 + +### ✨ 新功能 + +- 新增两种 JAR 加载模式(`JarLoader.Mode`): + - `BuiltIn`(推荐):加载器解出内嵌的 JuiceAgent-API jar 并注入系统类加载器,agent 通过 API 引导,再由 JarLoader 模块加载目标 JAR 并调用入口方法。 + - `CustomJar`:不再使用 JuiceAgent-API,加载器直接把 `JarPath` 加入系统类加载器并调用 `EntryClass.EntryMethod`,便于接入自定义引导。 +- 新增 `JarLoader.Enabled` 开关(默认 `false`),可在 `BuiltIn` 模式下关闭 JarLoader 模块。 +- 新增配置解析与访问的错误日志:配置缺失或类型不匹配时会给出明确提示。 + +### 🐛 修复 + +- 修复自定义 JAR 入口类查找失败:将类名规范化为 JNI 内部形式(`.` → `/`),`FindClass` 现在能正确解析 `Example.Main` 这类 Java 二进制名(修复 `NoClassDefFoundError`)。 +- 修复集成测试的二进制拷贝脚本 `tests/copy-bin.bat`:改用原生 `COPY /Y`,在目标文件被占用时明确报错,不再静默失败导致测试使用旧二进制。 +- 修复 `GetClassBytesByName` 集成测试:先加载目标类再按名获取字节码(该 API 只解析已加载的类)。 + +### 🔧 内部改动 + +- TOML 解析器由 `toml11` 迁移到 `toml++`。 +- 移除未使用的 `LoaderConfig` / `get_loader_config` / `print_loader_config`(其中仍引用着 v1 的配置键)。 + +### 📝 文档 + +- 新增 [docs/config.md](../config.md):完整的 v2 配置参考(含两种模式流程与各键默认值)。 +- 重写 [docs/advanced.md](../advanced.md):改为描述 `JarLoader.Mode = "CustomJar"`,移除已废弃的 `JUICEAGENT_API_*` 环境变量说明。 +- README(中/英)的 Quick Start 配置示例升级到 v2 并链接 `docs/config.md`;示例列表补充 `inject-via-java-api`。 +- 同步更新 `examples/inject-via-java-api` 的说明文档(中/英,md/txt)。 + +--- + +## English + +### ⚠️ Breaking Changes + +- **Configuration upgraded to v2**: `CONFIG_VERSION` is now `2`. The loader validates `JuiceAgent.Version` at startup and refuses to load on a mismatch, so existing v1 configs must be migrated first. + +v1 (no longer supported): + +```toml +[JuiceAgent] +Version = 1 + +[JuiceAgent.Loader] +JuiceAgentNativeLibraryPath = "" + +[JuiceAgent.Modules] + +[JuiceAgent.Modules.JarLoader] +Enabled = true +InjectionDir = "./injection" +JarPath = "./MyCustomJar.jar" +EntryClass = "Example.Main" +EntryMethod = "run" +``` + +v2 (current): + +```toml +[JuiceAgent] +Version = 2 +JuiceAgentNativeLibraryPath = "" + +[JarLoader] +Enabled = true +Mode = "BuiltIn" +InjectionDir = "./injection" +JarPath = "./MyCustomJar.jar" +EntryClass = "Example.Main" +EntryMethod = "run" +``` + +Migration: + +- `Version`: `1` → `2`. +- `JuiceAgentNativeLibraryPath` moved from `[JuiceAgent.Loader]` to `[JuiceAgent]`. +- `[JuiceAgent.Modules.JarLoader]` flattened to a top-level `[JarLoader]`. +- New required key `Mode` (`BuiltIn` or `CustomJar`). +- Full reference: [docs/config.md](../config.md). + +### ✨ Features + +- Two JAR loading modes (`JarLoader.Mode`): + - `BuiltIn` (recommended): the loader extracts the embedded JuiceAgent-API jar and adds it to the system class loader, the agent bootstraps it, and the JarLoader module loads the target JAR and invokes its entry method. + - `CustomJar`: JuiceAgent-API is not used; the loader adds `JarPath` to the system class loader and invokes `EntryClass.EntryMethod`, so you can plug in your own bootstrap. +- New `JarLoader.Enabled` switch (default `false`) to turn the JarLoader module off in `BuiltIn` mode. +- New logging for config parse and access errors, with clear messages when a key is missing or has the wrong type. + +### 🐛 Fixes + +- Fix entry class lookup for custom jars: class names are normalized to the JNI internal form (`.` → `/`) so `FindClass` resolves Java binary names like `Example.Main` (fixes `NoClassDefFoundError`). +- Fix the integration test helper `tests/copy-bin.bat`: it now uses native `COPY /Y` and reports a clear error when a target file is locked, instead of failing silently and testing against stale binaries. +- Fix the `GetClassBytesByName` integration test: load the target class before looking it up by name (the API only resolves already-loaded classes). + +### 🔧 Internal + +- Migrate the TOML parser from `toml11` to `toml++`. +- Remove the unused `LoaderConfig` / `get_loader_config` / `print_loader_config` (which still referenced a v1 config key). + +### 📝 Docs + +- Add [docs/config.md](../config.md): the complete v2 configuration reference (mode workflows and key defaults). +- Rewrite [docs/advanced.md](../advanced.md) around `JarLoader.Mode = "CustomJar"`, dropping the removed `JUICEAGENT_API_*` environment variables. +- Update the Quick Start config example in both READMEs to v2 and link `docs/config.md`; add `inject-via-java-api` to the examples list. +- Update the `examples/inject-via-java-api` guides (EN/ZH, md/txt). + +--- + +如果您在使用过程中遇到问题,可以加入我们的QQ/Discord群组 +If you encounter any issues during use, you can join our QQ/Discord group + +Discord: [JuiceDev](https://discord.gg/AQTnUyWNNJ) +QQ群: 1103504356 + +**Full Changelog**: https://github.com/xiaozhou233/JuiceAgent/compare/v4.1.2...v5.0.0