summaryrefslogtreecommitdiff
path: root/rules/proto/RULES
blob: b6ce000d8baddd5484279d0804947bcd1c4ffcfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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"}]
        }
      }
    }
  }
}