Skip to content

Commit fc09b17

Browse files
committed
GH-877: Implement Plexus converter that can convert algebraic sealed types
The implementation of this will expect users to take a 'kind' attribute on the marker for a sealed type parameter which is used via reflection to determine the concrete implementation class. Right now, we have to provide this info on each implementation via an annotation such that we can influence the behaviour that will eventually be provided for us by GH-880. This PR also changes the documentation and plugin interface so that users will pass in a <plugins> list containing all plugins now rather than having four distinct parameters for the same information. The exisiting parameters have been kept and still work the same way, but are now undocumented in the plugin guide, and are marked as deprecated-for-removal in v5.0.0. With this change, we will be able to use sealed implementation kinds for the <protoc/> parameter in future changes, further supporting GH-877.
1 parent 8625d4c commit fc09b17

38 files changed

Lines changed: 822 additions & 784 deletions

File tree

.editorconfig

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ ij_wrap_on_typing = false
1818

1919
# If we don't override this then it messes up on Windows by injecting a LF.
2020
[.mvn/jvm.config]
21-
charset = latin1
22-
end_of_line = unset
21+
charset = latin1
22+
end_of_line = unset
2323
insert_final_newline = false
2424

2525
[*.java]
@@ -31,7 +31,8 @@ ij_java_align_multiline_array_initializer_expression = false
3131
ij_java_align_multiline_assignment = false
3232
ij_java_align_multiline_binary_operation = false
3333
ij_java_align_multiline_chained_methods = false
34-
ij_java_align_multiline_extends_list = false
34+
ij_java_align_multiline_deconstruction_list_components = true
35+
ij_java_align_multiline_extends_list = true
3536
ij_java_align_multiline_for = false
3637
ij_java_align_multiline_method_parentheses = false
3738
ij_java_align_multiline_parameters = false
@@ -41,9 +42,11 @@ ij_java_align_multiline_records = true
4142
ij_java_align_multiline_resources = false
4243
ij_java_align_multiline_ternary_operation = false
4344
ij_java_align_multiline_text_blocks = false
44-
ij_java_align_multiline_throws_list = false
45+
ij_java_align_multiline_throws_list = true
4546
ij_java_align_subsequent_simple_methods = false
4647
ij_java_align_throws_keyword = false
48+
ij_java_align_types_in_multi_catch = true
49+
ij_java_annotation_new_line_in_record_component = false
4750
ij_java_annotation_parameter_wrap = off
4851
ij_java_array_initializer_new_line_after_left_brace = false
4952
ij_java_array_initializer_right_brace_on_new_line = false
@@ -60,17 +63,19 @@ ij_java_blank_lines_after_package = 1
6063
ij_java_blank_lines_around_class = 1
6164
ij_java_blank_lines_around_field = 0
6265
ij_java_blank_lines_around_field_in_interface = 0
66+
ij_java_blank_lines_around_field_with_annotations = 0
6367
ij_java_blank_lines_around_initializer = 1
6468
ij_java_blank_lines_around_method = 1
6569
ij_java_blank_lines_around_method_in_interface = 1
6670
ij_java_blank_lines_before_class_end = 0
6771
ij_java_blank_lines_before_imports = 1
6872
ij_java_blank_lines_before_method_body = 0
6973
ij_java_blank_lines_before_package = 0
74+
ij_java_blank_lines_between_record_components = 0
7075
ij_java_block_brace_style = end_of_line
7176
ij_java_block_comment_add_space = false
7277
ij_java_block_comment_at_first_column = true
73-
ij_java_builder_methods = none
78+
ij_java_builder_methods =
7479
ij_java_call_parameters_new_line_after_left_paren = false
7580
ij_java_call_parameters_right_paren_on_new_line = false
7681
ij_java_call_parameters_wrap = normal
@@ -80,8 +85,11 @@ ij_java_class_annotation_wrap = split_into_lines
8085
ij_java_class_brace_style = end_of_line
8186
ij_java_class_count_to_use_import_on_demand = 999
8287
ij_java_class_names_in_javadoc = 1
88+
ij_java_deconstruction_list_wrap = normal
89+
ij_java_delete_unused_module_imports = false
8390
ij_java_do_not_indent_top_level_class_members = false
8491
ij_java_do_not_wrap_after_single_annotation = false
92+
ij_java_do_not_wrap_after_single_annotation_in_parameter = false
8593
ij_java_do_while_brace_force = always
8694
ij_java_doc_add_blank_line_after_description = true
8795
ij_java_doc_add_blank_line_after_param_comments = false
@@ -92,7 +100,7 @@ ij_java_doc_align_param_comments = true
92100
ij_java_doc_do_not_wrap_if_one_line = false
93101
ij_java_doc_enable_formatting = true
94102
ij_java_doc_enable_leading_asterisks = true
95-
ij_java_doc_indent_on_continuation = true
103+
ij_java_doc_indent_on_continuation = false
96104
ij_java_doc_keep_empty_lines = true
97105
ij_java_doc_keep_empty_parameter_tag = true
98106
ij_java_doc_keep_empty_return_tag = true
@@ -103,16 +111,20 @@ ij_java_doc_preserve_line_breaks = false
103111
ij_java_doc_use_throws_not_exception_tag = true
104112
ij_java_else_on_new_line = false
105113
ij_java_enum_constants_wrap = off
114+
ij_java_enum_field_annotation_wrap = off
106115
ij_java_extends_keyword_wrap = off
107116
ij_java_extends_list_wrap = normal
108117
ij_java_field_annotation_wrap = split_into_lines
118+
ij_java_field_name_prefix =
119+
ij_java_field_name_suffix =
109120
ij_java_finally_on_new_line = false
110121
ij_java_for_brace_force = always
111122
ij_java_for_statement_new_line_after_left_paren = false
112123
ij_java_for_statement_right_paren_on_new_line = false
113124
ij_java_for_statement_wrap = normal
114125
ij_java_generate_final_locals = false
115126
ij_java_generate_final_parameters = false
127+
ij_java_generate_use_type_annotation_before_type = true
116128
ij_java_if_brace_force = always
117129
ij_java_imports_layout = $*, |, *
118130
ij_java_indent_case_from_switch = true
@@ -129,30 +141,42 @@ ij_java_keep_indents_on_empty_lines = false
129141
ij_java_keep_line_breaks = true
130142
ij_java_keep_multiple_expressions_in_one_line = false
131143
ij_java_keep_simple_blocks_in_one_line = false
132-
ij_java_keep_simple_classes_in_one_line = true
144+
ij_java_keep_simple_classes_in_one_line = false
133145
ij_java_keep_simple_lambdas_in_one_line = false
134146
ij_java_keep_simple_methods_in_one_line = false
135147
ij_java_label_indent_absolute = false
136148
ij_java_label_indent_size = 0
137149
ij_java_lambda_brace_style = end_of_line
150+
ij_java_layout_on_demand_import_from_same_package_first = true
138151
ij_java_layout_static_imports_separately = true
139152
ij_java_line_comment_add_space = false
153+
ij_java_line_comment_add_space_on_reformat = false
140154
ij_java_line_comment_at_first_column = true
155+
ij_java_local_variable_name_prefix =
156+
ij_java_local_variable_name_suffix =
141157
ij_java_method_annotation_wrap = split_into_lines
142158
ij_java_method_brace_style = end_of_line
143159
ij_java_method_call_chain_wrap = normal
144160
ij_java_method_parameters_new_line_after_left_paren = false
145161
ij_java_method_parameters_right_paren_on_new_line = false
146162
ij_java_method_parameters_wrap = normal
147163
ij_java_modifier_list_wrap = false
164+
ij_java_multi_catch_types_wrap = normal
148165
ij_java_names_count_to_use_import_on_demand = 999
166+
ij_java_new_line_after_lparen_in_annotation = false
167+
ij_java_new_line_after_lparen_in_deconstruction_pattern = true
149168
ij_java_new_line_after_lparen_in_record_header = false
169+
ij_java_new_line_when_body_is_presented = false
170+
ij_java_packages_to_use_import_on_demand =
150171
ij_java_parameter_annotation_wrap = off
172+
ij_java_parameter_name_prefix =
173+
ij_java_parameter_name_suffix =
151174
ij_java_parentheses_expression_new_line_after_left_paren = false
152175
ij_java_parentheses_expression_right_paren_on_new_line = false
153176
ij_java_place_assignment_sign_on_next_line = false
154177
ij_java_prefer_longer_names = true
155178
ij_java_prefer_parameters_wrap = false
179+
ij_java_preserve_module_imports = true
156180
ij_java_record_components_wrap = normal
157181
ij_java_repeat_synchronized = true
158182
ij_java_replace_instanceof_and_cast = false
@@ -161,6 +185,8 @@ ij_java_replace_sum_lambda_with_method_ref = true
161185
ij_java_resource_list_new_line_after_left_paren = false
162186
ij_java_resource_list_right_paren_on_new_line = false
163187
ij_java_resource_list_wrap = off
188+
ij_java_rparen_on_new_line_in_annotation = false
189+
ij_java_rparen_on_new_line_in_deconstruction_pattern = true
164190
ij_java_rparen_on_new_line_in_record_header = false
165191
ij_java_space_after_closing_angle_bracket_in_type_argument = false
166192
ij_java_space_after_colon = true
@@ -179,6 +205,7 @@ ij_java_space_before_class_left_brace = true
179205
ij_java_space_before_colon = true
180206
ij_java_space_before_colon_in_foreach = true
181207
ij_java_space_before_comma = false
208+
ij_java_space_before_deconstruction_list = false
182209
ij_java_space_before_do_left_brace = true
183210
ij_java_space_before_else_keyword = true
184211
ij_java_space_before_else_left_brace = true
@@ -209,6 +236,7 @@ ij_java_space_within_empty_array_initializer_braces = false
209236
ij_java_space_within_empty_method_call_parentheses = false
210237
ij_java_space_within_empty_method_parentheses = false
211238
ij_java_spaces_around_additive_operators = true
239+
ij_java_spaces_around_annotation_eq = true
212240
ij_java_spaces_around_assignment_operators = true
213241
ij_java_spaces_around_bitwise_operators = true
214242
ij_java_spaces_around_equality_operators = true
@@ -220,13 +248,15 @@ ij_java_spaces_around_relational_operators = true
220248
ij_java_spaces_around_shift_operators = true
221249
ij_java_spaces_around_type_bounds_in_type_parameters = true
222250
ij_java_spaces_around_unary_operator = false
251+
ij_java_spaces_inside_block_braces_when_body_is_present = false
223252
ij_java_spaces_within_angle_brackets = false
224253
ij_java_spaces_within_annotation_parentheses = false
225254
ij_java_spaces_within_array_initializer_braces = false
226255
ij_java_spaces_within_braces = false
227256
ij_java_spaces_within_brackets = false
228257
ij_java_spaces_within_cast_parentheses = false
229258
ij_java_spaces_within_catch_parentheses = false
259+
ij_java_spaces_within_deconstruction_list = false
230260
ij_java_spaces_within_for_parentheses = false
231261
ij_java_spaces_within_if_parentheses = false
232262
ij_java_spaces_within_method_call_parentheses = false
@@ -238,9 +268,14 @@ ij_java_spaces_within_synchronized_parentheses = false
238268
ij_java_spaces_within_try_parentheses = false
239269
ij_java_spaces_within_while_parentheses = false
240270
ij_java_special_else_if_treatment = true
271+
ij_java_static_field_name_prefix =
272+
ij_java_static_field_name_suffix =
273+
ij_java_subclass_name_prefix =
241274
ij_java_subclass_name_suffix = Impl
275+
ij_java_switch_expressions_wrap = normal
242276
ij_java_ternary_operation_signs_on_next_line = true
243277
ij_java_ternary_operation_wrap = normal
278+
ij_java_test_name_prefix =
244279
ij_java_test_name_suffix = Test
245280
ij_java_throws_keyword_wrap = normal
246281
ij_java_throws_list_wrap = off
@@ -255,6 +290,7 @@ ij_java_while_on_new_line = false
255290
ij_java_wrap_comments = true
256291
ij_java_wrap_first_method_in_call_chain = false
257292
ij_java_wrap_long_lines = false
293+
ij_java_wrap_semicolon_after_call_chain = false
258294

