1
1
# Copyright 2019 OpenAPI-Generator-Bazel Contributors
2
2
3
- def openapi_tools_generator_bazel_repositories (openapi_generator_cli_version = "4.1.3" , sha256 = "234cbbc5ec9b56e4b585199ec387b5ad3aefb3eda9424c30d35c849dd5950d2f" , prefix = "openapi_tools_generator_bazel" ):
3
+ def openapi_tools_generator_bazel_repositories (openapi_generator_cli_version = "4.1.3" , sha256 = "234cbbc5ec9b56e4b585199ec387b5ad3aefb3eda9424c30d35c849dd5950d2f" , prefix = "openapi_tools_generator_bazel" ):
4
4
native .maven_jar (
5
5
name = "openapi_tools_generator_bazel_cli" ,
6
6
sha256 = sha256 ,
@@ -27,7 +27,6 @@ def _new_generator_command(ctx, declared_dir, rjars):
27
27
28
28
jars = [ctx .file .openapi_generator_cli ] + rjars .to_list ()
29
29
30
-
31
30
gen_cmd += " -cp \" {jars}\" org.openapitools.codegen.OpenAPIGenerator generate -i {spec} -g {generator} -o {output}" .format (
32
31
java = java_path ,
33
32
jars = jar_delimiter .join ([j .path for j in jars ]),
@@ -67,6 +66,10 @@ def _new_generator_command(ctx, declared_dir, rjars):
67
66
gen_cmd += " --model-package {package}" .format (
68
67
package = ctx .attr .model_package ,
69
68
)
69
+ if ctx .attr .engine :
70
+ gen_cmd += " --engine {package}" .format (
71
+ package = ctx .attr .engine ,
72
+ )
70
73
71
74
# fixme: by default, openapi-generator is rather verbose. this helps with that but can also mask useful error messages
72
75
# when it fails. look into log configuration options. it's a java app so perhaps just a log4j.properties or something
@@ -89,7 +92,7 @@ def _impl(ctx):
89
92
inputs = inputs ,
90
93
command = "mkdir -p {gen_dir} && {generator_command}" .format (
91
94
gen_dir = declared_dir .path ,
92
- generator_command = _new_generator_command (ctx , declared_dir , rjars )
95
+ generator_command = _new_generator_command (ctx , declared_dir , rjars ),
93
96
),
94
97
outputs = [declared_dir ],
95
98
tools = ctx .files ._jdk ,
@@ -149,6 +152,7 @@ _openapi_generator = rule(
149
152
"model_package" : attr .string (),
150
153
"additional_properties" : attr .string_dict (),
151
154
"system_properties" : attr .string_dict (),
155
+ "engine" : attr .string (),
152
156
"type_mappings" : attr .string_dict (),
153
157
"is_windows" : attr .bool (mandatory = True ),
154
158
"_jdk" : attr .label (
0 commit comments