From 86c4f55b6f578bfae74ab35151c1e4425b7e1fd1 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 22 Feb 2022 17:03:21 +0100 Subject: Initial self-hosting commit This is the initial version of our tool that is able to build itself. In can be bootstrapped by ./bin/bootstrap.py Co-authored-by: Oliver Reiche Co-authored-by: Victor Moreno --- proto/RULES | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 proto/RULES (limited to 'proto') diff --git a/proto/RULES b/proto/RULES new file mode 100644 index 0000000..b6ce000 --- /dev/null +++ b/proto/RULES @@ -0,0 +1,105 @@ +{ "library": + { "target_fields": ["srcs", "deps"] + , "string_fields": ["stage", "name", "service"] + , "expression": + { "type": "let*" + , "bindings": + [ [ "stage" + , { "type": "join" + , "separator": "/" + , "$1": {"type": "FIELD", "name": "stage"} + } + ] + , [ "name" + , { "type": "assert_non_empty" + , "msg": "Have to provide a name, unique in the stage" + , "$1": {"type": "join", "$1": {"type": "FIELD", "name": "name"}} + } + ] + , [ "srcs" + , [ { "type": "VALUE_NODE" + , "$1": + { "type": "RESULT" + , "artifacts": + { "type": "to_subdir" + , "subdir": {"type": "var", "name": "stage"} + , "$1": + { "type": "disjoint_map_union" + , "msg": "Sources have to be conflict free" + , "$1": + { "type": "foreach" + , "var": "x" + , "range": {"type": "FIELD", "name": "srcs"} + , "body": + { "type": "DEP_ARTIFACTS" + , "dep": {"type": "var", "name": "x"} + } + } + } + } + } + } + ] + ] + , [ "deps" + , { "type": "++" + , "$1": + { "type": "foreach" + , "var": "x" + , "range": {"type": "FIELD", "name": "deps"} + , "body": + { "type": "DEP_PROVIDES" + , "dep": {"type": "var", "name": "x"} + , "provider": "proto" + } + } + } + ] + , [ "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"}] + } + ] + } + } + ] + ] + , "body": + { "type": "RESULT" + , "provides": + { "type": "singleton_map" + , "key": "proto" + , "value": [{"type": "var", "name": "node"}] + } + } + } + } +} -- cgit v1.2.3