This is an automated email from the ASF dual-hosted git repository.
wangdan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new 596603cae feat(java-client): use thrift-maven-plugin to generate
thrift sources instead of script (#1997)
596603cae is described below
commit 596603caeb4a97e72000d78214c5384e5856e3be
Author: shalk(xiao kun) <[email protected]>
AuthorDate: Thu Jun 27 18:16:56 2024 +0800
feat(java-client): use thrift-maven-plugin to generate thrift sources
instead of script (#1997)
https://github.com/apache/incubator-pegasus/issues/1664
Add thrift-maven-plugin by referencing following links:
- https://issues.apache.org/jira/browse/THRIFT-1536
- https://github.com/apache/parquet-java/pull/600
---
.github/workflows/lint_and_test_java-client.yml | 4 +--
java-client/README.md | 2 +-
java-client/pom.xml | 31 ++++++++++++++++++++++
.../{recompile_thrift.sh => download_thrift.sh} | 17 ------------
4 files changed, 34 insertions(+), 20 deletions(-)
diff --git a/.github/workflows/lint_and_test_java-client.yml
b/.github/workflows/lint_and_test_java-client.yml
index a11ebb5ee..b71d1e021 100644
--- a/.github/workflows/lint_and_test_java-client.yml
+++ b/.github/workflows/lint_and_test_java-client.yml
@@ -98,9 +98,9 @@ jobs:
export
LD_LIBRARY_PATH=$(pwd)/thirdparty/output/lib:${JAVA_HOME}/jre/lib/amd64/server
ulimit -s unlimited
./run.sh start_onebox
- - name: Recompile thrift
+ - name: Download thrift
working-directory: ./java-client/scripts
- run: ./recompile_thrift.sh
+ run: ./download_thrift.sh
- name: Run Java client tests
working-directory: ./java-client
run: mvn test --no-transfer-progress
diff --git a/java-client/README.md b/java-client/README.md
index 1faf9a9a7..9cfdb9a70 100644
--- a/java-client/README.md
+++ b/java-client/README.md
@@ -24,7 +24,7 @@ under the License.
### 1. Prepare
```
-cd scripts && bash recompile_thrift.sh
+cd scripts && bash download_thrift.sh
```
### 2. Format the code
diff --git a/java-client/pom.xml b/java-client/pom.xml
index 2a23c3e9a..14afe2250 100644
--- a/java-client/pom.xml
+++ b/java-client/pom.xml
@@ -69,6 +69,7 @@
<netty.version>4.1.85.Final</netty.version>
<zstd-jni.version>1.3.7-1</zstd-jni.version>
<libthrift.version>0.11.0</libthrift.version>
+ <thrift-maven-plugin.version>0.10.0</thrift-maven-plugin.version>
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
<zookeeper.version>3.7.2</zookeeper.version>
<doclint>none</doclint>
@@ -470,6 +471,36 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>thrift-maven-plugin</artifactId>
+ <version>${thrift-maven-plugin.version}</version>
+ <configuration>
+ <thriftSourceRoot>${project.basedir}/../idl</thriftSourceRoot>
+ <includes>
+ <include>backup.thrift</include>
+ <include>bulk_load.thrift</include>
+ <include>dsn.layer2.thrift</include>
+ <include>duplication.thrift</include>
+ <include>metadata.thrift</include>
+ <include>meta_admin.thrift</include>
+ <include>partition_split.thrift</include>
+ <include>rrdb.thrift</include>
+ <include>security.thrift</include>
+ </includes>
+ <thriftExecutable>thrift</thriftExecutable>
+ <outputDirectory>${project.basedir}/src/main/java</outputDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>thrift-sources</id>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <phase>generate-sources</phase>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
diff --git a/java-client/scripts/recompile_thrift.sh
b/java-client/scripts/download_thrift.sh
similarity index 73%
rename from java-client/scripts/recompile_thrift.sh
rename to java-client/scripts/download_thrift.sh
index 6efcba8fa..ea5e4f6ae 100755
--- a/java-client/scripts/recompile_thrift.sh
+++ b/java-client/scripts/download_thrift.sh
@@ -48,21 +48,4 @@ if ! $thrift -version | grep "0.11.0" ; then
exit 1
fi
-TMP_DIR=./gen-java
-rm -rf $TMP_DIR
-
-mkdir -p $TMP_DIR
-$thrift --gen java ../../idl/backup.thrift
-$thrift --gen java ../../idl/bulk_load.thrift
-$thrift --gen java ../../idl/dsn.layer2.thrift
-$thrift --gen java ../../idl/duplication.thrift
-$thrift --gen java ../../idl/metadata.thrift
-$thrift --gen java ../../idl/meta_admin.thrift
-$thrift --gen java ../../idl/partition_split.thrift
-$thrift --gen java ../../idl/rrdb.thrift
-$thrift --gen java ../../idl/security.thrift
-
-cp -v -r $TMP_DIR/* ../src/main/java/
-rm -rf $TMP_DIR
-
echo "done"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]