summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-09-19 14:13:02 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-10-10 17:28:26 +0200
commit6f404766c89fb48c4fc871d2ccb273bc5d5b2e5e (patch)
tree4a020048a1be9198811079ac56f43230a56576ad
parent1b8e5c3362673ece4bffe49e0f613eb3b5ec0aeb (diff)
downloadrules-cc-6f404766c89fb48c4fc871d2ccb273bc5d5b2e5e.tar.gz
rules: Use new 'env' expression
-rw-r--r--CC/EXPRESSIONS13
-rw-r--r--CC/RULES29
-rw-r--r--proto/RULES55
-rw-r--r--shell/test/EXPRESSIONS6
4 files changed, 18 insertions, 85 deletions
diff --git a/CC/EXPRESSIONS b/CC/EXPRESSIONS
index 48f40a2..5153b2d 100644
--- a/CC/EXPRESSIONS
+++ b/CC/EXPRESSIONS
@@ -506,18 +506,7 @@
, "provides":
{ "type": "map_union"
, "$1":
- [ { "type": "singleton_map"
- , "key": "compile-deps"
- , "value": {"type": "var", "name": "compile-deps"}
- }
- , { "type": "singleton_map"
- , "key": "link-deps"
- , "value": {"type": "var", "name": "link-deps"}
- }
- , { "type": "singleton_map"
- , "key": "link-args"
- , "value": {"type": "var", "name": "link-args"}
- }
+ [ {"type": "env", "vars": ["compile-deps", "link-deps", "link-args"]}
, { "type": "var"
, "name": "extra-provides"
, "default": {"type": "empty_map"}
diff --git a/CC/RULES b/CC/RULES
index 6fdab85..ac81da2 100644
--- a/CC/RULES
+++ b/CC/RULES
@@ -103,33 +103,8 @@
, "body":
{ "type": "RESULT"
, "provides":
- { "type": "map_union"
- , "$1":
- [ { "type": "singleton_map"
- , "key": "CC"
- , "value": {"type": "var", "name": "CC"}
- }
- , { "type": "singleton_map"
- , "key": "CXX"
- , "value": {"type": "var", "name": "CXX"}
- }
- , { "type": "singleton_map"
- , "key": "CFLAGS"
- , "value": {"type": "var", "name": "CFLAGS"}
- }
- , { "type": "singleton_map"
- , "key": "CXXFLAGS"
- , "value": {"type": "var", "name": "CXXFLAGS"}
- }
- , { "type": "singleton_map"
- , "key": "AR"
- , "value": {"type": "var", "name": "AR"}
- }
- , { "type": "singleton_map"
- , "key": "ENV"
- , "value": {"type": "var", "name": "ENV"}
- }
- ]
+ { "type": "env"
+ , "vars": ["CC", "CXX", "CFLAGS", "CXXFLAGS", "AR", "ENV"]
}
}
}
diff --git a/proto/RULES b/proto/RULES
index 9c7c1a2..95fb87a 100644
--- a/proto/RULES
+++ b/proto/RULES
@@ -76,51 +76,24 @@
, "body": {"type": "CALL_EXPRESSION", "name": "list_provider"}
}
]
- , [ "node"
- , { "type": "ABSTRACT_NODE"
- , "node_type":
- { "type": "if"
- , "cond": {"type": "FIELD", "name": "service"}
- , "then": "service library"
- , "else": "library"
- }
- , "target_fields":
- { "type": "map_union"
- , "$1":
- [ { "type": "singleton_map"
- , "key": "srcs"
- , "value": {"type": "var", "name": "srcs"}
- }
- , { "type": "singleton_map"
- , "key": "deps"
- , "value": {"type": "var", "name": "deps"}
- }
- ]
- }
- , "string_fields":
- { "type": "map_union"
- , "$1":
- [ { "type": "singleton_map"
- , "key": "name"
- , "value": [{"type": "var", "name": "name"}]
- }
- , { "type": "singleton_map"
- , "key": "stage"
- , "value": [{"type": "var", "name": "stage"}]
- }
- ]
+ , ["name", [{"type": "var", "name": "name"}]]
+ , ["stage", [{"type": "var", "name": "stage"}]]
+ , [ "proto"
+ , [ { "type": "ABSTRACT_NODE"
+ , "node_type":
+ { "type": "if"
+ , "cond": {"type": "FIELD", "name": "service"}
+ , "then": "service library"
+ , "else": "library"
+ }
+ , "target_fields": {"type": "env", "vars": ["srcs", "deps"]}
+ , "string_fields": {"type": "env", "vars": ["name", "stage"]}
}
- }
+ ]
]
]
, "body":
- { "type": "RESULT"
- , "provides":
- { "type": "singleton_map"
- , "key": "proto"
- , "value": [{"type": "var", "name": "node"}]
- }
- }
+ {"type": "RESULT", "provides": {"type": "env", "vars": ["proto"]}}
}
}
}
diff --git a/shell/test/EXPRESSIONS b/shell/test/EXPRESSIONS
index 6d163f3..24bf9ec 100644
--- a/shell/test/EXPRESSIONS
+++ b/shell/test/EXPRESSIONS
@@ -25,11 +25,7 @@
, "dep": {"type": "var", "name": "runner"}
}
}
- , "body":
- { "type": "singleton_map"
- , "key": "runner"
- , "value": {"type": "var", "name": "runner"}
- }
+ , "body": {"type": "env", "vars": ["runner"]}
}
}
}