summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2023-08-10 11:01:21 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2023-08-16 15:30:32 +0200
commit5f9a850dc64a4363cc83629812439d6fca9b5187 (patch)
tree9cdf853a1296627ac0647eef98ed8bcd6ba4214c
parentf9ae3b52d5ea07b5f360c338671595808aae9231 (diff)
downloadjustbuild-5f9a850dc64a4363cc83629812439d6fca9b5187.tar.gz
rules: Extend toolchains via defaults from base
-rw-r--r--rules/CC/RULES39
-rw-r--r--rules/CC/proto/RULES39
2 files changed, 44 insertions, 34 deletions
diff --git a/rules/CC/RULES b/rules/CC/RULES
index 98c5cb46..8af70beb 100644
--- a/rules/CC/RULES
+++ b/rules/CC/RULES
@@ -26,7 +26,7 @@
[ "Optional toolchain directory. A collection of artifacts that provide"
, "the tools CC, CXX, and AR (if needed). Note that only artifacts of"
, "the specified targets are considered (no runfiles etc.). Specifying"
- , "this field overlays artifacts from \"base\"."
+ , "this field extends artifacts from \"base\"."
]
, "deps":
[ "Optional CC libraries any CC library and CC binary implicitly depend"
@@ -72,7 +72,8 @@
, "config_vars": ["ARCH", "HOST_ARCH"]
, "imports":
{ "base-provides": "defaults-base-provides"
- , "artifacts": ["./", "..", "field_artifacts"]
+ , "base-provides-list": "defaults-base-provides-list"
+ , "artifacts_list": ["./", "..", "field_artifacts_list"]
, "compile-deps": "compile-deps"
, "compile-args-deps": "compile-args-deps"
, "link-deps": "link-deps"
@@ -224,24 +225,28 @@
, ["provider", "TOOLCHAIN"]
, ["default", {"type": "empty_map"}]
, [ "TOOLCHAIN"
- , { "type": "map_union"
+ , { "type": "disjoint_map_union"
+ , "msg": "toolchain artifacts may not overlap"
, "$1":
- [ {"type": "CALL_EXPRESSION", "name": "base-provides"}
- , { "type": "if"
- , "cond": {"type": "FIELD", "name": "toolchain"}
- , "then":
- { "type": "let*"
- , "bindings":
- [ ["fieldname", "toolchain"]
- , [ "transition"
- , {"type": "CALL_EXPRESSION", "name": "for host"}
+ { "type": "++"
+ , "$1":
+ [ {"type": "CALL_EXPRESSION", "name": "base-provides-list"}
+ , { "type": "if"
+ , "cond": {"type": "FIELD", "name": "toolchain"}
+ , "then":
+ { "type": "let*"
+ , "bindings":
+ [ ["fieldname", "toolchain"]
+ , [ "transition"
+ , {"type": "CALL_EXPRESSION", "name": "for host"}
+ ]
]
- ]
- , "body": {"type": "CALL_EXPRESSION", "name": "artifacts"}
+ , "body":
+ {"type": "CALL_EXPRESSION", "name": "artifacts_list"}
+ }
}
- , "else": {"type": "empty_map"}
- }
- ]
+ ]
+ }
}
]
, [ "CFLAGS"
diff --git a/rules/CC/proto/RULES b/rules/CC/proto/RULES
index 6d2e7251..cfc3786e 100644
--- a/rules/CC/proto/RULES
+++ b/rules/CC/proto/RULES
@@ -19,7 +19,7 @@
[ "Optional toolchain directory. A collection of artifacts that provide"
, "the protobuf compiler and the GRPC plugin (if needed). Note that only"
, "artifacts of the specified targets are considered (no runfiles etc.)."
- , "Specifying this field overlays artifacts from \"base\"."
+ , "Specifying this field extends artifacts from \"base\"."
]
, "deps":
[ "Optional CC libraries the resulting CC proto libraries implicitly"
@@ -56,7 +56,8 @@
}
, "imports":
{ "base-provides": ["./", "..", "defaults-base-provides"]
- , "artifacts": ["", "field_artifacts"]
+ , "base-provides-list": ["./", "..", "defaults-base-provides-list"]
+ , "artifacts_list": ["", "field_artifacts_list"]
, "compile-deps": ["CC", "compile-deps"]
, "compile-args-deps": ["CC", "compile-args-deps"]
, "link-deps": ["CC", "link-deps"]
@@ -158,24 +159,28 @@
, ["provider", "TOOLCHAIN"]
, ["default", {"type": "empty_map"}]
, [ "TOOLCHAIN"
- , { "type": "map_union"
+ , { "type": "disjoint_map_union"
+ , "msg": "toolchain artifacts may not overlap"
, "$1":
- [ {"type": "CALL_EXPRESSION", "name": "base-provides"}
- , { "type": "if"
- , "cond": {"type": "FIELD", "name": "toolchain"}
- , "then":
- { "type": "let*"
- , "bindings":
- [ ["fieldname", "toolchain"]
- , [ "transition"
- , {"type": "CALL_EXPRESSION", "name": "for host"}
+ { "type": "++"
+ , "$1":
+ [ {"type": "CALL_EXPRESSION", "name": "base-provides-list"}
+ , { "type": "if"
+ , "cond": {"type": "FIELD", "name": "toolchain"}
+ , "then":
+ { "type": "let*"
+ , "bindings":
+ [ ["fieldname", "toolchain"]
+ , [ "transition"
+ , {"type": "CALL_EXPRESSION", "name": "for host"}
+ ]
]
- ]
- , "body": {"type": "CALL_EXPRESSION", "name": "artifacts"}
+ , "body":
+ {"type": "CALL_EXPRESSION", "name": "artifacts_list"}
+ }
}
- , "else": {"type": "empty_map"}
- }
- ]
+ ]
+ }
}
]
, [ "LDFLAGS"