259295
[*.properties]
260296
ij_properties_align_group_field_declarations = false

README.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -149,34 +149,32 @@ and then proceed to generate gRPC wrappers and Reactor gRPC wrappers.
149149

150150
```xml
151151

152-
<plugin>
152+
<plugins>
153153
<groupId>io.github.ascopes</groupId>
154154
<artifactId>protobuf-maven-plugin</artifactId>
155155

156156
<configuration>
157157
<protoc>${protobuf-java.version}</protoc>
158-
159-
<!-- Vanilla protoc plugins - these are platform specific executables
160-
just like protoc is. -->
161-
<binaryMavenPlugins>
162-
<binaryMavenPlugin>
158+
159+
<plugins>
160+
<!-- Vanilla protoc plugins - these are platform specific executables
161+
just like protoc is. -->
162+
<plugin kind="binary-maven">
163163
<groupId>io.grpc</groupId>
164164
<artifactId>protoc-gen-grpc-java</artifactId>
165165
<version>${grpc.version}</version>
166-
</binaryMavenPlugin>
167-
</binaryMavenPlugins>
168-
169-
<!-- JVM plugins are distributed as JARs rather than native system
170-
executables. The protobuf-maven-plugin will automatically bootstrap
171-
them for you, without the need for additional
172-
tooling for your platform. It should "just work". -->
173-
<jvmMavenPlugins>
174-
<jvmMavenPlugin>
166+
</plugin>
167+
168+
<!-- JVM plugins are distributed as JARs rather than native system
169+
executables. The protobuf-maven-plugin will automatically bootstrap
170+
them for you, without the need for additional
171+
tooling for your platform. It should "just work". -->
172+
<plugin kind="jvm-maven">
175173
<groupId>com.salesforce.servicelibs</groupId>
176174
<artifactId>reactor-grpc</artifactId>
177175
<version>${reactor-grpc.version}</version>
178-
</jvmMavenPlugin>
179-
</jvmMavenPlugins>
176+
</plugin>
177+
</plugins>
180178
</configuration>
181179

182180
<executions>

protobuf-maven-plugin/src/it/gh-277-plugin-ordering/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,21 @@
7575
<artifactId>@project.artifactId@</artifactId>
7676

7777
<configuration>
78-
<binaryMavenPlugins>
79-
<binaryMavenPlugin>
78+
<plugins>
79+
<plugin kind="binary-maven">
8080
<groupId>com.salesforce.servicelibs</groupId>
8181
<artifactId>reactor-grpc</artifactId>
8282
<version>${reactor-grpc.version}</version>
8383
<order>200</order>
84-
</binaryMavenPlugin>
84+
</plugin>
8585

86-
<binaryMavenPlugin>
86+
<plugin kind="binary-maven">
8787
<groupId>io.grpc</groupId>
8888
<artifactId>protoc-gen-grpc-java</artifactId>
8989
<version>${grpc.version}</version>
9090
<order>100</order>
91-
</binaryMavenPlugin>
92-
</binaryMavenPlugins>
91+
</plugin>
92+
</plugins>
9393
</configuration>
9494

9595
<executions>

protobuf-maven-plugin/src/it/gh-358-unpackaged-jar-plugin/some-project/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
<version>@project.version@</version>
3939

4040
<configuration>
41-
<jvmMavenPlugins>
42-
<jvmMavenPlugin>
41+
<plugins>
42+
<plugin kind="jvm-maven">
4343
<groupId>${project.groupId}</groupId>
4444
<artifactId>protoc-plugin</artifactId>
4545
<version>${project.version}</version>
4646
<mainClass>org.example.protocplugin.ProtocPlugin</mainClass>
47-
</jvmMavenPlugin>
48-
</jvmMavenPlugins>
47+
</plugin>
48+
</plugins>
4949

5050
<javaEnabled>false</javaEnabled>
5151
<protoc>${protobuf.version}</protoc>

protobuf-maven-plugin/src/it/gh-359-modular-jar-plugin/some-project/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
<artifactId>@project.artifactId@</artifactId>
3838

3939
<configuration>
40-
<jvmMavenPlugins>
41-
<jvmMavenPlugin>
40+
<plugins>
41+
<plugin kind="jvm-maven">
4242
<groupId>${project.groupId}</groupId>
4343
<artifactId>protoc-plugin-frontend</artifactId>
4444
<version>${project.version}</version>
45-
</jvmMavenPlugin>
46-
</jvmMavenPlugins>
45+
</plugin>
46+
</plugins>
4747

4848
<javaEnabled>false</javaEnabled>
4949
</configuration>

protobuf-maven-plugin/src/it/gh-363-packaged-jvm-plugin-with-mainclass-set/some-project/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
<version>@project.version@</version>
3939

4040
<configuration>
41-
<jvmMavenPlugins>
42-
<jvmMavenPlugin>
41+
<plugins>
42+
<plugin kind="jvm-maven">
4343
<groupId>${project.groupId}</groupId>
4444
<artifactId>protoc-plugin</artifactId>
4545
<version>${project.version}</version>
46-
</jvmMavenPlugin>
47-
</jvmMavenPlugins>
46+
</plugin>
47+
</plugins>
4848

4949
<javaEnabled>false</javaEnabled>
5050
<protoc>${protobuf.version}</protoc>

protobuf-maven-plugin/src/it/gh-363-packaged-jvm-plugin-without-mainclass-set/some-project/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
<version>@project.version@</version>
3939

4040
<configuration>
41-
<jvmMavenPlugins>
42-
<jvmMavenPlugin>
41+
<plugins>
42+
<plugin kind="jvm-maven">
4343
<groupId>${project.groupId}</groupId>
4444
<artifactId>protoc-plugin</artifactId>
4545
<version>${project.version}</version>
4646
<mainClass>org.example.protocplugin.ProtocPlugin</mainClass>
47-
</jvmMavenPlugin>
48-
</jvmMavenPlugins>
47+
</plugin>
48+
</plugins>
4949

5050
<javaEnabled>false</javaEnabled>
5151
<protoc>${protobuf.version}</protoc>

protobuf-maven-plugin/src/it/gh-372-paths-with-spaces/some-project/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
<version>@project.version@</version>
3939

4040
<configuration>
41-
<jvmMavenPlugins>
42-
<jvmMavenPlugin>
41+
<plugins>
42+
<plugin kind="jvm-maven">
4343
<groupId>${project.groupId}</groupId>
4444
<artifactId>protoc-plugin</artifactId>
4545
<version>${project.version}</version>
46-
</jvmMavenPlugin>
47-
</jvmMavenPlugins>
46+
</plugin>
47+
</plugins>
4848

4949
<javaEnabled>false</javaEnabled>
5050
<protoc>${protobuf.version}</protoc>

protobuf-maven-plugin/src/it/gh-397-jvm-plugin-commandline-args/some-project/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
<version>@project.version@</version>
3939

4040
<configuration>
41-
<jvmMavenPlugins>
42-
<jvmMavenPlugin>
41+
<plugins>
42+
<plugin kind="jvm-maven">
4343
<groupId>${project.groupId}</groupId>
4444
<artifactId>protoc-plugin</artifactId>
4545
<version>${project.version}</version>
@@ -48,8 +48,8 @@
4848
<jvmArg>bar</jvmArg>
4949
<jvmArg>baz</jvmArg>
5050
</jvmArgs>
51-
</jvmMavenPlugin>
52-
</jvmMavenPlugins>
51+
</plugin>
52+
</plugins>
5353

5454
<javaEnabled>false</javaEnabled>
5555
<protoc>${protobuf.version}</protoc>

0 commit comments

Comments
 (0)