Skip to content

Commit 80f25c4

Browse files
committed
feat: release version 4.1.0 with new bundle module and breaking changes
- Introduced `fastproto-bundle` module, aggregating core and processor for simplified dependency management. - Removed `CodecProcessor` and `@GenerateCodec` annotation due to limited value. - Eliminated runtime dynamic compilation, relying solely on compile-time code generation for lambda formulas. - Restructured project into three modules: `fastproto-core`, `fastproto-processor`, and `fastproto`. - Updated documentation to reflect changes and provide a migration guide for users upgrading from version 4.0.0.
1 parent 6dfdc79 commit 80f25c4

33 files changed

Lines changed: 380 additions & 891 deletions

File tree

CHANGELOG-zh.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22

33
本文件用于记录本项目的所有重要变更。
44

5+
## [4.1.0] - 2026-01-27
6+
### 新增
7+
- **fastproto 聚合模块**:新增 `fastproto-bundle` 模块(artifactId 为 `fastproto`),聚合 core 和 processor,用户只需引用一个依赖即可获得完整功能
8+
- Bundle 模块集成测试,验证聚合后功能正常
9+
10+
### 移除
11+
- 移除 `CodecProcessor``@GenerateCodec` 注解(功能价值有限)
12+
- 移除运行时动态编译功能(`FormulaBuilder` 及相关类),lambda 公式现在完全依赖编译时代码生成
13+
14+
### 变更
15+
- 项目结构调整为三模块:
16+
- `fastproto-core` - 核心库
17+
- `fastproto-processor` - 注解处理器
18+
- `fastproto` (bundle) - 聚合模块,推荐用户使用
19+
- 更新文档,简化依赖引用说明
20+
21+
### 升级指南
22+
从 4.0.0 升级的用户,现在只需引用一个依赖:
23+
24+
**Maven:**
25+
```xml
26+
<dependency>
27+
<groupId>org.indunet</groupId>
28+
<artifactId>fastproto</artifactId>
29+
<version>4.1.0</version>
30+
</dependency>
31+
```
32+
533
## [4.0.0] - 2026-01-26
634
### 重大变更
735
- **多模块重构**:项目拆分为两个模块:

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [4.1.0] - 2026-01-27
6+
### Added
7+
- **fastproto bundle module**: New `fastproto-bundle` module (artifactId: `fastproto`) that aggregates core and processor, allowing users to include just one dependency for full functionality
8+
- Integration tests for the bundle module to verify aggregated functionality
9+
10+
### Removed
11+
- Removed `CodecProcessor` and `@GenerateCodec` annotation (limited practical value)
12+
- Removed runtime dynamic compilation (`FormulaBuilder` and related classes); lambda formulas now rely entirely on compile-time code generation
13+
14+
### Changed
15+
- Project restructured into three modules:
16+
- `fastproto-core` - Core library
17+
- `fastproto-processor` - Annotation processor
18+
- `fastproto` (bundle) - Aggregator module, recommended for users
19+
- Updated documentation to simplify dependency references
20+
21+
### Migration Guide
22+
Users upgrading from 4.0.0 now only need one dependency:
23+
24+
**Maven:**
25+
```xml
26+
<dependency>
27+
<groupId>org.indunet</groupId>
28+
<artifactId>fastproto</artifactId>
29+
<version>4.1.0</version>
30+
</dependency>
31+
```
32+
533
## [4.0.0] - 2026-01-26
634
### Breaking Changes
735
- **Multi-module restructure**: Project split into two modules:

README-zh.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,7 @@ FastProto 是一个面向 **二进制通信协议** 的高性能序列化 / 反
4545
<dependency>
4646
<groupId>org.indunet</groupId>
4747
<artifactId>fastproto</artifactId>
48-
<version>4.0.0</version>
49-
</dependency>
50-
51-
<!-- 可选:使用 lambda 公式时需要 (@DecodingFormula(lambda="...")) -->
52-
<dependency>
53-
<groupId>org.indunet</groupId>
54-
<artifactId>fastproto-processor</artifactId>
55-
<version>4.0.0</version>
56-
<scope>provided</scope>
48+
<version>4.1.0</version>
5749
</dependency>
5850
```
5951

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,7 @@ See the [CHANGELOG](CHANGELOG.md) for recent updates.
4646
<dependency>
4747
<groupId>org.indunet</groupId>
4848
<artifactId>fastproto</artifactId>
49-
<version>4.0.0</version>
50-
</dependency>
51-
52-
<!-- Optional: For lambda formula support (@DecodingFormula(lambda="...")) -->
53-
<dependency>
54-
<groupId>org.indunet</groupId>
55-
<artifactId>fastproto-processor</artifactId>
56-
<version>4.0.0</version>
57-
<scope>provided</scope>
49+
<version>4.1.0</version>
5850
</dependency>
5951
```
6052

