summaryrefslogtreecommitdiff
path: root/data/RULES
blob: feb1a73bac826ddc3071918f8ad0d0d6556f0577 (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
{ "staged":
  { "doc": ["Stage data to a logical subdirectory."]
  , "target_fields": ["srcs", "deps"]
  , "string_fields": ["stage"]
  , "field_doc":
    { "srcs": ["The files to be staged"]
    , "stage":
      [ "The logical directory to stage the files to."
      , "Individual directory components are joined with \"/\"."
      ]
    , "deps":
      [ "Targets of with their runfiles should be added as well."
      , "Their staging is not changed."
      ]
    }
  , "artifacts_doc":
    [ "The runfiles of the \"srcs\" targets staged to the directory"
    , "specified in \"stage\" together the runfiles of the targets"
    , "specied in the field \"deps\" (in their original location)."
    ]
  , "runfiles_doc": ["Same as artifacts"]
  , "imports":
    { "runfiles": ["./", "..", "field_runfiles"]
    , "artifacts": ["./", "..", "field_artifacts"]
    }
  , "expression":
    { "type": "let*"
    , "bindings":
      [ [ "stage"
        , { "type": "join"
          , "separator": "/"
          , "$1": {"type": "FIELD", "name": "stage"}
          }
        ]
      , [ "srcs"
        , { "type": "let*"
          , "bindings": [["fieldname", "srcs"]]
          , "body":
            { "type": "map_union"
            , "$1":
              [ {"type": "CALL_EXPRESSION", "name": "runfiles"}
              , {"type": "CALL_EXPRESSION", "name": "artifacts"}
              ]
            }
          }
        ]
      , [ "staged"
        , { "type": "to_subdir"
          , "subdir": {"type": "var", "name": "stage"}
          , "$1": {"type": "var", "name": "srcs"}
          }
        ]
      , [ "dep stage"
        , { "type": "let*"
          , "bindings": [["fieldname", "deps"]]
          , "body": {"type": "CALL_EXPRESSION", "name": "runfiles"}
          }
        ]
      , [ "total"
        , { "type": "disjoint_map_union"
          , "msg": "Conflict between staged data and dependencies"
          , "$1":
            [ {"type": "var", "name": "dep stage"}
            , {"type": "var", "name": "staged"}
            ]
          }
        ]
      ]
    , "body":
      { "type": "RESULT"
      , "artifacts": {"type": "var", "name": "total"}
      , "runfiles": {"type": "var", "name": "total"}
      }
    }
  }
, "overlay":
  { "doc":
    ["Overlay the artifacts of \"deps\" targets in a latest-wins fashion."]
  , "target_fields": ["deps"]
  , "field_doc": {"deps": ["The targets of which to overlay the artifacts"]}
  , "artifacts_doc":
    [ "Artifacts of the targets specified in \"deps\". For conflicting"
    , "logical paths, the artifact is taken from the latest target (in"
    , "the \"deps\" field) that defines that logical path"
    ]
  , "runfiles_doc": ["Same as artifacts"]
  , "expression":
    { "type": "let*"
    , "bindings":
      [ [ "all"
        , { "type": "map_union"
          , "$1":
            { "type": "foreach"
            , "var": "dep"
            , "range": {"type": "FIELD", "name": "deps"}
            , "body":
              {"type": "DEP_ARTIFACTS", "dep": {"type": "var", "name": "dep"}}
            }
          }
        ]
      ]
    , "body":
      { "type": "RESULT"
      , "artifacts": {"type": "var", "name": "all"}
      , "runfiles": {"type": "var", "name": "all"}
      }
    }
  }
}