diff --git a/sandboxed_api/bazel/sapi.bzl b/sandboxed_api/bazel/sapi.bzl index 211d5a6..d1c49ea 100644 --- a/sandboxed_api/bazel/sapi.bzl +++ b/sandboxed_api/bazel/sapi.bzl @@ -31,6 +31,7 @@ def get_embed_dir(): return native.package_name() def sort_deps(deps): + deps = depset(deps).to_list() colon_deps = [x for x in deps if x.startswith(":")] other_deps = [x for x in deps if not x.startswith(":")] return sorted(colon_deps) + sorted(other_deps) @@ -192,7 +193,10 @@ def sapi_library( data = [":" + name + ".bin"], deps = sort_deps( [ + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", rprefix + "//sandboxed_api:sapi", + rprefix + "//sandboxed_api/util:status", rprefix + "//sandboxed_api:vars", ] + deps + ([":" + name + "_embed"] if embed else []) + diff --git a/sandboxed_api/tools/generator2/BUILD b/sandboxed_api/tools/generator2/BUILD index 7bee859..d901370 100644 --- a/sandboxed_api/tools/generator2/BUILD +++ b/sandboxed_api/tools/generator2/BUILD @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) - load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") load("//sandboxed_api/bazel:sapi.bzl", "sapi_library") +licenses(["notice"]) + py_library( name = "code", srcs = ["code.py"], @@ -81,6 +81,9 @@ cc_binary( "//sandboxed_api:sapi", "//sandboxed_api:vars", "//sandboxed_api/sandbox2", + "//sandboxed_api/util:status", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", ], ) diff --git a/sandboxed_api/tools/generator2/code.py b/sandboxed_api/tools/generator2/code.py index ec1e4fc..a393459 100644 --- a/sandboxed_api/tools/generator2/code.py +++ b/sandboxed_api/tools/generator2/code.py @@ -906,7 +906,10 @@ class Generator(object): result.append(Generator.GUARD_START.format(header_guard)) # Copybara transform results in the paths below. + result.append('#include "absl/status/status.h"') + result.append('#include "absl/status/statusor.h"') result.append('#include "sandboxed_api/sandbox.h"') + result.append('#include "sandboxed_api/util/status_macros.h"') result.append('#include "sandboxed_api/vars.h"') if embed_name: diff --git a/sandboxed_api/tools/generator2/code_test_util.py b/sandboxed_api/tools/generator2/code_test_util.py index 82ee3a6..50b51ac 100644 --- a/sandboxed_api/tools/generator2/code_test_util.py +++ b/sandboxed_api/tools/generator2/code_test_util.py @@ -18,7 +18,10 @@ CODE_GOLD = """// AUTO-GENERATED by the Sandboxed API generator. // Edits will be discarded when regenerating this file. +#include "absl/status/status.h" +#include "absl/status/statusor.h" #include "sandboxed_api/sandbox.h" +#include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/vars.h" namespace sapi { @@ -119,7 +122,10 @@ class TestApi { CODE_GOLD_MAPPED = """// AUTO-GENERATED by the Sandboxed API generator. // Edits will be discarded when regenerating this file. +#include "absl/status/status.h" +#include "absl/status/statusor.h" #include "sandboxed_api/sandbox.h" +#include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/vars.h" namespace sapi { @@ -154,7 +160,10 @@ class TestApi { CODE_ENUM_GOLD = """// AUTO-GENERATED by the Sandboxed API generator. // Edits will be discarded when regenerating this file. +#include "absl/status/status.h" +#include "absl/status/statusor.h" #include "sandboxed_api/sandbox.h" +#include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/vars.h" namespace sapi {