docs/android.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,57 @@ This page summarizes how to use FastProto on Android.
1111

1212
## Lambda Formulas on Android
1313

14-
Since version 4.0.0, FastProto provides a separate annotation processor module (`fastproto-processor`) that generates formula classes at compile time. This makes `@DecodingFormula(lambda = "...")` and `@EncodingFormula(lambda = "...")` fully compatible with Android.
14+
FastProto provides a separate annotation processor module (`fastproto-processor`) that generates formula classes at compile time. This makes `@DecodingFormula(lambda = "...")` and `@EncodingFormula(lambda = "...")` fully compatible with Android.
1515

1616
### Setup
1717

18+
Android projects need to configure the annotation processor separately (cannot use the `fastproto` bundle directly).
19+
1820
**Gradle (Kotlin DSL)**:
1921
```kotlin
2022
dependencies {
21-
implementation("org.indunet:fastproto:4.0.0")
22-
annotationProcessor("org.indunet:fastproto-processor:4.0.0")
23+
implementation("org.indunet:fastproto-core:4.1.0")
24+
annotationProcessor("org.indunet:fastproto-processor:4.1.0")
2325
}
2426

2527
// For Kotlin projects, use kapt instead:
26-
// kapt("org.indunet:fastproto-processor:4.0.0")
28+
// kapt("org.indunet:fastproto-processor:4.1.0")
2729
```
2830

2931
**Gradle (Groovy DSL)**:
3032
```groovy
3133
dependencies {
32-
implementation 'org.indunet:fastproto:4.0.0'
33-
annotationProcessor 'org.indunet:fastproto-processor:4.0.0'
34+
implementation 'org.indunet:fastproto-core:4.1.0'
35+
annotationProcessor 'org.indunet:fastproto-processor:4.1.0'
3436
}
3537
```
3638

37-
**Maven**:
39+
**Maven (Android)**:
3840
```xml
3941
<dependencies>
4042
<dependency>
4143
<groupId>org.indunet</groupId>
42-
<artifactId>fastproto</artifactId>
43-
<version>4.0.0</version>
44+
<artifactId>fastproto-core</artifactId>
45+
<version>4.1.0</version>
4446
</dependency>
4547
<dependency>
4648
<groupId>org.indunet</groupId>
4749
<artifactId>fastproto-processor</artifactId>
48-
<version>4.0.0</version>
50+
<version>4.1.0</version>
4951
<scope>provided</scope>
5052
</dependency>
5153
</dependencies>
5254
```
5355

56+
**Note:** For standard Maven/Gradle projects (non-Android), simply use the `fastproto` bundle which includes everything:
57+
```xml
58+
<dependency>
59+
<groupId>org.indunet</groupId>
60+
<artifactId>fastproto</artifactId>
61+
<version>4.1.0</version>
62+
</dependency>
63+
```
64+
5465
### How It Works
5566

