From 0c83c812f8cc559c647e6a3c6f3beea71de3bb06 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 16 Nov 2022 17:04:26 +0100 Subject: support the concept of private deps i.e., libraries that are used only in the implementation without use in the public header files. In this way, the set of headers exposed to dependencies can be reduced leading potentially to better incrementality. --- rules/CC/EXPRESSIONS | 4 +++- rules/CC/RULES | 7 ++++++- rules/CC/proto/RULES | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/rules/CC/EXPRESSIONS b/rules/CC/EXPRESSIONS index fdef17f4..7871acef 100644 --- a/rules/CC/EXPRESSIONS +++ b/rules/CC/EXPRESSIONS @@ -486,7 +486,7 @@ , "expression": { "type": "let*" , "bindings": - [ ["deps-fieldnames", ["deps", "proto-deps"]] + [ ["deps-fieldnames", ["deps", "private-deps", "proto-deps"]] , ["compile-deps", {"type": "CALL_EXPRESSION", "name": "compile-deps"}] , ["link-deps", {"type": "CALL_EXPRESSION", "name": "link-deps"}] , ["lib", {"type": "CALL_EXPRESSION", "name": "lib artifact"}] @@ -502,6 +502,8 @@ } } ] + , ["deps-fieldnames", ["deps", "proto-deps"]] + , ["compile-deps", {"type": "CALL_EXPRESSION", "name": "compile-deps"}] ] , "body": { "type": "RESULT" diff --git a/rules/CC/RULES b/rules/CC/RULES index ac81da28..ab01a50f 100644 --- a/rules/CC/RULES +++ b/rules/CC/RULES @@ -170,7 +170,8 @@ } , "library": { "doc": ["A C++ libaray"] - , "target_fields": ["srcs", "hdrs", "private-hdrs", "deps", "proto"] + , "target_fields": + ["srcs", "hdrs", "private-hdrs", "deps", "private-deps", "proto"] , "string_fields": [ "name" , "stage" @@ -220,6 +221,10 @@ , "by this tool, typically system libraries)." ] , "deps": ["Any other libraries this library depends upon."] + , "private-deps": + [ "Any other libraries this library depends upon but does not include" + , "in its public headers." + ] , "proto": [ "Any [\"proto\", \"library\"] this target depends upon directly." , "The creation of C++ bindings for this proto library as well as of" diff --git a/rules/CC/proto/RULES b/rules/CC/proto/RULES index a4579e7e..d53ab35e 100644 --- a/rules/CC/proto/RULES +++ b/rules/CC/proto/RULES @@ -26,6 +26,7 @@ , "proto-deps": [["@", "protoc", "", "C++ runtime"]] , "well_known_protos": [["@", "protoc", "", "well_known_protos"]] , "pure C": [] + , "private-deps": [] } , "imports": { "protoc-compile": "protoc-compile" @@ -72,6 +73,7 @@ ] , "well_known_protos": [["@", "protoc", "", "well_known_protos"]] , "pure C": [] + , "private-deps": [] } , "imports": { "protoc-compile": "protoc-compile" -- cgit v1.2.3