This is an automated email from the ASF dual-hosted git repository. chaokunyang pushed a commit to branch release_1.0.0 in repository https://gitbox.apache.org/repos/asf/fory-site.git
commit d88ff21a181422aaf6c7af84646789c24beeb903 Author: 慕白 <[email protected]> AuthorDate: Thu May 21 15:13:15 2026 +0800 Translate release content for 1.0.0 --- .../2026-05-21-fory_1_0_0_release.md | 124 +++++++++++++++++++++ .../current/compiler/compiler-guide.md | 4 +- .../current/compiler/flatbuffers-idl.md | 18 +-- .../current/compiler/protobuf-idl.md | 21 ++-- .../current/compiler/schema-idl.md | 17 ++- .../current/guide/cpp/index.md | 17 ++- .../current/guide/csharp/index.md | 2 +- .../current/guide/dart/index.md | 2 +- .../current/guide/java/compression.md | 2 +- .../current/guide/kotlin/index.md | 4 +- .../current/guide/rust/basic-serialization.md | 33 +++++- .../current/guide/rust/index.md | 2 +- .../current/guide/scala/index.md | 2 +- .../current/guide/xlang/getting-started.md | 6 +- .../current/start/install.md | 32 +++--- .../download/index.md | 10 +- 16 files changed, 237 insertions(+), 59 deletions(-) diff --git a/i18n/zh-CN/docusaurus-plugin-content-blog/2026-05-21-fory_1_0_0_release.md b/i18n/zh-CN/docusaurus-plugin-content-blog/2026-05-21-fory_1_0_0_release.md new file mode 100644 index 0000000000..01102215d7 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-blog/2026-05-21-fory_1_0_0_release.md @@ -0,0 +1,124 @@ +--- +slug: fory_1_0_0_release +title: Fory v1.0.0 发布 +authors: [chaokunyang] +tags: [fory, java, kotlin, scala, android, python, rust, c++, go, c#, swift, dart, compiler] +--- + +Apache Fory 团队很高兴宣布 1.0.0 版本正式发布。这是一个里程碑版本,包含来自 11 位贡献者的 [84 个 PR](https://github.com/apache/fory/compare/v0.17.0...v1.0.0),并让跨语言运行时成为各支持语言的默认路径。请访问 [Install 页面](https://fory.apache.org/docs/start/install) 获取各平台安装方式。 + +## 发布亮点 + +Apache Fory 1.0.0 标准化了跨语言序列化模型。统一的 xlang 类型系统现在成为各语言默认模式,并带来兼容模式读取、简化的字段排序,以及更好的 list/array 兼容性。本版本还为 xlang 序列化增加了 decimal 和 bfloat16 支持。 + +各语言运行时继续围绕统一的 Schema 和元信息模型收敛。Rust、C++、C#、Go、Dart、Python 和 Swift 都加入了嵌套容器和字段 codec 支持。Kotlin 增加 xlang、KSP 和 Schema IDL 支持,Scala 增加 Schema IDL 支持并更新了生成注解。 + +本版本也扩展了部署覆盖面并继续提升性能。Java 增加 Android 序列化支持、annotation processor 支持、Schema typed row 字段访问器,以及嵌套 type-use 序列化元信息。Dart typed-container fast path 和生成 struct 优化提升了吞吐,同时更新了基准图表。 + +关键 PR: + +* 统一 xlang 类型系统,并让 xlang 成为默认模式: https://github.com/apache/fory/pull/3644, https://github.com/apache/fory/pull/3685 +* 为 xlang 序列化增加 decimal 和 bfloat16 支持: https://github.com/apache/fory/pull/3599, https://github.com/apache/fory/pull/3605 +* 增加嵌套容器和字段 codec 支持: https://github.com/apache/fory/pull/3625, https://github.com/apache/fory/pull/3630, https://github.com/apache/fory/pull/3636, https://github.com/apache/fory/pull/3639, https://github.com/apache/fory/pull/3640, https://github.com/apache/fory/pull/3641, https://github.com/apache/fory/pull/3643 +* 增加 Kotlin xlang、KSP 和 Schema IDL 支持: https://github.com/apache/fory/pull/3679, https://github.com/apache/fory/pull/3684 +* 增加 Scala Schema IDL 支持并更新生成注解: https://github.com/apache/fory/pull/3681, https://github.com/apache/fory/pull/3682 +* 增加 Android 序列化和 Java annotation processor 支持: https://github.com/apache/fory/pull/3667, https://github.com/apache/fory/pull/3670 +* 改进 xlang 兼容模式: https://github.com/apache/fory/pull/3648, https://github.com/apache/fory/pull/3650, https://github.com/apache/fory/pull/3675 +* 提升序列化性能: https://github.com/apache/fory/pull/3609, https://github.com/apache/fory/pull/3653, https://github.com/apache/fory/pull/3656, https://github.com/apache/fory/pull/3661 +* 增加 Java row 访问器和嵌套 type-use 元信息: https://github.com/apache/fory/pull/3631, https://github.com/apache/fory/pull/3633 + +## 功能特性 + +* feat(ci): 修复 csharp 和 dart release,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3582 +* feat(rust): 增加可配置的大小护栏,作者 @ayush00git,见 https://github.com/apache/fory/pull/3579 +* refactor(rust): 将 Fory 配置移动到 builder,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3593 +* feat(xlang): 为 xlang 增加 decimal 并对齐 serializer,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3599 +* refactor(dart): 对齐 dart 内部实现,作者 @Geethapranay1,见 https://github.com/apache/fory/pull/3601 +* feat(xlang): 增加 bfloat16 支持,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3605 +* feat(dart): 支持 dart web 平台,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3608 +* perf(dart): typed-container 写入 fast path 并消除 scan,作者 @yash-agarwa-l,见 https://github.com/apache/fory/pull/3609 +* feat(swift): 为 swift 增加嵌套容器 override 支持,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3625 +* feat(java): 增加 schema typed row 字段访问器,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3631 +* feat: 为 rust 增加嵌套容器 codec,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3630 +* feat(java): 支持嵌套 type-use 序列化元信息,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3633 +* refactor(cpp): 移除 abseil 依赖,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3634 +* feat(cpp): 增加嵌套字段 codec 支持,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3636 +* feat(csharp): 支持嵌套容器字段 codec,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3639 +* feat(go): 支持嵌套字段 annotation type spec,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3640 +* feat(dart): 为 dart 支持嵌套容器字段 codec,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3641 +* feat(python): 支持嵌套字段 schema encoding,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3643 +* feat(xlang): 统一 xlang 类型系统,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3644 +* feat(xlang): 增加全面的读取校验,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3647 +* feat(xlang): 默认对 xlang 使用兼容模式,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3648 +* feat(xlang): 支持 list 与 array 字段之间的兼容读取,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3650 +* perf(dart): 移除 generated struct slot bridge,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3653 +* perf: 优化序列化性能,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3656 +* perf: 更新 benchmark 图表,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3661 +* refactor(rust): 在生成的 Rust 代码中使用绝对路径,作者 @BaldDemian,见 https://github.com/apache/fory/pull/3666 +* feat: 增加 android 支持,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3667 +* feat(compiler): 增加用于生成统一 gRPC service/method 名称的 helper,作者 @BaldDemian,见 https://github.com/apache/fory/pull/3672 +* feat(java): 为 android serialization 增加 annotation processor,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3670 +* feat(xlang): 简化 xlang 字段排序,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3675 +* feat(kotlin): 增加 kotlin xlang 和 ksp 支持,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3679 +* refactor(java): 替换 static serializer SPI lookup,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3680 +* feat(scala): 增加 scala schema IDL 支持,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3681 +* feat(scala): 更新生成注解,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3682 +* feat(rust): 将 rust chrono 设为可选依赖,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3683 +* feat(kotlin): 为 kotlin 增加 schema IDL 支持,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3684 +* feat(xlang): 让所有语言默认使用 xlang,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3685 + +## Bug 修复 + +* fix(dart): 解决 fory pub.dev score 问题,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3585 +* fix(dart): 修复 dart CI,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3586 +* fix(dart): 使用 getUint32 正确编码 u64 值,作者 @ayush00git,见 https://github.com/apache/fory/pull/3592 +* fix(c++): 修复 c++ duration 序列化,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3598 +* fix(javascript): 将 TypeMeta preamble 常量与 python/java/rust/go xlang binding 对齐,作者 @emrul,见 https://github.com/apache/fory/pull/3603 +* fix(javascript): 修复 javascript schema IDL 测试,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3604 +* fix(dart): 增加 `>>>` 以实现 uint 中正确的逻辑右移语义,作者 @ayush00git,见 https://github.com/apache/fory/pull/3607 +* fix(go): 确保 unsafe varint fast path 有物理 buffer 空间,作者 @ayush00git,见 https://github.com/apache/fory/pull/3613 +* fix(go): 为 refResolver 和 metaStringResolver 读取增加边界检查,作者 @ayush00git,见 https://github.com/apache/fory/pull/3615 +* fix(go): 为 slice 和 string 增加预分配边界检查,作者 @ayush00git,见 https://github.com/apache/fory/pull/3618 +* fix(go): 为 decimal 反序列化增加 maxBinarySize 限制,作者 @ayush00git,见 https://github.com/apache/fory/pull/3623 +* fix(go): 增加可配置的 fieldCount 和 fieldDepth 护栏,作者 @ayush00git,见 https://github.com/apache/fory/pull/3620 +* fix(java): 在 generated decode 中遵循 record field encoding,作者 @mandrean,见 https://github.com/apache/fory/pull/3626 +* fix(java): 在兼容模式下保留 externalizable container,作者 @mandrean,见 https://github.com/apache/fory/pull/3628 +* fix(python): 在读取时执行更多校验,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3632 +* fix(xlang): 修复 xlang 类型系统,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3646 +* fix(java): 对未注册的 writeReplace class 使用 REPLACE_STUB_ID,避免跨 JVM ClassNotFoundException,作者 @wakilurislam,见 https://github.com/apache/fory/pull/3638 +* fix(java): 修复 set view 引用跟踪,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3649 +* fix(java): 为兼容读取恢复 map declared serializer,作者 @mandrean,见 https://github.com/apache/fory/pull/3654 +* fix: 将 TypeMeta header bits 纳入 hash,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3659 +* fix(java): 序列化 suppressed exception,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3663 +* fix(javascript): 在重新生成的 read serializer 中保留 getTypeInfo,作者 @xhzq233,见 https://github.com/apache/fory/pull/3669 +* fix(java): 校验 subclass serializer layer 数量,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3676 +* fix(java): 避免实例化 abstract meta-share type,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3677 +* fix: 修复 release script,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3687 + +## 其他改进 + +* chore: 跳过以 go 开头 tag 的自动发布,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3584 +* docs: 增加 NuGet badge,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3587 +* docs(java): 更新 graalvm guide 位置,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3588 +* docs: 将 graalvm_support.md 重命名为 graalvm-support.md,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3589 +* chore(rust): 优化 varint read/write 方法名,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3590 +* docs: 将 development guide 移动到 docs root,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3591 +* chore(dart): 增加缺失的 license header,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3594 +* chore(csharp): 增加更多 csharp 和 swift 测试,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3597 +* chore(dart): 优化 dart xlang serialization,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3596 +* docs: 增加更多 agent harness 规则,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3610 +* chore(dart): 移除过期 dart note 文件,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3642 +* chore(java): 配置默认 Fory log level,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3657 +* chore: 清理代码并增加 compiler warning 检查,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3660 +* docs: 收紧 benchmark throughput 图表,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3662 +* docs: 更新 README,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3664 +* docs: 增加 README schema IDL 示例,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3665 +* docs: 更新 xlang/native serialization 文档,作者 @chaokunyang,见 https://github.com/apache/fory/pull/3686 + +## 新贡献者 + +* @emrul 在 https://github.com/apache/fory/pull/3603 中完成了首次贡献 +* @wakilurislam 在 https://github.com/apache/fory/pull/3638 中完成了首次贡献 +* @xhzq233 在 https://github.com/apache/fory/pull/3669 中完成了首次贡献 + +**完整变更日志**: https://github.com/apache/fory/compare/v0.17.0...v1.0.0 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/compiler-guide.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/compiler-guide.md index 54e8886632..7144ab23f4 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/compiler-guide.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/compiler-guide.md @@ -536,7 +536,7 @@ cc_library( ```yaml dependencies: - fory: ^0.1.0 + fory: ^1.0.0 dev_dependencies: build_runner: ^2.4.0 @@ -736,5 +736,5 @@ fory = "x.y.z" ```yaml dependencies: - fory: ^0.1.0 + fory: ^1.0.0 ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/flatbuffers-idl.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/flatbuffers-idl.md index 6a2bfd2885..f250081313 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/flatbuffers-idl.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/flatbuffers-idl.md @@ -124,17 +124,19 @@ FlatBuffers metadata 属性写法为 `key:value`。对于 Fory 扩展选项, ### 支持的字段属性 -| FlatBuffers Attribute | 在 Fory 中的效果 | -| -------------------------------- | --------------------------------- | -| `fory_ref:true` | 为字段启用引用跟踪 | -| `fory_nullable:true` | 将字段标记为 optional/nullable | -| `fory_weak_ref:true` | 启用弱引用语义,并隐含开启 `ref` | -| `fory_thread_safe_pointer:false` | 对 ref 字段选择非线程安全指针类型 | +| FlatBuffers Attribute | 在 Fory 中的效果 | +| ------------------------------- | ------------------------------------------------------------------------ | +| `fory_ref:true` | 为字段启用引用跟踪 | +| `fory_nullable:true` | 将字段标记为 optional/nullable | +| `fory_weak_ref:true` | 启用弱引用语义,并隐含开启 `ref` | +| `fory_thread_safe_pointer:true` | 对 ref 字段使用 Rust `Arc`/`ArcWeak`,而不是默认的 `Rc`/`RcWeak` | 语义说明: - `fory_weak_ref:true` 隐含 `ref`。 -- `fory_thread_safe_pointer` 仅在字段启用 ref 跟踪时生效。 +- `fory_thread_safe_pointer` 默认为 `false`,仅在字段启用 ref 跟踪时生效,且不会改变编码格式。 +- 在 Rust 代码生成中,`fory_weak_ref:true` 默认使用 `RcWeak`;只有同时设置 + `fory_thread_safe_pointer:true` 时才会切换为 `ArcWeak`。 - 对列表字段,`fory_ref:true` 作用于列表元素。 示例: @@ -143,7 +145,7 @@ FlatBuffers metadata 属性写法为 `key:value`。对于 Fory 扩展选项, table Node { parent: Node (fory_weak_ref: true); children: [Node] (fory_ref: true); - cached: Node (fory_ref: true, fory_thread_safe_pointer: false); + cached: Node (fory_ref: true, fory_thread_safe_pointer: true); } ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/protobuf-idl.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/protobuf-idl.md index d5bb1d8791..13c0de6995 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/protobuf-idl.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/protobuf-idl.md @@ -221,14 +221,14 @@ message TreeNode { ### 字段级选项 -| 选项 | 类型 | 说明 | -| ---------------------------- | ------ | ----------------------------------------------------- | -| `(fory).ref` | bool | 为该字段启用引用跟踪 | -| `(fory).nullable` | bool | 将字段视为可空(`optional`) | -| `(fory).weak_ref` | bool | 生成弱指针语义(C++/Rust 代码生成) | -| `(fory).thread_safe_pointer` | bool | ref 字段在 Rust 中的指针类型(`Arc` vs `Rc`) | -| `(fory).deprecated` | bool | 标记字段为弃用 | -| `(fory).type` | string | 基础类型覆盖,目前支持 `tagged_int64`/`tagged_uint64` | +| 选项 | 类型 | 说明 | +| ---------------------------- | ------ | --------------------------------------------------------------------- | +| `(fory).ref` | bool | 为该字段启用引用跟踪 | +| `(fory).nullable` | bool | 将字段视为可空(`optional`) | +| `(fory).weak_ref` | bool | 生成弱指针语义(C++/Rust 代码生成) | +| `(fory).thread_safe_pointer` | bool | 对 ref 字段使用 Rust `Arc`/`ArcWeak`;默认 `false` 使用 `Rc`/`RcWeak` | +| `(fory).deprecated` | bool | 标记字段为弃用 | +| `(fory).type` | string | 基础类型覆盖,目前支持 `tagged_int64`/`tagged_uint64` | 引用相关行为: @@ -236,12 +236,15 @@ message TreeNode { - 对 `repeated` 字段,`(fory).ref = true` 作用于列表元素。 - 对 `map<K, V>` 字段,`(fory).ref = true` 作用于 map value。 - `weak_ref` 与 `thread_safe_pointer` 是 C++/Rust 代码生成提示。 +- `thread_safe_pointer` 默认为 `false`;它只改变生成的 Rust 指针承载类型,不改变编码格式。 +- 在 Rust 代码生成中,`(fory).weak_ref = true` 默认使用 `RcWeak`;只有同时设置 + `(fory).thread_safe_pointer = true` 时才会切换为 `ArcWeak`。 ### 典型选项组合示例 ```protobuf message Graph { - Node root = 1 [(fory).ref = true, (fory).thread_safe_pointer = false]; + Node root = 1 [(fory).ref = true, (fory).thread_safe_pointer = true]; repeated Node nodes = 2 [(fory).ref = true]; map<string, Node> cache = 3 [(fory).ref = true]; Node parent = 4 [(fory).weak_ref = true]; diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/schema-idl.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/schema-idl.md index 8f56cbecd8..2d704f3cea 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/schema-idl.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/schema-idl.md @@ -522,11 +522,26 @@ message Node { | Java | `Node parent` | `Node parent` 配合 `@ForyField(ref=true)` | | Python | `parent: Node` | `parent: Node = pyfory.field(ref=True)` | | Go | `Parent Node` | `Parent *Node` 配合 `fory:"ref"` | -| Rust | `parent: Node` | `parent: Arc<Node>` | +| Rust | `parent: Node` | `parent: Rc<Node>` | | C++ | `Node parent` | `std::shared_ptr<Node> parent` | | JavaScript | `parent: Node` | `parent: Node`(无额外 `ref` 区分) | | Dart | `Node parent` | `Node parent` 配合 `@ForyField(ref: true)` | +Rust 对启用 ref 跟踪的字段默认使用 `Rc` 和 `RcWeak`。当生成的 Rust 类型需要使用 +`Arc` 或 `ArcWeak` 进行跨线程共享所有权时,可以使用 `ref(thread_safe=true)`。这个 +设置只是 Rust 代码生成中的承载类型选择;它不会改变编码格式,也不会让被引用值本身 +变成线程安全。protobuf 选项语法见 +[Protocol Buffers IDL Support](protobuf-idl.md#field-level-options)。 + +Rust 指针承载类型映射: + +| Fory IDL | Rust type | +| ---------------------------------------------- | --------------- | +| `ref Node parent` | `Rc<Node>` | +| `ref(thread_safe=true) Node parent` | `Arc<Node>` | +| `ref(weak=true) Node parent` | `RcWeak<Node>` | +| `ref(weak=true, thread_safe=true) Node parent` | `ArcWeak<Node>` | + #### `list` 列表字段(`repeated` 为等价别名): diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/cpp/index.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/cpp/index.md index d416203a56..cb7f3d8d12 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/cpp/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/cpp/index.md @@ -42,6 +42,8 @@ C++ 实现同时支持 CMake 和 Bazel 构建系统。 - CMake 3.16+(用于 CMake 构建)或 Bazel 8+(用于 Bazel 构建) - 支持 C++17 的编译器(GCC 7+、Clang 5+、MSVC 2017+) +使用 MSVC 构建时,需要配置构建系统传入 `/Zc:preprocessor`。 + ### 使用 CMake(推荐) 最简单的集成方式是使用 CMake 的 `FetchContent` 模块: @@ -59,7 +61,7 @@ include(FetchContent) FetchContent_Declare( fory GIT_REPOSITORY https://github.com/apache/fory.git - GIT_TAG v0.17.0 + GIT_TAG v1.0.0 SOURCE_SUBDIR cpp ) FetchContent_MakeAvailable(fory) @@ -89,11 +91,11 @@ module( bazel_dep(name = "rules_cc", version = "0.1.1") -bazel_dep(name = "fory", version = "0.17.0") +bazel_dep(name = "fory", version = "1.0.0") git_override( module_name = "fory", remote = "https://github.com/apache/fory.git", - commit = "v0.17.0", # 或使用特定 commit hash 以确保可复现性 + commit = "v1.0.0", # 或使用特定 commit hash 以确保可复现性 ) ``` @@ -107,6 +109,13 @@ cc_binary( ) ``` +使用 MSVC 构建时,在 Bazel 配置中加入符合标准的预处理器选项: + +```bazel +# .bazelrc +build --cxxopt=/Zc:preprocessor +``` + 然后构建并运行: ```bash @@ -117,7 +126,7 @@ bazel run //:my_app 对于本地开发,也可以改用 `local_path_override`: ```bazel -bazel_dep(name = "fory", version = "0.17.0") +bazel_dep(name = "fory", version = "1.0.0") local_path_override( module_name = "fory", path = "/path/to/fory", diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/csharp/index.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/csharp/index.md index 966507f1f6..1d7a9b2c9e 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/csharp/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/csharp/index.md @@ -43,7 +43,7 @@ Apache Fory™ C# 是面向 .NET 的高性能跨语言序列化运行时。它 ```xml <ItemGroup> - <PackageReference Include="Apache.Fory" Version="0.17.0" /> + <PackageReference Include="Apache.Fory" Version="1.0.0" /> </ItemGroup> ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/dart/index.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/dart/index.md index c4920ee34f..a9d8fd7e9e 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/dart/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/dart/index.md @@ -42,7 +42,7 @@ Apache Fory™ Dart 可以把 Dart 对象序列化为字节,再从字节反序 ```yaml dependencies: - fory: ^0.17.0 + fory: ^1.0.0 dev_dependencies: build_runner: ^2.4.0 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/java/compression.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/java/compression.md index 5447dd9ed5..436176eedc 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/java/compression.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/java/compression.md @@ -84,7 +84,7 @@ CompressedArraySerializers.registerSerializers(fory); <dependency> <groupId>org.apache.fory</groupId> <artifactId>fory-simd</artifactId> - <version>0.17.0</version> + <version>1.0.0</version> </dependency> ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/kotlin/index.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/kotlin/index.md index 27405530a0..98ba8f6f8b 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/kotlin/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/kotlin/index.md @@ -50,14 +50,14 @@ Fory Kotlin 继承了 Fory Java 的全部特性,并增加了 Kotlin 特定优 <dependency> <groupId>org.apache.fory</groupId> <artifactId>fory-kotlin</artifactId> - <version>0.17.0</version> + <version>1.0.0</version> </dependency> ``` ### Gradle ```kotlin -implementation("org.apache.fory:fory-kotlin:0.17.0") +implementation("org.apache.fory:fory-kotlin:1.0.0") ``` ## 快速开始 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/rust/basic-serialization.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/rust/basic-serialization.md index 6cb1ea317b..3c2fb2dac1 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/rust/basic-serialization.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/rust/basic-serialization.md @@ -116,10 +116,35 @@ assert_eq!(person, decoded); ### 日期和时间 -| Rust 类型 | 描述 | -| ----------------------- | ---------------- | -| `chrono::NaiveDate` | 不带时区的日期 | -| `chrono::NaiveDateTime` | 不带时区的时间戳 | +| Rust 类型 | 描述 | +| ----------- | -------------------------------- | +| `Date` | 不带时区的日期,存储为 epoch 天数 | +| `Timestamp` | 时间点,存储为 epoch 秒和纳秒 | +| `Duration` | 有符号时长,存储为秒和规范化纳秒 | + +内置承载类型提供无额外依赖的构造器、访问器、转换和 checked 算术: + +```rust +use fory::{Date, Duration, Timestamp}; + +let date = Date::from_epoch_days(19_782); +assert_eq!(date.checked_add_days(1)?.epoch_days(), 19_783); + +let timestamp = Timestamp::from_epoch_millis(-1); +assert_eq!(timestamp.to_epoch_millis()?, -1); + +let duration = Duration::from_parts(1, 1_500_000_000)?; +assert_eq!(duration.to_millis()?, 2_500); +let later = timestamp.checked_add_duration(duration)?; +``` + +启用 Rust `chrono` feature 后,也支持 `chrono::NaiveDate`、`chrono::NaiveDateTime` 和 +`chrono::Duration`: + +```toml +[dependencies] +fory = { version = "1.0.0", features = ["chrono"] } +``` ### 自定义类型 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/rust/index.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/rust/index.md index b4d06e66b1..b825328818 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/rust/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/rust/index.md @@ -47,7 +47,7 @@ Rust 实现提供灵活而高性能的序列化能力,具备自动内存管理 ```toml [dependencies] -fory = "0.17.0" +fory = "1.0.0" ``` ### 基础示例 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/scala/index.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/scala/index.md index c64aa7c2e0..951f552d4e 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/scala/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/scala/index.md @@ -48,7 +48,7 @@ Fory Scala 继承了 Fory Java 的全部特性,并增加了 Scala 特定优化 使用 sbt 添加依赖: ```sbt -libraryDependencies += "org.apache.fory" %% "fory-scala" % "0.17.0" +libraryDependencies += "org.apache.fory" %% "fory-scala" % "1.0.0" ``` ## 快速开始 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/xlang/getting-started.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/xlang/getting-started.md index a93f386c4a..8d808a279f 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/xlang/getting-started.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/guide/xlang/getting-started.md @@ -31,14 +31,14 @@ license: | <dependency> <groupId>org.apache.fory</groupId> <artifactId>fory-core</artifactId> - <version>0.17.0</version> + <version>1.0.0</version> </dependency> ``` **Gradle:** ```gradle -implementation 'org.apache.fory:fory-core:0.17.0' +implementation 'org.apache.fory:fory-core:1.0.0' ``` ### Python @@ -57,7 +57,7 @@ go get github.com/apache/fory/go/fory ```toml [dependencies] -fory = "0.17.0" +fory = "1.0.0" ``` ### JavaScript diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/start/install.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/start/install.md index f7839c6300..6737454dfd 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/start/install.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/start/install.md @@ -16,14 +16,14 @@ Apache Fory™ 同时提供源码发布物和各语言对应的软件包。 <dependency> <groupId>org.apache.fory</groupId> <artifactId>fory-core</artifactId> - <version>0.17.0</version> + <version>1.0.0</version> </dependency> <!-- 可选的 row format 支持 --> <!-- <dependency> <groupId>org.apache.fory</groupId> <artifactId>fory-format</artifactId> - <version>0.17.0</version> + <version>1.0.0</version> </dependency> --> <!-- 用于数组压缩的 SIMD 加速(Java 16+) --> @@ -31,7 +31,7 @@ Apache Fory™ 同时提供源码发布物和各语言对应的软件包。 <dependency> <groupId>org.apache.fory</groupId> <artifactId>fory-simd</artifactId> - <version>0.17.0</version> + <version>1.0.0</version> </dependency> --> ``` @@ -44,7 +44,7 @@ Scala 2.13 的 Maven 依赖: <dependency> <groupId>org.apache.fory</groupId> <artifactId>fory-scala_2.13</artifactId> - <version>0.17.0</version> + <version>1.0.0</version> </dependency> ``` @@ -54,20 +54,20 @@ Scala 3 的 Maven 依赖: <dependency> <groupId>org.apache.fory</groupId> <artifactId>fory-scala_3</artifactId> - <version>0.17.0</version> + <version>1.0.0</version> </dependency> ``` Scala 2.13 的 sbt 依赖: ```sbt -libraryDependencies += "org.apache.fory" % "fory-scala_2.13" % "0.17.0" +libraryDependencies += "org.apache.fory" % "fory-scala_2.13" % "1.0.0" ``` Scala 3 的 sbt 依赖: ```sbt -libraryDependencies += "org.apache.fory" % "fory-scala_3" % "0.17.0" +libraryDependencies += "org.apache.fory" % "fory-scala_3" % "1.0.0" ``` ## Kotlin @@ -78,7 +78,7 @@ libraryDependencies += "org.apache.fory" % "fory-scala_3" % "0.17.0" <dependency> <groupId>org.apache.fory</groupId> <artifactId>fory-kotlin</artifactId> - <version>0.17.0</version> + <version>1.0.0</version> </dependency> ``` @@ -86,7 +86,7 @@ libraryDependencies += "org.apache.fory" % "fory-scala_3" % "0.17.0" ```bash python -m pip install --upgrade pip -pip install pyfory==0.17.0 +pip install pyfory==1.0.0 ``` ## Go @@ -94,7 +94,7 @@ pip install pyfory==0.17.0 请使用完整的 Go 模块路径 `github.com/apache/fory/go/fory`: ```bash -go get github.com/apache/fory/go/[email protected] +go get github.com/apache/fory/go/[email protected] ``` 如果你的 Go proxy 还没有同步新的子模块 tag,请稍后重试,或者临时使用 `GOPROXY=direct`。 @@ -103,13 +103,13 @@ go get github.com/apache/fory/go/[email protected] ```toml [dependencies] -fory = "0.17.0" +fory = "1.0.0" ``` 或者使用 `cargo add`: ```bash -cargo add [email protected] +cargo add [email protected] ``` ## JavaScript @@ -140,7 +140,7 @@ npm run build ```yaml dependencies: - fory: ^0.17.0 + fory: ^1.0.0 dev_dependencies: build_runner: ^2.4.13 @@ -157,12 +157,12 @@ dart run build_runner build --delete-conflicting-outputs 安装 `Apache.Fory` NuGet 包。它同时包含运行时以及 `[ForyObject]` 类型所需的源代码生成器。 ```bash -dotnet add package Apache.Fory --version 0.17.0 +dotnet add package Apache.Fory --version 1.0.0 ``` ```xml <ItemGroup> - <PackageReference Include="Apache.Fory" Version="0.17.0" /> + <PackageReference Include="Apache.Fory" Version="1.0.0" /> </ItemGroup> ``` @@ -172,7 +172,7 @@ dotnet add package Apache.Fory --version 0.17.0 ```swift dependencies: [ - .package(url: "https://github.com/apache/fory.git", exact: "0.17.0") + .package(url: "https://github.com/apache/fory.git", exact: "1.0.0") ], targets: [ .target( diff --git a/i18n/zh-CN/docusaurus-plugin-content-pages/download/index.md b/i18n/zh-CN/docusaurus-plugin-content-pages/download/index.md index 9e98da1454..be9e85d6e0 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-pages/download/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-pages/download/index.md @@ -9,11 +9,11 @@ Apache Fory™ 的官方发布以源码制品形式提供。 ## 最新版本 -当前最新源码版本为 0.17.0: +当前最新源码版本为 1.0.0: | 版本 | 日期 | 源码 | 发布说明 | | ------ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------- | -| 0.17.0 | 2026-04-19 | [source](https://www.apache.org/dyn/closer.lua/fory/0.17.0/apache-fory-0.17.0-src.tar.gz?action=download) [asc](https://downloads.apache.org/fory/0.17.0/apache-fory-0.17.0-src.tar.gz.asc) [sha512](https://downloads.apache.org/fory/0.17.0/apache-fory-0.17.0-src.tar.gz.sha512) | [release notes](https://github.com/apache/fory/releases/tag/v0.17.0) | +| 1.0.0 | 2026-05-21 | [source](https://www.apache.org/dyn/closer.lua/fory/1.0.0/apache-fory-1.0.0-src.tar.gz?action=download) [asc](https://downloads.apache.org/fory/1.0.0/apache-fory-1.0.0-src.tar.gz.asc) [sha512](https://downloads.apache.org/fory/1.0.0/apache-fory-1.0.0-src.tar.gz.sha512) | [release notes](https://github.com/apache/fory/releases/tag/v1.0.0) | ## 所有归档版本 @@ -31,13 +31,13 @@ Fory 为下载站点上的所有文件提供 SHA 摘要和 PGP 签名文件。 要验证 SHA 摘要,你需要 `.tar.gz` 文件及其对应的 `.tar.gz.sha512` 文件。示例命令如下: ```bash -sha512sum --check apache-fory-0.17.0-src.tar.gz +sha512sum --check apache-fory-1.0.0-src.tar.gz ``` 输出类似下面这样即表示校验通过: ```bash -apache-fory-0.17.0-src.tar.gz: OK +apache-fory-1.0.0-src.tar.gz: OK ``` ### 校验签名 @@ -53,7 +53,7 @@ gpg --import KEYS 之后可以校验签名: ```bash -gpg --verify apache-fory-0.17.0-src.tar.gz.asc apache-fory-0.17.0-src.tar.gz +gpg --verify apache-fory-1.0.0-src.tar.gz.asc apache-fory-1.0.0-src.tar.gz ``` 如果出现如下输出,即表示签名正确: --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
