From d0fd0957b485cb28e22557f3fab11075cd5a6b8b Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Fri, 2 Dec 2022 15:33:03 +0100 Subject: 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 --- CC/proto/EXPRESSIONS | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'CC/proto/EXPRESSIONS') diff --git a/CC/proto/EXPRESSIONS b/CC/proto/EXPRESSIONS index b2b3ea0..1ab17a5 100644 --- a/CC/proto/EXPRESSIONS +++ b/CC/proto/EXPRESSIONS @@ -8,13 +8,17 @@ } , "protoc-compile": { "vars": - [ "transition" - , "service support" - , "CXX" + [ "CXX" , "CXXFLAGS" , "ADD_CXXFLAGS" - , "ENV" , "AR" + , "ENV" + , "name" + , "stage" + , "service support" + , "deps-transition" + , "public-fieldnames" + , "private-fieldnames" ] , "imports": { "stage": ["", "stage_singleton_field"] @@ -26,9 +30,14 @@ , "expression": { "type": "let*" , "bindings": - [ [ "protoc" + [ ["pure C", false] + , [ "protoc" , { "type": "let*" - , "bindings": [["fieldname", "protoc"], ["location", "protoc"]] + , "bindings": + [ ["fieldname", "protoc"] + , ["transition", {"type": "var", "name": "deps-transition"}] + , ["location", "protoc"] + ] , "body": {"type": "CALL_EXPRESSION", "name": "stage"} } ] @@ -39,6 +48,7 @@ { "type": "let*" , "bindings": [ ["fieldname", "grpc_cpp_plugin"] + , ["transition", {"type": "var", "name": "deps-transition"}] , ["location", "grpc_cpp_plugin"] ] , "body": {"type": "CALL_EXPRESSION", "name": "stage"} @@ -52,8 +62,7 @@ , "subdir": "work" , "$1": { "type": "let*" - , "bindings": - [["fieldname", "well_known_protos"], ["transition", null]] + , "bindings": [["fieldname", "well_known_protos"]] , "body": {"type": "CALL_EXPRESSION", "name": "artifacts"} } } @@ -63,7 +72,7 @@ , "msg": "Sources may not conflict" , "$1": { "type": "let*" - , "bindings": [["fieldname", "srcs"], ["transition", null]] + , "bindings": [["fieldname", "srcs"]] , "body": {"type": "CALL_EXPRESSION", "name": "artifacts_list"} } } @@ -289,7 +298,9 @@ , "value": {"type": "var", "name": "all proto srcs"} } ] - , ["local cflags", ["-Wno-sign-conversion", "-Wno-unused-function"]] + , ["cflags", []] + , ["private-cflags", ["-Wno-sign-conversion", "-Wno-unused-function"]] + , ["private-ldflags", []] ] , "body": {"type": "CALL_EXPRESSION", "name": "result"} } -- cgit v1.2.3