diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 9996bbe..50fcb3d 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -1,103 +1,11 @@ workspace( - name = "zig-cc-bazel-exceptions", + name = "zig-cc-bazel", ) -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - - -rules_python_version = "812c48356881b34f3df68301b839a879c4d5ddf9" -http_archive( - name = "rules_python", - sha256 = "f8a50280b9034b3933c4a41c61d0cf2309d473e3da39d92b38dac37d54bd4f82", - strip_prefix = "rules_python-{}".format(rules_python_version), - url = "https://github.com/bazelbuild/rules_python/archive/{}.zip".format(rules_python_version), +load("//zig-toolchains:defs.bzl", + zig_register_all_toolchains = "register_all_toolchains", + zig_toolchain_repositories = "toolchain_repositories", ) -http_archive( - name = "io_bazel_rules_go", - sha256 = "7c10271940c6bce577d51a075ae77728964db285dac0a46614a7934dc34303e6", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.26.0/rules_go-v0.26.0.tar.gz", - "https://github.com/bazelbuild/rules_go/releases/download/v0.26.0/rules_go-v0.26.0.tar.gz", - ], -) - -http_archive( - name = "bazel_gazelle", - sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz", - ], -) - -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") - -go_rules_dependencies() - -go_register_toolchains(version = "1.16") - -gazelle_dependencies(go_repository_default_config = "@//:WORKSPACE.bazel") - -http_archive( - name = "com_google_protobuf", - sha256 = "bf0e5070b4b99240183b29df78155eee335885e53a8af8683964579c214ad301", - strip_prefix = "protobuf-3.14.0", - urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.14.0.zip"], -) - -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -protobuf_deps() - -http_archive( - name = "com_github_bazelbuild_buildtools", - strip_prefix = "buildtools-master", - url = "https://github.com/bazelbuild/buildtools/archive/master.zip", -) - -http_archive( - name = "rules_pkg", - sha256 = "6b5969a7acd7b60c02f816773b06fcf32fbe8ba0c7919ccdc2df4f8fb923804a", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.3.0/rules_pkg-0.3.0.tar.gz", - "https://github.com/bazelbuild/rules_pkg/releases/download/0.3.0/rules_pkg-0.3.0.tar.gz", - ], -) - -load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") -rules_pkg_dependencies() - - -http_archive( - name = "io_bazel_rules_docker", - patches = ["//:patches/rules_docker/transitions.patch"], - patch_args = ["-p1"], - sha256 = "95d39fd84ff4474babaf190450ee034d958202043e366b9fc38f438c9e6c3334", - strip_prefix = "rules_docker-0.16.0", - urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.16.0/rules_docker-v0.16.0.tar.gz"], -) - -load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repositories = "repositories") -container_repositories() - - -load("@io_bazel_rules_docker//cc:image.bzl", _cc_image_repos = "repositories") -_cc_image_repos() - -load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps") -container_deps() - -rules_boost_version = "c13a880269cc044c4b5e90046625339836771d77" -http_archive( - name = "com_github_nelhage_rules_boost", - url = "https://github.com/nelhage/rules_boost/archive/{}.zip".format(rules_boost_version), - strip_prefix = "rules_boost-{}".format(rules_boost_version), - sha256 = "19a51f2f67e6bd2d1655a0641568bd88211db641a77c27fcdab7d9ad6de7dc00", -) -load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps") -boost_deps() - -load("//zig-toolchains:defs.bzl", zig_register_all_toolchains = "register_all_toolchains", zig_toolchain_repositories = "toolchain_repositories") zig_toolchain_repositories() zig_register_all_toolchains() diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 85db9eb..bc7f35b 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -1,35 +1,9 @@ -load("@io_bazel_rules_docker//cc:image.bzl", "cc_image") - cc_binary( name = "hello", srcs = ["hello.cpp"], ) -cc_image( - name = "hello_image", - binary = ":hello", -) - -cc_binary( - name = "boost_exception", - srcs = ["boost_exception.cpp"], - copts = ["-fexceptions", "-frtti"], - deps = [ - "@boost//:lexical_cast", - ], -) - -cc_image( - name = "boost_exception_image", - binary = ":boost_exception", -) - cc_binary( name = "exception", srcs = ["exception.cpp"], ) - -cc_image( - name = "exception_image", - binary = ":exception", -) diff --git a/test/boost_exception.cpp b/test/boost_exception.cpp deleted file mode 100644 index eed9d8b..0000000 --- a/test/boost_exception.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -#include - -int main() { - std::cout << "about to cast \"1\" to double!" << std::endl; - std::cout << boost::lexical_cast("1") << std::endl; - - std::cout << "about to cast \"z\" to double, but expecting to catch bad_lexical_cast" << std::endl; - try { - std::cout << boost::lexical_cast("z"); - std::cout << "uh-oh, should have thrown an exception before here." << std::endl; - } catch (const boost::bad_lexical_cast &e) { - std::cout << "caught bad_lexical_cast" << std::endl; - } - - std::cout << "about to cast \"z\" to double, should see an uncaught exception." << std::endl; - std::cout << boost::lexical_cast("z"); - std::cout << "uh-oh, should have thrown an exception before here." << std::endl; -} diff --git a/zig-toolchains/defs.bzl b/zig-toolchains/defs.bzl index 99df60a..8bb7111 100644 --- a/zig-toolchains/defs.bzl +++ b/zig-toolchains/defs.bzl @@ -119,7 +119,7 @@ ZIG_TOOLS = [ ] BUILD = """ -load("@zig-cc-bazel-exceptions//zig-toolchains:defs.bzl", "zig_build_macro") +load("@zig-cc-bazel//zig-toolchains:defs.bzl", "zig_build_macro") package(default_visibility = ["//visibility:public"]) zig_build_macro(absolute_path={absolute_path}, zig_include_root={zig_include_root}) """