5667
The annotation processor scans your code at compile time and generates `Function` implementation classes for each lambda expression. These generated classes are included in your APK and used at runtime instead of dynamic compilation.
@@ -117,6 +128,7 @@ public class SensorData {
117128

118129
## FAQ
119130

120-
- **Can I use lambda formulas on Android?** Yes! Since 4.0.0, the `fastproto-processor` module generates formula classes at compile time, making lambda formulas fully compatible with Android.
131+
- **Can I use lambda formulas on Android?** Yes! The `fastproto-processor` module generates formula classes at compile time, making lambda formulas fully compatible with Android.
132+
- **Why can't I use the `fastproto` bundle on Android?** Android's build system requires explicit annotation processor configuration. The bundle works for standard Maven/Gradle projects but Android needs separate `fastproto-core` + `fastproto-processor` dependencies.
121133
- **Do I need the annotation processor?** If you use `@DecodingFormula(lambda = "...")` or `@EncodingFormula(lambda = "...")`, yes. If you only use class-based formulas like `@DecodingFormula(MyFormula.class)`, the annotation processor is optional.
122134
- **Do I need ProGuard rules?** If you rely on reflection/annotations, keep them as shown above. The generated formula classes should also be kept.

docs/formulas.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Formulas let you convert between raw on‑wire values and engineering values. Yo
99
- Decode formula: raw -> target field type
1010
- Encode formula: target field type -> raw
1111

12-
> **Note:** Lambda formulas require the `fastproto-processor` module for compile-time code generation. This ensures compatibility with Android and Java 11+ JRE environments. See [Android guide](android.md) for setup details.
12+
> **Note:** Lambda formulas require annotation processing for compile-time code generation. The `fastproto` bundle includes this by default. For Android projects, see [Android guide](android.md) for setup details.
1313
1414
## Quick Steps
1515

@@ -28,21 +28,22 @@ Formulas let you convert between raw on‑wire values and engineering values. Yo
2828
- Example: reverse the above conversion.
2929

3030
### Lambda vs Class
31-
- Lambda: `@DecodingFormula(lambda = "...")` / `@EncodingFormula(lambda = "...")`requires `fastproto-processor` dependency
31+
- Lambda: `@DecodingFormula(lambda = "...")` / `@EncodingFormula(lambda = "...")`included in `fastproto` bundle
3232
- Class: `@DecodingFormula(MyFunc.class)` / `@EncodingFormula(MyFunc.class)` where class implements `Function<In, Out>`
3333
- Precedence: Class‑based formulas win if both lambda and class are present.
3434

35-
### Lambda Processor Setup
36-
To use lambda expressions, add the annotation processor:
35+
### Lambda Support
36+
Lambda expressions are supported out of the box when using the `fastproto` bundle:
3737
```xml
3838
<dependency>
3939
<groupId>org.indunet</groupId>
40-
<artifactId>fastproto-processor</artifactId>
41-
<version>4.0.0</version>
42-
<scope>provided</scope>
40+
<artifactId>fastproto</artifactId>
41+
<version>4.1.0</version>
4342
</dependency>
4443
```
4544

45+
For Android projects, see [android.md](android.md) for separate configuration.
46+
4647
### Lifecycle & Errors
4748
- Formulas are compiled/bound during graph resolve and invoked per field during decode/encode.
4849
- Throwing exceptions inside formulas will surface as `DecodingException` / `EncodingException` at call sites.

docs/quick-start.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,20 @@ Add the dependency via Maven:
1010
<dependency>
1111
<groupId>org.indunet</groupId>
1212
<artifactId>fastproto</artifactId>
13-
<version>4.0.0</version>
13+
<version>4.1.0</version>
1414
</dependency>
15+
```
16+
17+
This bundle includes both core library and annotation processor for lambda formula support.
1518

16-
<!-- Optional: For lambda formula support (@DecodingFormula(lambda="...")) -->
19+
For Android projects or if you only need core functionality:
20+
21+
```xml
22+
<!-- Core only (no lambda formula support) -->
1723
<dependency>
1824
<groupId>org.indunet</groupId>
19-
<artifactId>fastproto-processor</artifactId>
20-
<version>4.0.0</version>
21-
<scope>provided</scope>
25+
<artifactId>fastproto-core</artifactId>
26+
<version>4.1.0</version>
2227
</dependency>
2328
```
2429

fastproto-bundle/pom.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>org.indunet</groupId>
9+
<artifactId>fastproto-parent</artifactId>
10+
<version>4.1.0</version>
11+
</parent>
12+
13+
<artifactId>fastproto</artifactId>
14+
<packaging>jar</packaging>
15+
<name>FastProto</name>
16+
<description>FastProto all-in-one bundle including core and annotation processor</description>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>org.indunet</groupId>
21+
<artifactId>fastproto-core</artifactId>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.indunet</groupId>
25+
<artifactId>fastproto-processor</artifactId>
26+
</dependency>
27+
28+
<!-- Testing -->
29+
<dependency>
30+
<groupId>org.junit.jupiter</groupId>
31+
<artifactId>junit-jupiter</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.projectlombok</groupId>
35+
<artifactId>lombok</artifactId>
36+
</dependency>
37+
</dependencies>
38+
</project>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2019-2024 indunet.org
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.indunet.fastproto;
18+
19+
import lombok.Data;
20+
import org.indunet.fastproto.annotation.Int32ArrayType;
21+
22+
/**
23+
* Protocol class with array types for testing.
24+
*
25+
* @author Deng Ran
26+
* @since 4.1.0
27+
*/
28+
@Data
29+
public class ArrayProtocol {
30+
@Int32ArrayType(offset = 0, length = 3)
31+
private int[] values;
32+
}

0 commit comments

Comments
 (0)