summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/defaults/CC/TARGETS.just24
-rw-r--r--etc/dev/TARGETS2
-rw-r--r--etc/import.pkgconfig/TARGETS.gsl6
-rw-r--r--etc/import/TARGETS.gsl12
-rw-r--r--etc/repos.json18
-rw-r--r--src/buildtool/auth/TARGETS3
-rw-r--r--src/buildtool/auth/authentication.hpp4
-rw-r--r--src/buildtool/build_engine/base_maps/TARGETS18
-rw-r--r--src/buildtool/build_engine/base_maps/directory_map.hpp2
-rw-r--r--src/buildtool/build_engine/base_maps/entity_name.hpp2
-rw-r--r--src/buildtool/build_engine/base_maps/expression_function.hpp8
-rw-r--r--src/buildtool/build_engine/base_maps/expression_map.hpp2
-rw-r--r--src/buildtool/build_engine/base_maps/field_reader.hpp2
-rw-r--r--src/buildtool/build_engine/base_maps/json_file_map.hpp2
-rw-r--r--src/buildtool/build_engine/base_maps/rule_map.hpp2
-rw-r--r--src/buildtool/build_engine/base_maps/source_map.hpp2
-rw-r--r--src/buildtool/build_engine/base_maps/user_rule.hpp7
-rw-r--r--src/buildtool/build_engine/expression/TARGETS3
-rw-r--r--src/buildtool/build_engine/expression/configuration.hpp7
-rw-r--r--src/buildtool/build_engine/expression/expression.cpp5
-rw-r--r--src/buildtool/build_engine/expression/expression.hpp2
-rw-r--r--src/buildtool/build_engine/expression/target_result.cpp2
-rw-r--r--src/buildtool/build_engine/target_map/TARGETS5
-rw-r--r--src/buildtool/build_engine/target_map/built_in_rules.hpp2
-rw-r--r--src/buildtool/build_engine/target_map/export.hpp2
-rw-r--r--src/buildtool/build_engine/target_map/result_map.hpp7
-rw-r--r--src/buildtool/build_engine/target_map/target_map.cpp7
-rw-r--r--src/buildtool/build_engine/target_map/target_map.hpp2
-rw-r--r--src/buildtool/build_engine/target_map/utils.hpp2
-rw-r--r--src/buildtool/common/TARGETS3
-rw-r--r--src/buildtool/common/artifact_description.hpp4
-rw-r--r--src/buildtool/common/artifact_digest.hpp5
-rw-r--r--src/buildtool/common/cli.hpp2
-rw-r--r--src/buildtool/compatibility/TARGETS3
-rw-r--r--src/buildtool/compatibility/native_support.hpp9
-rw-r--r--src/buildtool/crypto/TARGETS2
-rw-r--r--src/buildtool/crypto/hash_function.hpp6
-rw-r--r--src/buildtool/execution_api/bazel_msg/TARGETS7
-rw-r--r--src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp4
-rw-r--r--src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp2
-rw-r--r--src/buildtool/execution_api/bazel_msg/blob_tree.hpp9
-rw-r--r--src/buildtool/execution_api/bazel_msg/directory_tree.cpp3
-rw-r--r--src/buildtool/execution_api/bazel_msg/directory_tree.hpp2
-rw-r--r--src/buildtool/execution_api/common/TARGETS3
-rw-r--r--src/buildtool/execution_api/common/execution_action.hpp2
-rw-r--r--src/buildtool/execution_api/common/execution_api.hpp2
-rw-r--r--src/buildtool/execution_api/common/execution_common.hpp11
-rw-r--r--src/buildtool/execution_api/common/execution_response.hpp2
-rw-r--r--src/buildtool/execution_api/execution_service/TARGETS2
-rw-r--r--src/buildtool/execution_api/execution_service/execution_server.cpp2
-rw-r--r--src/buildtool/execution_api/git/TARGETS2
-rw-r--r--src/buildtool/execution_api/git/git_api.hpp2
-rw-r--r--src/buildtool/execution_api/local/TARGETS4
-rw-r--r--src/buildtool/execution_api/local/config.hpp3
-rw-r--r--src/buildtool/execution_api/local/local_action.cpp2
-rw-r--r--src/buildtool/execution_api/local/local_action.hpp4
-rw-r--r--src/buildtool/execution_api/local/local_api.hpp2
-rw-r--r--src/buildtool/execution_api/local/local_response.hpp9
-rw-r--r--src/buildtool/execution_api/remote/TARGETS7
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_ac_client.cpp2
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_api.hpp2
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp2
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp2
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_network.cpp121
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_network.hpp4
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_response.cpp5
-rw-r--r--src/buildtool/execution_api/remote/bazel/bytestream_client.hpp93
-rw-r--r--src/buildtool/execution_api/remote/config.hpp2
-rw-r--r--src/buildtool/execution_engine/dag/TARGETS2
-rw-r--r--src/buildtool/execution_engine/dag/dag.hpp6
-rw-r--r--src/buildtool/execution_engine/executor/TARGETS2
-rw-r--r--src/buildtool/execution_engine/executor/executor.hpp2
-rw-r--r--src/buildtool/execution_engine/traverser/TARGETS2
-rw-r--r--src/buildtool/execution_engine/traverser/traverser.hpp9
-rw-r--r--src/buildtool/file_system/TARGETS13
-rw-r--r--src/buildtool/file_system/file_root.hpp12
-rw-r--r--src/buildtool/file_system/file_system_manager.hpp2
-rw-r--r--src/buildtool/file_system/git_cas.cpp2
-rw-r--r--src/buildtool/file_system/git_repo.cpp5
-rw-r--r--src/buildtool/file_system/git_tree.hpp16
-rw-r--r--src/buildtool/file_system/git_utils.hpp2
-rw-r--r--src/buildtool/file_system/object_type.hpp6
-rw-r--r--src/buildtool/graph_traverser/graph_traverser.hpp4
-rw-r--r--src/buildtool/logging/TARGETS5
-rw-r--r--src/buildtool/logging/log_level.hpp4
-rw-r--r--src/buildtool/logging/log_sink_file.hpp2
-rw-r--r--src/buildtool/main/TARGETS2
-rw-r--r--src/buildtool/main/install_cas.hpp4
-rw-r--r--src/buildtool/main/main.cpp2
-rw-r--r--src/buildtool/multithreading/TARGETS17
-rw-r--r--src/buildtool/multithreading/async_map.hpp2
-rw-r--r--src/buildtool/multithreading/async_map_consumer.hpp2
-rw-r--r--src/buildtool/multithreading/async_map_node.hpp5
-rw-r--r--src/buildtool/multithreading/notification_queue.hpp8
-rw-r--r--src/buildtool/multithreading/task_system.cpp4
-rw-r--r--src/buildtool/progress_reporting/TARGETS2
-rw-r--r--src/buildtool/progress_reporting/progress_reporter.cpp2
-rw-r--r--src/buildtool/storage/TARGETS6
-rw-r--r--src/buildtool/storage/config.hpp6
-rw-r--r--src/buildtool/storage/local_ac.hpp2
-rw-r--r--src/buildtool/storage/target_cache.hpp7
-rw-r--r--src/buildtool/storage/target_cache_entry.cpp5
-rw-r--r--src/buildtool/storage/target_cache_entry.hpp3
-rw-r--r--src/buildtool/system/TARGETS2
-rw-r--r--src/buildtool/system/system_command.hpp2
-rw-r--r--src/other_tools/just_mr/TARGETS2
-rw-r--r--src/other_tools/just_mr/cli.hpp2
-rw-r--r--src/other_tools/just_mr/progress_reporting/TARGETS2
-rw-r--r--src/other_tools/just_mr/progress_reporting/progress_reporter.cpp2
-rw-r--r--src/other_tools/utils/TARGETS6
-rw-r--r--src/other_tools/utils/archive_ops.hpp2
-rw-r--r--src/other_tools/utils/curl_easy_handle.hpp2
-rw-r--r--src/other_tools/utils/curl_url_handle.hpp2
-rw-r--r--src/utils/automata/dfa_minimizer.hpp2
-rw-r--r--src/utils/cpp/TARGETS17
-rw-r--r--src/utils/cpp/file_locking.hpp2
-rw-r--r--src/utils/cpp/gsl.hpp33
-rw-r--r--src/utils/cpp/hash_combine.hpp2
-rw-r--r--src/utils/cpp/json.hpp11
-rw-r--r--src/utils/cpp/tmp_dir.cpp2
-rw-r--r--src/utils/cpp/type_safe_arithmetic.hpp6
-rw-r--r--test/bootstrap/TARGETS2
-rwxr-xr-xtest/bootstrap/test-mixed-bootstrap.sh8
-rw-r--r--test/buildtool/storage/local_ac.test.cpp2
-rw-r--r--test/utils/TARGETS2
-rw-r--r--test/utils/remote_execution/bazel_action_creator.hpp2
126 files changed, 431 insertions, 374 deletions
diff --git a/etc/defaults/CC/TARGETS.just b/etc/defaults/CC/TARGETS.just
index ea501e09..66033bef 100644
--- a/etc/defaults/CC/TARGETS.just
+++ b/etc/defaults/CC/TARGETS.just
@@ -12,21 +12,13 @@
, "-pedantic-errors"
]
, "ADD_CXXFLAGS":
- { "type": "++"
- , "$1":
- [ [ "-std=c++20"
- , "-Wall"
- , "-Wextra"
- , "-Wpedantic"
- , "-Wsign-conversion"
- , "-Werror"
- , "-pedantic-errors"
- ]
- , { "type": "if"
- , "cond": {"type": "var", "name": "DEBUG"}
- , "then": ["-Dgsl_CONFIG_CONTRACT_CHECKING_AUDIT=1"]
- }
- ]
- }
+ [ "-std=c++20"
+ , "-Wall"
+ , "-Wextra"
+ , "-Wpedantic"
+ , "-Wsign-conversion"
+ , "-Werror"
+ , "-pedantic-errors"
+ ]
}
}
diff --git a/etc/dev/TARGETS b/etc/dev/TARGETS
index 40fdcf52..725f884e 100644
--- a/etc/dev/TARGETS
+++ b/etc/dev/TARGETS
@@ -11,7 +11,7 @@
, "targets":
[ ["@", "ssl", "", "crypto"]
, ["@", "grpc", "", "grpc++"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["@", "fmt", "", "fmt"]
, ["@", "cli11", "", "cli11"]
, ["@", "json", "", "json"]
diff --git a/etc/import.pkgconfig/TARGETS.gsl b/etc/import.pkgconfig/TARGETS.gsl
index e73040f5..866c3fcf 100644
--- a/etc/import.pkgconfig/TARGETS.gsl
+++ b/etc/import.pkgconfig/TARGETS.gsl
@@ -1,5 +1,3 @@
-{ "gsl-lite":
- { "type": ["@", "rules", "CC/pkgconfig", "system_library"]
- , "name": ["gsl-lite"]
- }
+{ "gsl":
+ {"type": ["@", "rules", "CC/pkgconfig", "system_library"], "name": ["gsl"]}
}
diff --git a/etc/import/TARGETS.gsl b/etc/import/TARGETS.gsl
index d22e25b2..a769eac9 100644
--- a/etc/import/TARGETS.gsl
+++ b/etc/import/TARGETS.gsl
@@ -1,11 +1,7 @@
-{ "gsl-lite":
+{ "gsl":
{ "type": ["@", "rules", "CC", "library"]
- , "name": ["gsl-lite"]
- , "hdrs": ["gsl-lite hdrs"]
- }
-, "gsl-lite hdrs":
- { "type": "tree"
- , "name": "gsl-lite"
- , "deps": ["gsl", "gsl-lite.h", "gsl-lite.hpp", "gsl-lite-vc6.hpp"]
+ , "name": ["gsl"]
+ , "hdrs": [["TREE", null, "."]]
+ , "stage": ["gsl"]
}
}
diff --git a/etc/repos.json b/etc/repos.json
index f6bfb68b..44bf6698 100644
--- a/etc/repos.json
+++ b/etc/repos.json
@@ -5,7 +5,7 @@
, "bindings":
{ "rules": "rules-just"
, "just-distfiles": "just-distfiles"
- , "gsl-lite": "gsl-lite"
+ , "gsl": "com_github_microsoft_gsl"
, "cli11": "cli11"
, "json": "json"
, "fmt": "fmt"
@@ -27,7 +27,7 @@
{ "repository":
{ "type": "distdir"
, "repositories":
- [ "gsl-lite"
+ [ "com_github_microsoft_gsl"
, "cli11"
, "json"
, "fmt"
@@ -138,18 +138,20 @@
{"type": "file", "path": "etc/import", "pragma": {"to_git": true}}
, "pkg_bootstrap": {"local_path": "etc/import.pkgconfig"}
}
- , "gsl-lite":
+ , "com_github_microsoft_gsl":
{ "repository":
{ "type": "archive"
- , "content": "6a2245941d8a713897f439c35512593683f6ad48"
- , "fetch": "https://github.com/gsl-lite/gsl-lite/archive/v0.40.0.tar.gz"
- , "sha256": "65af4ec8a1050dac4f1ca4622881bb02a9c3978a9baec289fb56e25412d6cac7"
- , "sha512": "afd65009bf33f54cd1caf1988b725e618bee4f4f779825ae1df55017034c6fff75feaa737a358a7f5e690757637f4d281c2f22d06c39efb81dacd7d1949251df"
- , "subdir": "gsl-lite-0.40.0/include/gsl"
+ , "content": "386f0a89a47763481223a63d5026215af8d3c827"
+ , "fetch": "https://github.com/microsoft/GSL/archive/refs/tags/v4.0.0.tar.gz"
+ , "sha256": "f0e32cb10654fea91ad56bde89170d78cfbf4363ee0b01d8f097de2ba49f6ce9"
+ , "sha512": "7fa7446796c6bf82fb3bff09f86a69c446a27be528bef3b17c8bc5ad2f24d5cf86bdb3d3813ecb44726e8f395020180e97e41027330d1fbf545cc0f0b44aac29"
+ , "subdir": "GSL-4.0.0/include/gsl"
}
, "target_root": "import targets"
, "target_file_name": "TARGETS.gsl"
, "bindings": {"rules": "rules"}
+ , "bootstrap": {"include_name": "gsl"}
+ , "pkg_bootstrap": {"local_path": "include/gsl"}
}
, "cli11":
{ "repository":
diff --git a/src/buildtool/auth/TARGETS b/src/buildtool/auth/TARGETS
index 6faf688c..a4d6fdbe 100644
--- a/src/buildtool/auth/TARGETS
+++ b/src/buildtool/auth/TARGETS
@@ -2,8 +2,7 @@
{ "type": ["@", "rules", "CC", "library"]
, "name": ["auth"]
, "hdrs": ["authentication.hpp"]
- , "deps":
- [["@", "gsl-lite", "", "gsl-lite"], ["src/buildtool/logging", "logging"]]
+ , "deps": [["@", "gsl", "", "gsl"], ["src/buildtool/logging", "logging"]]
, "stage": ["src", "buildtool", "auth"]
}
}
diff --git a/src/buildtool/auth/authentication.hpp b/src/buildtool/auth/authentication.hpp
index a903f7fe..14bc02bb 100644
--- a/src/buildtool/auth/authentication.hpp
+++ b/src/buildtool/auth/authentication.hpp
@@ -22,9 +22,9 @@
#include <string>
#include <utility>
-#include <gsl-lite/gsl-lite.hpp>
-
#include "src/buildtool/logging/logger.hpp"
+
+#include <gsl/gsl>
enum class AuthMethod : std::uint8_t { kNONE, kTLS };
class Auth {
diff --git a/src/buildtool/build_engine/base_maps/TARGETS b/src/buildtool/build_engine/base_maps/TARGETS
index 7f8b5546..ddc03ab9 100644
--- a/src/buildtool/build_engine/base_maps/TARGETS
+++ b/src/buildtool/build_engine/base_maps/TARGETS
@@ -26,7 +26,7 @@
, "deps":
[ ["@", "fmt", "", "fmt"]
, ["@", "json", "", "json"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/common", "config"]
, ["src/buildtool/multithreading", "async_map_consumer"]
, "module_name"
@@ -65,7 +65,7 @@
, "deps":
[ "entity_name_data"
, ["@", "json", "", "json"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/common", "config"]
, ["src/buildtool/build_engine/expression", "expression"]
, ["src/utils/cpp", "hash_combine"]
@@ -81,7 +81,7 @@
[ "directory_map"
, "entity_name"
, ["@", "json", "", "json"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/build_engine/analysed_target", "target"]
, ["src/buildtool/build_engine/expression", "expression"]
, ["src/buildtool/multithreading", "async_map_consumer"]
@@ -98,7 +98,7 @@
[ "entity_name"
, ["@", "fmt", "", "fmt"]
, ["@", "json", "", "json"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/multithreading", "async_map_consumer"]
, ["src/buildtool/build_engine/expression", "expression"]
]
@@ -111,7 +111,8 @@
, "deps":
[ ["src/buildtool/build_engine/expression", "expression"]
, ["src/buildtool/logging", "logging"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["src/utils/cpp", "gsl"]
+ , ["@", "gsl", "", "gsl"]
]
, "stage": ["src", "buildtool", "build_engine", "base_maps"]
, "private-deps": [["src/utils/cpp", "hash_combine"]]
@@ -125,7 +126,7 @@
[ "json_file_map"
, "entity_name"
, "expression_function"
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["@", "fmt", "", "fmt"]
, ["@", "json", "", "json"]
, ["src/buildtool/multithreading", "async_map_consumer"]
@@ -142,10 +143,11 @@
, "deps":
[ "entity_name"
, "expression_function"
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["@", "fmt", "", "fmt"]
, ["src/buildtool/build_engine/expression", "expression"]
, ["src/utils/cpp", "concepts"]
+ , ["src/utils/cpp", "gsl"]
]
, "stage": ["src", "buildtool", "build_engine", "base_maps"]
}
@@ -159,7 +161,7 @@
, "entity_name"
, "user_rule"
, "expression_map"
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["@", "fmt", "", "fmt"]
, ["@", "json", "", "json"]
, ["src/buildtool/multithreading", "async_map_consumer"]
diff --git a/src/buildtool/build_engine/base_maps/directory_map.hpp b/src/buildtool/build_engine/base_maps/directory_map.hpp
index 4a04a14c..1cf7f358 100644
--- a/src/buildtool/build_engine/base_maps/directory_map.hpp
+++ b/src/buildtool/build_engine/base_maps/directory_map.hpp
@@ -19,7 +19,7 @@
#include <map>
#include <unordered_set>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/build_engine/base_maps/module_name.hpp"
#include "src/buildtool/file_system/file_root.hpp"
#include "src/buildtool/multithreading/async_map_consumer.hpp"
diff --git a/src/buildtool/build_engine/base_maps/entity_name.hpp b/src/buildtool/build_engine/base_maps/entity_name.hpp
index dd3528ce..e2df632e 100644
--- a/src/buildtool/build_engine/base_maps/entity_name.hpp
+++ b/src/buildtool/build_engine/base_maps/entity_name.hpp
@@ -19,7 +19,7 @@
#include <optional>
#include <utility>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/base_maps/entity_name_data.hpp"
#include "src/buildtool/build_engine/expression/expression.hpp"
diff --git a/src/buildtool/build_engine/base_maps/expression_function.hpp b/src/buildtool/build_engine/base_maps/expression_function.hpp
index 842b8059..91b303a5 100644
--- a/src/buildtool/build_engine/base_maps/expression_function.hpp
+++ b/src/buildtool/build_engine/base_maps/expression_function.hpp
@@ -20,12 +20,14 @@
#include <unordered_map>
#include <vector>
-#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include <fmt/core.h>
+
+#include "gsl/gsl"
#include "src/buildtool/build_engine/expression/configuration.hpp"
#include "src/buildtool/build_engine/expression/evaluator.hpp"
#include "src/buildtool/build_engine/expression/expression.hpp"
#include "src/buildtool/logging/logger.hpp"
+#include "src/utils/cpp/gsl.hpp"
namespace BuildMaps::Base {
@@ -93,7 +95,7 @@ class ExpressionFunction {
logger,
note_user_context);
} catch (...) {
- gsl_EnsuresAudit(false); // ensure that the try-block never throws
+ EnsuresAudit(false); // ensure that the try-block never throws
return ExpressionPtr{nullptr};
}
}
diff --git a/src/buildtool/build_engine/base_maps/expression_map.hpp b/src/buildtool/build_engine/base_maps/expression_map.hpp
index d0d9af9c..4b2ebfb9 100644
--- a/src/buildtool/build_engine/base_maps/expression_map.hpp
+++ b/src/buildtool/build_engine/base_maps/expression_map.hpp
@@ -18,7 +18,7 @@
#include <memory>
#include <string>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/base_maps/entity_name.hpp"
#include "src/buildtool/build_engine/base_maps/expression_function.hpp"
diff --git a/src/buildtool/build_engine/base_maps/field_reader.hpp b/src/buildtool/build_engine/base_maps/field_reader.hpp
index fc764777..ba774e49 100644
--- a/src/buildtool/build_engine/base_maps/field_reader.hpp
+++ b/src/buildtool/build_engine/base_maps/field_reader.hpp
@@ -21,7 +21,7 @@
#include <vector>
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/base_maps/entity_name.hpp"
#include "src/buildtool/build_engine/expression/expression.hpp"
diff --git a/src/buildtool/build_engine/base_maps/json_file_map.hpp b/src/buildtool/build_engine/base_maps/json_file_map.hpp
index 412631ca..2fdd3f98 100644
--- a/src/buildtool/build_engine/base_maps/json_file_map.hpp
+++ b/src/buildtool/build_engine/base_maps/json_file_map.hpp
@@ -20,7 +20,7 @@
#include <string>
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/base_maps/module_name.hpp"
#include "src/buildtool/common/repository_config.hpp"
diff --git a/src/buildtool/build_engine/base_maps/rule_map.hpp b/src/buildtool/build_engine/base_maps/rule_map.hpp
index d60bfefd..ab9c0098 100644
--- a/src/buildtool/build_engine/base_maps/rule_map.hpp
+++ b/src/buildtool/build_engine/base_maps/rule_map.hpp
@@ -18,7 +18,7 @@
#include <memory>
#include <string>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/base_maps/entity_name.hpp"
#include "src/buildtool/build_engine/base_maps/expression_map.hpp"
diff --git a/src/buildtool/build_engine/base_maps/source_map.hpp b/src/buildtool/build_engine/base_maps/source_map.hpp
index 0f34f45b..899d9ce4 100644
--- a/src/buildtool/build_engine/base_maps/source_map.hpp
+++ b/src/buildtool/build_engine/base_maps/source_map.hpp
@@ -17,7 +17,7 @@
#include <unordered_set>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/analysed_target/analysed_target.hpp"
#include "src/buildtool/build_engine/base_maps/directory_map.hpp"
diff --git a/src/buildtool/build_engine/base_maps/user_rule.hpp b/src/buildtool/build_engine/base_maps/user_rule.hpp
index c1b6398c..58e5ca40 100644
--- a/src/buildtool/build_engine/base_maps/user_rule.hpp
+++ b/src/buildtool/build_engine/base_maps/user_rule.hpp
@@ -25,11 +25,12 @@
#include <vector>
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/build_engine/base_maps/entity_name.hpp"
#include "src/buildtool/build_engine/base_maps/expression_function.hpp"
#include "src/buildtool/build_engine/expression/expression.hpp"
#include "src/utils/cpp/concepts.hpp"
+#include "src/utils/cpp/gsl.hpp"
namespace BuildMaps::Base {
@@ -357,8 +358,8 @@ static auto inline FindDuplicates(gsl::not_null<T_Result*> const& dups,
T_First const& first,
T_Second const& second,
T_Rest const&... rest) -> void {
- gsl_ExpectsAudit(std::is_sorted(first.begin(), first.end()) and
- std::is_sorted(second.begin(), second.end()));
+ ExpectsAudit(std::is_sorted(first.begin(), first.end()) and
+ std::is_sorted(second.begin(), second.end()));
std::set_intersection(first.begin(),
first.end(),
second.begin(),
diff --git a/src/buildtool/build_engine/expression/TARGETS b/src/buildtool/build_engine/expression/TARGETS
index 5aa59941..ed888b25 100644
--- a/src/buildtool/build_engine/expression/TARGETS
+++ b/src/buildtool/build_engine/expression/TARGETS
@@ -49,7 +49,8 @@
, ["src/utils/cpp", "hash_combine"]
, ["src/utils/cpp", "hex_string"]
, ["src/utils/cpp", "concepts"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["src/utils/cpp", "gsl"]
+ , ["@", "gsl", "", "gsl"]
]
, "stage": ["src", "buildtool", "build_engine", "expression"]
, "private-deps":
diff --git a/src/buildtool/build_engine/expression/configuration.hpp b/src/buildtool/build_engine/expression/configuration.hpp
index 16afd81f..3e0328d8 100644
--- a/src/buildtool/build_engine/expression/configuration.hpp
+++ b/src/buildtool/build_engine/expression/configuration.hpp
@@ -19,16 +19,17 @@
#include <sstream>
#include <string>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/build_engine/expression/expression.hpp"
#include "src/utils/cpp/concepts.hpp"
+#include "src/utils/cpp/gsl.hpp"
// Decorator for Expression containing a map. Adds Prune() and Update().
class Configuration {
public:
explicit Configuration(ExpressionPtr expr) noexcept
: expr_{std::move(expr)} {
- gsl_ExpectsAudit(expr_->IsMap());
+ ExpectsAudit(expr_->IsMap());
}
explicit Configuration(Expression::map_t&& map) noexcept
: expr_{ExpressionPtr{std::move(map)}} {}
@@ -140,7 +141,7 @@ class Configuration {
}
[[nodiscard]] auto Update(ExpressionPtr const& map) const -> Configuration {
- gsl_ExpectsAudit(map->IsMap());
+ ExpectsAudit(map->IsMap());
if (map->Map().empty()) {
return *this;
}
diff --git a/src/buildtool/build_engine/expression/expression.cpp b/src/buildtool/build_engine/expression/expression.cpp
index 191af619..1cb27a69 100644
--- a/src/buildtool/build_engine/expression/expression.cpp
+++ b/src/buildtool/build_engine/expression/expression.cpp
@@ -21,9 +21,10 @@
#include <type_traits>
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/build_engine/expression/evaluator.hpp"
#include "src/buildtool/logging/logger.hpp"
+#include "src/utils/cpp/gsl.hpp"
#include "src/utils/cpp/json.hpp"
auto Expression::operator[](
@@ -208,7 +209,7 @@ auto Expression::FromJson(nlohmann::json const& json) noexcept
return ExpressionPtr{Expression::map_t{m}};
}
} catch (...) {
- gsl_EnsuresAudit(false); // ensure that the try-block never throws
+ EnsuresAudit(false); // ensure that the try-block never throws
}
return ExpressionPtr{nullptr};
}
diff --git a/src/buildtool/build_engine/expression/expression.hpp b/src/buildtool/build_engine/expression/expression.hpp
index 48bda6b6..5d84e131 100644
--- a/src/buildtool/build_engine/expression/expression.hpp
+++ b/src/buildtool/build_engine/expression/expression.hpp
@@ -25,7 +25,7 @@
#include <vector>
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/build_engine/base_maps/entity_name_data.hpp"
#include "src/buildtool/build_engine/expression/expression_ptr.hpp"
#include "src/buildtool/build_engine/expression/function_map.hpp"
diff --git a/src/buildtool/build_engine/expression/target_result.cpp b/src/buildtool/build_engine/expression/target_result.cpp
index 33df5dfb..8bd3cbaa 100644
--- a/src/buildtool/build_engine/expression/target_result.cpp
+++ b/src/buildtool/build_engine/expression/target_result.cpp
@@ -18,7 +18,7 @@
#include <unordered_set>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/build_engine/expression/expression.hpp"
#include "src/buildtool/logging/logger.hpp"
diff --git a/src/buildtool/build_engine/target_map/TARGETS b/src/buildtool/build_engine/target_map/TARGETS
index 54eb2e77..92c55cbd 100644
--- a/src/buildtool/build_engine/target_map/TARGETS
+++ b/src/buildtool/build_engine/target_map/TARGETS
@@ -23,7 +23,7 @@
, ["src/buildtool/multithreading", "task"]
, ["src/buildtool/multithreading", "task_system"]
, ["src/buildtool/progress_reporting", "progress"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/utils/cpp", "hash_combine"]
, ["src/buildtool/logging", "logging"]
, ["src/buildtool/common", "common"]
@@ -45,8 +45,9 @@
, ["src/buildtool/build_engine/base_maps", "source_map"]
, ["src/buildtool/build_engine/base_maps", "targets_file_map"]
, ["src/buildtool/multithreading", "async_map_consumer"]
+ , ["src/utils/cpp", "gsl"]
, ["@", "fmt", "", "fmt"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["@", "json", "", "json"]
]
, "stage": ["src", "buildtool", "build_engine", "target_map"]
diff --git a/src/buildtool/build_engine/target_map/built_in_rules.hpp b/src/buildtool/build_engine/target_map/built_in_rules.hpp
index d51f3a62..9eadfcb1 100644
--- a/src/buildtool/build_engine/target_map/built_in_rules.hpp
+++ b/src/buildtool/build_engine/target_map/built_in_rules.hpp
@@ -15,7 +15,7 @@
#ifndef INCLUDED_SRC_BUILDTOOL_BUILD_ENGINE_TARGET_MAP_BUILT_IN_RULES_HPP
#define INCLUDED_SRC_BUILDTOOL_BUILD_ENGINE_TARGET_MAP_BUILT_IN_RULES_HPP
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/target_map/configured_target.hpp"
#include "src/buildtool/build_engine/target_map/result_map.hpp"
diff --git a/src/buildtool/build_engine/target_map/export.hpp b/src/buildtool/build_engine/target_map/export.hpp
index b0d37a44..495b5ace 100644
--- a/src/buildtool/build_engine/target_map/export.hpp
+++ b/src/buildtool/build_engine/target_map/export.hpp
@@ -15,7 +15,7 @@
#ifndef INCLUDED_SRC_BUILDTOOL_BUILD_ENGINE_TARGET_MAP_EXPORT_HPP
#define INCLUDED_SRC_BUILDTOOL_BUILD_ENGINE_TARGET_MAP_EXPORT_HPP
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/target_map/configured_target.hpp"
#include "src/buildtool/build_engine/target_map/result_map.hpp"
diff --git a/src/buildtool/build_engine/target_map/result_map.hpp b/src/buildtool/build_engine/target_map/result_map.hpp
index 235b9cc3..f8b66958 100644
--- a/src/buildtool/build_engine/target_map/result_map.hpp
+++ b/src/buildtool/build_engine/target_map/result_map.hpp
@@ -24,7 +24,7 @@
#include <unordered_set>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/analysed_target/analysed_target.hpp"
#include "src/buildtool/build_engine/base_maps/entity_name.hpp"
@@ -68,14 +68,13 @@ class ResultTargetMap {
[[nodiscard]] auto Add(
BuildMaps::Base::EntityName name,
Configuration conf,
- gsl::not_null<AnalysedTargetPtr> result,
+ gsl::not_null<AnalysedTargetPtr> const& result,
std::optional<TargetCacheKey> target_cache_key = std::nullopt,
bool is_export_target = false) -> AnalysedTargetPtr {
auto part = std::hash<BuildMaps::Base::EntityName>{}(name) % width_;
std::unique_lock lock{m_[part]};
auto [entry, inserted] = targets_[part].emplace(
- ConfiguredTarget{std::move(name), std::move(conf)},
- std::move(result));
+ ConfiguredTarget{std::move(name), std::move(conf)}, result);
if (target_cache_key) {
cache_targets_[part].emplace(*target_cache_key, entry->second);
}
diff --git a/src/buildtool/build_engine/target_map/target_map.cpp b/src/buildtool/build_engine/target_map/target_map.cpp
index e441b705..2e788f7b 100644
--- a/src/buildtool/build_engine/target_map/target_map.cpp
+++ b/src/buildtool/build_engine/target_map/target_map.cpp
@@ -23,7 +23,7 @@
#include <fnmatch.h>
#include "fmt/format.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/base_maps/field_reader.hpp"
#include "src/buildtool/build_engine/expression/configuration.hpp"
@@ -33,6 +33,7 @@
#include "src/buildtool/build_engine/target_map/utils.hpp"
#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/logging/logger.hpp"
+#include "src/utils/cpp/gsl.hpp"
#include "src/utils/cpp/path.hpp"
#include "src/utils/cpp/vector.hpp"
@@ -249,8 +250,8 @@ void withDependencies(
std::vector<BuildMaps::Target::ConfiguredTargetPtr> declared_deps{};
std::vector<BuildMaps::Target::ConfiguredTargetPtr> implicit_deps{};
std::vector<BuildMaps::Target::ConfiguredTargetPtr> anonymous_deps{};
- gsl_ExpectsAudit(declared_count <= declared_and_implicit_count);
- gsl_ExpectsAudit(declared_and_implicit_count <= dependency_values.size());
+ ExpectsAudit(declared_count <= declared_and_implicit_count);
+ ExpectsAudit(declared_and_implicit_count <= dependency_values.size());
auto fill_target_graph = [&dependency_values](
size_t const a, size_t const b, auto* deps) {
std::transform(
diff --git a/src/buildtool/build_engine/target_map/target_map.hpp b/src/buildtool/build_engine/target_map/target_map.hpp
index 370f8e3d..4baf07e3 100644
--- a/src/buildtool/build_engine/target_map/target_map.hpp
+++ b/src/buildtool/build_engine/target_map/target_map.hpp
@@ -15,7 +15,7 @@
#ifndef INCLUDED_SRC_BUILDTOOL_BUILD_ENGINE_TARGET_MAP_TARGET_MAP_HPP
#define INCLUDED_SRC_BUILDTOOL_BUILD_ENGINE_TARGET_MAP_TARGET_MAP_HPP
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/build_engine/analysed_target/analysed_target.hpp"
#include "src/buildtool/build_engine/base_maps/rule_map.hpp"
#include "src/buildtool/build_engine/base_maps/source_map.hpp"
diff --git a/src/buildtool/build_engine/target_map/utils.hpp b/src/buildtool/build_engine/target_map/utils.hpp
index 5593535c..5ae77890 100644
--- a/src/buildtool/build_engine/target_map/utils.hpp
+++ b/src/buildtool/build_engine/target_map/utils.hpp
@@ -19,7 +19,7 @@
#include <unordered_map>
#include <variant>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/build_engine/analysed_target/analysed_target.hpp"
#include "src/buildtool/build_engine/base_maps/entity_name.hpp"
#include "src/buildtool/build_engine/base_maps/field_reader.hpp"
diff --git a/src/buildtool/common/TARGETS b/src/buildtool/common/TARGETS
index 568fe6cd..0640aae6 100644
--- a/src/buildtool/common/TARGETS
+++ b/src/buildtool/common/TARGETS
@@ -17,7 +17,7 @@
, ["@", "cli11", "", "cli11"]
, ["@", "json", "", "json"]
, ["@", "fmt", "", "fmt"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
]
, "stage": ["src", "buildtool", "common"]
}
@@ -44,6 +44,7 @@
, ["src/buildtool/file_system", "object_type"]
, ["src/buildtool/compatibility", "compatibility"]
, ["src/utils/cpp", "hash_combine"]
+ , ["src/utils/cpp", "gsl"]
, ["@", "json", "", "json"]
]
, "stage": ["src", "buildtool", "common"]
diff --git a/src/buildtool/common/artifact_description.hpp b/src/buildtool/common/artifact_description.hpp
index 5ec0f2ab..69dfef7e 100644
--- a/src/buildtool/common/artifact_description.hpp
+++ b/src/buildtool/common/artifact_description.hpp
@@ -139,7 +139,7 @@ class ArtifactDescription {
"Serializing to JSON failed with error:\n{}",
ex.what());
}
- gsl_Ensures(false); // unreachable
+ Ensures(false); // unreachable
return {};
}
@@ -165,7 +165,7 @@ class ArtifactDescription {
"Creating artifact failed with error:\n{}",
ex.what());
}
- gsl_Ensures(false); // unreachable
+ Ensures(false); // unreachable
return Artifact{{}};
}
diff --git a/src/buildtool/common/artifact_digest.hpp b/src/buildtool/common/artifact_digest.hpp
index 56488163..5b4589cd 100644
--- a/src/buildtool/common/artifact_digest.hpp
+++ b/src/buildtool/common/artifact_digest.hpp
@@ -18,11 +18,12 @@
#include <optional>
#include <string>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/bazel_types.hpp"
#include "src/buildtool/compatibility/native_support.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/file_system/object_type.hpp"
+#include "src/utils/cpp/gsl.hpp"
#include "src/utils/cpp/hash_combine.hpp"
// Provides getter for size with convenient non-protobuf type. Contains a
@@ -48,7 +49,7 @@ class ArtifactDigest {
// Tree information is only stored in a digest in native mode and
// false in compatible mode.
is_tree_{not Compatibility::IsCompatible() and is_tree} {
- gsl_ExpectsAudit(not NativeSupport::IsPrefixed(hash_));
+ ExpectsAudit(not NativeSupport::IsPrefixed(hash_));
}
[[nodiscard]] auto hash() const& noexcept -> std::string const& {
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp
index 9f5974d3..03f13bce 100644
--- a/src/buildtool/common/cli.hpp
+++ b/src/buildtool/common/cli.hpp
@@ -24,7 +24,7 @@
#include "CLI/CLI.hpp"
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/expression/evaluator.hpp"
#include "src/buildtool/common/clidefaults.hpp"
diff --git a/src/buildtool/compatibility/TARGETS b/src/buildtool/compatibility/TARGETS
index 93eedce0..18dac1c5 100644
--- a/src/buildtool/compatibility/TARGETS
+++ b/src/buildtool/compatibility/TARGETS
@@ -4,8 +4,9 @@
, "hdrs": ["compatibility.hpp", "native_support.hpp"]
, "deps":
[ ["src/buildtool/crypto", "hash_function"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/logging", "logging"]
+ , ["src/utils/cpp", "gsl"]
]
, "stage": ["src", "buildtool", "compatibility"]
}
diff --git a/src/buildtool/compatibility/native_support.hpp b/src/buildtool/compatibility/native_support.hpp
index cb7b147f..449117c9 100644
--- a/src/buildtool/compatibility/native_support.hpp
+++ b/src/buildtool/compatibility/native_support.hpp
@@ -17,9 +17,10 @@
#include <string>
-#include <gsl-lite/gsl-lite.hpp>
-
#include "src/buildtool/compatibility/compatibility.hpp"
+#include "src/utils/cpp/gsl.hpp"
+
+#include <gsl/gsl>
/// \brief Helper functions to support the native remote-execution protocol.
class NativeSupport {
@@ -44,7 +45,7 @@ class NativeSupport {
if (Compatibility::IsCompatible()) {
return hash;
}
- gsl_ExpectsAudit(not IsPrefixed(hash));
+ ExpectsAudit(not IsPrefixed(hash));
return (is_tree ? kTreeTag : kBlobTag) + hash;
}
@@ -53,7 +54,7 @@ class NativeSupport {
if (Compatibility::IsCompatible()) {
return hash;
}
- gsl_ExpectsAudit(IsPrefixed(hash));
+ ExpectsAudit(IsPrefixed(hash));
return hash.substr(kTagLength);
}
diff --git a/src/buildtool/crypto/TARGETS b/src/buildtool/crypto/TARGETS
index 9598206c..ab2d6b21 100644
--- a/src/buildtool/crypto/TARGETS
+++ b/src/buildtool/crypto/TARGETS
@@ -22,7 +22,7 @@
{ "type": ["@", "rules", "CC", "library"]
, "name": ["hash_function"]
, "hdrs": ["hash_function.hpp"]
- , "deps": ["hasher", ["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": ["hasher", ["@", "gsl", "", "gsl"]]
, "stage": ["src", "buildtool", "crypto"]
}
}
diff --git a/src/buildtool/crypto/hash_function.hpp b/src/buildtool/crypto/hash_function.hpp
index ac7cadcc..44341777 100644
--- a/src/buildtool/crypto/hash_function.hpp
+++ b/src/buildtool/crypto/hash_function.hpp
@@ -20,10 +20,10 @@
#include <optional>
#include <string>
-#include <gsl-lite/gsl-lite.hpp>
-
#include "src/buildtool/crypto/hasher.hpp"
+#include <gsl/gsl>
+
/// \brief Hash function used for the entire buildtool.
class HashFunction {
public:
@@ -71,7 +71,7 @@ class HashFunction {
case JustHash::Compatible:
return ::Hasher{Hasher::HashType::SHA256};
}
- gsl_Ensures(false); // unreachable
+ Ensures(false); // unreachable
}
private:
diff --git a/src/buildtool/execution_api/bazel_msg/TARGETS b/src/buildtool/execution_api/bazel_msg/TARGETS
index c83fac48..31bbc5df 100644
--- a/src/buildtool/execution_api/bazel_msg/TARGETS
+++ b/src/buildtool/execution_api/bazel_msg/TARGETS
@@ -12,6 +12,7 @@
, "private-deps":
[ ["src/buildtool/crypto", "hash_function"]
, ["src/buildtool/file_system", "git_cas"]
+ , ["src/utils/cpp", "gsl"]
]
}
, "bazel_msg_factory":
@@ -30,7 +31,7 @@
, "private-deps":
[ ["src/buildtool/compatibility", "compatibility"]
, ["src/utils/cpp", "hex_string"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/file_system", "file_system_manager"]
]
, "stage": ["src", "buildtool", "execution_api", "bazel_msg"]
@@ -41,7 +42,7 @@
, "hdrs": ["directory_tree.hpp"]
, "srcs": ["directory_tree.cpp"]
, "deps":
- [ ["@", "gsl-lite", "", "gsl-lite"]
+ [ ["@", "gsl", "", "gsl"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/execution_engine/dag", "dag"]
]
@@ -59,7 +60,7 @@
, "deps":
[ "bazel_msg"
, "directory_tree"
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/compatibility", "compatibility"]
]
, "private-deps":
diff --git a/src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp b/src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp
index 5ebc72bd..50552126 100644
--- a/src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp
+++ b/src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp
@@ -21,7 +21,7 @@
#include <utility>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/execution_api/bazel_msg/bazel_blob.hpp"
#include "src/utils/cpp/concepts.hpp"
@@ -168,7 +168,7 @@ class BlobContainer {
public:
explicit digest_to_blob(
gsl::not_null<underlaying_map_t const*> blobs) noexcept
- : blobs_{std::move(blobs)} {}
+ : blobs_{blobs} {}
digest_to_blob(digest_to_blob const& other) noexcept = default;
digest_to_blob(digest_to_blob&& other) noexcept = default;
~digest_to_blob() noexcept = default;
diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
index c89a6323..5f392483 100644
--- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
+++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
@@ -24,7 +24,7 @@
#include <string>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/bazel_types.hpp"
#include "src/buildtool/compatibility/native_support.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
diff --git a/src/buildtool/execution_api/bazel_msg/blob_tree.hpp b/src/buildtool/execution_api/bazel_msg/blob_tree.hpp
index 786e3c55..781150da 100644
--- a/src/buildtool/execution_api/bazel_msg/blob_tree.hpp
+++ b/src/buildtool/execution_api/bazel_msg/blob_tree.hpp
@@ -21,7 +21,7 @@
#include <utility>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/compatibility/native_support.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_blob.hpp"
#include "src/buildtool/execution_api/bazel_msg/directory_tree.hpp"
@@ -34,12 +34,7 @@ using BlobTreePtr = gsl::not_null<std::shared_ptr<BlobTree>>;
class BlobTree {
public:
BlobTree(BazelBlob blob, std::vector<BlobTreePtr> nodes)
- : blob_{std::move(blob)} {
- nodes_.reserve(nodes.size());
- for (auto& node : nodes) {
- nodes_.emplace_back(std::move(node));
- }
- }
+ : blob_{std::move(blob)}, nodes_{std::move(nodes)} {}
[[nodiscard]] auto Blob() const noexcept -> BazelBlob { return blob_; }
[[nodiscard]] auto IsTree() const noexcept -> bool {
diff --git a/src/buildtool/execution_api/bazel_msg/directory_tree.cpp b/src/buildtool/execution_api/bazel_msg/directory_tree.cpp
index a7951f90..25e17ee6 100644
--- a/src/buildtool/execution_api/bazel_msg/directory_tree.cpp
+++ b/src/buildtool/execution_api/bazel_msg/directory_tree.cpp
@@ -17,6 +17,7 @@
#include "src/buildtool/common/artifact_digest.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/logging/logger.hpp"
+#include "src/utils/cpp/gsl.hpp"
auto DirectoryTree::AddArtifact(std::filesystem::path const& path,
Artifact const* artifact) noexcept -> bool {
@@ -53,7 +54,7 @@ auto DirectoryTree::FromNamedArtifacts(
auto DirectoryTree::AddArtifact(std::filesystem::path::iterator* begin,
std::filesystem::path::iterator const& end,
Artifact const* artifact) -> bool {
- gsl_ExpectsAudit(std::distance(*begin, end) > 0);
+ ExpectsAudit(std::distance(*begin, end) > 0);
auto segment = *((*begin)++);
if (segment == "." or segment == "..") { // fail on "." and ".."
return false;
diff --git a/src/buildtool/execution_api/bazel_msg/directory_tree.hpp b/src/buildtool/execution_api/bazel_msg/directory_tree.hpp
index 968c8899..5436be9e 100644
--- a/src/buildtool/execution_api/bazel_msg/directory_tree.hpp
+++ b/src/buildtool/execution_api/bazel_msg/directory_tree.hpp
@@ -23,7 +23,7 @@
#include <variant>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/artifact.hpp"
#include "src/buildtool/execution_engine/dag/dag.hpp"
diff --git a/src/buildtool/execution_api/common/TARGETS b/src/buildtool/execution_api/common/TARGETS
index 2c7ca6cf..4e4bf796 100644
--- a/src/buildtool/execution_api/common/TARGETS
+++ b/src/buildtool/execution_api/common/TARGETS
@@ -8,12 +8,13 @@
, "execution_response.hpp"
]
, "deps":
- [ ["@", "gsl-lite", "", "gsl-lite"]
+ [ ["@", "gsl", "", "gsl"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/crypto", "hash_function"]
, ["src/buildtool/execution_api/bazel_msg", "bazel_msg"]
, ["src/buildtool/execution_api/bazel_msg", "bazel_msg_factory"]
, ["src/utils/cpp", "hex_string"]
+ , ["src/utils/cpp", "gsl"]
, ["src/buildtool/logging", "logging"]
]
, "stage": ["src", "buildtool", "execution_api", "common"]
diff --git a/src/buildtool/execution_api/common/execution_action.hpp b/src/buildtool/execution_api/common/execution_action.hpp
index d3089f81..649c634c 100644
--- a/src/buildtool/execution_api/common/execution_action.hpp
+++ b/src/buildtool/execution_api/common/execution_action.hpp
@@ -18,7 +18,7 @@
#include <chrono>
#include <memory>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/execution_api/common/execution_response.hpp"
class Logger;
diff --git a/src/buildtool/execution_api/common/execution_api.hpp b/src/buildtool/execution_api/common/execution_api.hpp
index ffa31483..7a301f71 100644
--- a/src/buildtool/execution_api/common/execution_api.hpp
+++ b/src/buildtool/execution_api/common/execution_api.hpp
@@ -21,7 +21,7 @@
#include <utility>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/artifact.hpp" // Artifact::ObjectInfo
#include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp"
diff --git a/src/buildtool/execution_api/common/execution_common.hpp b/src/buildtool/execution_api/common/execution_common.hpp
index 51e62455..d9aea07f 100644
--- a/src/buildtool/execution_api/common/execution_common.hpp
+++ b/src/buildtool/execution_api/common/execution_common.hpp
@@ -30,9 +30,10 @@
#include <string>
#include <thread>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/logging/logger.hpp"
+#include "src/utils/cpp/gsl.hpp"
#include "src/utils/cpp/hex_string.hpp"
/// \brief Create unique ID for current process and thread.
@@ -80,7 +81,7 @@ static void EncodeUUIDVersion4(std::string* uuid) {
constexpr auto kVersionByte = 6UL;
constexpr auto kVersionBits = 0x40U; // version 4: 0100 xxxx
constexpr auto kClearMask = 0x0fU;
- gsl_Expects(uuid->size() >= kVersionByte);
+ Expects(uuid->size() >= kVersionByte);
auto& byte = uuid->at(kVersionByte);
byte = static_cast<char>(kVersionBits |
(kClearMask & static_cast<std::uint8_t>(byte)));
@@ -90,7 +91,7 @@ static void EncodeUUIDVariant1(std::string* uuid) {
constexpr auto kVariantByte = 8UL;
constexpr auto kVariantBits = 0x80U; // variant 1: 10xx xxxx
constexpr auto kClearMask = 0x3fU;
- gsl_Expects(uuid->size() >= kVariantByte);
+ Expects(uuid->size() >= kVariantByte);
auto& byte = uuid->at(kVariantByte);
byte = static_cast<char>(kVariantBits |
(kClearMask & static_cast<std::uint8_t>(byte)));
@@ -106,7 +107,7 @@ static void EncodeUUIDVariant1(std::string* uuid) {
auto uuid = HashFunction::ComputeHash(value).Bytes();
EncodeUUIDVersion4(&uuid);
EncodeUUIDVariant1(&uuid);
- gsl_Expects(uuid.size() >= kRawLength);
+ Expects(uuid.size() >= kRawLength);
std::size_t cur{};
std::ostringstream ss{};
@@ -116,7 +117,7 @@ static void EncodeUUIDVariant1(std::string* uuid) {
cur = pos;
}
ss << uuid_hex.substr(cur);
- gsl_EnsuresAudit(ss.str().size() == (2 * kRawLength) + kHexDashPos.size());
+ EnsuresAudit(ss.str().size() == (2 * kRawLength) + kHexDashPos.size());
return ss.str();
}
diff --git a/src/buildtool/execution_api/common/execution_response.hpp b/src/buildtool/execution_api/common/execution_response.hpp
index deb8186f..a08134dd 100644
--- a/src/buildtool/execution_api/common/execution_response.hpp
+++ b/src/buildtool/execution_api/common/execution_response.hpp
@@ -20,7 +20,7 @@
#include <unordered_map>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/artifact.hpp"
/// \brief Abstract response.
diff --git a/src/buildtool/execution_api/execution_service/TARGETS b/src/buildtool/execution_api/execution_service/TARGETS
index 7227c8e4..26bf08e7 100644
--- a/src/buildtool/execution_api/execution_service/TARGETS
+++ b/src/buildtool/execution_api/execution_service/TARGETS
@@ -13,7 +13,7 @@
]
, "private-deps":
[ ["@", "fmt", "", "fmt"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/storage", "storage"]
, ["src/buildtool/file_system", "file_system_manager"]
, "operation_cache"
diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp
index ed22e023..c34201a1 100644
--- a/src/buildtool/execution_api/execution_service/execution_server.cpp
+++ b/src/buildtool/execution_api/execution_service/execution_server.cpp
@@ -22,7 +22,7 @@
#include "execution_server.hpp"
#include "fmt/format.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/execution_api/execution_service/operation_cache.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/storage/garbage_collector.hpp"
diff --git a/src/buildtool/execution_api/git/TARGETS b/src/buildtool/execution_api/git/TARGETS
index ca0f09bc..bed87ae8 100644
--- a/src/buildtool/execution_api/git/TARGETS
+++ b/src/buildtool/execution_api/git/TARGETS
@@ -3,7 +3,7 @@
, "name": ["git"]
, "hdrs": ["git_api.hpp"]
, "deps":
- [ ["@", "gsl-lite", "", "gsl-lite"]
+ [ ["@", "gsl", "", "gsl"]
, ["src/buildtool/common", "config"]
, ["src/buildtool/execution_api/bazel_msg", "bazel_msg_factory"]
, ["src/buildtool/execution_api/common", "common"]
diff --git a/src/buildtool/execution_api/git/git_api.hpp b/src/buildtool/execution_api/git/git_api.hpp
index 67207b79..2844d492 100644
--- a/src/buildtool/execution_api/git/git_api.hpp
+++ b/src/buildtool/execution_api/git/git_api.hpp
@@ -17,7 +17,7 @@
#include <cstdio>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/repository_config.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp"
#include "src/buildtool/execution_api/common/execution_api.hpp"
diff --git a/src/buildtool/execution_api/local/TARGETS b/src/buildtool/execution_api/local/TARGETS
index 3109afca..b9e056b8 100644
--- a/src/buildtool/execution_api/local/TARGETS
+++ b/src/buildtool/execution_api/local/TARGETS
@@ -5,7 +5,7 @@
, "deps":
[ ["@", "fmt", "", "fmt"]
, ["@", "json", "", "json"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/file_system", "object_type"]
@@ -25,7 +25,7 @@
, "srcs": ["local_action.cpp"]
, "deps":
[ ["@", "fmt", "", "fmt"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/storage", "storage"]
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/execution_api/bazel_msg", "bazel_msg_factory"]
diff --git a/src/buildtool/execution_api/local/config.hpp b/src/buildtool/execution_api/local/config.hpp
index a1882776..9257b758 100644
--- a/src/buildtool/execution_api/local/config.hpp
+++ b/src/buildtool/execution_api/local/config.hpp
@@ -20,7 +20,6 @@
#include <string>
#include <vector>
-#include <gsl-lite/gsl-lite.hpp>
#include <nlohmann/json.hpp>
#include "src/buildtool/common/artifact_digest.hpp"
@@ -29,6 +28,8 @@
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
+#include <gsl/gsl>
+
/// \brief Store global build system configuration.
class LocalExecutionConfig {
struct ConfigData {
diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp
index 209c6a5d..764c00aa 100644
--- a/src/buildtool/execution_api/local/local_action.cpp
+++ b/src/buildtool/execution_api/local/local_action.cpp
@@ -17,7 +17,7 @@
#include <algorithm>
#include <filesystem>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/bazel_types.hpp"
#include "src/buildtool/compatibility/native_support.hpp"
#include "src/buildtool/execution_api/local/config.hpp"
diff --git a/src/buildtool/execution_api/local/local_action.hpp b/src/buildtool/execution_api/local/local_action.hpp
index 4fba44ba..a49060e4 100644
--- a/src/buildtool/execution_api/local/local_action.hpp
+++ b/src/buildtool/execution_api/local/local_action.hpp
@@ -59,14 +59,14 @@ class LocalAction final : public IExecutionAction {
std::chrono::milliseconds timeout_{kDefaultTimeout};
CacheFlag cache_flag_{CacheFlag::CacheOutput};
- LocalAction(gsl::not_null<Storage const*> storage,
+ LocalAction(gsl::not_null<Storage const*> const& storage,
ArtifactDigest root_digest,
std::vector<std::string> command,
std::vector<std::string> output_files,
std::vector<std::string> output_dirs,
std::map<std::string, std::string> env_vars,
std::map<std::string, std::string> const& properties) noexcept
- : storage_{std::move(storage)},
+ : storage_{storage},
root_digest_{std::move(root_digest)},
cmdline_{std::move(command)},
output_files_{std::move(output_files)},
diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp
index c40f8471..577d771b 100644
--- a/src/buildtool/execution_api/local/local_api.hpp
+++ b/src/buildtool/execution_api/local/local_api.hpp
@@ -23,7 +23,7 @@
#include <vector>
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/compatibility/compatibility.hpp"
#include "src/buildtool/compatibility/native_support.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_blob.hpp"
diff --git a/src/buildtool/execution_api/local/local_response.hpp b/src/buildtool/execution_api/local/local_response.hpp
index 93b12009..2875ec16 100644
--- a/src/buildtool/execution_api/local/local_response.hpp
+++ b/src/buildtool/execution_api/local/local_response.hpp
@@ -105,12 +105,13 @@ class LocalResponse final : public IExecutionResponse {
LocalAction::Output output_{};
gsl::not_null<Storage const*> storage_;
- explicit LocalResponse(std::string action_id,
- LocalAction::Output output,
- gsl::not_null<Storage const*> storage) noexcept
+ explicit LocalResponse(
+ std::string action_id,
+ LocalAction::Output output,
+ gsl::not_null<Storage const*> const& storage) noexcept
: action_id_{std::move(action_id)},
output_{std::move(output)},
- storage_{std::move(storage)} {}
+ storage_{storage} {}
};
#endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_LOCAL_LOCAL_RESPONSE_HPP
diff --git a/src/buildtool/execution_api/remote/TARGETS b/src/buildtool/execution_api/remote/TARGETS
index 68ff94b3..5a462481 100644
--- a/src/buildtool/execution_api/remote/TARGETS
+++ b/src/buildtool/execution_api/remote/TARGETS
@@ -23,11 +23,12 @@
[ "config"
, ["src/buildtool/logging", "logging"]
, ["src/buildtool/execution_api/common", "common"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/common", "bazel_types"]
, ["src/buildtool/execution_api/bazel_msg", "bazel_msg"]
, ["src/buildtool/auth", "auth"]
, ["src/buildtool/execution_api/common", "bytestream-common"]
+ , ["src/utils/cpp", "gsl"]
]
, "proto":
[ ["@", "bazel_remote_apis", "", "remote_execution_proto"]
@@ -52,7 +53,7 @@
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/execution_api/bazel_msg", "bazel_msg"]
, ["src/buildtool/execution_api/bazel_msg", "blob_tree"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/common", "common"]
]
, "stage": ["src", "buildtool", "execution_api", "remote"]
@@ -69,7 +70,7 @@
, "deps":
[ ["src/buildtool/logging", "logging"]
, ["src/utils/cpp", "type_safe_arithmetic"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
]
, "stage": ["src", "buildtool", "execution_api", "remote"]
}
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_ac_client.cpp b/src/buildtool/execution_api/remote/bazel/bazel_ac_client.cpp
index 74542453..85759ec1 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_ac_client.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_ac_client.cpp
@@ -14,7 +14,7 @@
#include "src/buildtool/execution_api/remote/bazel/bazel_ac_client.hpp"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/bazel_types.hpp"
#include "src/buildtool/execution_api/remote/bazel/bazel_client_common.hpp"
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.hpp b/src/buildtool/execution_api/remote/bazel/bazel_api.hpp
index 111a09cf..6edfae5f 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_api.hpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_api.hpp
@@ -20,7 +20,7 @@
#include <utility>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/artifact_digest.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_common.hpp"
#include "src/buildtool/execution_api/bazel_msg/blob_tree.hpp"
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
index 6dd2e9e3..0c59c83d 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
@@ -15,7 +15,7 @@
#include "src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp"
#include "grpcpp/grpcpp.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/bazel_types.hpp"
#include "src/buildtool/execution_api/common/execution_common.hpp"
#include "src/buildtool/execution_api/remote/bazel/bazel_client_common.hpp"
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp
index b1244e0c..365998a7 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp
@@ -15,7 +15,7 @@
#include "src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp"
#include "grpcpp/grpcpp.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/execution_api/remote/bazel/bazel_client_common.hpp"
namespace bazel_re = build::bazel::remote::execution::v2;
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network.cpp b/src/buildtool/execution_api/remote/bazel/bazel_network.cpp
index c92164ba..159a848e 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_network.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_network.cpp
@@ -120,50 +120,53 @@ auto BazelNetwork::IsAvailable(std::vector<bazel_re::Digest> const& digests)
template <class T_Iter>
auto BazelNetwork::DoUploadBlobs(T_Iter const& first,
T_Iter const& last) noexcept -> bool {
- auto num_blobs = gsl::narrow<std::size_t>(std::distance(first, last));
-
- std::vector<bazel_re::Digest> digests{};
- digests.reserve(num_blobs);
-
- auto begin = first;
- auto current = first;
- std::size_t transfer_size{};
- while (current != last) {
- auto const& blob = *current;
- transfer_size += blob.data.size();
- if (transfer_size > kMaxBatchTransferSize) {
- if (begin == current) {
- if (cas_->UpdateSingleBlob(instance_name_, blob)) {
- digests.emplace_back(blob.digest);
+ try {
+ auto num_blobs = gsl::narrow<std::size_t>(std::distance(first, last));
+
+ std::vector<bazel_re::Digest> digests{};
+ digests.reserve(num_blobs);
+
+ auto begin = first;
+ auto current = first;
+ std::size_t transfer_size{};
+ while (current != last) {
+ auto const& blob = *current;
+ transfer_size += blob.data.size();
+ if (transfer_size > kMaxBatchTransferSize) {
+ if (begin == current) {
+ if (cas_->UpdateSingleBlob(instance_name_, blob)) {
+ digests.emplace_back(blob.digest);
+ }
+ ++current;
}
- ++current;
+ else {
+ for (auto& digest : cas_->BatchUpdateBlobs(
+ instance_name_, begin, current)) {
+ digests.emplace_back(std::move(digest));
+ }
+ }
+ begin = current;
+ transfer_size = 0;
}
else {
- for (auto& digest :
- cas_->BatchUpdateBlobs(instance_name_, begin, current)) {
- digests.emplace_back(std::move(digest));
- }
+ ++current;
}
- begin = current;
- transfer_size = 0;
- }
- else {
- ++current;
}
- }
- if (begin != current) {
- for (auto& digest :
- cas_->BatchUpdateBlobs(instance_name_, begin, current)) {
- digests.emplace_back(std::move(digest));
+ if (begin != current) {
+ for (auto& digest :
+ cas_->BatchUpdateBlobs(instance_name_, begin, current)) {
+ digests.emplace_back(std::move(digest));
+ }
}
- }
- if (digests.size() != num_blobs) {
- Logger::Log(LogLevel::Warning, "Failed to update all blobs");
- return false;
+ if (digests.size() == num_blobs) {
+ return true;
+ }
+ } catch (...) {
}
- return true;
+ Logger::Log(LogLevel::Warning, "Failed to update all blobs");
+ return false;
}
auto BazelNetwork::UploadBlobs(BlobContainer const& blobs,
@@ -206,31 +209,37 @@ auto BazelNetwork::BlobReader::Next() noexcept -> std::vector<BazelBlob> {
std::size_t size{};
std::vector<BazelBlob> blobs{};
- while (current_ != ids_.end()) {
- auto blob_size = gsl::narrow<std::size_t>(current_->size_bytes());
- size += blob_size;
- // read if size is 0 (unknown) or exceeds transfer size
- if (blob_size == 0 or size > kMaxBatchTransferSize) {
- // perform read of range [begin_, current_)
- if (begin_ == current_) {
- auto blob = cas_->ReadSingleBlob(instance_name_, *begin_);
- if (blob) {
- blobs.emplace_back(std::move(*blob));
+ try {
+ while (current_ != ids_.end()) {
+ auto blob_size = gsl::narrow<std::size_t>(current_->size_bytes());
+ size += blob_size;
+ // read if size is 0 (unknown) or exceeds transfer size
+ if (blob_size == 0 or size > kMaxBatchTransferSize) {
+ // perform read of range [begin_, current_)
+ if (begin_ == current_) {
+ auto blob = cas_->ReadSingleBlob(instance_name_, *begin_);
+ if (blob) {
+ blobs.emplace_back(std::move(*blob));
+ }
+ ++current_;
}
- ++current_;
- }
- else {
- blobs = cas_->BatchReadBlobs(instance_name_, begin_, current_);
+ else {
+ blobs =
+ cas_->BatchReadBlobs(instance_name_, begin_, current_);
+ }
+ begin_ = current_;
+ break;
}
- begin_ = current_;
- break;
+ ++current_;
}
- ++current_;
- }
- if (begin_ != current_) {
- blobs = cas_->BatchReadBlobs(instance_name_, begin_, current_);
- begin_ = current_;
+ if (begin_ != current_) {
+ blobs = cas_->BatchReadBlobs(instance_name_, begin_, current_);
+ begin_ = current_;
+ }
+ } catch (std::exception const& e) {
+ Logger::Log(LogLevel::Error, "Reading blobs failed with: {}", e.what());
+ Ensures(false);
}
return blobs;
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp
index e2c1a065..c1ae34ad 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp
@@ -46,10 +46,10 @@ class BazelNetwork {
std::vector<bazel_re::Digest>::const_iterator current_;
BlobReader(std::string instance_name,
- gsl::not_null<BazelCasClient*> cas,
+ gsl::not_null<BazelCasClient*> const& cas,
std::vector<bazel_re::Digest> ids)
: instance_name_{std::move(instance_name)},
- cas_{std::move(cas)},
+ cas_{cas},
ids_{std::move(ids)},
begin_{ids_.begin()},
current_{begin_} {};
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
index ddebd648..d45d9aa1 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
@@ -14,10 +14,11 @@
#include "src/buildtool/execution_api/remote/bazel/bazel_response.hpp"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/compatibility/native_support.hpp"
#include "src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp"
#include "src/buildtool/logging/logger.hpp"
+#include "src/utils/cpp/gsl.hpp"
namespace {
@@ -63,7 +64,7 @@ auto BazelResponse::Artifacts() const noexcept -> ArtifactInfos {
if (not Compatibility::IsCompatible()) {
// in native mode: just collect and store tree digests
for (auto const& tree : action_result.output_directories()) {
- gsl_ExpectsAudit(NativeSupport::IsTree(tree.tree_digest().hash()));
+ ExpectsAudit(NativeSupport::IsTree(tree.tree_digest().hash()));
try {
artifacts.emplace(
tree.path(),
diff --git a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp
index 79905b39..b9a55707 100644
--- a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp
+++ b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp
@@ -99,56 +99,61 @@ class ByteStreamClient {
[[nodiscard]] auto Write(std::string const& resource_name,
std::string const& data) const noexcept -> bool {
- grpc::ClientContext ctx;
- google::bytestream::WriteResponse response{};
- auto writer = stub_->Write(&ctx, &response);
-
- auto* allocated_data =
- std::make_unique<std::string>(kChunkSize, '\0').release();
- google::bytestream::WriteRequest request{};
- request.set_resource_name(resource_name);
- request.set_allocated_data(allocated_data);
- std::size_t pos{};
- do {
- auto const size = std::min(data.size() - pos, kChunkSize);
- allocated_data->resize(size);
- data.copy(allocated_data->data(), size, pos);
- request.set_write_offset(static_cast<int>(pos));
- request.set_finish_write(pos + size >= data.size());
- if (not writer->Write(request)) {
- // According to the docs, quote:
- // If there is an error or the connection is broken during the
- // `Write()`, the client should check the status of the
- // `Write()` by calling `QueryWriteStatus()` and continue
- // writing from the returned `committed_size`.
- auto const committed_size = QueryWriteStatus(resource_name);
- if (committed_size <= 0) {
- logger_.Emit(LogLevel::Error,
- "broken stream for upload to resource name {}",
- resource_name);
- return false;
+ try {
+ grpc::ClientContext ctx;
+ google::bytestream::WriteResponse response{};
+ auto writer = stub_->Write(&ctx, &response);
+
+ auto* allocated_data =
+ std::make_unique<std::string>(kChunkSize, '\0').release();
+ google::bytestream::WriteRequest request{};
+ request.set_resource_name(resource_name);
+ request.set_allocated_data(allocated_data);
+ std::size_t pos{};
+ do {
+ auto const size = std::min(data.size() - pos, kChunkSize);
+ allocated_data->resize(size);
+ data.copy(allocated_data->data(), size, pos);
+ request.set_write_offset(static_cast<int>(pos));
+ request.set_finish_write(pos + size >= data.size());
+ if (not writer->Write(request)) {
+ // According to the docs, quote:
+ // If there is an error or the connection is broken during
+ // the `Write()`, the client should check the status of the
+ // `Write()` by calling `QueryWriteStatus()` and continue
+ // writing from the returned `committed_size`.
+ auto const committed_size = QueryWriteStatus(resource_name);
+ if (committed_size <= 0) {
+ logger_.Emit(
+ LogLevel::Error,
+ "broken stream for upload to resource name {}",
+ resource_name);
+ return false;
+ }
+ pos = gsl::narrow<std::size_t>(committed_size);
+ }
+ else {
+ pos += kChunkSize;
}
- pos = gsl::narrow<std::size_t>(committed_size);
+ } while (pos < data.size());
+ if (not writer->WritesDone()) {
+ logger_.Emit(LogLevel::Error,
+ "broken stream for upload to resource name {}",
+ resource_name);
+ return false;
}
- else {
- pos += kChunkSize;
+
+ auto status = writer->Finish();
+ if (not status.ok()) {
+ LogStatus(&logger_, LogLevel::Error, status);
+ return false;
}
- } while (pos < data.size());
- if (not writer->WritesDone()) {
- logger_.Emit(LogLevel::Error,
- "broken stream for upload to resource name {}",
- resource_name);
- return false;
- }
- auto status = writer->Finish();
- if (not status.ok()) {
- LogStatus(&logger_, LogLevel::Error, status);
+ return gsl::narrow<std::size_t>(response.committed_size()) ==
+ data.size();
+ } catch (...) {
return false;
}
-
- return gsl::narrow<std::size_t>(response.committed_size()) ==
- data.size();
}
template <class T_Input>
diff --git a/src/buildtool/execution_api/remote/config.hpp b/src/buildtool/execution_api/remote/config.hpp
index b37e9f73..b10c3b23 100644
--- a/src/buildtool/execution_api/remote/config.hpp
+++ b/src/buildtool/execution_api/remote/config.hpp
@@ -23,7 +23,7 @@
#include <string>
#include <utility>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/logging/logger.hpp"
#include "src/utils/cpp/type_safe_arithmetic.hpp"
diff --git a/src/buildtool/execution_engine/dag/TARGETS b/src/buildtool/execution_engine/dag/TARGETS
index ae60499d..e4fb5bed 100644
--- a/src/buildtool/execution_engine/dag/TARGETS
+++ b/src/buildtool/execution_engine/dag/TARGETS
@@ -9,7 +9,7 @@
, ["src/buildtool/common", "action_description"]
, ["src/buildtool/common", "artifact_description"]
, ["src/buildtool/file_system", "object_type"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
]
, "stage": ["src", "buildtool", "execution_engine", "dag"]
, "private-deps": [["src/buildtool/logging", "logging"]]
diff --git a/src/buildtool/execution_engine/dag/dag.hpp b/src/buildtool/execution_engine/dag/dag.hpp
index 1a00f6a5..93746b3e 100644
--- a/src/buildtool/execution_engine/dag/dag.hpp
+++ b/src/buildtool/execution_engine/dag/dag.hpp
@@ -27,7 +27,7 @@
#include <variant>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/action.hpp"
#include "src/buildtool/common/action_description.hpp"
#include "src/buildtool/common/artifact.hpp"
@@ -293,7 +293,7 @@ class DependencyGraph : DirectedAcyclicGraph {
public:
using base::base;
- using Ptr = gsl::not_null<std::unique_ptr<ActionNode>>;
+ using Ptr = std::unique_ptr<ActionNode>;
struct NamedOtherNodePtr {
Action::LocalPath path;
base::OtherNodePtr node;
@@ -474,7 +474,7 @@ class DependencyGraph : DirectedAcyclicGraph {
using base::base;
using typename base::OtherNode;
using typename base::OtherNodePtr;
- using Ptr = gsl::not_null<std::unique_ptr<ArtifactNode>>;
+ using Ptr = std::unique_ptr<ArtifactNode>;
[[nodiscard]] static auto Create(Artifact const& content) noexcept
-> Ptr {
diff --git a/src/buildtool/execution_engine/executor/TARGETS b/src/buildtool/execution_engine/executor/TARGETS
index 45f8a31c..c8c62b8d 100644
--- a/src/buildtool/execution_engine/executor/TARGETS
+++ b/src/buildtool/execution_engine/executor/TARGETS
@@ -12,7 +12,7 @@
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/progress_reporting", "progress"]
, ["src/utils/cpp", "hex_string"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/common", "common"]
]
, "stage": ["src", "buildtool", "execution_engine", "executor"]
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp
index baf0be12..64494715 100644
--- a/src/buildtool/execution_engine/executor/executor.hpp
+++ b/src/buildtool/execution_engine/executor/executor.hpp
@@ -24,7 +24,7 @@
#include <type_traits>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/repository_config.hpp"
#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/common/tree.hpp"
diff --git a/src/buildtool/execution_engine/traverser/TARGETS b/src/buildtool/execution_engine/traverser/TARGETS
index a3cbac05..d757d216 100644
--- a/src/buildtool/execution_engine/traverser/TARGETS
+++ b/src/buildtool/execution_engine/traverser/TARGETS
@@ -7,7 +7,7 @@
, ["src/buildtool/multithreading", "task_system"]
, ["src/buildtool/logging", "logging"]
, ["src/utils/cpp", "concepts"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
]
, "stage": ["src", "buildtool", "execution_engine", "traverser"]
}
diff --git a/src/buildtool/execution_engine/traverser/traverser.hpp b/src/buildtool/execution_engine/traverser/traverser.hpp
index 2567f3a4..bc09dc72 100644
--- a/src/buildtool/execution_engine/traverser/traverser.hpp
+++ b/src/buildtool/execution_engine/traverser/traverser.hpp
@@ -17,7 +17,7 @@
#include <atomic>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/execution_engine/dag/dag.hpp"
#include "src/buildtool/logging/logger.hpp"
#include "src/buildtool/multithreading/task_system.hpp"
@@ -46,11 +46,8 @@ class Traverser {
Traverser(Executor const& r,
DependencyGraph const& graph,
std::size_t jobs,
- gsl::not_null<std::atomic<bool>*> fail_flag)
- : runner_{r},
- graph_{graph},
- failed_{std::move(fail_flag)},
- tasker_{jobs} {}
+ gsl::not_null<std::atomic<bool>*> const& fail_flag)
+ : runner_{r}, graph_{graph}, failed_{fail_flag}, tasker_{jobs} {}
Traverser() = delete;
Traverser(Traverser const&) = delete;
Traverser(Traverser&&) = delete;
diff --git a/src/buildtool/file_system/TARGETS b/src/buildtool/file_system/TARGETS
index 866660db..8d2f524b 100644
--- a/src/buildtool/file_system/TARGETS
+++ b/src/buildtool/file_system/TARGETS
@@ -2,7 +2,7 @@
{ "type": ["@", "rules", "CC", "library"]
, "name": ["object_type"]
, "hdrs": ["object_type.hpp"]
- , "deps": [["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": [["@", "gsl", "", "gsl"]]
, "stage": ["src", "buildtool", "file_system"]
}
, "file_storage":
@@ -36,7 +36,7 @@
[ "object_type"
, ["src/buildtool/logging", "logging"]
, ["src/buildtool/system", "system"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
]
, "stage": ["src", "buildtool", "file_system"]
}
@@ -52,7 +52,7 @@
, "name": ["git_cas"]
, "hdrs": ["git_cas.hpp"]
, "srcs": ["git_cas.cpp"]
- , "deps": ["git_context", "git_utils", ["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": ["git_context", "git_utils", ["@", "gsl", "", "gsl"]]
, "stage": ["src", "buildtool", "file_system"]
, "private-deps":
[ ["src/buildtool/logging", "logging"]
@@ -70,7 +70,7 @@
, "object_type"
, ["src/buildtool/multithreading", "atomic_value"]
, ["src/utils/cpp", "hex_string"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
]
, "stage": ["src", "buildtool", "file_system"]
, "private-deps":
@@ -99,6 +99,7 @@
, ["", "libgit2"]
, ["src/utils/cpp", "path"]
, ["src/utils/cpp", "hex_string"]
+ , ["src/utils/cpp", "gsl"]
]
, "cflags": ["-pthread"]
}
@@ -107,7 +108,7 @@
, "name": ["git_utils"]
, "hdrs": ["git_utils.hpp"]
, "srcs": ["git_utils.cpp"]
- , "deps": [["@", "gsl-lite", "", "gsl-lite"], "object_type"]
+ , "deps": [["@", "gsl", "", "gsl"], "object_type"]
, "stage": ["src", "buildtool", "file_system"]
, "private-deps":
[ ["", "libgit2"]
@@ -125,7 +126,7 @@
, "file_system_manager"
, ["src/buildtool/common", "artifact_description"]
, ["src/buildtool/compatibility", "compatibility"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["@", "json", "", "json"]
, ["src/utils/cpp", "concepts"]
]
diff --git a/src/buildtool/file_system/file_root.hpp b/src/buildtool/file_system/file_root.hpp
index a1b21a81..e25a2455 100644
--- a/src/buildtool/file_system/file_root.hpp
+++ b/src/buildtool/file_system/file_root.hpp
@@ -24,7 +24,7 @@
#include <utility>
#include <variant>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/common/artifact_description.hpp"
#include "src/buildtool/compatibility/compatibility.hpp"
@@ -169,8 +169,8 @@ class FileRoot {
explicit DirectoryEntries(pairs_t pairs) noexcept
: data_{std::move(pairs)} {}
- explicit DirectoryEntries(tree_t git_tree) noexcept
- : data_{std::move(git_tree)} {}
+ explicit DirectoryEntries(tree_t const& git_tree) noexcept
+ : data_{git_tree} {}
[[nodiscard]] auto ContainsFile(std::string const& name) const noexcept
-> bool {
@@ -272,9 +272,9 @@ class FileRoot {
FileRoot() noexcept = default;
explicit FileRoot(std::filesystem::path root) noexcept
: root_{std::move(root)} {}
- FileRoot(gsl::not_null<GitCASPtr> cas,
- gsl::not_null<GitTreePtr> tree) noexcept
- : root_{git_root_t{std::move(cas), std::move(tree)}} {}
+ FileRoot(gsl::not_null<GitCASPtr> const& cas,
+ gsl::not_null<GitTreePtr> const& tree) noexcept
+ : root_{git_root_t{cas, tree}} {}
[[nodiscard]] static auto FromGit(std::filesystem::path const& repo_path,
std::string const& git_tree_id) noexcept
diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp
index a9a3db2b..c7a31b29 100644
--- a/src/buildtool/file_system/file_system_manager.hpp
+++ b/src/buildtool/file_system/file_system_manager.hpp
@@ -27,7 +27,7 @@
#include <unistd.h>
#endif
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/logging/logger.hpp"
#include "src/buildtool/system/system.hpp"
diff --git a/src/buildtool/file_system/git_cas.cpp b/src/buildtool/file_system/git_cas.cpp
index 1f8525fe..081d080f 100644
--- a/src/buildtool/file_system/git_cas.cpp
+++ b/src/buildtool/file_system/git_cas.cpp
@@ -18,7 +18,7 @@
#include <mutex>
#include <sstream>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/logging/logger.hpp"
#include "src/utils/cpp/hex_string.hpp"
diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp
index 2e09f84d..d135875a 100644
--- a/src/buildtool/file_system/git_repo.cpp
+++ b/src/buildtool/file_system/git_repo.cpp
@@ -17,6 +17,7 @@
#include <thread>
#include "src/buildtool/logging/logger.hpp"
+#include "src/utils/cpp/gsl.hpp"
#include "src/utils/cpp/hex_string.hpp"
#include "src/utils/cpp/path.hpp"
@@ -1147,7 +1148,7 @@ auto GitRepo::ReadTree(std::string const& id, bool is_hex_id) const noexcept
}
#ifndef NDEBUG
- gsl_EnsuresAudit(ValidateEntries(entries));
+ EnsuresAudit(ValidateEntries(entries));
#endif
return entries;
@@ -1160,7 +1161,7 @@ auto GitRepo::CreateTree(tree_entries_t const& entries) const noexcept
return std::nullopt;
#else
#ifndef NDEBUG
- gsl_ExpectsAudit(ValidateEntries(entries));
+ ExpectsAudit(ValidateEntries(entries));
#endif // NDEBUG
// share the odb lock
std::shared_lock lock{GetGitCAS()->mutex_};
diff --git a/src/buildtool/file_system/git_tree.hpp b/src/buildtool/file_system/git_tree.hpp
index ac409e69..5007b106 100644
--- a/src/buildtool/file_system/git_tree.hpp
+++ b/src/buildtool/file_system/git_tree.hpp
@@ -19,7 +19,7 @@
#include <optional>
#include <unordered_map>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/file_system/git_repo.hpp"
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/multithreading/atomic_value.hpp"
@@ -69,14 +69,12 @@ class GitTree {
entries_t entries_;
std::string raw_id_;
- GitTree(gsl::not_null<GitCASPtr> cas,
+ GitTree(gsl::not_null<GitCASPtr> const& cas,
entries_t&& entries,
std::string raw_id) noexcept
- : cas_{std::move(cas)},
- entries_{std::move(entries)},
- raw_id_{std::move(raw_id)} {}
+ : cas_{cas}, entries_{std::move(entries)}, raw_id_{std::move(raw_id)} {}
- [[nodiscard]] static auto FromEntries(gsl::not_null<GitCASPtr> cas,
+ [[nodiscard]] static auto FromEntries(gsl::not_null<GitCASPtr> const& cas,
GitRepo::tree_entries_t&& entries,
std::string raw_id) noexcept
-> std::optional<GitTree> {
@@ -93,16 +91,16 @@ class GitTree {
}
}
}
- return GitTree(std::move(cas), std::move(e), std::move(raw_id));
+ return GitTree(cas, std::move(e), std::move(raw_id));
}
};
class GitTreeEntry {
public:
- GitTreeEntry(gsl::not_null<GitCASPtr> cas,
+ GitTreeEntry(gsl::not_null<GitCASPtr> const& cas,
std::string raw_id,
ObjectType type) noexcept
- : cas_{std::move(cas)}, raw_id_{std::move(raw_id)}, type_{type} {}
+ : cas_{cas}, raw_id_{std::move(raw_id)}, type_{type} {}
[[nodiscard]] auto IsBlob() const noexcept { return IsFileObject(type_); }
[[nodiscard]] auto IsTree() const noexcept { return IsTreeObject(type_); }
diff --git a/src/buildtool/file_system/git_utils.hpp b/src/buildtool/file_system/git_utils.hpp
index fc43e542..17647595 100644
--- a/src/buildtool/file_system/git_utils.hpp
+++ b/src/buildtool/file_system/git_utils.hpp
@@ -17,7 +17,7 @@
#include <optional>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/file_system/object_type.hpp"
extern "C" {
diff --git a/src/buildtool/file_system/object_type.hpp b/src/buildtool/file_system/object_type.hpp
index 661ab657..36a451e8 100644
--- a/src/buildtool/file_system/object_type.hpp
+++ b/src/buildtool/file_system/object_type.hpp
@@ -16,7 +16,7 @@
#define INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_OBJECT_TYPE_HPP
#include <cstdint>
-#include <gsl-lite/gsl-lite.hpp>
+#include <gsl/gsl>
enum class ObjectType : std::int8_t {
File,
@@ -33,7 +33,7 @@ enum class ObjectType : std::int8_t {
default:
return ObjectType::File;
}
- gsl_Ensures(false); // unreachable
+ Ensures(false); // unreachable
}
[[nodiscard]] constexpr auto ToChar(ObjectType type) -> char {
@@ -45,7 +45,7 @@ enum class ObjectType : std::int8_t {
case ObjectType::Tree:
return 't';
}
- gsl_Ensures(false); // unreachable
+ Ensures(false); // unreachable
}
[[nodiscard]] constexpr auto IsFileObject(ObjectType type) -> bool {
diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp
index 05ac3a82..cc2ecfa1 100644
--- a/src/buildtool/graph_traverser/graph_traverser.hpp
+++ b/src/buildtool/graph_traverser/graph_traverser.hpp
@@ -28,7 +28,7 @@
#include <utility>
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/cli.hpp"
#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/common/tree.hpp"
@@ -115,7 +115,7 @@ class GraphTraverser {
return std::nullopt;
}
- gsl_Expects(extra_artifacts.size() == extra_infos->size());
+ Expects(extra_artifacts.size() == extra_infos->size());
std::unordered_map<ArtifactDescription, Artifact::ObjectInfo> infos;
infos.reserve(extra_infos->size());
std::transform(
diff --git a/src/buildtool/logging/TARGETS b/src/buildtool/logging/TARGETS
index e0b9b6a2..a4871482 100644
--- a/src/buildtool/logging/TARGETS
+++ b/src/buildtool/logging/TARGETS
@@ -2,7 +2,7 @@
{ "type": ["@", "rules", "CC", "library"]
, "name": ["log_level"]
, "hdrs": ["log_level.hpp"]
- , "deps": [["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": [["@", "gsl", "", "gsl"]]
, "stage": ["src", "buildtool", "logging"]
}
, "logging":
@@ -15,8 +15,7 @@
, "log_sink_file.hpp"
, "logger.hpp"
]
- , "deps":
- ["log_level", ["@", "fmt", "", "fmt"], ["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": ["log_level", ["@", "fmt", "", "fmt"], ["@", "gsl", "", "gsl"]]
, "stage": ["src", "buildtool", "logging"]
, "private-ldflags": ["-pthread"]
}
diff --git a/src/buildtool/logging/log_level.hpp b/src/buildtool/logging/log_level.hpp
index 1902e960..bbc599b9 100644
--- a/src/buildtool/logging/log_level.hpp
+++ b/src/buildtool/logging/log_level.hpp
@@ -20,7 +20,7 @@
#include <string>
#include <type_traits>
-#include <gsl-lite/gsl-lite.hpp>
+#include <gsl/gsl>
enum class LogLevel {
Error, ///< Error messages, fatal errors
@@ -76,7 +76,7 @@ constexpr auto kLastLogLevel = LogLevel::Trace;
case LogLevel::Trace:
return "TRACE";
}
- gsl_Ensures(false); // unreachable
+ Ensures(false); // unreachable
}
#endif // INCLUDED_SRC_BUILDTOOL_LOGGING_LOG_LEVEL_HPP
diff --git a/src/buildtool/logging/log_sink_file.hpp b/src/buildtool/logging/log_sink_file.hpp
index b27726a2..c658af7a 100644
--- a/src/buildtool/logging/log_sink_file.hpp
+++ b/src/buildtool/logging/log_sink_file.hpp
@@ -32,7 +32,7 @@
#include "fmt/chrono.h"
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/logging/log_sink.hpp"
#include "src/buildtool/logging/logger.hpp"
diff --git a/src/buildtool/main/TARGETS b/src/buildtool/main/TARGETS
index a99eb7b9..68197a89 100644
--- a/src/buildtool/main/TARGETS
+++ b/src/buildtool/main/TARGETS
@@ -70,7 +70,7 @@
[ ["src/buildtool/common", "cli"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/execution_api/common", "common"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
]
, "stage": ["src", "buildtool", "main"]
, "private-deps":
diff --git a/src/buildtool/main/install_cas.hpp b/src/buildtool/main/install_cas.hpp
index e083776e..f577866d 100644
--- a/src/buildtool/main/install_cas.hpp
+++ b/src/buildtool/main/install_cas.hpp
@@ -17,10 +17,10 @@
#include <string>
-#include <gsl-lite/gsl-lite.hpp>
-
#include "src/buildtool/common/artifact.hpp"
#include "src/buildtool/common/cli.hpp"
+
+#include <gsl/gsl>
#ifndef BOOTSTRAP_BUILD_TOOL
#include "src/buildtool/execution_api/common/execution_api.hpp"
#endif
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index b6796c05..81a932a1 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -449,7 +449,7 @@ void SetupHashFunction() {
FileRoot const& root,
std::vector<std::string> const& markers)
-> std::optional<std::filesystem::path> {
- gsl_Expects(subdir.is_relative());
+ Expects(subdir.is_relative());
auto current = subdir;
while (true) {
for (auto const& marker : markers) {
diff --git a/src/buildtool/multithreading/TARGETS b/src/buildtool/multithreading/TARGETS
index 2e5467f4..2d758589 100644
--- a/src/buildtool/multithreading/TARGETS
+++ b/src/buildtool/multithreading/TARGETS
@@ -9,8 +9,7 @@
{ "type": ["@", "rules", "CC", "library"]
, "name": ["notification_queue"]
, "hdrs": ["notification_queue.hpp"]
- , "deps":
- ["task", ["src/utils/cpp", "atomic"], ["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": ["task", ["src/utils/cpp", "atomic"], ["@", "gsl", "", "gsl"]]
, "stage": ["src", "buildtool", "multithreading"]
}
, "task_system":
@@ -18,7 +17,7 @@
, "name": ["task_system"]
, "hdrs": ["task_system.hpp"]
, "srcs": ["task_system.cpp"]
- , "deps": ["notification_queue", ["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": ["notification_queue", ["@", "gsl", "", "gsl"]]
, "stage": ["src", "buildtool", "multithreading"]
, "private-deps": ["task"]
}
@@ -26,19 +25,15 @@
{ "type": ["@", "rules", "CC", "library"]
, "name": ["async_map_node"]
, "hdrs": ["async_map_node.hpp"]
- , "deps": ["task", "task_system", ["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps":
+ ["task", "task_system", ["src/utils/cpp", "gsl"], ["@", "gsl", "", "gsl"]]
, "stage": ["src", "buildtool", "multithreading"]
}
, "async_map":
{ "type": ["@", "rules", "CC", "library"]
, "name": ["async_map"]
, "hdrs": ["async_map.hpp"]
- , "deps":
- [ "task"
- , "task_system"
- , "async_map_node"
- , ["@", "gsl-lite", "", "gsl-lite"]
- ]
+ , "deps": ["task", "task_system", "async_map_node", ["@", "gsl", "", "gsl"]]
, "stage": ["src", "buildtool", "multithreading"]
}
, "async_map_consumer":
@@ -50,7 +45,7 @@
, "task_system"
, "async_map_node"
, "async_map"
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
]
, "stage": ["src", "buildtool", "multithreading"]
}
diff --git a/src/buildtool/multithreading/async_map.hpp b/src/buildtool/multithreading/async_map.hpp
index 91ffd8c2..3267b312 100644
--- a/src/buildtool/multithreading/async_map.hpp
+++ b/src/buildtool/multithreading/async_map.hpp
@@ -23,7 +23,7 @@
#include <utility> // std::make_pair to use std::unordered_map's emplace()
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/multithreading/async_map_node.hpp"
#include "src/buildtool/multithreading/task.hpp"
#include "src/buildtool/multithreading/task_system.hpp"
diff --git a/src/buildtool/multithreading/async_map_consumer.hpp b/src/buildtool/multithreading/async_map_consumer.hpp
index 3dcc0eff..0de6b36f 100644
--- a/src/buildtool/multithreading/async_map_consumer.hpp
+++ b/src/buildtool/multithreading/async_map_consumer.hpp
@@ -25,7 +25,7 @@
#include <unordered_set>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/multithreading/async_map.hpp"
#include "src/buildtool/multithreading/async_map_node.hpp"
#include "src/buildtool/multithreading/task.hpp"
diff --git a/src/buildtool/multithreading/async_map_node.hpp b/src/buildtool/multithreading/async_map_node.hpp
index c729582d..2c07f11b 100644
--- a/src/buildtool/multithreading/async_map_node.hpp
+++ b/src/buildtool/multithreading/async_map_node.hpp
@@ -19,9 +19,10 @@
#include <mutex>
#include <optional>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/multithreading/task.hpp"
#include "src/buildtool/multithreading/task_system.hpp"
+#include "src/utils/cpp/gsl.hpp"
// Wrapper around Value to enable async access to it in a continuation-style
// programming way
@@ -154,7 +155,7 @@ class AsyncMapNode {
// Not thread safe, do not use unless the value has been already set
[[nodiscard]] auto GetValue() const& noexcept -> Value const& {
// Will only be checked in debug build
- gsl_ExpectsAudit(value_.has_value());
+ ExpectsAudit(value_.has_value());
return *value_;
}
[[nodiscard]] auto GetValue() && noexcept = delete;
diff --git a/src/buildtool/multithreading/notification_queue.hpp b/src/buildtool/multithreading/notification_queue.hpp
index 1df5d659..9d2f06eb 100644
--- a/src/buildtool/multithreading/notification_queue.hpp
+++ b/src/buildtool/multithreading/notification_queue.hpp
@@ -22,7 +22,7 @@
#include <shared_mutex>
#include <utility> // std::forward
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/multithreading/task.hpp"
#include "src/utils/cpp/atomic.hpp"
@@ -67,14 +67,14 @@ class WaitableZeroCounter {
class NotificationQueue {
public:
explicit NotificationQueue(
- gsl::not_null<WaitableZeroCounter*> total_workload)
- : total_workload_{std::move(total_workload)} {}
+ gsl::not_null<WaitableZeroCounter*> const& total_workload)
+ : total_workload_{total_workload} {}
NotificationQueue(NotificationQueue const& other) = delete;
NotificationQueue(NotificationQueue&& other) noexcept
: queue_{std::move(other.queue_)},
done_{other.done_},
- total_workload_{std::move(other.total_workload_)} {}
+ total_workload_{other.total_workload_} {}
~NotificationQueue() = default;
[[nodiscard]] auto operator=(NotificationQueue const& other)
diff --git a/src/buildtool/multithreading/task_system.cpp b/src/buildtool/multithreading/task_system.cpp
index cf9ed543..13c3caec 100644
--- a/src/buildtool/multithreading/task_system.cpp
+++ b/src/buildtool/multithreading/task_system.cpp
@@ -14,7 +14,7 @@
#include "src/buildtool/multithreading/task_system.hpp"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/multithreading/task.hpp"
TaskSystem::TaskSystem() : TaskSystem(std::thread::hardware_concurrency()) {}
@@ -59,7 +59,7 @@ void TaskSystem::Finish() noexcept {
}
void TaskSystem::Run(std::size_t idx) {
- gsl_Expects(thread_count_ > 0);
+ Expects(thread_count_ > 0);
while (not shutdown_) {
std::optional<Task> t{};
diff --git a/src/buildtool/progress_reporting/TARGETS b/src/buildtool/progress_reporting/TARGETS
index 4eb378f1..45c3db1c 100644
--- a/src/buildtool/progress_reporting/TARGETS
+++ b/src/buildtool/progress_reporting/TARGETS
@@ -28,7 +28,7 @@
, "private-deps":
[ "progress"
, ["@", "fmt", "", "fmt"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/logging", "logging"]
]
diff --git a/src/buildtool/progress_reporting/progress_reporter.cpp b/src/buildtool/progress_reporting/progress_reporter.cpp
index 976df89d..86ec0c0e 100644
--- a/src/buildtool/progress_reporting/progress_reporter.cpp
+++ b/src/buildtool/progress_reporting/progress_reporter.cpp
@@ -17,7 +17,7 @@
#include <string>
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
diff --git a/src/buildtool/storage/TARGETS b/src/buildtool/storage/TARGETS
index 04e66707..ee2a2e13 100644
--- a/src/buildtool/storage/TARGETS
+++ b/src/buildtool/storage/TARGETS
@@ -5,13 +5,14 @@
, "deps":
[ ["src/buildtool/common", "common"]
, ["src/buildtool/execution_api/remote", "config"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["@", "json", "", "json"]
, ["src/buildtool/compatibility", "compatibility"]
, ["src/buildtool/file_system", "object_type"]
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/logging", "logging"]
, ["src/buildtool/logging", "log_level"]
+ , ["src/utils/cpp", "gsl"]
]
, "stage": ["src", "buildtool", "storage"]
, "private-deps": [["src/buildtool/file_system", "file_storage"]]
@@ -43,7 +44,8 @@
, ["src/buildtool/build_engine/base_maps", "entity_name_data"]
, ["src/buildtool/build_engine/expression", "expression"]
, ["src/utils/cpp", "file_locking"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["src/utils/cpp", "gsl"]
+ , ["@", "gsl", "", "gsl"]
, ["@", "json", "", "json"]
, ["src/buildtool/file_system", "object_type"]
, ["src/buildtool/file_system", "file_system_manager"]
diff --git a/src/buildtool/storage/config.hpp b/src/buildtool/storage/config.hpp
index 058aca88..d231f06a 100644
--- a/src/buildtool/storage/config.hpp
+++ b/src/buildtool/storage/config.hpp
@@ -29,7 +29,6 @@
#include <vector>
#include <fmt/core.h>
-#include <gsl-lite/gsl-lite.hpp>
#include <nlohmann/json.hpp>
#include "src/buildtool/common/artifact_digest.hpp"
@@ -39,6 +38,9 @@
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
+#include "src/utils/cpp/gsl.hpp"
+
+#include <gsl/gsl>
/// \brief Global storage configuration.
class StorageConfig {
@@ -119,7 +121,7 @@ class StorageConfig {
/// non-compatible protocol types.
[[nodiscard]] static auto GenerationCacheRoot(std::size_t index) noexcept
-> std::filesystem::path {
- gsl_ExpectsAudit(index < Data().num_generations);
+ ExpectsAudit(index < Data().num_generations);
auto generation = std::string{"generation-"} + std::to_string(index);
return CacheRoot() / generation;
}
diff --git a/src/buildtool/storage/local_ac.hpp b/src/buildtool/storage/local_ac.hpp
index 313abd7f..069af936 100644
--- a/src/buildtool/storage/local_ac.hpp
+++ b/src/buildtool/storage/local_ac.hpp
@@ -15,7 +15,7 @@
#ifndef INCLUDED_SRC_BUILDTOOL_STORAGE_LOCAL_AC_HPP
#define INCLUDED_SRC_BUILDTOOL_STORAGE_LOCAL_AC_HPP
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/execution_api/common/execution_common.hpp"
#include "src/buildtool/file_system/file_storage.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
diff --git a/src/buildtool/storage/target_cache.hpp b/src/buildtool/storage/target_cache.hpp
index c9f0fbe6..bd13ad99 100644
--- a/src/buildtool/storage/target_cache.hpp
+++ b/src/buildtool/storage/target_cache.hpp
@@ -20,7 +20,6 @@
#include <optional>
#include <utility>
-#include <gsl-lite/gsl-lite.hpp>
#include <nlohmann/json.hpp>
#include "src/buildtool/common/artifact.hpp"
@@ -32,6 +31,9 @@
#include "src/buildtool/storage/local_cas.hpp"
#include "src/buildtool/storage/target_cache_entry.hpp"
#include "src/buildtool/storage/target_cache_key.hpp"
+#include "src/utils/cpp/gsl.hpp"
+
+#include <gsl/gsl>
/// \brief The high-level target cache for storing export target's data.
/// Supports global uplinking across all generations using the garbage
@@ -55,8 +57,7 @@ class TargetCache {
// write backend description (shard) to CAS
[[maybe_unused]] auto id =
cas_->StoreBlob(StorageConfig::ExecutionBackendDescription());
- gsl_EnsuresAudit(id and
- ArtifactDigest{*id}.hash() == ComputeShard());
+ EnsuresAudit(id and ArtifactDigest{*id}.hash() == ComputeShard());
}
}
diff --git a/src/buildtool/storage/target_cache_entry.cpp b/src/buildtool/storage/target_cache_entry.cpp
index 683b2f02..6e1f3187 100644
--- a/src/buildtool/storage/target_cache_entry.cpp
+++ b/src/buildtool/storage/target_cache_entry.cpp
@@ -20,6 +20,7 @@
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
+#include "src/utils/cpp/gsl.hpp"
auto TargetCacheEntry::FromTarget(
AnalysedTargetPtr const& target,
@@ -48,9 +49,9 @@ auto TargetCacheEntry::ToResult() const noexcept
auto const& desc = ArtifactDescription::FromJson(json);
// The assumption is that all artifacts mentioned in a target cache
// entry are KNOWN to the remote side.
- gsl_ExpectsAudit(desc and desc->IsKnown());
+ ExpectsAudit(desc and desc->IsKnown());
auto const& info = desc->ToArtifact().Info();
- gsl_ExpectsAudit(info);
+ ExpectsAudit(info);
return *info;
}
diff --git a/src/buildtool/storage/target_cache_entry.hpp b/src/buildtool/storage/target_cache_entry.hpp
index b2002f80..dadbb080 100644
--- a/src/buildtool/storage/target_cache_entry.hpp
+++ b/src/buildtool/storage/target_cache_entry.hpp
@@ -20,7 +20,6 @@
#include <utility>
#include <vector>
-#include <gsl-lite/gsl-lite.hpp>
#include <nlohmann/json.hpp>
#include "src/buildtool/build_engine/analysed_target/analysed_target.hpp"
@@ -28,6 +27,8 @@
#include "src/buildtool/common/artifact.hpp"
#include "src/buildtool/common/artifact_description.hpp"
+#include <gsl/gsl>
+
// Entry for target cache. Created from target, contains TargetResult.
class TargetCacheEntry {
public:
diff --git a/src/buildtool/system/TARGETS b/src/buildtool/system/TARGETS
index 11c2bd47..a72fcac4 100644
--- a/src/buildtool/system/TARGETS
+++ b/src/buildtool/system/TARGETS
@@ -20,7 +20,7 @@
[ "system"
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/logging", "logging"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
]
, "stage": ["src", "buildtool", "system"]
}
diff --git a/src/buildtool/system/system_command.hpp b/src/buildtool/system/system_command.hpp
index ac3eb719..5bec9ad1 100644
--- a/src/buildtool/system/system_command.hpp
+++ b/src/buildtool/system/system_command.hpp
@@ -29,7 +29,7 @@
#include <sys/wait.h>
#include <unistd.h>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/logging/logger.hpp"
#include "src/buildtool/system/system.hpp"
diff --git a/src/other_tools/just_mr/TARGETS b/src/other_tools/just_mr/TARGETS
index 299818d9..85b86f53 100644
--- a/src/other_tools/just_mr/TARGETS
+++ b/src/other_tools/just_mr/TARGETS
@@ -58,7 +58,7 @@
, "deps":
[ ["@", "cli11", "", "cli11"]
, ["@", "fmt", "", "fmt"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["@", "json", "", "json"]
, ["src/buildtool/common", "clidefaults"]
, ["src/buildtool/execution_api/local", "config"]
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp
index 1d6580da..48c06fb8 100644
--- a/src/other_tools/just_mr/cli.hpp
+++ b/src/other_tools/just_mr/cli.hpp
@@ -23,7 +23,7 @@
#include "CLI/CLI.hpp"
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/common/clidefaults.hpp"
#include "src/buildtool/execution_api/local/config.hpp"
diff --git a/src/other_tools/just_mr/progress_reporting/TARGETS b/src/other_tools/just_mr/progress_reporting/TARGETS
index b8dc61b7..78fa7b87 100644
--- a/src/other_tools/just_mr/progress_reporting/TARGETS
+++ b/src/other_tools/just_mr/progress_reporting/TARGETS
@@ -23,7 +23,7 @@
, "statistics"
, ["@", "fmt", "", "fmt"]
, ["@", "json", "", "json"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/logging", "logging"]
]
}
diff --git a/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp b/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp
index 21a3db3c..e7319d5f 100644
--- a/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp
+++ b/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp
@@ -18,7 +18,7 @@
#include <string>
#include "fmt/core.h"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
diff --git a/src/other_tools/utils/TARGETS b/src/other_tools/utils/TARGETS
index cf80bc47..9e3fa89d 100644
--- a/src/other_tools/utils/TARGETS
+++ b/src/other_tools/utils/TARGETS
@@ -3,7 +3,7 @@
, "name": ["archive_ops"]
, "hdrs": ["archive_ops.hpp"]
, "srcs": ["archive_ops.cpp"]
- , "deps": [["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": [["@", "gsl", "", "gsl"]]
, "stage": ["src", "other_tools", "utils"]
, "private-deps":
[["src/buildtool/file_system", "file_system_manager"], ["", "libarchive"]]
@@ -21,7 +21,7 @@
, "name": ["curl_easy_handle"]
, "hdrs": ["curl_easy_handle.hpp"]
, "srcs": ["curl_easy_handle.cpp"]
- , "deps": ["curl_context", ["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": ["curl_context", ["@", "gsl", "", "gsl"]]
, "stage": ["src", "other_tools", "utils"]
, "private-deps":
[ ["src/buildtool/logging", "logging"]
@@ -34,7 +34,7 @@
, "name": ["curl_url_handle"]
, "hdrs": ["curl_url_handle.hpp"]
, "srcs": ["curl_url_handle.cpp"]
- , "deps": ["curl_context", ["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": ["curl_context", ["@", "gsl", "", "gsl"]]
, "stage": ["src", "other_tools", "utils"]
, "private-deps": [["src/buildtool/logging", "logging"], ["", "libcurl"]]
}
diff --git a/src/other_tools/utils/archive_ops.hpp b/src/other_tools/utils/archive_ops.hpp
index 7fccae45..50110c18 100644
--- a/src/other_tools/utils/archive_ops.hpp
+++ b/src/other_tools/utils/archive_ops.hpp
@@ -18,7 +18,7 @@
#include <filesystem>
#include <optional>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
extern "C" {
using archive = struct archive;
diff --git a/src/other_tools/utils/curl_easy_handle.hpp b/src/other_tools/utils/curl_easy_handle.hpp
index ea5989a1..470f6f2a 100644
--- a/src/other_tools/utils/curl_easy_handle.hpp
+++ b/src/other_tools/utils/curl_easy_handle.hpp
@@ -21,7 +21,7 @@
#include <optional>
#include <string>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/other_tools/utils/curl_context.hpp"
extern "C" {
diff --git a/src/other_tools/utils/curl_url_handle.hpp b/src/other_tools/utils/curl_url_handle.hpp
index d7192142..1a535162 100644
--- a/src/other_tools/utils/curl_url_handle.hpp
+++ b/src/other_tools/utils/curl_url_handle.hpp
@@ -21,7 +21,7 @@
#include <optional>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/other_tools/utils/curl_context.hpp"
extern "C" {
diff --git a/src/utils/automata/dfa_minimizer.hpp b/src/utils/automata/dfa_minimizer.hpp
index 617617e3..ae647b44 100644
--- a/src/utils/automata/dfa_minimizer.hpp
+++ b/src/utils/automata/dfa_minimizer.hpp
@@ -111,7 +111,7 @@ class DFAMinimizer {
it = buckets_.emplace(bucket_id, Bucket{std::move(symbols)}).first;
}
it->second.states.emplace(name, transitions);
- gsl_Ensures(buckets_by_state_.emplace(name, bucket_id).second);
+ Ensures(buckets_by_state_.emplace(name, bucket_id).second);
}
// Compute bisimulation for each state and return a map, which maps a
diff --git a/src/utils/cpp/TARGETS b/src/utils/cpp/TARGETS
index 42d8ae9e..fffb2e7b 100644
--- a/src/utils/cpp/TARGETS
+++ b/src/utils/cpp/TARGETS
@@ -2,21 +2,21 @@
{ "type": ["@", "rules", "CC", "library"]
, "name": ["hash_combine"]
, "hdrs": ["hash_combine.hpp"]
- , "deps": [["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": [["@", "gsl", "", "gsl"]]
, "stage": ["src", "utils", "cpp"]
}
, "type_safe_arithmetic":
{ "type": ["@", "rules", "CC", "library"]
, "name": ["type_safe_arithmetic"]
, "hdrs": ["type_safe_arithmetic.hpp"]
- , "deps": [["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": [["@", "gsl", "", "gsl"]]
, "stage": ["src", "utils", "cpp"]
}
, "json":
{ "type": ["@", "rules", "CC", "library"]
, "name": ["json"]
, "hdrs": ["json.hpp"]
- , "deps": [["@", "json", "", "json"], ["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": ["gsl", ["@", "json", "", "json"], ["@", "gsl", "", "gsl"]]
, "stage": ["src", "utils", "cpp"]
}
, "concepts":
@@ -54,7 +54,7 @@
, "name": ["tmp_dir"]
, "hdrs": ["tmp_dir.hpp"]
, "srcs": ["tmp_dir.cpp"]
- , "deps": [["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": [["@", "gsl", "", "gsl"]]
, "stage": ["src", "utils", "cpp"]
, "private-deps": [["src/buildtool/file_system", "file_system_manager"]]
}
@@ -63,11 +63,18 @@
, "name": ["file_locking"]
, "hdrs": ["file_locking.hpp"]
, "srcs": ["file_locking.cpp"]
- , "deps": [["@", "gsl-lite", "", "gsl-lite"]]
+ , "deps": [["@", "gsl", "", "gsl"]]
, "stage": ["src", "utils", "cpp"]
, "private-deps":
[ ["src/buildtool/file_system", "file_system_manager"]
, ["src/utils/cpp", "path"]
]
}
+, "gsl":
+ { "type": ["@", "rules", "CC", "library"]
+ , "name": ["gsl"]
+ , "hdrs": ["gsl.hpp"]
+ , "deps": [["@", "gsl", "", "gsl"]]
+ , "stage": ["src", "utils", "cpp"]
+ }
}
diff --git a/src/utils/cpp/file_locking.hpp b/src/utils/cpp/file_locking.hpp
index c9635d69..24aeb90b 100644
--- a/src/utils/cpp/file_locking.hpp
+++ b/src/utils/cpp/file_locking.hpp
@@ -19,7 +19,7 @@
#include <memory>
#include <optional>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
/* \brief Thread- and process-safe file locking mechanism for paths.
* User guarantees write access in the parent directory of the path given, as
diff --git a/src/utils/cpp/gsl.hpp b/src/utils/cpp/gsl.hpp
new file mode 100644
index 00000000..882df29b
--- /dev/null
+++ b/src/utils/cpp/gsl.hpp
@@ -0,0 +1,33 @@
+// Copyright 2023 Huawei Cloud Computing Technology Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef INCLUDED_SRC_UTILS_CPP_GSL_HPP
+#define INCLUDED_SRC_UTILS_CPP_GSL_HPP
+
+#include <gsl/gsl>
+
+// implement EnsuresAudit/ExpectsAudit (from gsl-lite) only run in debug mode
+#ifdef NDEBUG
+// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
+#define ExpectsAudit(x) (void)0
+// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
+#define EnsuresAudit(x) (void)0
+#else
+// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
+#define ExpectsAudit(x) Expects(x)
+// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
+#define EnsuresAudit(x) Ensures(x)
+#endif
+
+#endif // INCLUDED_SRC_UTILS_CPP_GSL_HPP_
diff --git a/src/utils/cpp/hash_combine.hpp b/src/utils/cpp/hash_combine.hpp
index 68c01c57..6660815d 100644
--- a/src/utils/cpp/hash_combine.hpp
+++ b/src/utils/cpp/hash_combine.hpp
@@ -15,7 +15,7 @@
#ifndef INCLUDED_SRC_UTILS_CPP_HASH_COMBINE_HPP
#define INCLUDED_SRC_UTILS_CPP_HASH_COMBINE_HPP
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
// Taken from Boost, as hash_combine did not yet make it to STL.
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0814r0.pdf
diff --git a/src/utils/cpp/json.hpp b/src/utils/cpp/json.hpp
index 4921a39b..aed2f3f4 100644
--- a/src/utils/cpp/json.hpp
+++ b/src/utils/cpp/json.hpp
@@ -21,8 +21,9 @@
#include <string>
#include <unordered_map>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
+#include "src/utils/cpp/gsl.hpp"
template <typename ValueT>
auto ExtractValueAs(
@@ -65,7 +66,7 @@ namespace detail {
}
std::fill_n(iterator{oss}, depth, indent);
oss << '}';
- gsl_EnsuresAudit(nlohmann::json::parse(oss.str()) == json);
+ EnsuresAudit(nlohmann::json::parse(oss.str()) == json);
return oss.str();
}
if (json.is_array() and depth < until) {
@@ -79,7 +80,7 @@ namespace detail {
}
std::fill_n(iterator{oss}, depth, indent);
oss << ']';
- gsl_EnsuresAudit(nlohmann::json::parse(oss.str()) == json);
+ EnsuresAudit(nlohmann::json::parse(oss.str()) == json);
return oss.str();
}
return json.dump();
@@ -116,7 +117,7 @@ namespace detail {
}
std::fill_n(iterator{oss}, depth, indent);
oss << '}';
- gsl_EnsuresAudit(nlohmann::json::parse(oss.str()) == json);
+ EnsuresAudit(nlohmann::json::parse(oss.str()) == json);
return oss.str();
}
if (json.is_array() and depth < until) {
@@ -131,7 +132,7 @@ namespace detail {
}
std::fill_n(iterator{oss}, depth, indent);
oss << ']';
- gsl_EnsuresAudit(nlohmann::json::parse(oss.str()) == json);
+ EnsuresAudit(nlohmann::json::parse(oss.str()) == json);
return oss.str();
}
return json.dump();
diff --git a/src/utils/cpp/tmp_dir.cpp b/src/utils/cpp/tmp_dir.cpp
index d821558f..b0cc4905 100644
--- a/src/utils/cpp/tmp_dir.cpp
+++ b/src/utils/cpp/tmp_dir.cpp
@@ -14,7 +14,7 @@
#include "src/utils/cpp/tmp_dir.hpp"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/file_system/file_system_manager.hpp"
auto TmpDir::Create(std::filesystem::path const& prefix,
diff --git a/src/utils/cpp/type_safe_arithmetic.hpp b/src/utils/cpp/type_safe_arithmetic.hpp
index 878631cb..090c266b 100644
--- a/src/utils/cpp/type_safe_arithmetic.hpp
+++ b/src/utils/cpp/type_safe_arithmetic.hpp
@@ -18,7 +18,7 @@
#include <limits>
#include <type_traits>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
/// \struct type_safe_arithmetic_tag
/// \brief Abstract tag defining types and limits for custom arithmetic types.
@@ -87,8 +87,8 @@ class type_safe_arithmetic {
constexpr auto get() const -> value_t { return m_value; }
constexpr void set(value_t value) {
- gsl_Expects(value >= min_value && value <= max_value &&
- "value output of range");
+ Expects(value >= min_value && value <= max_value &&
+ "value output of range");
m_value = value;
}
diff --git a/test/bootstrap/TARGETS b/test/bootstrap/TARGETS
index 9018ccbf..ee78934e 100644
--- a/test/bootstrap/TARGETS
+++ b/test/bootstrap/TARGETS
@@ -53,7 +53,7 @@
, "targets":
[ ["@", "json", "", "json"]
, ["@", "fmt", "", "fmt"]
- , ["@", "gsl-lite", "", "gsl-lite"]
+ , ["@", "gsl", "", "gsl"]
, ["@", "cli11", "", "cli11"]
, ["@", "ssl", "", "crypto"]
, ["", "libgit2"]
diff --git a/test/bootstrap/test-mixed-bootstrap.sh b/test/bootstrap/test-mixed-bootstrap.sh
index 61b1f5ea..d43a6a58 100755
--- a/test/bootstrap/test-mixed-bootstrap.sh
+++ b/test/bootstrap/test-mixed-bootstrap.sh
@@ -37,9 +37,9 @@ mkdir -p "${DISTDIR}"
cp -r "${ORIG_LOCALBASE}" "${LOCALBASE}"
-# - gsl-liste
-rm -rf "${LOCALBASE}/include/gsl-lite"
-cp distdir/v0.40.0.tar.gz "${DISTDIR}"
+# - gsl
+rm -rf "${LOCALBASE}/include/gsl"
+cp distdir/v4.0.0.tar.gz "${DISTDIR}"
# - fmt
rm -rf "${LOCALBASE}/include/fmt*"
@@ -50,7 +50,7 @@ cp distdir/fmt-9.1.0.zip "${DISTDIR}"
env LOCALBASE=${LOCALBASE} \
PACKAGE=YES \
- NON_LOCAL_DEPS='["gsl-lite", "fmt"]' \
+ NON_LOCAL_DEPS='["com_github_microsoft_gsl", "fmt"]' \
JUST_BUILD_CONF='{"COMPILER_FAMILY":"clang", "PKG_CONFIG_ARGS":["--define-prefix"]}' \
python3 ${WRKSRC}/bin/bootstrap.py ${WRKSRC} ${WRKDIR} ${DISTDIR} 2>&1
diff --git a/test/buildtool/storage/local_ac.test.cpp b/test/buildtool/storage/local_ac.test.cpp
index f4867e32..a5da6201 100644
--- a/test/buildtool/storage/local_ac.test.cpp
+++ b/test/buildtool/storage/local_ac.test.cpp
@@ -15,7 +15,7 @@
#include <string>
#include "catch2/catch_test_macros.hpp"
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/storage/storage.hpp"
#include "test/utils/hermeticity/local.hpp"
diff --git a/test/utils/TARGETS b/test/utils/TARGETS
index 92b086d2..fd94f48c 100644
--- a/test/utils/TARGETS
+++ b/test/utils/TARGETS
@@ -10,7 +10,7 @@
, "name": ["execution_bazel"]
, "hdrs": ["remote_execution/bazel_action_creator.hpp"]
, "deps":
- [ ["@", "gsl-lite", "", "gsl-lite"]
+ [ ["@", "gsl", "", "gsl"]
, ["src/buildtool/execution_api/remote", "bazel_network"]
]
, "stage": ["test", "utils"]
diff --git a/test/utils/remote_execution/bazel_action_creator.hpp b/test/utils/remote_execution/bazel_action_creator.hpp
index dd8fa34d..0ee251c8 100644
--- a/test/utils/remote_execution/bazel_action_creator.hpp
+++ b/test/utils/remote_execution/bazel_action_creator.hpp
@@ -19,7 +19,7 @@
#include <string>
#include <vector>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"