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 /shell/test | |
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 'shell/test')
-rw-r--r-- | shell/test/EXPRESSIONS | 29 | ||||
-rw-r--r-- | shell/test/RULES | 3 |
2 files changed, 23 insertions, 9 deletions
diff --git a/shell/test/EXPRESSIONS b/shell/test/EXPRESSIONS index 24bf9ec..444de92 100644 --- a/shell/test/EXPRESSIONS +++ b/shell/test/EXPRESSIONS @@ -1,5 +1,13 @@ { "test-action": - { "vars": ["name", "test.sh", "ATTEMPT", "TEST_ENV"] + { "vars": + [ "TEST_ENV" + , "ATTEMPT" + , "name" + , "test.sh" + , "keep" + , "runner" + , "deps-fieldname" + ] , "imports": { "artifacts_list": ["./", "../..", "field_artifacts_list"] , "runfiles_list": ["./", "../..", "field_runfiles_list"] @@ -12,7 +20,7 @@ , "$1": { "type": "foreach" , "var": "runner" - , "range": {"type": "FIELD", "name": "runner"} + , "range": {"type": "var", "name": "runner"} , "body": { "type": "map_union" , "$1": @@ -35,12 +43,17 @@ , { "type": "TREE" , "$1": { "type": "disjoint_map_union" - , "msg": "Field 'deps' has to stage in a conflict free way" + , "msg": + [ "Field" + , {"type": "var", "name": "deps-fieldname"} + , "has to stage in a conflict free way" + ] , "$1": { "type": "++" , "$1": { "type": "let*" - , "bindings": [["fieldname", "deps"]] + , "bindings": + [["fieldname", {"type": "var", "name": "deps-fieldname"}]] , "body": [ {"type": "CALL_EXPRESSION", "name": "runfiles_list"} , {"type": "CALL_EXPRESSION", "name": "artifacts_list"} @@ -72,7 +85,7 @@ [ ["result", "stdout", "stderr", "time-start", "time-stop"] , { "type": "foreach" , "var": "filename" - , "range": {"type": "FIELD", "name": "keep"} + , "range": {"type": "var", "name": "keep"} , "body": { "type": "join" , "$1": ["work/", {"type": "var", "name": "filename"}] @@ -95,9 +108,7 @@ } ] , [ "cmd" - , { "type": "++" - , "$1": [["./runner"], {"type": "FIELD", "name": "keep"}] - } + , {"type": "++", "$1": [["./runner"], {"type": "var", "name": "keep"}]} ] , [ "test_env" , {"type": "var", "name": "TEST_ENV", "default": {"type": "empty_map"}} @@ -142,7 +153,7 @@ } } , "test-result": - { "vars": ["name", "test.sh", "TEST_ENV"] + { "vars": ["TEST_ENV", "name", "test.sh", "keep", "runner", "deps-fieldname"] , "imports": {"action": "test-action"} , "expression": { "type": "let*" diff --git a/shell/test/RULES b/shell/test/RULES index 4242d94..990e8d9 100644 --- a/shell/test/RULES +++ b/shell/test/RULES @@ -75,6 +75,9 @@ , "$1": {"type": "join", "$1": {"type": "FIELD", "name": "name"}} } ] + , ["keep", {"type": "FIELD", "name": "keep"}] + , ["runner", {"type": "FIELD", "name": "runner"}] + , ["deps-fieldname", "deps"] ] , "body": { "type": "if" |