summaryrefslogtreecommitdiff
path: root/test/end-to-end/target-cache/data/pydicts/RULES
blob: c9a1dbda1eb5dab974884c8b5e834bc758502cad (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
{ "py_dicts":
  { "target_fields": ["py_files"]
  , "implicit": {"converter": [["FILE", null, "dict_converter.py"]]}
  , "expression":
    { "type": "RESULT"
    , "artifacts": {"type": "empty_map"}
    , "runfiles": {"type": "empty_map"}
    , "provides":
      { "type": "let*"
      , "bindings":
        [ [ "converter"
          , { "type": "VALUE_NODE"
            , "$1":
              { "type": "RESULT"
              , "artifacts":
                { "type": "map_union"
                , "$1":
                  { "type": "foreach"
                  , "var": "d"
                  , "range": {"type": "FIELD", "name": "converter"}
                  , "body":
                    { "type": "DEP_ARTIFACTS"
                    , "dep": {"type": "var", "name": "d"}
                    }
                  }
                }
              , "runfiles": {"type": "empty_map"}
              , "provides": {"type": "empty_map"}
              }
            }
          ]
        , [ "py_files"
          , { "type": "VALUE_NODE"
            , "$1":
              { "type": "RESULT"
              , "artifacts":
                { "type": "map_union"
                , "$1":
                  { "type": "foreach"
                  , "var": "d"
                  , "range": {"type": "FIELD", "name": "py_files"}
                  , "body":
                    { "type": "DEP_ARTIFACTS"
                    , "dep": {"type": "var", "name": "d"}
                    }
                  }
                }
              , "runfiles": {"type": "empty_map"}
              , "provides": {"type": "empty_map"}
              }
            }
          ]
        ]
      , "body":
        { "type": "map_union"
        , "$1":
          [ { "type": "singleton_map"
            , "key": "py2json"
            , "value":
              [ { "type": "ABSTRACT_NODE"
                , "string_fields":
                  { "type": "map_union"
                  , "$1":
                    [ {"type": "singleton_map", "key": "from", "value": ["py"]}
                    , {"type": "singleton_map", "key": "to", "value": ["json"]}
                    ]
                  }
                , "target_fields":
                  { "type": "map_union"
                  , "$1":
                    [ { "type": "singleton_map"
                      , "key": "converter"
                      , "value": [{"type": "var", "name": "converter"}]
                      }
                    , { "type": "singleton_map"
                      , "key": "dicts"
                      , "value": [{"type": "var", "name": "py_files"}]
                      }
                    ]
                  }
                , "node_type": "convert"
                }
              ]
            }
          ]
        }
      }
    }
  }
, "dicts_convert":
  { "string_fields": ["from", "to"]
  , "target_fields": ["converter", "dicts"]
  , "config_vars": ["ext"]
  , "expression":
    { "type": "let*"
    , "bindings":
      [ ["from", {"type": "join", "$1": {"type": "FIELD", "name": "from"}}]
      , ["to", {"type": "join", "$1": {"type": "FIELD", "name": "to"}}]
      , [ "ext"
        , { "type": "var"
          , "name": "ext"
          , "default":
            { "type": "if"
            , "cond":
              {"type": "==", "$1": {"type": "var", "name": "to"}, "$2": "py"}
            , "then": ".py"
            , "else":
              { "type": "if"
              , "cond":
                { "type": "=="
                , "$1": {"type": "var", "name": "to"}
                , "$2": "json"
                }
              , "then": ".json"
              , "else": ".yaml"
              }
            }
          }
        ]
      , [ "dicts"
        , { "type": "disjoint_map_union"
          , "$1":
            { "type": "foreach"
            , "var": "d"
            , "range": {"type": "FIELD", "name": "dicts"}
            , "body":
              {"type": "DEP_ARTIFACTS", "dep": {"type": "var", "name": "d"}}
            }
          }
        ]
      , [ "converter"
        , { "type": "to_subdir"
          , "subdir": "bin"
          , "flat": false
          , "$1":
            { "type": "disjoint_map_union"
            , "$1":
              { "type": "foreach"
              , "var": "x"
              , "range": {"type": "FIELD", "name": "converter"}
              , "body":
                {"type": "DEP_ARTIFACTS", "dep": {"type": "var", "name": "x"}}
              }
            }
          }
        ]
      , [ "converter_bin"
        , { "type": "join"
          , "$1": {"type": "keys", "$1": {"type": "var", "name": "converter"}}
          }
        ]
      ]
    , "body":
      { "type": "RESULT"
      , "artifacts":
        { "type": "disjoint_map_union"
        , "$1":
          { "type": "foreach_map"
          , "var_key": "path"
          , "var_val": "file"
          , "range": {"type": "var", "name": "dicts"}
          , "body":
            { "type": "let*"
            , "bindings":
              [ [ "out"
                , { "type": "change_ending"
                  , "ending": {"type": "var", "name": "ext"}
                  , "$1": {"type": "var", "name": "path"}
                  }
                ]
              ]
            , "body":
              { "type": "ACTION"
              , "cmd":
                [ "/bin/sh"
                , "-c"
                , { "type": "join"
                  , "$1":
                    { "type": "++"
                    , "$1":
                      [ [{"type": "var", "name": "converter_bin"}]
                      , [ {"type": "var", "name": "from"}
                        , {"type": "var", "name": "to"}
                        ]
                      , [ {"type": "var", "name": "path"}
                        , ">"
                        , {"type": "var", "name": "out"}
                        ]
                      ]
                    }
                  , "separator": " "
                  }
                ]
              , "inputs":
                { "type": "disjoint_map_union"
                , "$1":
                  [ {"type": "var", "name": "converter"}
                  , { "type": "singleton_map"
                    , "key": {"type": "var", "name": "path"}
                    , "value": {"type": "var", "name": "file"}
                    }
                  ]
                }
              , "outs": [{"type": "var", "name": "out"}]
              }
            }
          }
        }
      , "runfiles": {"type": "empty_map"}
      , "provides": {"type": "empty_map"}
      }
    }
  }
, "json_dicts":
  { "target_fields": ["py_dicts"]
  , "implicit": {"converter": [["FILE", null, "dict_converter.py"]]}
  , "anonymous":
    { "from_py":
      { "provider": "py2json"
      , "rule_map": {"convert": "dicts_convert"}
      , "target": "py_dicts"
      }
    }
  , "expression":
    { "type": "RESULT"
    , "artifacts":
      { "type": "disjoint_map_union"
      , "$1":
        { "type": "foreach"
        , "var": "a"
        , "range": {"type": "FIELD", "name": "from_py"}
        , "body":
          {"type": "DEP_ARTIFACTS", "dep": {"type": "var", "name": "a"}}
        }
      }
    , "runfiles": {"type": "empty_map"}
    , "provides":
      { "type": "let*"
      , "bindings":
        [ [ "converter"
          , { "type": "VALUE_NODE"
            , "$1":
              { "type": "RESULT"
              , "artifacts":
                { "type": "map_union"
                , "$1":
                  { "type": "foreach"
                  , "var": "d"
                  , "range": {"type": "FIELD", "name": "converter"}
                  , "body":
                    { "type": "DEP_ARTIFACTS"
                    , "dep": {"type": "var", "name": "d"}
                    }
                  }
                }
              , "runfiles": {"type": "empty_map"}
              , "provides": {"type": "empty_map"}
              }
            }
          ]
        , [ "py_nodes"
          , { "type": "++"
            , "$1":
              { "type": "foreach"
              , "var": "d"
              , "range": {"type": "FIELD", "name": "py_dicts"}
              , "body":
                { "type": "DEP_PROVIDES"
                , "dep": {"type": "var", "name": "d"}
                , "provider": "py2json"
                , "default": {"type": "empty_map"}
                }
              }
            }
          ]
        ]
      , "body":
        { "type": "map_union"
        , "$1":
          [ { "type": "singleton_map"
            , "key": "json2yaml"
            , "value":
              [ { "type": "ABSTRACT_NODE"
                , "string_fields":
                  { "type": "map_union"
                  , "$1":
                    [ { "type": "singleton_map"
                      , "key": "from"
                      , "value": ["json"]
                      }
                    , {"type": "singleton_map", "key": "to", "value": ["yaml"]}
                    ]
                  }
                , "target_fields":
                  { "type": "map_union"
                  , "$1":
                    [ { "type": "singleton_map"
                      , "key": "converter"
                      , "value": [{"type": "var", "name": "converter"}]
                      }
                    , { "type": "singleton_map"
                      , "key": "dicts"
                      , "value": {"type": "var", "name": "py_nodes"}
                      }
                    ]
                  }
                , "node_type": "convert"
                }
              ]
            }
          ]
        }
      }
    }
  }
}