diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-12-02 15:33:03 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-12-09 13:13:21 +0100 |
commit | d0fd0957b485cb28e22557f3fab11075cd5a6b8b (patch) | |
tree | ccfcfa8e236a34481146f37270a6fe66710f2598 /CC/proto/RULES | |
parent | 00103df6ff5d06c85d6c42f1b9d1f56f2325ad3a (diff) | |
download | rules-cc-d0fd0957b485cb28e22557f3fab11075cd5a6b8b.tar.gz |
rules: Refactoring and minor improvements
Compared to the previous commit, the action graphs for just
and its unit tests are unchanged.
- Git hash of action graph for ["",""]:
c6e75f17abd7ffaab6ff9bb725ad67ec0bf6c973
- Git hash of action graph for ["test/buildtool","TESTS"]:
8063dfb3dd7daa9ae01d95c177e14946f785c57e
Refactor:
- "local cflags" to "private-cflags"
- "local defines" to "private-defines"
- "link externals" to "private-ldflags"
- "deps" to "private-deps" for (test) binaries
- "proto" to "private-proto" for binaries
Improvements:
- consistent variable declaration order:
OS, ARCH, HOST_ARCH, TARGET_ARCH,
CC, CXX, CFLAGS, CXXFLAGS, ADD_CFLAGS, ADD_CXXFLAGS,
AR, ENV, PATH
- use fields close to their definition (in RULES)
- use common expression for binaries and test binaries
- split expression "flags" and "compiler"
... to separate ones for CC and CXX.
- rename "transition" to "deps-transition"
... to avoid conflicts with other transitions.
- support "defaults-transition" for CC expressions
Implement:
- "cflags" for libraries
- "private-cflags" for (test) binaries
- "private-defines" for test binaries
- "private-ldflags" for test binaries
- (public) "defines" for libraries
Diffstat (limited to 'CC/proto/RULES')
-rw-r--r-- | CC/proto/RULES | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/CC/proto/RULES b/CC/proto/RULES index d53ab35..d1cfc4e 100644 --- a/CC/proto/RULES +++ b/CC/proto/RULES @@ -8,25 +8,12 @@ , "string_fields": ["name", "stage"] , "target_fields": ["srcs", "deps"] , "config_vars": - [ "OS" - , "ARCH" - , "HOST_ARCH" - , "CXX" - , "CC" - , "CXXFLAGS" - , "CFLAGS" - , "ADD_CXXFLAGS" - , "ADD_CFLAGS" - , "ENV" - , "AR" - ] + ["OS", "ARCH", "HOST_ARCH", "CXX", "CFLAGS", "ADD_CFLAGS", "AR", "ENV"] , "implicit": { "protoc": [["@", "protoc", "", "protoc"]] , "defaults": [["./", "..", "defaults"]] , "proto-deps": [["@", "protoc", "", "C++ runtime"]] , "well_known_protos": [["@", "protoc", "", "well_known_protos"]] - , "pure C": [] - , "private-deps": [] } , "imports": { "protoc-compile": "protoc-compile" @@ -37,7 +24,19 @@ , "expression": { "type": "let*" , "bindings": - [["transition", {"type": "CALL_EXPRESSION", "name": "host transition"}]] + [ ["name", {"type": "join", "$1": {"type": "FIELD", "name": "name"}}] + , [ "stage" + , { "type": "join" + , "separator": "/" + , "$1": {"type": "FIELD", "name": "stage"} + } + ] + , [ "deps-transition" + , {"type": "CALL_EXPRESSION", "name": "host transition"} + ] + , ["public-fieldnames", ["deps", "proto-deps"]] + , ["private-fieldnames", ["deps", "proto-deps"]] + ] , "body": {"type": "CALL_EXPRESSION", "name": "protoc-compile"} } } @@ -51,18 +50,7 @@ , "string_fields": ["name", "stage"] , "target_fields": ["srcs", "deps"] , "config_vars": - [ "OS" - , "ARCH" - , "HOST_ARCH" - , "CXX" - , "CC" - , "CXXFLAGS" - , "CFLAGS" - , "ADD_CXXFLAGS" - , "ADD_CFLAGS" - , "ENV" - , "AR" - ] + ["OS", "ARCH", "HOST_ARCH", "CXX", "CXXFLAGS", "ADD_CXXFLAGS", "AR", "ENV"] , "implicit": { "protoc": [["@", "protoc", "", "protoc"]] , "grpc_cpp_plugin": [["@", "grpc", "src/compiler", "grpc_cpp_plugin"]] @@ -72,8 +60,6 @@ , ["@", "protoc", "", "C++ runtime"] ] , "well_known_protos": [["@", "protoc", "", "well_known_protos"]] - , "pure C": [] - , "private-deps": [] } , "imports": { "protoc-compile": "protoc-compile" @@ -88,7 +74,18 @@ { "type": "let*" , "bindings": [ ["service support", true] - , ["transition", {"type": "CALL_EXPRESSION", "name": "host transition"}] + , ["name", {"type": "join", "$1": {"type": "FIELD", "name": "name"}}] + , [ "stage" + , { "type": "join" + , "separator": "/" + , "$1": {"type": "FIELD", "name": "stage"} + } + ] + , [ "deps-transition" + , {"type": "CALL_EXPRESSION", "name": "host transition"} + ] + , ["public-fieldnames", ["deps", "proto-deps"]] + , ["private-fieldnames", ["deps", "proto-deps"]] ] , "body": {"type": "CALL_EXPRESSION", "name": "protoc-compile"} } |