Skip to content

Commit 8bb6468

Browse files
authored
feat (thrift deprecation)!: replace thrift entities with internal ones (#1022)
What changed? Migration Guide To construct GRPC Workflow Service use new WorkflowServiceGrpc() instead of new Thrift2ProtoAdapter(IGrpcServiceStubs.newInstance()); Removed TException and now all workflow service method returns CadenceError instead; Replaced thrift generated entities with internal entities (Currently still generated from thrift files but no longer has runtime dependency on thrift); Removed support for thrift entities in default data converter; Why? Java thrift deprecation How did you test it? Unit Test
1 parent e0704d1 commit 8bb6468

File tree

163 files changed

+6027
-15106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+6027
-15106
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@ jobs:
2424
java-version: '11'
2525
distribution: 'temurin'
2626
cache: 'gradle'
27-
- name: Install necessary tooling
28-
env:
29-
APACHE_THRIFT_VERSION: 0.9.3
30-
run: |
31-
apt-get update && apt-get install -y wget gcc make build-essential git
32-
33-
wget https://archive.apache.org/dist/thrift/${APACHE_THRIFT_VERSION}/thrift-${APACHE_THRIFT_VERSION}.tar.gz && \
34-
tar -xvf thrift-${APACHE_THRIFT_VERSION}.tar.gz && \
35-
rm thrift-${APACHE_THRIFT_VERSION}.tar.gz && \
36-
cd thrift-${APACHE_THRIFT_VERSION}/ && \
37-
./configure --enable-libs=no --enable-tests=no --enable-tutorial=no --with-cpp=no --with-c_glib=no --with-java=yes --with-ruby=no --with-erlang=no --with-go=no --with-nodejs=no --with-python=no && \
38-
make && \
39-
make install && \
40-
cd .. && \
41-
rm -rf thrift-${APACHE_THRIFT_VERSION}
42-
4327
- name: Determine release version
4428
id: vars
4529
run: |

build.gradle

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
buildscript {
22
dependencies {
3-
classpath "gradle.plugin.org.jruyi.gradle:thrift-gradle-plugin:0.4.1"
43
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.11'
54
}
65
}
@@ -34,7 +33,6 @@ repositories {
3433
apply plugin: 'com.google.protobuf'
3534
apply plugin: 'idea' // IntelliJ plugin to see files generated from protos
3635
apply plugin: 'maven'
37-
apply plugin: 'org.jruyi.thrift'
3836
apply plugin: 'maven-publish'
3937
apply plugin: 'com.github.sherter.google-java-format'
4038

@@ -44,7 +42,7 @@ googleJavaFormat {
4442
exclude '**/generated-sources/*'
4543
}
4644

47-
tasks.googleJavaFormat.dependsOn 'license'
45+
tasks.googleJavaFormat.dependsOn 'licenseFormat'
4846

4947
group = 'com.uber.cadence'
5048

@@ -77,7 +75,6 @@ dependencies {
7775

7876
compile group: 'com.uber.tchannel', name: 'tchannel-core', version: '0.8.30'
7977
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36'
80-
compile group: 'org.apache.thrift', name: 'libthrift', version: '0.9.3'
8178
compile group: 'com.google.code.gson', name: 'gson', version: '2.10'
8279
compile group: 'com.uber.m3', name: 'tally-core', version: '0.11.1'
8380
compile group: 'com.google.guava', name: 'guava', version: '31.1-jre'
@@ -89,6 +86,10 @@ dependencies {
8986
compile group: 'com.google.api.grpc', name: 'proto-google-common-protos', version: '2.10.0'
9087
compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: '3.21.9'
9188
compile group: 'com.google.oauth-client', name: 'google-oauth-client', version: '1.35.0'
89+
compileOnly 'org.projectlombok:lombok:1.18.30'
90+
annotationProcessor 'org.projectlombok:lombok:1.18.30'
91+
testCompileOnly 'org.projectlombok:lombok:1.18.30'
92+
testAnnotationProcessor 'org.projectlombok:lombok:1.18.30'
9293

9394
implementation 'io.grpc:grpc-netty-shaded:1.54.2'
9495
implementation 'io.grpc:grpc-protobuf:1.54.2'
@@ -126,19 +127,14 @@ task updateDlsSubmodule(type: Exec) {
126127
commandLine 'git', 'submodule', 'update'
127128
}
128129

129-
compileThrift {
130-
dependsOn updateDlsSubmodule
131-
verbose true
132-
sourceItems "${projectDir}/src/main/idls/thrift/cadence.thrift","${projectDir}/src/main/idls/thrift/shared.thrift","${projectDir}/src/main/idls/thrift/shadower.thrift"
133-
}
134-
135130
sourceSets {
136131
main {
137132
proto {
138133
srcDir 'src/main/idls/proto'
139134
}
140135
java {
141136
srcDir 'src/main'
137+
srcDir 'src/gen/java'
142138
}
143139
}
144140
}

docker/github_actions/Dockerfile

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,10 @@
33
# commits to that branch and one of them can break the build
44
FROM adoptopenjdk/openjdk11:jdk-11.0.10_9-alpine
55

6-
# Apache Thrift version
7-
ENV APACHE_THRIFT_VERSION=0.9.3
8-
96
# Install dependencies using apk
10-
RUN apk update && apk add --virtual wget ca-certificates wget && apk add --virtual build-dependencies build-base gcc
7+
RUN apk update && apk add --virtual wget ca-certificates wget
118
# Git is needed in order to update the dls submodule
129
RUN apk add git libstdc++ bash curl
1310

14-
# Compile source
15-
RUN set -ex ;\
16-
wget https://archive.apache.org/dist/thrift/${APACHE_THRIFT_VERSION}/thrift-${APACHE_THRIFT_VERSION}.tar.gz && \
17-
tar -xvf thrift-${APACHE_THRIFT_VERSION}.tar.gz && \
18-
rm thrift-${APACHE_THRIFT_VERSION}.tar.gz && \
19-
cd thrift-${APACHE_THRIFT_VERSION}/ && \
20-
./configure --enable-libs=no --enable-tests=no --enable-tutorial=no --with-cpp=no --with-c_glib=no --with-java=yes --with-ruby=no --with-erlang=no --with-go=no --with-nodejs=no --with-python=no && \
21-
make && \
22-
make install && \
23-
cd .. && \
24-
rm -rf thrift-${APACHE_THRIFT_VERSION}
25-
26-
# Cleanup packages and remove cache
27-
RUN apk del build-dependencies wget && rm -rf /var/cache/apk/*
28-
2911
RUN mkdir /cadence-java-client
3012
WORKDIR /cadence-java-client

scripts/install-thrift-locally-osx.sh

Lines changed: 0 additions & 39 deletions
This file was deleted.

scripts/v4_entity_generator/generator.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const (
1919
type Field struct {
2020
Name string
2121
Type string
22+
Initializer string
2223
}
2324

2425
type TemplateEntity struct {
@@ -119,9 +120,22 @@ func (g *Generator) generateStruct(v *ast.Struct, outputDir string, packageName
119120
return fmt.Errorf("failed to map field type: %w", err)
120121
}
121122

123+
initializer := ""
124+
switch field.Type.(type) {
125+
case ast.SetType:
126+
initializer = " = new HashSet<>();"
127+
case ast.ListType:
128+
initializer = " = new ArrayList<>();"
129+
case ast.MapType:
130+
initializer = " = new HashMap<>();"
131+
}
132+
133+
fmt.Println(field.Name, initializer, typeStr)
134+
122135
fields = append(fields, Field{
123136
Name: field.Name,
124137
Type: typeStr,
138+
Initializer: initializer,
125139
})
126140
}
127141

scripts/v4_entity_generator/template/java_struct.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import {{.}};
1111
@Accessors(chain = true)
1212
public class {{.ClassName}} {
1313
{{- range .Fields}}
14-
private {{.Type}} {{.Name}};
14+
private {{.Type}} {{.Name}}{{.Initializer}};
1515
{{- end}}
1616
}

src/gen/java/com/uber/cadence/BadBinaries.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
@Data
88
@Accessors(chain = true)
99
public class BadBinaries {
10-
private Map<String, BadBinaryInfo> binaries;
10+
private Map<String, BadBinaryInfo> binaries = new HashMap<>();;
1111
}

src/gen/java/com/uber/cadence/CrossClusterApplyParentClosePolicyRequestAttributes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
@Data
88
@Accessors(chain = true)
99
public class CrossClusterApplyParentClosePolicyRequestAttributes {
10-
private List<ApplyParentClosePolicyRequest> children;
10+
private List<ApplyParentClosePolicyRequest> children = new ArrayList<>();;
1111
}

src/gen/java/com/uber/cadence/CrossClusterApplyParentClosePolicyResponseAttributes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
@Data
88
@Accessors(chain = true)
99
public class CrossClusterApplyParentClosePolicyResponseAttributes {
10-
private List<ApplyParentClosePolicyResult> childrenStatus;
10+
private List<ApplyParentClosePolicyResult> childrenStatus = new ArrayList<>();;
1111
}

src/gen/java/com/uber/cadence/CrossClusterStartChildExecutionRequestAttributes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ public class CrossClusterStartChildExecutionRequestAttributes {
1212
private long initiatedEventID;
1313
private StartChildWorkflowExecutionInitiatedEventAttributes initiatedEventAttributes;
1414
private String targetRunID;
15-
private Map<String, String> partitionConfig;
15+
private Map<String, String> partitionConfig = new HashMap<>();;
1616
}

0 commit comments

Comments
 (0)