diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-04-01 11:06:29 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-04-23 15:26:15 +0200 |
commit | 6634c6cc70f74696761c2306f2ce353359359b2e (patch) | |
tree | 24ff4437f91903290db4ab562263ae66fe2e42a7 | |
parent | 95905ca12f6433916ba3c326685f3cdfd92ce89f (diff) | |
download | rules-cc-6634c6cc70f74696761c2306f2ce353359359b2e.tar.gz |
expressions CC: Small refactoring
Allow the expressions running the actions producing the library and
binary artifacts to pass along more information to consumers if
needed by extending their return values to maps. Ensure the changes
do not affect other consumers of the current expressions, such as
the test rules, which do not expect extra information besides the
single action artifact.
-rw-r--r-- | CC/EXPRESSIONS | 86 |
1 files changed, 82 insertions, 4 deletions
diff --git a/CC/EXPRESSIONS b/CC/EXPRESSIONS index 03c9c07..476bc11 100644 --- a/CC/EXPRESSIONS +++ b/CC/EXPRESSIONS @@ -1500,7 +1500,42 @@ } } , "lib artifact": - { "vars": + { "doc": ["Provides the library artifact."] + , "vars": + [ "CC" + , "CXX" + , "CFLAGS" + , "CXXFLAGS" + , "ADD_CFLAGS" + , "ADD_CXXFLAGS" + , "AR" + , "ENV" + , "DEBUG" + , "name" + , "pure C" + , "srcs" + , "hdrs" + , "private-hdrs" + , "stage" + , "compile-deps" + , "compile-args" + , "cflags-files" + , "defaults-transition" + ] + , "imports": {"lib action": "lib action"} + , "expression": + { "type": "lookup" + , "key": "library" + , "map": {"type": "CALL_EXPRESSION", "name": "lib action"} + , "default": {"type": "empty_map"} + } + } +, "lib action": + { "doc": + [ "Run the action producing the library artifact and pass it together with" + , "related information to consumers." + ] + , "vars": [ "CC" , "CXX" , "CFLAGS" @@ -1715,7 +1750,11 @@ } ] ] - , "body": {"type": "var", "name": "lib"} + , "body": + { "type": "singleton_map" + , "key": "library" + , "value": {"type": "var", "name": "lib"} + } } } , "lib result": @@ -1886,7 +1925,42 @@ } } , "bin artifact": - { "doc": ["Produces the binary artifact."] + { "doc": ["Provides the linked binary."] + , "vars": + [ "CC" + , "CXX" + , "CFLAGS" + , "CXXFLAGS" + , "ADD_CFLAGS" + , "ADD_CXXFLAGS" + , "ENV" + , "DEBUG" + , "name" + , "pure C" + , "srcs" + , "private-hdrs" + , "stage" + , "compile-deps" + , "compile-args" + , "link-deps" + , "link-args" + , "cflags-files" + , "ldflags-files" + , "defaults-transition" + ] + , "imports": {"bin action": "bin action"} + , "expression": + { "type": "lookup" + , "key": "binary" + , "map": {"type": "CALL_EXPRESSION", "name": "bin action"} + , "default": {"type": "empty_map"} + } + } +, "bin action": + { "doc": + [ "Run the action producing the binary artifact and pass it together with" + , "related information to consumers." + ] , "vars": [ "CC" , "CXX" @@ -2106,7 +2180,11 @@ } ] ] - , "body": {"type": "var", "name": "binary"} + , "body": + { "type": "singleton_map" + , "key": "binary" + , "value": {"type": "var", "name": "binary"} + } } } , "bin result": |