Skip to content

Commit

Permalink
feat(java-client): use thrift-maven-plugin to generate thrift sources…
Browse files Browse the repository at this point in the history
… instead of script (#1997)

#1664

Add thrift-maven-plugin by referencing following links: 
- https://issues.apache.org/jira/browse/THRIFT-1536
- apache/parquet-java#600
  • Loading branch information
shalk authored Jun 27, 2024
1 parent a774afe commit 596603c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint_and_test_java-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion java-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions java-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 596603c

Please sign in to comment.