-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support trimming multiple IDLs
- Loading branch information
1 parent
2bac1d3
commit 8b944ee
Showing
28 changed files
with
1,208 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tool/trimmer/test_cases/config/idl_compose/idl_compose.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2024 CloudWeGo Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
idls: | ||
test1.thrift: | ||
trimmer: | ||
methods: | ||
- "TestService.func1" | ||
- "TestService.func3" | ||
preserve: true | ||
preserved_structs: | ||
- "useless" | ||
match_go_name: true | ||
test2.thrift: |
21 changes: 21 additions & 0 deletions
21
tool/trimmer/test_cases/config/trim_config/trim_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2024 CloudWeGo Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
methods: | ||
- "TestService.func1" | ||
- "TestService.func3" | ||
preserve: true | ||
preserved_structs: | ||
- "useless" | ||
match_go_name: true |
25 changes: 25 additions & 0 deletions
25
tool/trimmer/test_cases/config/trim_config_and_idl_compose/idl_compose.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2024 CloudWeGo Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
idls: | ||
test1.thrift: | ||
trimmer: | ||
methods: | ||
- "TestService.func1" | ||
- "TestService.func3" | ||
preserve: true | ||
preserved_structs: | ||
- "useless" | ||
match_go_name: true | ||
test2.thrift: |
21 changes: 21 additions & 0 deletions
21
tool/trimmer/test_cases/config/trim_config_and_idl_compose/trim_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2024 CloudWeGo Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
methods: | ||
- "TestService.func1" | ||
- "TestService.func3" | ||
preserve: true | ||
preserved_structs: | ||
- "useless" | ||
match_go_name: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2024 CloudWeGo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace go tests.multiple.common | ||
|
||
enum Common1Enum1 { | ||
ONE | ||
TWO | ||
THREE | ||
} | ||
|
||
enum Common1Enum2 { | ||
ONE | ||
TWO | ||
THERR | ||
} | ||
|
||
struct Common1Struct1 { | ||
1: required string field | ||
} | ||
|
||
struct Common1Struct2 { | ||
1: required string field | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2024 CloudWeGo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace go tests.multiple.common | ||
|
||
enum Common2Enum1 { | ||
ONE | ||
TWO | ||
THREE | ||
} | ||
|
||
enum Common2Enum2 { | ||
ONE | ||
TWO | ||
THERR | ||
} | ||
|
||
struct Common2Struct1 { | ||
1: required string field | ||
} | ||
|
||
struct Common2Struct2 { | ||
1: required string field | ||
} |
26 changes: 26 additions & 0 deletions
26
tool/trimmer/test_cases/multiple_idls/multiple_idls_include_common/test1.thrift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2024 CloudWeGo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace go multiple.include.common | ||
|
||
include "../common1.thrift" | ||
|
||
struct Test1Struct1 { | ||
1: required common1.Common1Enum1 enumField | ||
2: required common1.Common1Struct1 structField | ||
} | ||
|
||
service Test1 { | ||
string Process(1: Test1Struct1 req) | ||
} |
26 changes: 26 additions & 0 deletions
26
tool/trimmer/test_cases/multiple_idls/multiple_idls_include_common/test2.thrift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2024 CloudWeGo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace go multiple.include.common | ||
|
||
include "../common1.thrift" | ||
|
||
struct Test2Struct1 { | ||
1: required common1.Common1Enum2 enumField | ||
2: required common1.Common1Struct2 structField | ||
} | ||
|
||
service Test2 { | ||
string Process(1: Test2Struct1 req) | ||
} |
29 changes: 29 additions & 0 deletions
29
tool/trimmer/test_cases/multiple_idls/multiple_idls_include_common/test3.thrift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2024 CloudWeGo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace go multiple.include.common | ||
|
||
include "../common1.thrift" | ||
include "../common2.thrift" | ||
|
||
struct Test3Struct1 { | ||
1: required common1.Common1Enum1 enumField1 | ||
2: required common1.Common1Struct1 structField1 | ||
3: required common2.Common2Enum1 enumField2 | ||
4: required common2.Common2Struct1 structField2 | ||
} | ||
|
||
service Test3 { | ||
string Process(1: Test3Struct1 req) | ||
} |
29 changes: 29 additions & 0 deletions
29
tool/trimmer/test_cases/multiple_idls/multiple_idls_include_common/test4.thrift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2024 CloudWeGo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace go multiple.include.common | ||
|
||
include "../common1.thrift" | ||
include "../common2.thrift" | ||
|
||
struct Test4Struct1 { | ||
1: required common1.Common1Enum2 enumField1 | ||
2: required common1.Common1Struct2 structField1 | ||
3: required common2.Common2Enum2 enumField2 | ||
4: required common2.Common2Struct2 structField2 | ||
} | ||
|
||
service Test4 { | ||
string Process(1: Test4Struct1 req) | ||
} |
33 changes: 33 additions & 0 deletions
33
tool/trimmer/test_cases/multiple_idls/multiple_idls_include_common/test5.thrift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2024 CloudWeGo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace go multiple.include.common | ||
|
||
include "../common1.thrift" | ||
include "../common2.thrift" | ||
|
||
struct Test5Struct1 { | ||
1: required common1.Common1Enum1 enumField1 | ||
2: required common1.Common1Struct1 structField1 | ||
3: required common2.Common2Enum1 enumField2 | ||
4: required common2.Common2Struct1 structField2 | ||
} | ||
|
||
struct Test5Struct2 { | ||
1: required string stringField | ||
} | ||
|
||
service Test5 { | ||
string Process(1: Test5Struct1 req) | ||
} |
31 changes: 31 additions & 0 deletions
31
tool/trimmer/test_cases/multiple_idls/multiple_idls_include_common/test6.thrift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2024 CloudWeGo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace go multiple.include.common | ||
|
||
include "../common1.thrift" | ||
include "../common2.thrift" | ||
include "test5.thrift" | ||
|
||
struct Test6Struct1 { | ||
1: required common1.Common1Enum2 enumField1 | ||
2: required common1.Common1Struct2 structField1 | ||
3: required common2.Common2Enum2 enumField2 | ||
4: required common2.Common2Struct2 structField2 | ||
} | ||
|
||
service Test6 { | ||
string Process(1: Test6Struct1 req) | ||
string ProcessAnotherIDL(1: test5.Test5Struct2 req) | ||
} |
Oops, something went wrong.