Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support enable warning when compiling pb.cc #1050

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/en/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ proto_library_config(
    protoc='protoc', #protoc compiler path
    protobuf_libs='//thirdparty/protobuf:protobuf', #protobuf library path, Blade deps format
    protobuf_path='thirdparty', # import proto search path, relative to BLADE_ROOT
protobuf_cc_warning='', # enable warning(disable -w) or not when compiling pb.cc, yes or no
    protobuf_include_path = 'thirdparty', # extra -I path when compiling pb.cc
)
```
Expand Down
4 changes: 4 additions & 0 deletions doc/zh_CN/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ Java 构建相关的配置:

import 时的 proto 搜索路径,相对于 BLADE_ROOT。

- `protobuf_cc_warning`: string = ''

编译pb.cc 时是否开启warnings, yes或者no

- `protobuf_include_path` : string =

编译 pb.cc 时额外的 -I 路径。
Expand Down
1 change: 1 addition & 0 deletions src/blade/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def __init__(self):
'protobuf_libs': [],
'protobuf_path': '',
'protobuf_incs': [],
'protobuf_cc_warning': '',
'protobuf_java_incs': [],
'protobuf_php_path': '',
'protoc_php_plugin': '',
Expand Down
5 changes: 3 additions & 2 deletions src/blade/proto_library_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def __init__(self,
"""
# pylint: disable=too-many-locals
srcs = var_to_list(srcs)
proto_config = config.get_section('proto_library_config')

super(ProtoLibrary, self).__init__(
name=name,
type='proto_library',
Expand All @@ -108,7 +110,7 @@ def __init__(self,
deps=deps,
visibility=visibility,
tags=tags,
warning='',
warning=proto_config['protobuf_cc_warning'],
defs=[],
incs=[],
export_incs=[],
Expand All @@ -123,7 +125,6 @@ def __init__(self,
self.attr['public_protos'] = [self._source_file_path(s) for s in srcs]
self._add_tags('lang:proto', 'type:library')

proto_config = config.get_section('proto_library_config')
protobuf_libs = var_to_list(proto_config['protobuf_libs'])
protobuf_java_libs = var_to_list(proto_config['protobuf_java_libs'])
protobuf_python_libs = var_to_list(proto_config['protobuf_python_libs'])
Expand Down
1 change: 1 addition & 0 deletions vim/syntax/blade_config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ syn keyword bladeArg fbthrift_incs
syn keyword bladeTarget proto_library_config
syn keyword bladeArg protobuf_go_path
syn keyword bladeArg protobuf_incs
syn keyword bladeArg protobuf_cc_warning
syn keyword bladeArg protobuf_java_incs
syn keyword bladeArg protobuf_java_libs
syn keyword bladeArg protobuf_libs
Expand Down
Loading