From 8721fa00b58937d310c50b02c05281f6b42f6bc5 Mon Sep 17 00:00:00 2001 From: wep21 Date: Mon, 26 Aug 2024 07:29:28 +0900 Subject: [PATCH] iox-#2325 support bzlmod Signed-off-by: wep21 --- .bazelrc | 2 -- .gitignore | 1 + MODULE.bazel | 10 ++++++ WORKSPACE.bazel | 27 --------------- bazel/cpptoml/BUILD.bazel | 0 bazel/cpptoml/cpptoml.BUILD | 24 ------------- bazel/cpptoml/repositories.bzl | 34 ------------------- bazel/googletest/BUILD.bazel | 0 bazel/googletest/repositories.bzl | 33 ------------------ bazel/load_repositories.bzl | 32 ----------------- bazel/setup_repositories.bzl | 25 -------------- .../test/moduletests/test_utility_convert.cpp | 1 + 12 files changed, 12 insertions(+), 177 deletions(-) create mode 100644 MODULE.bazel delete mode 100644 WORKSPACE.bazel delete mode 100644 bazel/cpptoml/BUILD.bazel delete mode 100644 bazel/cpptoml/cpptoml.BUILD delete mode 100644 bazel/cpptoml/repositories.bzl delete mode 100644 bazel/googletest/BUILD.bazel delete mode 100644 bazel/googletest/repositories.bzl delete mode 100644 bazel/load_repositories.bzl delete mode 100644 bazel/setup_repositories.bzl diff --git a/.bazelrc b/.bazelrc index 493027fa73..5f02e04daf 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,5 +1,3 @@ -build --noenable_bzlmod - build --enable_platform_specific_config build:linux --cxxopt="-std=c++17" build:macos --cxxopt="-std=c++17" diff --git a/.gitignore b/.gitignore index 131c71f53c..0f17803082 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ tools/website/generated/ *.project __pycache__ /bazel-* +MODULE.bazel.lock diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000000..fd7c7a1316 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,10 @@ +module(name = "org_eclipse_iceroyx", version = "2.95.0") + +bazel_dep(name = "cpptoml", version = "0.1.1") +bazel_dep(name = "googletest", version = "1.15.2") +bazel_dep(name = "buildtools", dev_dependency = True, repo_name = "com_github_bazelbuild_buildtools") +git_override( + module_name = 'buildtools', + remote = 'https://github.com/bazelbuild/buildtools.git', + commit = '37932ddd72301f8ca6075ee6b24e9e5d333c96a5', # Jun 28, 2024 +) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel deleted file mode 100644 index 136a69f31d..0000000000 --- a/WORKSPACE.bazel +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -workspace(name = "org_eclipse_iceoryx") - -# Load dependency googletest -load("//bazel:load_repositories.bzl", "load_repositories") - -load_repositories() - -# Load dependency cpptoml -load("//bazel:setup_repositories.bzl", "setup_repositories") - -setup_repositories() diff --git a/bazel/cpptoml/BUILD.bazel b/bazel/cpptoml/BUILD.bazel deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/bazel/cpptoml/cpptoml.BUILD b/bazel/cpptoml/cpptoml.BUILD deleted file mode 100644 index e7fe3a407f..0000000000 --- a/bazel/cpptoml/cpptoml.BUILD +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -load("@rules_cc//cc:defs.bzl", "cc_library") - -cc_library( - name = "cpptoml", - hdrs = ["include/cpptoml.h"], - strip_include_prefix = "include", - visibility = ["//visibility:public"], -) diff --git a/bazel/cpptoml/repositories.bzl b/bazel/cpptoml/repositories.bzl deleted file mode 100644 index 5c05c243ce..0000000000 --- a/bazel/cpptoml/repositories.bzl +++ /dev/null @@ -1,34 +0,0 @@ -""" -Copyright (c) 2022 by Apex.AI Inc. All rights reserved. - -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. - -SPDX-License-Identifier: Apache-2.0 - -This module downloads the cpptoml project: https://github.com/skystrife/cpptoml -""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - -CPPTOML_VERSION = "0.1.1" - -def load_cpptoml_repositories(): - maybe( - name = "cpptoml", - repo_rule = http_archive, - sha256 = "23af72468cfd4040984d46a0dd2a609538579c78ddc429d6b8fd7a10a6e24403", - url = "https://github.com/skystrife/cpptoml/archive/refs/tags/v{version}.tar.gz".format(version = CPPTOML_VERSION), - strip_prefix = "cpptoml-{version}".format(version = CPPTOML_VERSION), - build_file = Label("//bazel/cpptoml:cpptoml.BUILD"), - ) diff --git a/bazel/googletest/BUILD.bazel b/bazel/googletest/BUILD.bazel deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/bazel/googletest/repositories.bzl b/bazel/googletest/repositories.bzl deleted file mode 100644 index 98d0a09039..0000000000 --- a/bazel/googletest/repositories.bzl +++ /dev/null @@ -1,33 +0,0 @@ -""" -Copyright (c) 2022 by Apex.AI Inc. All rights reserved. - -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. - -SPDX-License-Identifier: Apache-2.0 - -Loads https://github.com/google/googletest -""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - -GOOGLETEST_VERSION = "1.11.0" - -def load_googletest_repositories(): - maybe( - name = "googletest", - repo_rule = http_archive, - urls = ["https://github.com/google/googletest/archive/refs/tags/release-{version}.zip".format(version = GOOGLETEST_VERSION)], - sha256 = "353571c2440176ded91c2de6d6cd88ddd41401d14692ec1f99e35d013feda55a", - strip_prefix = "googletest-release-{version}".format(version = GOOGLETEST_VERSION), - ) diff --git a/bazel/load_repositories.bzl b/bazel/load_repositories.bzl deleted file mode 100644 index b258c85353..0000000000 --- a/bazel/load_repositories.bzl +++ /dev/null @@ -1,32 +0,0 @@ -""" -Copyright (c) 2022 by Apex.AI Inc. All rights reserved. - -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. - -SPDX-License-Identifier: Apache-2.0 -""" - -load("//bazel/bazelbuild:repositories.bzl", "load_com_github_bazelbuild_buildtools_repositories", "load_com_github_bazelbuild_rules_cc_repositories", "load_com_google_protobuf_repositories", "load_io_bazel_rules_go_repositories") -load("//bazel/cpptoml:repositories.bzl", "load_cpptoml_repositories") -load("//bazel/googletest:repositories.bzl", "load_googletest_repositories") - -def load_repositories(): - """ - Loads repositories for iceoryx dependencies - """ - load_com_github_bazelbuild_rules_cc_repositories() - load_io_bazel_rules_go_repositories() - load_com_google_protobuf_repositories() - load_com_github_bazelbuild_buildtools_repositories() - load_googletest_repositories() - load_cpptoml_repositories() diff --git a/bazel/setup_repositories.bzl b/bazel/setup_repositories.bzl deleted file mode 100644 index 7dc1e3cab6..0000000000 --- a/bazel/setup_repositories.bzl +++ /dev/null @@ -1,25 +0,0 @@ -""" -Copyright (c) 2022 by Apex.AI Inc. All rights reserved. - -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. - -SPDX-License-Identifier: Apache-2.0 -""" - -load("//bazel/bazelbuild:setup.bzl", "setup_go_protobuf_for_bazelbuild") - -def setup_repositories(): - """ - Loads repositories for iceoryx dependencies - """ - setup_go_protobuf_for_bazelbuild() diff --git a/iceoryx_hoofs/test/moduletests/test_utility_convert.cpp b/iceoryx_hoofs/test/moduletests/test_utility_convert.cpp index b13d467629..d227a84090 100644 --- a/iceoryx_hoofs/test/moduletests/test_utility_convert.cpp +++ b/iceoryx_hoofs/test/moduletests/test_utility_convert.cpp @@ -23,6 +23,7 @@ #include #include +#include #include namespace {