summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-05-29 12:01:30 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-06-03 16:46:49 +0200
commit485a7bc685d8926530b577a876ca3c9cfae20601 (patch)
tree31933dc6a212b5d28ae4e8bcf6dd90aed571dfda /rules
parentc0b46b2f4e47fc017beeae34ff555418d198e1d4 (diff)
downloadjustbuild-485a7bc685d8926530b577a876ca3c9cfae20601.tar.gz
debug rule: Add flag field to skip installing extra debug artifacts
This is useful when we want to install targets built in debug mode, but do not want to stage all the additional source and header files if no debugging is being performed, e.g., in tests.
Diffstat (limited to 'rules')
-rw-r--r--rules/CC/EXPRESSIONS22
-rw-r--r--rules/CC/RULES12
2 files changed, 26 insertions, 8 deletions
diff --git a/rules/CC/EXPRESSIONS b/rules/CC/EXPRESSIONS
index 7d9dfa1d..437758e4 100644
--- a/rules/CC/EXPRESSIONS
+++ b/rules/CC/EXPRESSIONS
@@ -1452,7 +1452,14 @@
}
}
, "install-with-deps result":
- { "vars": ["pc-install-dir", "targets", "prefix", "flat-libs", "hdrs-only"]
+ { "vars":
+ [ "pc-install-dir"
+ , "targets"
+ , "prefix"
+ , "flat-libs"
+ , "hdrs-only"
+ , "skip-debug-stage"
+ ]
, "imports": {"pkg-config": "pkg-config"}
, "expression":
{ "type": "let*"
@@ -1490,10 +1497,15 @@
}
]
, [ "debug-srcs"
- , { "type": "DEP_PROVIDES"
- , "dep": {"type": "var", "name": "target"}
- , "provider": "debug-srcs"
- , "default": {"type": "empty_map"}
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "skip-debug-stage"}
+ , "then": {"type": "empty_map"}
+ , "else":
+ { "type": "DEP_PROVIDES"
+ , "dep": {"type": "var", "name": "target"}
+ , "provider": "debug-srcs"
+ , "default": {"type": "empty_map"}
+ }
}
]
]
diff --git a/rules/CC/RULES b/rules/CC/RULES
index a2ced03d..4d906ff7 100644
--- a/rules/CC/RULES
+++ b/rules/CC/RULES
@@ -718,12 +718,13 @@
, "the target, artifacts and dependencies will be installed to"
, "subdirectories \"bin\", \"include\", and \"lib\". For library targets,"
, "a pkg-config file is generated and provided in \"lib/pkgconfig\"."
- , "In debug mode, sources needed for local debugging will be installed to"
- , "subdirectory \"debug-src\"."
+ , "In debug mode, depending on the target, additional artifacts needed for"
+ , "local debugging are gathered and installed, depending on target, to"
+ , "\"work\" and \"include\"."
]
, "config_vars": ["PREFIX"]
, "target_fields": ["targets"]
- , "string_fields": ["flat-libs", "prefix", "hdrs-only"]
+ , "string_fields": ["flat-libs", "prefix", "hdrs-only", "skip-debug-stage"]
, "imports": {"install result": "install-with-deps result"}
, "field_doc":
{ "targets": ["Targets to install artifacts from."]
@@ -739,6 +740,10 @@
, "taken, with the default value being \"/\"."
]
, "hdrs-only": ["Only collect headers from deps (without subdirectory)."]
+ , "skip-debug-stage":
+ [ "If in debug mode, skip installing additional artifacts gathered if no"
+ , "local debugging is needed, but debug targets are nonetheless desired."
+ ]
}
, "config_doc":
{ "PREFIX":
@@ -768,6 +773,7 @@
]
, ["flat-libs", {"type": "FIELD", "name": "flat-libs"}]
, ["hdrs-only", {"type": "FIELD", "name": "hdrs-only"}]
+ , ["skip-debug-stage", {"type": "FIELD", "name": "skip-debug-stage"}]
]
, "body": {"type": "CALL_EXPRESSION", "name": "install result"}
}