diff options
50 files changed, 759 insertions, 546 deletions
diff --git a/bin/bootstrap.py b/bin/bootstrap.py index f07b66af..a8030e12 100755 --- a/bin/bootstrap.py +++ b/bin/bootstrap.py @@ -231,7 +231,7 @@ def config_to_local(*, repos_file, link_targets_file): link_external = ["-L%s" % (os.path.join(LOCALBASE, d),) for d in global_link_dirs] print("External link arguments %r" % (link_external,)) - main["link external"] = link_external + main["private-ldflags"] = link_external target[LOCAL_LINK_DIRS_TARGET] = main os.unlink(link_targets_file) with open(link_targets_file, "w") as f: diff --git a/doc/tutorial/hello-world.org b/doc/tutorial/hello-world.org index 46686fec..28503545 100644 --- a/doc/tutorial/hello-world.org +++ b/doc/tutorial/hello-world.org @@ -306,7 +306,7 @@ of the module ~"greet"~ in the top-level ~TARGETS~ file: { "type": ["@", "rules", "CC", "binary"] , "name": ["helloworld"] , "srcs": ["main.cpp"] - , "deps": [["greet", "greet"]] + , "private-deps": [["greet", "greet"]] } } #+END_SRC diff --git a/doc/tutorial/third-party-software.org b/doc/tutorial/third-party-software.org index 7bce1c48..6fdde256 100644 --- a/doc/tutorial/third-party-software.org +++ b/doc/tutorial/third-party-software.org @@ -456,7 +456,7 @@ ambient system. , "name": ["fmt"] , "stage": ["fmt"] , "hdrs": [["TREE", null, "."]] - , "link external": ["-lfmt"] + , "private-ldflags": ["-lfmt"] } } #+END_SRC diff --git a/etc/import.prebuilt/TARGETS.absl b/etc/import.prebuilt/TARGETS.absl index 986e6cb8..293ef7a8 100644 --- a/etc/import.prebuilt/TARGETS.absl +++ b/etc/import.prebuilt/TARGETS.absl @@ -1,7 +1,7 @@ { "absl": { "type": ["@", "rules", "CC", "library"] , "name": ["absl"] - , "link external": + , "private-ldflags": [ "-lbad_optional_access" , "-lstr_format_internal" , "-ltime" diff --git a/etc/import.prebuilt/TARGETS.boringssl b/etc/import.prebuilt/TARGETS.boringssl index 3e4e0b71..a58a406f 100644 --- a/etc/import.prebuilt/TARGETS.boringssl +++ b/etc/import.prebuilt/TARGETS.boringssl @@ -2,11 +2,11 @@ { "type": ["@", "rules", "CC", "library"] , "hdrs": [["TREE", null, "."]] , "stage": ["openssl"] - , "link external": ["-lcrypto"] + , "private-ldflags": ["-lcrypto"] } , "ssl": { "type": ["@", "rules", "CC", "library"] - , "link external": ["-lssl"] + , "private-ldflags": ["-lssl"] , "deps": ["crypto"] } } diff --git a/etc/import.prebuilt/TARGETS.fmt b/etc/import.prebuilt/TARGETS.fmt index 58c436e4..4c49c84b 100644 --- a/etc/import.prebuilt/TARGETS.fmt +++ b/etc/import.prebuilt/TARGETS.fmt @@ -3,6 +3,6 @@ , "name": ["fmt"] , "stage": ["fmt"] , "hdrs": [["TREE", null, "."]] - , "link external": ["-lfmt"] + , "private-ldflags": ["-lfmt"] } } diff --git a/etc/import.prebuilt/TARGETS.git2 b/etc/import.prebuilt/TARGETS.git2 index b4bf90e8..1578852d 100644 --- a/etc/import.prebuilt/TARGETS.git2 +++ b/etc/import.prebuilt/TARGETS.git2 @@ -1,7 +1,7 @@ { "git2": { "type": ["@", "rules", "CC", "library"] , "hdrs": ["git2.h", ["TREE", null, "git2"]] - , "link external": + , "private-ldflags": [ "-lgit2" , "-lgit2_os_unix" , "-lgit2_hash_openssl" diff --git a/etc/import.prebuilt/TARGETS.grpc b/etc/import.prebuilt/TARGETS.grpc index 0af9910a..0e5f5e81 100644 --- a/etc/import.prebuilt/TARGETS.grpc +++ b/etc/import.prebuilt/TARGETS.grpc @@ -1,7 +1,7 @@ { "grpc++": { "type": ["@", "rules", "CC", "library"] , "hdrs": [["include", "grpcpp"]] - , "link external": + , "private-ldflags": [ "-lgrpc++" , "-lgrpc++_base" , "-lgrpc" @@ -80,7 +80,7 @@ { "type": ["@", "rules", "CC", "library"] , "name": ["grpc++_codegen_proto"] , "hdrs": [["include", "grpcpp"], ["include", "grpc++"], ["include", "grpc"]] - , "link external": ["-lgrpc++_codegen_base_src"] + , "private-ldflags": ["-lgrpc++_codegen_base_src"] , "deps": ["grpc++"] } } diff --git a/etc/import.prebuilt/TARGETS.protobuf b/etc/import.prebuilt/TARGETS.protobuf index a31d4138..f375192d 100644 --- a/etc/import.prebuilt/TARGETS.protobuf +++ b/etc/import.prebuilt/TARGETS.protobuf @@ -4,7 +4,7 @@ { "type": ["@", "rules", "CC", "library"] , "name": ["protobuf"] , "hdrs": [["include", "protobuf"]] - , "link external": ["-lprotobuf", "-lprotobuf_lite"] + , "private-ldflags": ["-lprotobuf", "-lprotobuf_lite"] } , "well_known_protos": { "type": ["@", "rules", "data", "staged"] diff --git a/etc/import.prebuilt/TARGETS.zlib b/etc/import.prebuilt/TARGETS.zlib index 2bddbfbc..6f6d1049 100644 --- a/etc/import.prebuilt/TARGETS.zlib +++ b/etc/import.prebuilt/TARGETS.zlib @@ -1,6 +1,6 @@ { "zlib": { "type": ["@", "rules", "CC", "library"] , "name": ["zlib"] - , "link external": ["-lzlib"] + , "private-ldflags": ["-lzlib"] } } diff --git a/etc/import/TARGETS.cares b/etc/import/TARGETS.cares index 5edc6092..92ea5d48 100644 --- a/etc/import/TARGETS.cares +++ b/etc/import/TARGETS.cares @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC", "library"] , "name": ["ares"] , "pure C": ["YES"] - , "local defines": + , "private-defines": ["_GNU_SOURCE", "_HAS_EXCEPTIONS=0", "HAVE_CONFIG_H", "CARES_STATICLIB"] , "srcs": [ "ares__close_sockets.c" diff --git a/etc/import/TARGETS.catch2 b/etc/import/TARGETS.catch2 index 266386ed..44fdda10 100644 --- a/etc/import/TARGETS.catch2 +++ b/etc/import/TARGETS.catch2 @@ -1,7 +1,7 @@ { "catch2": { "type": ["@", "rules", "CC", "library"] , "hdrs": ["catch.hpp"] - , "link external": ["-lpthread"] + , "private-ldflags": ["-lpthread"] , "stage": ["catch2"] } } diff --git a/etc/import/TARGETS.grpc b/etc/import/TARGETS.grpc index b5870722..c5981b87 100644 --- a/etc/import/TARGETS.grpc +++ b/etc/import/TARGETS.grpc @@ -454,7 +454,7 @@ , "src/core/lib/transport/transport_impl.h" , "src/core/lib/uri/uri_parser.h" ] - , "link external": + , "private-ldflags": { "type": "case" , "expr": { "type": "var" @@ -666,7 +666,7 @@ { "type": ["@", "rules", "CC", "library"] , "arguments_config": ["COMPILER_FAMILY"] , "name": ["grpc_http_filters"] - , "local cflags": + , "private-cflags": { "type": "case" , "expr": {"type": "var", "name": "COMPILER_FAMILY", "default": "unknown"} , "case": {"gnu": ["-Wno-array-bounds"]} diff --git a/etc/import/TARGETS.re2 b/etc/import/TARGETS.re2 index ac486aa1..28bb1882 100644 --- a/etc/import/TARGETS.re2 +++ b/etc/import/TARGETS.re2 @@ -46,6 +46,6 @@ ] , "hdrs": ["re2/filtered_re2.h", "re2/re2.h", "re2/set.h", "re2/stringpiece.h"] - , "link external": ["-pthread"] + , "private-ldflags": ["-pthread"] } } diff --git a/etc/import/TARGETS.upb b/etc/import/TARGETS.upb index c7cd7119..3a111937 100644 --- a/etc/import/TARGETS.upb +++ b/etc/import/TARGETS.upb @@ -10,7 +10,7 @@ , "arguments_config": ["COMPILER_FAMILY"] , "name": ["upb"] , "pure C": ["YES"] - , "local cflags": + , "private-cflags": { "type": "case" , "expr": {"type": "var", "name": "COMPILER_FAMILY", "default": "unknown"} , "case": {"gnu": ["-Wno-int-to-pointer-cast", "-Wno-pointer-to-int-cast"]} diff --git a/etc/import/absl/base/TARGETS.absl b/etc/import/absl/base/TARGETS.absl index a87b05c8..a896ddce 100644 --- a/etc/import/absl/base/TARGETS.absl +++ b/etc/import/absl/base/TARGETS.absl @@ -30,7 +30,7 @@ { "type": ["@", "rules", "CC", "library"] , "name": ["dynamic_annotations"] , "stage": ["absl", "base"] - , "local defines": ["__CLANG_SUPPORT_DYN_ANNOTATION__"] + , "private-defines": ["__CLANG_SUPPORT_DYN_ANNOTATION__"] , "srcs": ["dynamic_annotations.cc"] , "hdrs": ["dynamic_annotations.h"] } diff --git a/etc/import/absl/time/internal/cctz/TARGETS.absl b/etc/import/absl/time/internal/cctz/TARGETS.absl index 418bf63f..d890bd0e 100644 --- a/etc/import/absl/time/internal/cctz/TARGETS.absl +++ b/etc/import/absl/time/internal/cctz/TARGETS.absl @@ -10,7 +10,7 @@ { "type": ["@", "rules", "CC", "library"] , "name": ["time_zone"] , "stage": ["absl", "time", "internal", "cctz"] - , "local cflags": + , "private-cflags": [ "-Wno-shadow" , "-Wno-unused-template" , "-Wno-tautological-type-limit-compare" diff --git a/etc/import/deps/http-parser/TARGETS.git2 b/etc/import/deps/http-parser/TARGETS.git2 index 62ecee4f..ad48f2c2 100644 --- a/etc/import/deps/http-parser/TARGETS.git2 +++ b/etc/import/deps/http-parser/TARGETS.git2 @@ -5,7 +5,7 @@ , "pure C": ["yes"] , "srcs": ["http_parser.c"] , "hdrs": ["http_parser.h"] - , "local cflags": + , "private-cflags": { "type": "case" , "expr": {"type": "var", "name": "COMPILER_FAMILY", "default": "unknown"} , "case": {"gnu": ["-Wimplicit-fallthrough=1"]} diff --git a/etc/import/deps/pcre/TARGETS.git2 b/etc/import/deps/pcre/TARGETS.git2 index 1f626dfc..f26925a9 100644 --- a/etc/import/deps/pcre/TARGETS.git2 +++ b/etc/import/deps/pcre/TARGETS.git2 @@ -121,7 +121,7 @@ , "arguments_config": ["OS"] , "name": ["git2_pcre"] , "pure C": ["yes"] - , "local defines": + , "private-defines": { "type": "++" , "$1": [ ["HAVE_CONFIG_H"] @@ -132,7 +132,7 @@ } ] } - , "local cflags": ["-Wno-unused-function", "-Wno-implicit-fallthrough"] + , "private-cflags": ["-Wno-unused-function", "-Wno-implicit-fallthrough"] , "srcs": [ "pcre_byte_order.c" , "pcre_chartables.c" diff --git a/etc/import/src/TARGETS.git2 b/etc/import/src/TARGETS.git2 index 5d983455..ef98f2ca 100644 --- a/etc/import/src/TARGETS.git2 +++ b/etc/import/src/TARGETS.git2 @@ -169,7 +169,7 @@ , "pure C": ["yes"] , "srcs": ["unix/map.c", "unix/realpath.c"] , "private-hdrs": ["git2_private_headers"] - , "link external": + , "private-ldflags": { "type": "++" , "$1": [ { "type": "if" @@ -207,7 +207,7 @@ , "win32/w32_util.c" ] , "private-hdrs": ["git2_private_headers"] - , "link external": ["-lws2_32"] + , "private-ldflags": ["-lws2_32"] } , "git2_os": { "type": ["@", "rules", "CC", "library"] @@ -224,7 +224,7 @@ { "type": ["@", "rules", "CC", "library"] , "name": ["git2_hash_collision_detection"] , "pure C": ["yes"] - , "local defines": + , "private-defines": [ "SHA1DC_NO_STANDARD_INCLUDES=1" , "SHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"" , "SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"" @@ -243,7 +243,7 @@ , "pure C": ["yes"] , "srcs": ["hash/sha1/openssl.c"] , "private-hdrs": ["git2_private_headers"] - , "link external": + , "private-ldflags": { "type": "if" , "cond": {"type": "var", "name": "USE_SYSTEM_LIBS"} , "then": ["-lssl"] @@ -262,7 +262,7 @@ , "pure C": ["yes"] , "srcs": ["hash/sha1/common_crypto.c"] , "private-hdrs": ["git2_private_headers"] - , "link external": + , "private-ldflags": { "type": "if" , "cond": {"type": "var", "name": "USE_SYSTEM_LIBS"} , "then": ["-lcommon_crypto"] @@ -281,7 +281,7 @@ , "pure C": ["yes"] , "srcs": ["hash/sha1/mbedtls.c"] , "private-hdrs": ["git2_private_headers"] - , "link external": + , "private-ldflags": { "type": "if" , "cond": {"type": "var", "name": "USE_SYSTEM_LIBS"} , "then": ["-lmbedtls"] @@ -329,7 +329,7 @@ { "type": ["@", "rules", "CC", "library"] , "arguments_config": ["USE_SYSTEM_LIBS", "REGEX_BACKEND"] , "name": ["git2_regex"] - , "link external": + , "private-ldflags": { "type": "if" , "cond": {"type": "var", "name": "USE_SYSTEM_LIBS"} , "then": @@ -365,7 +365,7 @@ { "type": ["@", "rules", "CC", "library"] , "arguments_config": ["USE_SYSTEM_LIBS", "USE_BUNDLED_ZLIB"] , "name": ["git2_compress"] - , "link external": + , "private-ldflags": { "type": "if" , "cond": {"type": "var", "name": "USE_BUNDLED_ZLIB"} , "then": [] @@ -392,7 +392,7 @@ { "type": ["@", "rules", "CC", "library"] , "arguments_config": ["USE_SYSTEM_LIBS", "USE_SSH"] , "name": ["git2_ssh"] - , "link external": + , "private-ldflags": { "type": "if" , "cond": {"type": "var", "name": "USE_SSH"} , "then": @@ -416,7 +416,7 @@ { "type": ["@", "rules", "CC", "library"] , "arguments_config": ["USE_SYSTEM_LIBS", "USE_HTTP_PARSER"] , "name": ["git2_http_parser"] - , "link external": + , "private-ldflags": { "type": "case*" , "expr": {"type": "var", "name": "USE_HTTP_PARSER"} , "case": @@ -447,7 +447,7 @@ { "type": ["@", "rules", "CC", "library"] , "arguments_config": ["OS", "USE_SYSTEM_LIBS", "USE_GSSAPI"] , "name": ["git2_gssapi"] - , "link external": + , "private-ldflags": { "type": "if" , "cond": {"type": "var", "name": "USE_SYSTEM_LIBS"} , "then": @@ -481,7 +481,7 @@ { "type": ["@", "rules", "CC", "library"] , "arguments_config": ["OS", "USE_SYSTEM_LIBS", "USE_HTTPS"] , "name": ["git2_http"] - , "link external": + , "private-ldflags": { "type": "case*" , "expr": {"type": "var", "name": "USE_HTTPS"} , "case": [["WinHTTP", ["-lwinhttp"]]] @@ -527,7 +527,7 @@ , "arguments_config": ["OS", "ARCH", "TARGET_ARCH"] , "name": ["git2"] , "pure C": ["yes"] - , "local defines": + , "private-defines": { "type": "case" , "expr": {"type": "var", "name": "OS"} , "case": @@ -537,7 +537,7 @@ , "windows": ["HAVE_QSORT_S"] } } - , "local cflags": + , "private-cflags": { "type": "case" , "expr": { "type": "var" diff --git a/etc/import/src/compiler/TARGETS.grpc b/etc/import/src/compiler/TARGETS.grpc index a6a21d9e..132c58e0 100644 --- a/etc/import/src/compiler/TARGETS.grpc +++ b/etc/import/src/compiler/TARGETS.grpc @@ -62,7 +62,7 @@ { "type": ["@", "rules", "CC", "binary"] , "name": ["grpc_cpp_plugin"] , "srcs": ["cpp_plugin.cc"] - , "deps": ["grpc_plugin_support"] - , "link external": ["-pthread"] + , "private-deps": ["grpc_plugin_support"] + , "private-ldflags": ["-pthread"] } } diff --git a/etc/import/src/google/protobuf/TARGETS.protobuf b/etc/import/src/google/protobuf/TARGETS.protobuf index 5b7a0a1c..81ab28ec 100644 --- a/etc/import/src/google/protobuf/TARGETS.protobuf +++ b/etc/import/src/google/protobuf/TARGETS.protobuf @@ -417,8 +417,8 @@ { "type": ["@", "rules", "CC", "binary"] , "name": ["protoc"] , "srcs": ["compiler/main.cc"] - , "deps": ["protoc_lib"] - , "link external": ["-pthread"] + , "private-deps": ["protoc_lib"] + , "private-ldflags": ["-pthread"] } , "well_known_proto_files": { "type": "install" diff --git a/rules/CC/EXPRESSIONS b/rules/CC/EXPRESSIONS index 7871acef..81ac1fd8 100644 --- a/rules/CC/EXPRESSIONS +++ b/rules/CC/EXPRESSIONS @@ -1,59 +1,98 @@ { "default-CC": - { "imports": {"list_provider": ["./", "..", "field_list_provider"]} + { "vars": ["defaults-transition"] + , "imports": {"list_provider": ["./", "..", "field_list_provider"]} , "expression": { "type": "join" , "$1": { "type": "let*" - , "bindings": [["fieldname", "defaults"], ["provider", "CC"]] + , "bindings": + [ ["fieldname", "defaults"] + , ["provider", "CC"] + , [ "transition" + , {"type": "var", "name": "defaults-transition", "default": null} + ] + ] , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} } } } , "default-CXX": - { "imports": {"list_provider": ["./", "..", "field_list_provider"]} + { "vars": ["defaults-transition"] + , "imports": {"list_provider": ["./", "..", "field_list_provider"]} , "expression": { "type": "join" , "$1": { "type": "let*" - , "bindings": [["fieldname", "defaults"], ["provider", "CXX"]] + , "bindings": + [ ["fieldname", "defaults"] + , ["provider", "CXX"] + , [ "transition" + , {"type": "var", "name": "defaults-transition", "default": null} + ] + ] , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} } } } , "default-AR": - { "imports": {"list_provider": ["./", "..", "field_list_provider"]} + { "vars": ["defaults-transition"] + , "imports": {"list_provider": ["./", "..", "field_list_provider"]} , "expression": { "type": "join" , "$1": { "type": "let*" - , "bindings": [["fieldname", "defaults"], ["provider", "AR"]] + , "bindings": + [ ["fieldname", "defaults"] + , ["provider", "AR"] + , [ "transition" + , {"type": "var", "name": "defaults-transition", "default": null} + ] + ] , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} } } } , "default-CFLAGS": - { "imports": {"list_provider": ["./", "..", "field_list_provider"]} + { "vars": ["defaults-transition"] + , "imports": {"list_provider": ["./", "..", "field_list_provider"]} , "expression": { "type": "let*" - , "bindings": [["fieldname", "defaults"], ["provider", "CFLAGS"]] + , "bindings": + [ ["fieldname", "defaults"] + , ["provider", "CFLAGS"] + , [ "transition" + , {"type": "var", "name": "defaults-transition", "default": null} + ] + ] , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} } } , "default-CXXFLAGS": - { "imports": {"list_provider": ["./", "..", "field_list_provider"]} + { "vars": ["defaults-transition"] + , "imports": {"list_provider": ["./", "..", "field_list_provider"]} , "expression": { "type": "let*" - , "bindings": [["fieldname", "defaults"], ["provider", "CXXFLAGS"]] + , "bindings": + [ ["fieldname", "defaults"] + , ["provider", "CXXFLAGS"] + , [ "transition" + , {"type": "var", "name": "defaults-transition", "default": null} + ] + ] , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} } } , "default-ENV": - { "imports": {"provider_list": ["./", "..", "field_provider_list"]} + { "vars": ["defaults-transition"] + , "imports": {"provider_list": ["./", "..", "field_provider_list"]} , "expression": { "type": "let*" , "bindings": [ ["fieldname", "defaults"] , ["provider", "ENV"] + , [ "transition" + , {"type": "var", "name": "defaults-transition", "default": null} + ] , ["default", {"type": "empty_map"}] ] , "body": {"type": "CALL_EXPRESSION", "name": "provider_list"} @@ -84,11 +123,12 @@ } , "compile-deps": { "doc": ["Collect compile dependencies (headers) from given target_fields"] - , "vars": ["deps-fieldnames", "transition"] + , "vars": ["deps-fieldnames", "deps-transition"] , "vars_doc": { "deps-fieldnames": ["List of target_field names to collect dependencies from."] - , "transition": ["The optional configuration transition for the targets."] + , "deps-transition": + ["The optional configuration transition for the targets."] } , "imports": { "runfiles_list": ["./", "..", "field_runfiles_list"] @@ -108,6 +148,7 @@ { "type": "let*" , "bindings": [ ["provider", "compile-deps"] + , ["transition", {"type": "var", "name": "deps-transition"}] , ["default", {"type": "empty_map"}] ] , "body": @@ -120,13 +161,41 @@ } } } +, "compile-args-deps": + { "doc": ["Collect compile arguments from given target_fields"] + , "vars": ["deps-fieldnames", "deps-transition"] + , "vars_doc": + { "deps-fieldnames": + ["List of target_field names to collect arguments from."] + , "deps-transition": + ["The optional configuration transition for the targets."] + } + , "imports": {"list_provider": ["./", "..", "field_list_provider"]} + , "expression": + { "type": "++" + , "$1": + { "type": "foreach" + , "var": "fieldname" + , "range": {"type": "var", "name": "deps-fieldnames"} + , "body": + { "type": "let*" + , "bindings": + [ ["provider", "compile-args"] + , ["transition", {"type": "var", "name": "deps-transition"}] + ] + , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} + } + } + } + } , "link-deps": { "doc": ["Collect link dependencies (libraries) from given target_fields"] - , "vars": ["deps-fieldnames", "transition"] + , "vars": ["deps-fieldnames", "deps-transition"] , "vars_doc": { "deps-fieldnames": ["List of target_field names to collect dependencies from."] - , "transition": ["The optional configuration transition for the targets."] + , "deps-transition": + ["The optional configuration transition for the targets."] } , "imports": { "artifacts_list": ["./", "..", "field_artifacts_list"] @@ -145,7 +214,10 @@ , "$1": { "type": "let*" , "bindings": - [["provider", "link-deps"], ["default", {"type": "empty_map"}]] + [ ["provider", "link-deps"] + , ["default", {"type": "empty_map"}] + , ["transition", {"type": "var", "name": "deps-transition"}] + ] , "body": [ {"type": "CALL_EXPRESSION", "name": "provider_list"} , {"type": "CALL_EXPRESSION", "name": "artifacts_list"} @@ -158,11 +230,12 @@ } , "link-args-deps": { "doc": ["Collect linker arguments from given target_fields"] - , "vars": ["deps-fieldnames", "transition"] + , "vars": ["deps-fieldnames", "deps-transition"] , "vars_doc": { "deps-fieldnames": ["List of target_field names to collect arguments from."] - , "transition": ["The optional configuration transition for the targets."] + , "deps-transition": + ["The optional configuration transition for the targets."] } , "imports": {"list_provider": ["./", "..", "field_list_provider"]} , "expression": @@ -173,14 +246,25 @@ , "range": {"type": "var", "name": "deps-fieldnames"} , "body": { "type": "let*" - , "bindings": [["provider", "link-args"]] + , "bindings": + [ ["provider", "link-args"] + , ["transition", {"type": "var", "name": "deps-transition"}] + ] , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} } } } } , "objects": - { "vars": ["CXX", "CXXFLAGS", "ENV", "srcs", "compile-deps", "local hdrs"] + { "vars": + [ "COMPILER" + , "COMPILE_FLAGS" + , "ENV" + , "srcs" + , "hdrs" + , "private-hdrs" + , "compile-deps" + ] , "expression": { "type": "let*" , "bindings": @@ -197,7 +281,13 @@ [ {"type": "var", "name": "include tree"} , { "type": "to_subdir" , "subdir": "work" - , "$1": {"type": "var", "name": "local hdrs"} + , "$1": + { "type": "disjoint_map_union" + , "$1": + [ {"type": "var", "name": "hdrs"} + , {"type": "var", "name": "private-hdrs"} + ] + } } ] } @@ -254,8 +344,8 @@ , "cmd": { "type": "++" , "$1": - [ [{"type": "var", "name": "CXX"}] - , {"type": "var", "name": "CXXFLAGS"} + [ [{"type": "var", "name": "COMPILER"}] + , {"type": "var", "name": "COMPILE_FLAGS"} , ["-I", "work", "-isystem", "include"] , ["-c", {"type": "var", "name": "work src_name"}] , ["-o", {"type": "var", "name": "work out"}] @@ -284,70 +374,98 @@ } } } +, "compiler-cc": + { "vars": ["CC", "defaults-transition"] + , "imports": {"default-CC": "default-CC"} + , "expression": + { "type": "var" + , "name": "CC" + , "default": {"type": "CALL_EXPRESSION", "name": "default-CC"} + } + } +, "compiler-cxx": + { "vars": ["CXX", "defaults-transition"] + , "imports": {"default-CXX": "default-CXX"} + , "expression": + { "type": "var" + , "name": "CXX" + , "default": {"type": "CALL_EXPRESSION", "name": "default-CXX"} + } + } , "compiler": - { "vars": ["CC", "CXX"] - , "imports": {"default-CC": "default-CC", "default-CXX": "default-CXX"} + { "vars": ["CC", "CXX", "pure C", "defaults-transition"] + , "imports": {"compiler-cc": "compiler-cc", "compiler-cxx": "compiler-cxx"} , "expression": { "type": "if" - , "cond": {"type": "FIELD", "name": "pure C"} - , "then": - { "type": "var" - , "name": "CC" - , "default": {"type": "CALL_EXPRESSION", "name": "default-CC"} - } - , "else": - { "type": "var" - , "name": "CXX" - , "default": {"type": "CALL_EXPRESSION", "name": "default-CXX"} - } + , "cond": {"type": "var", "name": "pure C"} + , "then": {"type": "CALL_EXPRESSION", "name": "compiler-cc"} + , "else": {"type": "CALL_EXPRESSION", "name": "compiler-cxx"} } } -, "flags": - { "vars": ["CFLAGS", "CXXFLAGS", "ADD_CFLAGS", "ADD_CXXFLAGS"] - , "imports": - { "default-CFLAGS": "default-CFLAGS" - , "default-CXXFLAGS": "default-CXXFLAGS" +, "flags-cc": + { "vars": ["CFLAGS", "ADD_CFLAGS", "defaults-transition"] + , "imports": {"default-CFLAGS": "default-CFLAGS"} + , "expression": + { "type": "++" + , "$1": + [ { "type": "var" + , "name": "CFLAGS" + , "default": {"type": "CALL_EXPRESSION", "name": "default-CFLAGS"} + } + , {"type": "var", "name": "ADD_CFLAGS", "default": []} + ] } + } +, "flags-cxx": + { "vars": ["CXXFLAGS", "ADD_CXXFLAGS", "defaults-transition"] + , "imports": {"default-CXXFLAGS": "default-CXXFLAGS"} , "expression": - { "type": "if" - , "cond": {"type": "FIELD", "name": "pure C"} - , "then": - { "type": "++" - , "$1": - [ { "type": "var" - , "name": "CFLAGS" - , "default": {"type": "CALL_EXPRESSION", "name": "default-CFLAGS"} - } - , {"type": "var", "name": "ADD_CFLAGS", "default": []} - ] - } - , "else": - { "type": "++" - , "$1": - [ { "type": "var" - , "name": "CXXFLAGS" - , "default": {"type": "CALL_EXPRESSION", "name": "default-CXXFLAGS"} - } - , {"type": "var", "name": "ADD_CXXFLAGS", "default": []} - ] - } + { "type": "++" + , "$1": + [ { "type": "var" + , "name": "CXXFLAGS" + , "default": {"type": "CALL_EXPRESSION", "name": "default-CXXFLAGS"} + } + , {"type": "var", "name": "ADD_CXXFLAGS", "default": []} + ] } } -, "lib artifact": +, "flags": { "vars": - [ "CXX" + [ "CFLAGS" , "CXXFLAGS" + , "ADD_CFLAGS" , "ADD_CXXFLAGS" - , "CC" + , "pure C" + , "defaults-transition" + ] + , "imports": {"flags-cc": "flags-cc", "flags-cxx": "flags-cxx"} + , "expression": + { "type": "if" + , "cond": {"type": "var", "name": "pure C"} + , "then": {"type": "CALL_EXPRESSION", "name": "flags-cc"} + , "else": {"type": "CALL_EXPRESSION", "name": "flags-cxx"} + } + } +, "lib artifact": + { "vars": + [ "CC" + , "CXX" , "CFLAGS" + , "CXXFLAGS" , "ADD_CFLAGS" - , "ENV" + , "ADD_CXXFLAGS" , "AR" + , "ENV" + , "name" + , "pure C" , "srcs" , "hdrs" , "private-hdrs" - , "local cflags" + , "stage" , "compile-deps" + , "compile-args" + , "defaults-transition" ] , "imports": { "compiler": "compiler" @@ -359,28 +477,21 @@ , "expression": { "type": "let*" , "bindings": - [ [ "stage" - , { "type": "join" - , "separator": "/" - , "$1": {"type": "FIELD", "name": "stage"} + [ ["COMPILER", {"type": "CALL_EXPRESSION", "name": "compiler"}] + , [ "COMPILE_FLAGS" + , { "type": "++" + , "$1": + [ {"type": "CALL_EXPRESSION", "name": "flags"} + , {"type": "var", "name": "compile-args"} + ] } ] - , ["CXX", {"type": "CALL_EXPRESSION", "name": "compiler"}] - , ["CXXFLAGS", {"type": "CALL_EXPRESSION", "name": "flags"}] , [ "AR" , { "type": "var" , "name": "AR" , "default": {"type": "CALL_EXPRESSION", "name": "default-AR"} } ] - , [ "CXXFLAGS" - , { "type": "++" - , "$1": - [ {"type": "var", "name": "CXXFLAGS"} - , {"type": "var", "name": "local cflags", "default": []} - ] - } - ] , [ "ENV" , { "type": "map_union" , "$1": @@ -396,32 +507,16 @@ } } ] - , [ "local hdrs" - , { "type": "disjoint_map_union" - , "$1": - [ {"type": "var", "name": "hdrs"} - , {"type": "var", "name": "private-hdrs"} - ] - } - ] , ["objects", {"type": "CALL_EXPRESSION", "name": "objects"}] , [ "base name" - , { "type": "let*" - , "bindings": - [ [ "name" - , {"type": "join", "$1": {"type": "FIELD", "name": "name"}} - ] - ] - , "body": - { "type": "if" - , "cond": {"type": "var", "name": "objects"} - , "then": - { "type": "assert_non_empty" - , "msg": "A name has to be provided for non-header-only libraries" - , "$1": {"type": "var", "name": "name"} - } - , "else": {"type": "var", "name": "name"} + , { "type": "if" + , "cond": {"type": "var", "name": "objects"} + , "then": + { "type": "assert_non_empty" + , "msg": "A name has to be provided for non-header-only libraries" + , "$1": {"type": "var", "name": "name"} } + , "else": {"type": "var", "name": "name"} } ] , [ "libname" @@ -462,23 +557,30 @@ } , "lib result": { "vars": - [ "CXX" - , "CXXFLAGS" - , "ADD_CXXFLAGS" - , "CC" + [ "CC" + , "CXX" , "CFLAGS" + , "CXXFLAGS" , "ADD_CFLAGS" - , "ENV" + , "ADD_CXXFLAGS" , "AR" + , "ENV" + , "name" + , "pure C" , "srcs" , "hdrs" , "private-hdrs" - , "local cflags" - , "link external" + , "cflags" + , "private-cflags" + , "private-ldflags" + , "stage" , "extra-provides" + , "public-fieldnames" + , "private-fieldnames" ] , "imports": { "compile-deps": "compile-deps" + , "compile-args-deps": "compile-args-deps" , "link-deps": "link-deps" , "link-args-deps": "link-args-deps" , "lib artifact": "lib artifact" @@ -486,8 +588,20 @@ , "expression": { "type": "let*" , "bindings": - [ ["deps-fieldnames", ["deps", "private-deps", "proto-deps"]] + [ ["deps-fieldnames", {"type": "var", "name": "private-fieldnames"}] , ["compile-deps", {"type": "CALL_EXPRESSION", "name": "compile-deps"}] + , [ "compile-args" + , { "type": "nub_right" + , "$1": + { "type": "++" + , "$1": + [ {"type": "var", "name": "cflags"} + , {"type": "var", "name": "private-cflags"} + , {"type": "CALL_EXPRESSION", "name": "compile-args-deps"} + ] + } + } + ] , ["link-deps", {"type": "CALL_EXPRESSION", "name": "link-deps"}] , ["lib", {"type": "CALL_EXPRESSION", "name": "lib artifact"}] , [ "link-args" @@ -496,14 +610,25 @@ { "type": "++" , "$1": [ {"type": "keys", "$1": {"type": "var", "name": "lib"}} - , {"type": "var", "name": "link external", "default": []} + , {"type": "var", "name": "private-ldflags", "default": []} , {"type": "CALL_EXPRESSION", "name": "link-args-deps"} ] } } ] - , ["deps-fieldnames", ["deps", "proto-deps"]] + , ["deps-fieldnames", {"type": "var", "name": "public-fieldnames"}] , ["compile-deps", {"type": "CALL_EXPRESSION", "name": "compile-deps"}] + , [ "compile-args" + , { "type": "nub_right" + , "$1": + { "type": "++" + , "$1": + [ {"type": "var", "name": "cflags"} + , {"type": "CALL_EXPRESSION", "name": "compile-args-deps"} + ] + } + } + ] ] , "body": { "type": "RESULT" @@ -512,7 +637,10 @@ , "provides": { "type": "map_union" , "$1": - [ {"type": "env", "vars": ["compile-deps", "link-deps", "link-args"]} + [ { "type": "env" + , "vars": + ["compile-deps", "compile-args", "link-deps", "link-args"] + } , { "type": "var" , "name": "extra-provides" , "default": {"type": "empty_map"} @@ -522,4 +650,171 @@ } } } +, "bin artifact": + { "doc": ["Produces the binary artifact."] + , "vars": + [ "CC" + , "CXX" + , "CFLAGS" + , "CXXFLAGS" + , "ADD_CFLAGS" + , "ADD_CXXFLAGS" + , "ENV" + , "name" + , "pure C" + , "srcs" + , "private-hdrs" + , "stage" + , "compile-deps" + , "compile-args" + , "link-deps" + , "link-args" + , "defaults-transition" + ] + , "imports": + { "compiler": "compiler" + , "flags": "flags" + , "objects": "objects" + , "default-ENV": "default-ENV" + } + , "expression": + { "type": "let*" + , "bindings": + [ ["COMPILER", {"type": "CALL_EXPRESSION", "name": "compiler"}] + , [ "COMPILE_FLAGS" + , { "type": "++" + , "$1": + [ {"type": "CALL_EXPRESSION", "name": "flags"} + , {"type": "var", "name": "compile-args"} + ] + } + ] + , [ "ENV" + , { "type": "map_union" + , "$1": + { "type": "++" + , "$1": + [ {"type": "CALL_EXPRESSION", "name": "default-ENV"} + , [ { "type": "var" + , "name": "ENV" + , "default": {"type": "empty_map"} + } + ] + ] + } + } + ] + , ["hdrs", {"type": "empty_map"}] + , ["objects", {"type": "CALL_EXPRESSION", "name": "objects"}] + , [ "link-args" + , { "type": "nub_right" + , "$1": + { "type": "++" + , "$1": + [ {"type": "keys", "$1": {"type": "var", "name": "objects"}} + , {"type": "var", "name": "link-args"} + ] + } + } + ] + , [ "binpath" + , { "type": "if" + , "cond": {"type": "var", "name": "stage"} + , "then": + { "type": "join" + , "separator": "/" + , "$1": + [ {"type": "var", "name": "stage"} + , {"type": "var", "name": "name"} + ] + } + , "else": {"type": "var", "name": "name"} + } + ] + , [ "binary" + , { "type": "ACTION" + , "outs": [{"type": "var", "name": "binpath"}] + , "inputs": + { "type": "disjoint_map_union" + , "$1": + [ {"type": "var", "name": "objects"} + , {"type": "var", "name": "link-deps"} + ] + } + , "cmd": + { "type": "++" + , "$1": + [ [ {"type": "var", "name": "COMPILER"} + , "-o" + , {"type": "var", "name": "binpath"} + ] + , {"type": "var", "name": "COMPILE_FLAGS"} + , {"type": "var", "name": "link-args"} + ] + } + , "env": {"type": "var", "name": "ENV"} + } + ] + ] + , "body": {"type": "var", "name": "binary"} + } + } +, "bin result": + { "doc": ["Produces the binary target result."] + , "vars": + [ "CC" + , "CXX" + , "CFLAGS" + , "CXXFLAGS" + , "ADD_CFLAGS" + , "ADD_CXXFLAGS" + , "ENV" + , "name" + , "pure C" + , "srcs" + , "private-hdrs" + , "private-cflags" + , "private-ldflags" + , "stage" + , "private-fieldnames" + ] + , "imports": + { "compile-deps": "compile-deps" + , "compile-args-deps": "compile-args-deps" + , "link-deps": "link-deps" + , "link-args-deps": "link-args-deps" + , "binary": "bin artifact" + } + , "expression": + { "type": "let*" + , "bindings": + [ ["deps-fieldnames", {"type": "var", "name": "private-fieldnames"}] + , ["compile-deps", {"type": "CALL_EXPRESSION", "name": "compile-deps"}] + , [ "compile-args" + , { "type": "++" + , "$1": + [ {"type": "CALL_EXPRESSION", "name": "compile-args-deps"} + , {"type": "var", "name": "private-cflags"} + ] + } + ] + , ["link-deps", {"type": "CALL_EXPRESSION", "name": "link-deps"}] + , [ "link-args" + , { "type": "nub_right" + , "$1": + { "type": "++" + , "$1": + [ {"type": "CALL_EXPRESSION", "name": "link-args-deps"} + , {"type": "var", "name": "private-ldflags"} + ] + } + } + ] + ] + , "body": + { "type": "RESULT" + , "artifacts": {"type": "CALL_EXPRESSION", "name": "binary"} + } + } + } } diff --git a/rules/CC/RULES b/rules/CC/RULES index 9e599e19..9b041dd4 100644 --- a/rules/CC/RULES +++ b/rules/CC/RULES @@ -1,7 +1,7 @@ { "defaults": { "doc": [ "A rule to provide defaults." - , "All CC targets take their defaults for CXX, CC, flags, etc from" + , "All CC targets take their defaults for CC, CXX, flags, etc from" , "the target [\"CC\", \"defaults\"]. This is probably the only sensibe" , "use of this rule. As targets form a different root, the defaults" , "can be provided without changing this directory." @@ -14,8 +14,8 @@ , "CXXFLAGS" , "ADD_CFLAGS" , "ADD_CXXFLAGS" - , "PATH" , "AR" + , "PATH" ] , "imports": {"base-provides": "defaults-base-provides"} , "expression": @@ -110,26 +110,28 @@ } } , "library": - { "doc": ["A C++ libaray"] + { "doc": ["A C++ library"] , "target_fields": ["srcs", "hdrs", "private-hdrs", "deps", "private-deps", "proto"] , "string_fields": [ "name" , "stage" , "pure C" - , "local defines" - , "local cflags" - , "link external" + , "defines" + , "private-defines" + , "cflags" + , "private-cflags" + , "private-ldflags" ] , "config_vars": - [ "CXX" - , "CC" - , "CXXFLAGS" + [ "CC" + , "CXX" , "CFLAGS" - , "ADD_CXXFLAGS" + , "CXXFLAGS" , "ADD_CFLAGS" - , "ENV" + , "ADD_CXXFLAGS" , "AR" + , "ENV" ] , "implicit": {"defaults": ["defaults"]} , "field_doc": @@ -151,13 +153,19 @@ , "In particular, CC is used to compile rather than CXX (or their" , "respective defaults)." ] - , "local defines": + , "defines": + [ "List of defines set for this target and its consumers." + , "Each list entry will be prepended by \"-D\"." + ] + , "private-defines": [ "List of defines set for source files local to this target." , "Each list entry will be prepended by \"-D\"." ] - , "local cflags": + , "cflags": + ["List of compile flags set for this target and its consumers."] + , "private-cflags": ["List of compile flags set for source files local to this target."] - , "link external": + , "private-ldflags": [ "Additional linker flags for linking external libraries (not built" , "by this tool, typically system libraries)." ] @@ -175,30 +183,31 @@ ] } , "config_doc": - { "CXX": - [ "The name of the C++ compiler to be used." - , "If None, the respective value from [\"CC\", \"defaults\"] will be taken." - ] - , "CC": + { "CC": [ "The name of the C compiler to be used (when compiling pure C code)." , "If None, the respective value from [\"CC\", \"defaults\"] will be taken." ] - , "AR": - [ "The archive tool to used for creating the library" + , "CXX": + [ "The name of the C++ compiler to be used." , "If None, the respective value from [\"CC\", \"defaults\"] will be taken." ] - , "ENV": ["The environment for any action generated."] + , "CFLAGS": + [ "The flags for CC to be used instead of the default ones." + , "For libraries that should be built in a non-standard way; usually" + , "adapting the default target [\"CC\", \"defaults\"] is the better" + , "choice." + ] , "CXXFLAGS": [ "The flags for CXX to be used instead of the default ones." , "For libraries that should be built in a non-standard way; usually" , "adapting the default target [\"CC\", \"defaults\"] is the better" , "choice." ] - , "CFLAGS": - [ "The flags for CC to be used instead of the default ones." + , "ADD_CFLAGS": + [ "The flags to add to the default ones for CC." , "For libraries that should be built in a non-standard way; usually" , "adapting the default target [\"CC\", \"defaults\"] is the better" - , "choice" + , "choice." ] , "ADD_CXXFLAGS": [ "The flags to add to the default ones for CXX." @@ -206,12 +215,11 @@ , "adapting the default target [\"CC\", \"defaults\"] is the better" , "choice." ] - , "ADD_CFLAGS": - [ "The flags to add to the default ones for CC." - , "For libraries that should be built in a non-standard way; usually" - , "adapting the default target [\"CC\", \"defaults\"] is the better" - , "choice." + , "AR": + [ "The archive tool to used for creating the library" + , "If None, the respective value from [\"CC\", \"defaults\"] will be taken." ] + , "ENV": ["The environment for any action generated."] } , "artifacts_doc": ["The actual library (libname.a) staged in the specified directory"] @@ -241,44 +249,35 @@ } } , "imports": - { "artifacts": ["./", "..", "field_artifacts"] - , "default-CXXFLAGS": "default-CXXFLAGS" - , "default-CFLAGS": "default-CFLAGS" - , "result": "lib result" - } + {"artifacts": ["./", "..", "field_artifacts"], "result": "lib result"} , "expression": { "type": "let*" , "bindings": - [ [ "local defines" - , { "type": "foreach" - , "var": "def" - , "range": {"type": "FIELD", "name": "local defines"} - , "body": - {"type": "join", "$1": ["-D", {"type": "var", "name": "def"}]} - } - ] - , ["local cflags", {"type": "FIELD", "name": "local cflags"}] - , [ "CFLAGS" + [ ["name", {"type": "join", "$1": {"type": "FIELD", "name": "name"}}] + , ["pure C", {"type": "FIELD", "name": "pure C"}] + , [ "cflags" , { "type": "++" , "$1": - [ { "type": "var" - , "name": "CFLAGS" - , "default": - {"type": "CALL_EXPRESSION", "name": "default-CFLAGS"} + [ {"type": "FIELD", "name": "cflags"} + , { "type": "foreach" + , "var": "def" + , "range": {"type": "FIELD", "name": "defines"} + , "body": + {"type": "join", "$1": ["-D", {"type": "var", "name": "def"}]} } - , {"type": "var", "name": "local defines"} ] } ] - , [ "CXXFLAGS" + , [ "private-cflags" , { "type": "++" , "$1": - [ { "type": "var" - , "name": "CXXFLAGS" - , "default": - {"type": "CALL_EXPRESSION", "name": "default-CXXFLAGS"} + [ { "type": "foreach" + , "var": "def" + , "range": {"type": "FIELD", "name": "private-defines"} + , "body": + {"type": "join", "$1": ["-D", {"type": "var", "name": "def"}]} } - , {"type": "var", "name": "local defines"} + , {"type": "FIELD", "name": "private-cflags"} ] } ] @@ -318,18 +317,26 @@ } } ] - , ["link external", {"type": "FIELD", "name": "link external"}] + , ["private-ldflags", {"type": "FIELD", "name": "private-ldflags"}] + , ["public-fieldnames", ["deps", "proto-deps"]] + , ["private-fieldnames", ["deps", "private-deps", "proto-deps"]] ] , "body": {"type": "CALL_EXPRESSION", "name": "result"} } } , "binary": { "doc": ["A binary written in C++"] - , "target_fields": ["srcs", "private-hdrs", "deps", "proto"] + , "target_fields": ["srcs", "private-hdrs", "private-deps", "private-proto"] , "string_fields": - ["name", "stage", "pure C", "local defines", "link external"] + [ "name" + , "stage" + , "pure C" + , "private-defines" + , "private-cflags" + , "private-ldflags" + ] , "config_vars": - ["CXX", "CC", "CXXFLAGS", "CFLAGS", "ADD_CXXFLAGS", "ADD_CFLAGS", "ENV"] + ["CC", "CXX", "CFLAGS", "CXXFLAGS", "ADD_CFLAGS", "ADD_CXXFLAGS", "ENV"] , "implicit": {"defaults": ["defaults"]} , "field_doc": { "name": ["The name of the binary"] @@ -347,14 +354,16 @@ [ "If non-empty, compile as C sources rathter than C++ sources." , "In particular, CC is used to compile rather than CXX" ] - , "local defines": + , "private-defines": [ "List of defines set for source files local to this target." , "Each list entry will be prepended by \"-D\"." ] - , "link external": + , "private-cflags": + ["List of compile flags set for source files local to this target."] + , "private-ldflags": ["Additional linker flags for linking external libraries."] - , "deps": ["Any other libraries this binary depends upon."] - , "proto": + , "private-deps": ["Any other libraries this binary depends upon."] + , "private-proto": [ "Any [\"proto\", \"library\"] this target depends upon directly." , "The creation of C++ bindings for this proto library as well as of" , "is dependencies will be taken care of (as anonymous targets, so no" @@ -363,32 +372,32 @@ ] } , "config_doc": - { "CXX": ["The name of the C++ compiler to be used."] - , "CC": + { "CC": ["The name of the C compiler to be used (when compiling pure C code)"] - , "ENV": ["The environment for any action generated."] - , "CXXFLAGS": - [ "The flags for CXX to be used instead of the default ones" - , "taken from the [\"CC\", \"defaults\"] target" - ] + , "CXX": ["The name of the C++ compiler to be used."] , "CFLAGS": [ "The flags for CXX to be used instead of the default ones" , "taken from the [\"CC\", \"defaults\"] target" ] - , "ADD_CXXFLAGS": - [ "The flags to add to the default ones for CXX" + , "CXXFLAGS": + [ "The flags for CXX to be used instead of the default ones" , "taken from the [\"CC\", \"defaults\"] target" ] , "ADD_CFLAGS": [ "The flags to add to the default ones for CC" , "taken from the [\"CC\", \"defaults\"] target" ] + , "ADD_CXXFLAGS": + [ "The flags to add to the default ones for CXX" + , "taken from the [\"CC\", \"defaults\"] target" + ] + , "ENV": ["The environment for any action generated."] } , "artifacts_doc": ["The final binary, staged to the given directory"] , "runfiles_doc": ["None"] , "anonymous": - { "proto-deps": - { "target": "proto" + { "private-proto-deps": + { "target": "private-proto" , "provider": "proto" , "rule_map": { "library": ["./", "proto", "library"] @@ -397,26 +406,17 @@ } } , "imports": - { "artifacts": ["./", "..", "field_artifacts"] - , "compile-deps": "compile-deps" - , "link-deps": "link-deps" - , "link-args-deps": "link-args-deps" - , "objects": "objects" - , "compiler": "compiler" - , "flags": "flags" - , "default-ENV": "default-ENV" - } + {"artifacts": ["./", "..", "field_artifacts"], "bin result": "bin result"} , "expression": { "type": "let*" , "bindings": - [ [ "local defines" - , { "type": "foreach" - , "var": "def" - , "range": {"type": "FIELD", "name": "local defines"} - , "body": - {"type": "join", "$1": ["-D", {"type": "var", "name": "def"}]} + [ [ "name" + , { "type": "assert_non_empty" + , "msg": "A non-empty name has to be provided for binaries" + , "$1": {"type": "join", "$1": {"type": "FIELD", "name": "name"}} } ] + , ["pure C", {"type": "FIELD", "name": "pure C"}] , [ "stage" , { "type": "join" , "separator": "/" @@ -433,7 +433,7 @@ } } ] - , [ "local hdrs" + , [ "private-hdrs" , { "type": "to_subdir" , "subdir": {"type": "var", "name": "stage"} , "$1": @@ -443,94 +443,23 @@ } } ] - , ["CXX", {"type": "CALL_EXPRESSION", "name": "compiler"}] - , ["CXXFLAGS", {"type": "CALL_EXPRESSION", "name": "flags"}] - , [ "CXXFLAGS" + , [ "private-cflags" , { "type": "++" , "$1": - [ {"type": "var", "name": "CXXFLAGS"} - , {"type": "var", "name": "local defines"} + [ { "type": "foreach" + , "var": "def" + , "range": {"type": "FIELD", "name": "private-defines"} + , "body": + {"type": "join", "$1": ["-D", {"type": "var", "name": "def"}]} + } + , {"type": "FIELD", "name": "private-cflags"} ] } ] - , [ "ENV" - , { "type": "map_union" - , "$1": - { "type": "++" - , "$1": - [ {"type": "CALL_EXPRESSION", "name": "default-ENV"} - , [ { "type": "var" - , "name": "ENV" - , "default": {"type": "empty_map"} - } - ] - ] - } - } - ] - , ["deps-fieldnames", ["deps", "proto-deps"]] - , ["compile-deps", {"type": "CALL_EXPRESSION", "name": "compile-deps"}] - , ["link-deps", {"type": "CALL_EXPRESSION", "name": "link-deps"}] - , ["objects", {"type": "CALL_EXPRESSION", "name": "objects"}] - , [ "base name" - , { "type": "assert_non_empty" - , "msg": "A non-empty name has to be provided for binaries" - , "$1": {"type": "join", "$1": {"type": "FIELD", "name": "name"}} - } - ] - , [ "binary name" - , { "type": "if" - , "cond": {"type": "var", "name": "stage"} - , "else": {"type": "var", "name": "base name"} - , "then": - { "type": "join" - , "separator": "/" - , "$1": - [ {"type": "var", "name": "stage"} - , {"type": "var", "name": "base name"} - ] - } - } - ] - , [ "link-args" - , { "type": "nub_right" - , "$1": - { "type": "++" - , "$1": - [ {"type": "keys", "$1": {"type": "var", "name": "objects"}} - , {"type": "CALL_EXPRESSION", "name": "link-args-deps"} - , {"type": "FIELD", "name": "link external"} - ] - } - } - ] - , [ "binary" - , { "type": "ACTION" - , "outs": [{"type": "var", "name": "binary name"}] - , "inputs": - { "type": "disjoint_map_union" - , "$1": - [ {"type": "var", "name": "objects"} - , {"type": "var", "name": "link-deps"} - ] - } - , "cmd": - { "type": "++" - , "$1": - [ [ {"type": "var", "name": "CXX"} - , "-o" - , {"type": "var", "name": "binary name"} - ] - , {"type": "var", "name": "CXXFLAGS"} - , {"type": "var", "name": "link-args"} - ] - } - , "env": {"type": "var", "name": "ENV"} - } - ] + , ["private-ldflags", {"type": "FIELD", "name": "private-ldflags"}] + , ["private-fieldnames", ["private-deps", "private-proto-deps"]] ] - , "body": - {"type": "RESULT", "artifacts": {"type": "var", "name": "binary"}} + , "body": {"type": "CALL_EXPRESSION", "name": "bin result"} } } } diff --git a/rules/CC/auto/RULES b/rules/CC/auto/RULES index ab1e689f..24296344 100644 --- a/rules/CC/auto/RULES +++ b/rules/CC/auto/RULES @@ -24,12 +24,12 @@ ] } , "config_doc": - { "CXX": - [ "The name of the C++ compiler to be used by checks. If None, the" + { "CC": + [ "The name of the C compiler to be used by checks. If None, the" , "respective value from [\"CC\", \"defaults\"] will be taken." ] - , "CC": - [ "The name of the C compiler to be used by checks. If None, the" + , "CXX": + [ "The name of the C++ compiler to be used by checks. If None, the" , "respective value from [\"CC\", \"defaults\"] will be taken." ] , "CFLAGS": diff --git a/rules/CC/proto/EXPRESSIONS b/rules/CC/proto/EXPRESSIONS index b2b3ea0d..1ab17a59 100644 --- a/rules/CC/proto/EXPRESSIONS +++ b/rules/CC/proto/EXPRESSIONS @@ -8,13 +8,17 @@ } , "protoc-compile": { "vars": - [ "transition" - , "service support" - , "CXX" + [ "CXX" , "CXXFLAGS" , "ADD_CXXFLAGS" - , "ENV" , "AR" + , "ENV" + , "name" + , "stage" + , "service support" + , "deps-transition" + , "public-fieldnames" + , "private-fieldnames" ] , "imports": { "stage": ["", "stage_singleton_field"] @@ -26,9 +30,14 @@ , "expression": { "type": "let*" , "bindings": - [ [ "protoc" + [ ["pure C", false] + , [ "protoc" , { "type": "let*" - , "bindings": [["fieldname", "protoc"], ["location", "protoc"]] + , "bindings": + [ ["fieldname", "protoc"] + , ["transition", {"type": "var", "name": "deps-transition"}] + , ["location", "protoc"] + ] , "body": {"type": "CALL_EXPRESSION", "name": "stage"} } ] @@ -39,6 +48,7 @@ { "type": "let*" , "bindings": [ ["fieldname", "grpc_cpp_plugin"] + , ["transition", {"type": "var", "name": "deps-transition"}] , ["location", "grpc_cpp_plugin"] ] , "body": {"type": "CALL_EXPRESSION", "name": "stage"} @@ -52,8 +62,7 @@ , "subdir": "work" , "$1": { "type": "let*" - , "bindings": - [["fieldname", "well_known_protos"], ["transition", null]] + , "bindings": [["fieldname", "well_known_protos"]] , "body": {"type": "CALL_EXPRESSION", "name": "artifacts"} } } @@ -63,7 +72,7 @@ , "msg": "Sources may not conflict" , "$1": { "type": "let*" - , "bindings": [["fieldname", "srcs"], ["transition", null]] + , "bindings": [["fieldname", "srcs"]] , "body": {"type": "CALL_EXPRESSION", "name": "artifacts_list"} } } @@ -289,7 +298,9 @@ , "value": {"type": "var", "name": "all proto srcs"} } ] - , ["local cflags", ["-Wno-sign-conversion", "-Wno-unused-function"]] + , ["cflags", []] + , ["private-cflags", ["-Wno-sign-conversion", "-Wno-unused-function"]] + , ["private-ldflags", []] ] , "body": {"type": "CALL_EXPRESSION", "name": "result"} } diff --git a/rules/CC/proto/RULES b/rules/CC/proto/RULES index d53ab35e..d1cfc4e5 100644 --- a/rules/CC/proto/RULES +++ b/rules/CC/proto/RULES @@ -8,25 +8,12 @@ , "string_fields": ["name", "stage"] , "target_fields": ["srcs", "deps"] , "config_vars": - [ "OS" - , "ARCH" - , "HOST_ARCH" - , "CXX" - , "CC" - , "CXXFLAGS" - , "CFLAGS" - , "ADD_CXXFLAGS" - , "ADD_CFLAGS" - , "ENV" - , "AR" - ] + ["OS", "ARCH", "HOST_ARCH", "CXX", "CFLAGS", "ADD_CFLAGS", "AR", "ENV"] , "implicit": { "protoc": [["@", "protoc", "", "protoc"]] , "defaults": [["./", "..", "defaults"]] , "proto-deps": [["@", "protoc", "", "C++ runtime"]] , "well_known_protos": [["@", "protoc", "", "well_known_protos"]] - , "pure C": [] - , "private-deps": [] } , "imports": { "protoc-compile": "protoc-compile" @@ -37,7 +24,19 @@ , "expression": { "type": "let*" , "bindings": - [["transition", {"type": "CALL_EXPRESSION", "name": "host transition"}]] + [ ["name", {"type": "join", "$1": {"type": "FIELD", "name": "name"}}] + , [ "stage" + , { "type": "join" + , "separator": "/" + , "$1": {"type": "FIELD", "name": "stage"} + } + ] + , [ "deps-transition" + , {"type": "CALL_EXPRESSION", "name": "host transition"} + ] + , ["public-fieldnames", ["deps", "proto-deps"]] + , ["private-fieldnames", ["deps", "proto-deps"]] + ] , "body": {"type": "CALL_EXPRESSION", "name": "protoc-compile"} } } @@ -51,18 +50,7 @@ , "string_fields": ["name", "stage"] , "target_fields": ["srcs", "deps"] , "config_vars": - [ "OS" - , "ARCH" - , "HOST_ARCH" - , "CXX" - , "CC" - , "CXXFLAGS" - , "CFLAGS" - , "ADD_CXXFLAGS" - , "ADD_CFLAGS" - , "ENV" - , "AR" - ] + ["OS", "ARCH", "HOST_ARCH", "CXX", "CXXFLAGS", "ADD_CXXFLAGS", "AR", "ENV"] , "implicit": { "protoc": [["@", "protoc", "", "protoc"]] , "grpc_cpp_plugin": [["@", "grpc", "src/compiler", "grpc_cpp_plugin"]] @@ -72,8 +60,6 @@ , ["@", "protoc", "", "C++ runtime"] ] , "well_known_protos": [["@", "protoc", "", "well_known_protos"]] - , "pure C": [] - , "private-deps": [] } , "imports": { "protoc-compile": "protoc-compile" @@ -88,7 +74,18 @@ { "type": "let*" , "bindings": [ ["service support", true] - , ["transition", {"type": "CALL_EXPRESSION", "name": "host transition"}] + , ["name", {"type": "join", "$1": {"type": "FIELD", "name": "name"}}] + , [ "stage" + , { "type": "join" + , "separator": "/" + , "$1": {"type": "FIELD", "name": "stage"} + } + ] + , [ "deps-transition" + , {"type": "CALL_EXPRESSION", "name": "host transition"} + ] + , ["public-fieldnames", ["deps", "proto-deps"]] + , ["private-fieldnames", ["deps", "proto-deps"]] ] , "body": {"type": "CALL_EXPRESSION", "name": "protoc-compile"} } diff --git a/rules/CC/test/RULES b/rules/CC/test/RULES index 0d7a9ba7..b42b6c4f 100644 --- a/rules/CC/test/RULES +++ b/rules/CC/test/RULES @@ -4,24 +4,28 @@ , "FIXME: the test binary and data must be built for host" ] , "tainted": ["test"] - , "target_fields": ["srcs", "private-hdrs", "deps", "data"] - , "string_fields": ["name", "stage"] + , "target_fields": ["srcs", "private-hdrs", "private-deps", "data"] + , "string_fields": + [ "name" + , "stage" + , "pure C" + , "private-defines" + , "private-cflags" + , "private-ldflags" + ] , "config_vars": - [ "CXX" - , "CC" - , "CXXFLAGS" + [ "CC" + , "CXX" , "CFLAGS" - , "ADD_CXXFLAGS" + , "CXXFLAGS" , "ADD_CFLAGS" + , "ADD_CXXFLAGS" , "ENV" , "TEST_ENV" , "CC_TEST_LAUNCHER" ] , "implicit": - { "defaults": [["./", "..", "defaults"]] - , "proto-deps": [] - , "runner": ["test_runner.sh"] - } + {"defaults": [["./", "..", "defaults"]], "runner": ["test_runner.sh"]} , "field_doc": { "name": [ "The name of the test" @@ -33,6 +37,16 @@ [ "Any additional header files that need to be present when compiling" , "the test binary." ] + , "private-defines": + [ "List of defines set for source files local to this target." + , "Each list entry will be prepended by \"-D\"." + ] + , "private-cflags": + ["List of compile flags set for source files local to this target."] + , "private-ldflags": + [ "Additional linker flags for linking external libraries (not built" + , "by this tool, typically system libraries)." + ] , "stage": [ "The logical location of all header and source files." , "Individual directory components are joined with \"/\"." @@ -40,25 +54,25 @@ , "data": ["Any files the test binary needs access to when running"] } , "config_doc": - { "CXX": ["The name of the C++ compiler to be used."] - , "CC": ["The name of the C compiler to be used."] - , "ENV": ["The environment for any action generated."] - , "CXXFLAGS": - [ "The flags for CXX to be used instead of the default ones" - , "taken from the [\"CC\", \"defaults\"] target" - ] + { "CC": ["The name of the C compiler to be used."] + , "CXX": ["The name of the C++ compiler to be used."] , "CFLAGS": [ "The flags for CC to be used instead of the default ones" , "taken from the [\"CC\", \"defaults\"] target" ] - , "ADD_CXXFLAGS": - [ "The flags to add to the default ones for CXX" + , "CXXFLAGS": + [ "The flags for CXX to be used instead of the default ones" , "taken from the [\"CC\", \"defaults\"] target" ] , "ADD_CFLAGS": [ "The flags to add to the default ones for CC" , "taken from the [\"CC\", \"defaults\"] target" ] + , "ADD_CXXFLAGS": + [ "The flags to add to the default ones for CXX" + , "taken from the [\"CC\", \"defaults\"] target" + ] + , "ENV": ["The environment for any action generated."] , "TEST_ENV": ["The environment for executing the test runner."] , "CC_TEST_LAUNCHER": [ "List of strings representing the launcher that is prepend to the" @@ -75,24 +89,30 @@ ] , "runfiles_doc": [ "A tree consisting of the artifacts staged at the name of the test." - , "As the built-in \"install\" rule only takes the runfiles of its \"deps\"" - , "argument, this gives an easy way of defining test suites." + , "As the built-in \"install\" rule only takes the runfiles of its" + , "\"private-deps\" argument, this gives an easy way of defining test" + , "suites." ] , "imports": { "artifacts": ["./", "../..", "field_artifacts"] , "runfiles_list": ["./", "../..", "field_runfiles_list"] , "compile-deps": ["./", "..", "compile-deps"] + , "compile-args-deps": ["./", "..", "compile-args-deps"] , "link-deps": ["./", "..", "link-deps"] , "link-args-deps": ["./", "..", "link-args-deps"] - , "objects": ["./", "..", "objects"] - , "default-CXX": ["./", "..", "default-CXX"] - , "default-CXXFLAGS": ["./", "..", "default-CXXFLAGS"] - , "default-ENV": ["./", "..", "default-ENV"] + , "binary": ["./", "..", "bin artifact"] } , "expression": { "type": "let*" , "bindings": - [ [ "stage" + [ [ "name" + , { "type": "assert_non_empty" + , "msg": "A non-empty name has to be provided for binaries" + , "$1": {"type": "join", "$1": {"type": "FIELD", "name": "name"}} + } + ] + , ["pure C", {"type": "FIELD", "name": "pure C"}] + , [ "stage" , { "type": "join" , "separator": "/" , "$1": {"type": "FIELD", "name": "stage"} @@ -108,7 +128,7 @@ } } ] - , [ "local hdrs" + , [ "private-hdrs" , { "type": "to_subdir" , "subdir": {"type": "var", "name": "stage"} , "$1": @@ -118,92 +138,32 @@ } } ] - , [ "CXX" - , { "type": "var" - , "name": "CXX" - , "default": {"type": "CALL_EXPRESSION", "name": "default-CXX"} - } - ] - , [ "CXXFLAGS" - , { "type": "var" - , "name": "CXXFLAGS" - , "default": {"type": "CALL_EXPRESSION", "name": "default-CXXFLAGS"} - } - ] - , [ "ENV" - , { "type": "map_union" + , ["deps-fieldnames", ["private-deps"]] + , ["compile-deps", {"type": "CALL_EXPRESSION", "name": "compile-deps"}] + , [ "compile-args" + , { "type": "++" , "$1": - { "type": "++" - , "$1": - [ {"type": "CALL_EXPRESSION", "name": "default-ENV"} - , [ { "type": "var" - , "name": "ENV" - , "default": {"type": "empty_map"} - } - ] - ] - } + [ { "type": "foreach" + , "var": "def" + , "range": {"type": "FIELD", "name": "private-defines"} + , "body": + {"type": "join", "$1": ["-D", {"type": "var", "name": "def"}]} + } + , {"type": "FIELD", "name": "private-cflags"} + , {"type": "CALL_EXPRESSION", "name": "compile-args-deps"} + ] } ] - , ["deps-fieldnames", ["deps", "proto-deps"]] - , ["compile-deps", {"type": "CALL_EXPRESSION", "name": "compile-deps"}] , ["link-deps", {"type": "CALL_EXPRESSION", "name": "link-deps"}] - , ["objects", {"type": "CALL_EXPRESSION", "name": "objects"}] - , [ "base name" - , { "type": "assert_non_empty" - , "msg": "A non-empty name has to be provided" - , "$1": {"type": "join", "$1": {"type": "FIELD", "name": "name"}} - } - ] - , [ "binary name" - , { "type": "if" - , "cond": {"type": "var", "name": "stage"} - , "else": {"type": "var", "name": "base name"} - , "then": - { "type": "join" - , "separator": "/" - , "$1": - [ {"type": "var", "name": "stage"} - , {"type": "var", "name": "base name"} - ] - } - } - ] , [ "link-args" - , { "type": "nub_right" + , { "type": "++" , "$1": - { "type": "++" - , "$1": - [ {"type": "keys", "$1": {"type": "var", "name": "objects"}} - , {"type": "CALL_EXPRESSION", "name": "link-args-deps"} - ] - } - } - ] - , [ "binary" - , { "type": "ACTION" - , "outs": [{"type": "var", "name": "binary name"}] - , "inputs": - { "type": "disjoint_map_union" - , "$1": - [ {"type": "var", "name": "objects"} - , {"type": "var", "name": "link-deps"} - ] - } - , "cmd": - { "type": "++" - , "$1": - [ [ {"type": "var", "name": "CXX"} - , "-o" - , {"type": "var", "name": "binary name"} - ] - , {"type": "var", "name": "CXXFLAGS"} - , {"type": "var", "name": "link-args"} - ] - } - , "env": {"type": "var", "name": "ENV"} + [ {"type": "CALL_EXPRESSION", "name": "link-args-deps"} + , {"type": "FIELD", "name": "private-ldflags"} + ] } ] + , ["binary", {"type": "CALL_EXPRESSION", "name": "binary"}] , [ "staged test binary" , { "type": "map_union" , "$1": @@ -256,6 +216,13 @@ } } ] + , [ "test-name" + , { "type": "join" + , "separator": "/" + , "$1": + [{"type": "var", "name": "stage"}, {"type": "var", "name": "name"}] + } + ] , [ "test-results" , { "type": "ACTION" , "outs": ["result", "stdout", "stderr", "time-start", "time-stop"] @@ -286,13 +253,13 @@ , "fail_message": { "type": "join" , "$1": - ["CC test ", {"type": "var", "name": "binary name"}, " failed"] + ["CC test ", {"type": "var", "name": "test-name"}, " failed"] } } ] , [ "runfiles" , { "type": "singleton_map" - , "key": {"type": "var", "name": "base name"} + , "key": {"type": "var", "name": "name"} , "value": {"type": "TREE", "$1": {"type": "var", "name": "test-results"}} } diff --git a/rules/shell/test/EXPRESSIONS b/rules/shell/test/EXPRESSIONS index 24bf9ec1..444de921 100644 --- a/rules/shell/test/EXPRESSIONS +++ b/rules/shell/test/EXPRESSIONS @@ -1,5 +1,13 @@ { "test-action": - { "vars": ["name", "test.sh", "ATTEMPT", "TEST_ENV"] + { "vars": + [ "TEST_ENV" + , "ATTEMPT" + , "name" + , "test.sh" + , "keep" + , "runner" + , "deps-fieldname" + ] , "imports": { "artifacts_list": ["./", "../..", "field_artifacts_list"] , "runfiles_list": ["./", "../..", "field_runfiles_list"] @@ -12,7 +20,7 @@ , "$1": { "type": "foreach" , "var": "runner" - , "range": {"type": "FIELD", "name": "runner"} + , "range": {"type": "var", "name": "runner"} , "body": { "type": "map_union" , "$1": @@ -35,12 +43,17 @@ , { "type": "TREE" , "$1": { "type": "disjoint_map_union" - , "msg": "Field 'deps' has to stage in a conflict free way" + , "msg": + [ "Field" + , {"type": "var", "name": "deps-fieldname"} + , "has to stage in a conflict free way" + ] , "$1": { "type": "++" , "$1": { "type": "let*" - , "bindings": [["fieldname", "deps"]] + , "bindings": + [["fieldname", {"type": "var", "name": "deps-fieldname"}]] , "body": [ {"type": "CALL_EXPRESSION", "name": "runfiles_list"} , {"type": "CALL_EXPRESSION", "name": "artifacts_list"} @@ -72,7 +85,7 @@ [ ["result", "stdout", "stderr", "time-start", "time-stop"] , { "type": "foreach" , "var": "filename" - , "range": {"type": "FIELD", "name": "keep"} + , "range": {"type": "var", "name": "keep"} , "body": { "type": "join" , "$1": ["work/", {"type": "var", "name": "filename"}] @@ -95,9 +108,7 @@ } ] , [ "cmd" - , { "type": "++" - , "$1": [["./runner"], {"type": "FIELD", "name": "keep"}] - } + , {"type": "++", "$1": [["./runner"], {"type": "var", "name": "keep"}]} ] , [ "test_env" , {"type": "var", "name": "TEST_ENV", "default": {"type": "empty_map"}} @@ -142,7 +153,7 @@ } } , "test-result": - { "vars": ["name", "test.sh", "TEST_ENV"] + { "vars": ["TEST_ENV", "name", "test.sh", "keep", "runner", "deps-fieldname"] , "imports": {"action": "test-action"} , "expression": { "type": "let*" diff --git a/rules/shell/test/RULES b/rules/shell/test/RULES index 4242d94e..990e8d91 100644 --- a/rules/shell/test/RULES +++ b/rules/shell/test/RULES @@ -75,6 +75,9 @@ , "$1": {"type": "join", "$1": {"type": "FIELD", "name": "name"}} } ] + , ["keep", {"type": "FIELD", "name": "keep"}] + , ["runner", {"type": "FIELD", "name": "runner"}] + , ["deps-fieldname", "deps"] ] , "body": { "type": "if" diff --git a/src/buildtool/main/TARGETS b/src/buildtool/main/TARGETS index 079d3f40..36a8cbff 100644 --- a/src/buildtool/main/TARGETS +++ b/src/buildtool/main/TARGETS @@ -3,7 +3,7 @@ , "arguments_config": ["BUILD_STATIC_BINARY"] , "name": ["just"] , "srcs": ["main.cpp"] - , "deps": + , "private-deps": [ ["src/buildtool/common", "cli"] , ["src/buildtool/common", "config"] , ["src/buildtool/compatibility", "compatibility"] @@ -23,7 +23,7 @@ , "describe" ] , "stage": ["src", "buildtool", "main"] - , "link external": + , "private-ldflags": { "type": "if" , "cond": {"type": "var", "name": "BUILD_STATIC_BINARY"} , "then": ["-static"] @@ -101,7 +101,7 @@ , "name": ["version"] , "hdrs": ["version.hpp"] , "srcs": ["version.cpp"] - , "local defines": + , "private-defines": { "type": "++" , "$1": [ { "type": "if" diff --git a/src/buildtool/system/TARGETS b/src/buildtool/system/TARGETS index ddc7ae4d..11c2bd47 100644 --- a/src/buildtool/system/TARGETS +++ b/src/buildtool/system/TARGETS @@ -4,7 +4,7 @@ , "name": ["system"] , "hdrs": ["system.hpp"] , "srcs": ["system.cpp"] - , "local defines": + , "private-defines": { "type": "if" , "cond": {"type": "var", "name": "VALGRIND_BUILD"} , "then": ["VALGRIND_BUILD"] diff --git a/test/buildtool/build_engine/base_maps/TARGETS b/test/buildtool/build_engine/base_maps/TARGETS index a55d1762..194acdbb 100644 --- a/test/buildtool/build_engine/base_maps/TARGETS +++ b/test/buildtool/build_engine/base_maps/TARGETS @@ -12,7 +12,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["entity_name"] , "srcs": ["entity_name.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/build_engine/base_maps", "entity_name"] @@ -24,7 +24,7 @@ , "name": ["directory_map"] , "srcs": ["directory_map.test.cpp"] , "data": ["test_data_src", "test_data"] - , "deps": + , "private-deps": [ "test_repo" , ["@", "catch2", "", "catch2"] , ["test", "catch-main"] @@ -38,7 +38,7 @@ , "name": ["json_file_map"] , "srcs": ["json_file_map.test.cpp"] , "data": ["test_data_json", "test_data"] - , "deps": + , "private-deps": [ "test_repo" , ["@", "catch2", "", "catch2"] , ["test", "catch-main"] @@ -51,7 +51,7 @@ , "name": ["source_map"] , "srcs": ["source_map.test.cpp"] , "data": ["test_data", "test_data_src"] - , "deps": + , "private-deps": [ "test_repo" , ["@", "catch2", "", "catch2"] , ["test", "catch-main"] @@ -65,7 +65,7 @@ , "name": ["expression_map"] , "srcs": ["expression_map.test.cpp"] , "data": ["test_data_expr", "test_data"] - , "deps": + , "private-deps": [ "test_repo" , ["@", "catch2", "", "catch2"] , ["test", "catch-main"] @@ -78,7 +78,7 @@ , "name": ["rule_map"] , "srcs": ["rule_map.test.cpp"] , "data": ["test_data_rule", "test_data"] - , "deps": + , "private-deps": [ "test_repo" , ["@", "catch2", "", "catch2"] , ["test", "catch-main"] diff --git a/test/buildtool/build_engine/expression/TARGETS b/test/buildtool/build_engine/expression/TARGETS index 1796ca3a..5488c212 100644 --- a/test/buildtool/build_engine/expression/TARGETS +++ b/test/buildtool/build_engine/expression/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["linked_map"] , "srcs": ["linked_map.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] @@ -14,7 +14,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["expression"] , "srcs": ["expression.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] @@ -26,7 +26,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["configuration"] , "srcs": ["configuration.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] diff --git a/test/buildtool/build_engine/target_map/TARGETS b/test/buildtool/build_engine/target_map/TARGETS index 4c2eed56..d266a4cd 100644 --- a/test/buildtool/build_engine/target_map/TARGETS +++ b/test/buildtool/build_engine/target_map/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["result_map"] , "srcs": ["result_map.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/file_system", "file_system_manager"] @@ -15,7 +15,7 @@ , "name": ["target_map"] , "srcs": ["target_map.test.cpp"] , "data": ["test_data"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/build_engine/base_maps", "directory_map"] @@ -30,7 +30,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["target_map_internals"] , "srcs": ["target_map_internals.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , [ "src/buildtool/build_engine/target_map" diff --git a/test/buildtool/common/TARGETS b/test/buildtool/common/TARGETS index 8890b8b8..c03a1f77 100644 --- a/test/buildtool/common/TARGETS +++ b/test/buildtool/common/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["artifact_factory"] , "srcs": ["artifact_factory.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/common", "artifact_factory"] @@ -13,7 +13,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["artifact_description"] , "srcs": ["artifact_description.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/common", "artifact_factory"] @@ -25,7 +25,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["action_description"] , "srcs": ["action_description.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/common", "artifact_factory"] @@ -37,7 +37,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["repository_config"] , "srcs": ["repository_config.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/common", "config"] diff --git a/test/buildtool/crypto/TARGETS b/test/buildtool/crypto/TARGETS index c12fa855..a3b7d880 100644 --- a/test/buildtool/crypto/TARGETS +++ b/test/buildtool/crypto/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["hasher"] , "srcs": ["hasher.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/crypto", "hasher"] @@ -13,7 +13,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["hash_function"] , "srcs": ["hash_function.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/crypto", "hash_function"] diff --git a/test/buildtool/execution_api/bazel/TARGETS b/test/buildtool/execution_api/bazel/TARGETS index 5978f7be..6f32e64d 100644 --- a/test/buildtool/execution_api/bazel/TARGETS +++ b/test/buildtool/execution_api/bazel/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["ac_client"] , "srcs": ["bazel_ac_client.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test/utils", "catch-main-remote-execution"] , ["test/utils", "execution_bazel"] @@ -14,7 +14,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["cas_client"] , "srcs": ["bazel_cas_client.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test/utils", "catch-main-remote-execution"] , ["src/buildtool/execution_api/remote", "bazel_network"] @@ -26,7 +26,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["execution_client"] , "srcs": ["bazel_execution_client.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test/utils", "catch-main-remote-execution"] , ["test/utils", "execution_bazel"] @@ -38,7 +38,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["bytestream_client"] , "srcs": ["bytestream_client.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test/utils", "catch-main-remote-execution"] , ["test/utils", "execution_bazel"] @@ -50,7 +50,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["network"] , "srcs": ["bazel_network.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test/utils", "catch-main-remote-execution"] , ["test/utils", "execution_bazel"] @@ -63,7 +63,7 @@ , "name": ["msg_factory"] , "srcs": ["bazel_msg_factory.test.cpp"] , "data": [["test/buildtool/execution_api", "test_data"]] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/common", "artifact_factory"] @@ -76,7 +76,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["bazel_api"] , "srcs": ["bazel_api.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test/utils", "catch-main-remote-execution"] , ["src/buildtool/execution_api/remote", "bazel"] diff --git a/test/buildtool/execution_api/local/TARGETS b/test/buildtool/execution_api/local/TARGETS index 6cf9607b..22c459ce 100644 --- a/test/buildtool/execution_api/local/TARGETS +++ b/test/buildtool/execution_api/local/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["local_cas"] , "srcs": ["local_cas.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/crypto", "hash_function"] @@ -16,7 +16,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["local_ac"] , "srcs": ["local_ac.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/execution_api/local", "local"] @@ -29,7 +29,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["local_execution"] , "srcs": ["local_execution.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/common", "artifact_factory"] @@ -42,7 +42,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["local_api"] , "srcs": ["local_api.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/execution_api/local", "local"] @@ -56,7 +56,7 @@ , "name": ["local_storage"] , "srcs": ["local_storage.test.cpp"] , "data": [["test/buildtool/execution_api", "test_data"]] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/execution_api/local", "local"] diff --git a/test/buildtool/execution_engine/dag/TARGETS b/test/buildtool/execution_engine/dag/TARGETS index c6015f16..95dff1fe 100644 --- a/test/buildtool/execution_engine/dag/TARGETS +++ b/test/buildtool/execution_engine/dag/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["dag"] , "srcs": ["dag.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] diff --git a/test/buildtool/execution_engine/executor/TARGETS b/test/buildtool/execution_engine/executor/TARGETS index 0a825fa5..75f7d385 100644 --- a/test/buildtool/execution_engine/executor/TARGETS +++ b/test/buildtool/execution_engine/executor/TARGETS @@ -8,7 +8,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["executor"] , "srcs": ["executor.test.cpp"] - , "deps": + , "private-deps": [ ["src/buildtool/common", "artifact_factory"] , ["src/buildtool/execution_api/common", "common"] , ["src/buildtool/execution_engine/dag", "dag"] @@ -23,7 +23,7 @@ , "name": ["local"] , "srcs": ["executor_api_local.test.cpp"] , "data": ["test_data"] - , "deps": + , "private-deps": [ "executor_api_tests" , ["src/buildtool/common", "artifact_factory"] , ["src/buildtool/execution_api/local", "local"] @@ -41,7 +41,7 @@ , "name": ["remote_bazel"] , "srcs": ["executor_api_remote_bazel.test.cpp"] , "data": ["test_data"] - , "deps": + , "private-deps": [ "executor_api_tests" , ["src/buildtool/common", "artifact_factory"] , ["src/buildtool/execution_api/remote", "bazel"] diff --git a/test/buildtool/execution_engine/traverser/TARGETS b/test/buildtool/execution_engine/traverser/TARGETS index 7f2192fe..2b9ced2d 100644 --- a/test/buildtool/execution_engine/traverser/TARGETS +++ b/test/buildtool/execution_engine/traverser/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["traverser"] , "srcs": ["traverser.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] diff --git a/test/buildtool/file_system/TARGETS b/test/buildtool/file_system/TARGETS index c4fdfd73..6bf9ce72 100644 --- a/test/buildtool/file_system/TARGETS +++ b/test/buildtool/file_system/TARGETS @@ -3,7 +3,7 @@ , "name": ["file_system_manager"] , "srcs": ["file_system_manager.test.cpp"] , "data": ["test_data"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/file_system", "file_system_manager"] @@ -15,7 +15,7 @@ , "name": ["git_tree"] , "srcs": ["git_tree.test.cpp"] , "data": ["test_data"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] @@ -29,7 +29,7 @@ , "name": ["file_root"] , "srcs": ["file_root.test.cpp"] , "data": ["test_data"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] @@ -43,7 +43,7 @@ , "name": ["directory_entries"] , "srcs": ["directory_entries.test.cpp"] , "data": ["test_data"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] diff --git a/test/buildtool/graph_traverser/TARGETS b/test/buildtool/graph_traverser/TARGETS index cf47ff26..302c68e0 100644 --- a/test/buildtool/graph_traverser/TARGETS +++ b/test/buildtool/graph_traverser/TARGETS @@ -17,7 +17,7 @@ , "name": ["graph_traverser_local"] , "srcs": ["graph_traverser_local.test.cpp"] , "data": ["test_data"] - , "deps": + , "private-deps": [ "graph_traverser_tests" , ["@", "catch2", "", "catch2"] , ["test", "catch-main"] @@ -30,7 +30,7 @@ , "name": ["graph_traverser_remote"] , "srcs": ["graph_traverser_remote.test.cpp"] , "data": ["test_data"] - , "deps": + , "private-deps": [ "graph_traverser_tests" , ["@", "catch2", "", "catch2"] , ["test/utils", "catch-main-remote-execution"] diff --git a/test/buildtool/logging/TARGETS b/test/buildtool/logging/TARGETS index fdf6d2e4..a14a0fc3 100644 --- a/test/buildtool/logging/TARGETS +++ b/test/buildtool/logging/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["logger"] , "srcs": ["logger.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/logging", "logging"] @@ -13,7 +13,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["log_sink_file"] , "srcs": ["log_sink_file.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/logging", "logging"] diff --git a/test/buildtool/main/TARGETS b/test/buildtool/main/TARGETS index 8cbd13e2..e7305262 100644 --- a/test/buildtool/main/TARGETS +++ b/test/buildtool/main/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["install_cas"] , "srcs": ["install_cas.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/main", "install_cas"] diff --git a/test/buildtool/multithreading/TARGETS b/test/buildtool/multithreading/TARGETS index 47267190..65f38330 100644 --- a/test/buildtool/multithreading/TARGETS +++ b/test/buildtool/multithreading/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["task"] , "srcs": ["task.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/multithreading", "task_system"] @@ -13,7 +13,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["task_system"] , "srcs": ["task_system.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] @@ -25,7 +25,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["async_map_node"] , "srcs": ["async_map_node.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] @@ -38,7 +38,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["async_map"] , "srcs": ["async_map.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] @@ -52,7 +52,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["async_map_consumer"] , "srcs": ["async_map_consumer.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["test/utils", "container_matchers"] diff --git a/test/buildtool/system/TARGETS b/test/buildtool/system/TARGETS index 97101bae..952fe8d2 100644 --- a/test/buildtool/system/TARGETS +++ b/test/buildtool/system/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["system_command"] , "srcs": ["system_command.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/buildtool/system", "system_command"] diff --git a/test/end-to-end/target-cache/test-data-artifacts-sync/greetlib/main/TARGETS b/test/end-to-end/target-cache/test-data-artifacts-sync/greetlib/main/TARGETS index a3924f4d..746cd866 100644 --- a/test/end-to-end/target-cache/test-data-artifacts-sync/greetlib/main/TARGETS +++ b/test/end-to-end/target-cache/test-data-artifacts-sync/greetlib/main/TARGETS @@ -2,6 +2,6 @@ { "type": ["@", "rules", "CC", "binary"] , "name": ["main"] , "srcs": ["main.cpp"] - , "deps": [["@", "greet", "", "greet"]] + , "private-deps": [["@", "greet", "", "greet"]] } } diff --git a/test/utils/cpp/TARGETS b/test/utils/cpp/TARGETS index 5e11d258..113d6d10 100644 --- a/test/utils/cpp/TARGETS +++ b/test/utils/cpp/TARGETS @@ -2,7 +2,7 @@ { "type": ["@", "rules", "CC/test", "test"] , "name": ["path"] , "srcs": ["path.test.cpp"] - , "deps": + , "private-deps": [ ["@", "catch2", "", "catch2"] , ["test", "catch-main"] , ["src/utils/cpp", "path"] |