From b1ae93b0a397048226278a2845f514539102d153 Mon Sep 17 00:00:00 2001 From: Karl Wallner Date: Mon, 25 Jul 2022 13:44:38 +0200 Subject: [PATCH 01/14] iox-#1542 Add files needed for bazel build support Signed-off-by: Karl Wallner --- BUILD.bazel | 73 ++++++++ WORKSPACE.bazel | 27 +++ bazel/BUILD.bazel | 0 bazel/bazelbuild/BUILD.bazel | 0 bazel/bazelbuild/repositories.bzl | 73 ++++++++ bazel/bazelbuild/setup.bzl | 29 +++ bazel/configure_file.bzl | 42 +++++ bazel/configure_version.bzl | 67 +++++++ 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 +++ iceoryx_binding_c/BUILD.bazel | 26 +++ iceoryx_binding_c/test/BUILD.bazel | 48 +++++ iceoryx_examples/callbacks/BUILD.bazel | 55 ++++++ iceoryx_examples/callbacks_in_c/BUILD.bazel | 63 +++++++ iceoryx_examples/complexdata/BUILD.bazel | 66 +++++++ .../ice_access_control/BUILD.bazel | 66 +++++++ iceoryx_examples/icedelivery/BUILD.bazel | 66 +++++++ iceoryx_examples/icedelivery_in_c/BUILD.bazel | 45 +++++ iceoryx_examples/icediscovery/BUILD.bazel | 79 +++++++++ .../icediscovery_in_c/BUILD.bazel | 41 +++++ iceoryx_examples/icehello/BUILD.bazel | 44 +++++ iceoryx_examples/iceoptions/BUILD.bazel | 44 +++++ iceoryx_examples/iceperf/BUILD.bazel | 77 ++++++++ iceoryx_examples/request_response/BUILD.bazel | 94 ++++++++++ .../request_response_in_c/BUILD.bazel | 62 +++++++ iceoryx_examples/singleprocess/BUILD.bazel | 28 +++ iceoryx_examples/user_header/BUILD.bazel | 91 ++++++++++ iceoryx_examples/waitset/BUILD.bazel | 44 +++++ iceoryx_examples/waitset_in_c/BUILD.bazel | 80 +++++++++ iceoryx_hoofs/BUILD.bazel | 49 ++++++ iceoryx_hoofs/platform/BUILD.bazel | 79 +++++++++ iceoryx_hoofs/test/BUILD.bazel | 85 +++++++++ iceoryx_posh/BUILD.bazel | 166 ++++++++++++++++++ iceoryx_posh/test/BUILD.bazel | 91 ++++++++++ tools/introspection/BUILD.bazel | 49 ++++++ 40 files changed, 2097 insertions(+) create mode 100644 BUILD.bazel create mode 100644 WORKSPACE.bazel create mode 100644 bazel/BUILD.bazel create mode 100644 bazel/bazelbuild/BUILD.bazel create mode 100644 bazel/bazelbuild/repositories.bzl create mode 100644 bazel/bazelbuild/setup.bzl create mode 100644 bazel/configure_file.bzl create mode 100644 bazel/configure_version.bzl create mode 100644 bazel/cpptoml/BUILD.bazel create mode 100644 bazel/cpptoml/cpptoml.BUILD create mode 100644 bazel/cpptoml/repositories.bzl create mode 100644 bazel/googletest/BUILD.bazel create mode 100644 bazel/googletest/repositories.bzl create mode 100644 bazel/load_repositories.bzl create mode 100644 bazel/setup_repositories.bzl create mode 100644 iceoryx_binding_c/BUILD.bazel create mode 100644 iceoryx_binding_c/test/BUILD.bazel create mode 100644 iceoryx_examples/callbacks/BUILD.bazel create mode 100644 iceoryx_examples/callbacks_in_c/BUILD.bazel create mode 100644 iceoryx_examples/complexdata/BUILD.bazel create mode 100644 iceoryx_examples/ice_access_control/BUILD.bazel create mode 100644 iceoryx_examples/icedelivery/BUILD.bazel create mode 100644 iceoryx_examples/icedelivery_in_c/BUILD.bazel create mode 100644 iceoryx_examples/icediscovery/BUILD.bazel create mode 100644 iceoryx_examples/icediscovery_in_c/BUILD.bazel create mode 100644 iceoryx_examples/icehello/BUILD.bazel create mode 100644 iceoryx_examples/iceoptions/BUILD.bazel create mode 100644 iceoryx_examples/iceperf/BUILD.bazel create mode 100644 iceoryx_examples/request_response/BUILD.bazel create mode 100644 iceoryx_examples/request_response_in_c/BUILD.bazel create mode 100644 iceoryx_examples/singleprocess/BUILD.bazel create mode 100644 iceoryx_examples/user_header/BUILD.bazel create mode 100644 iceoryx_examples/waitset/BUILD.bazel create mode 100644 iceoryx_examples/waitset_in_c/BUILD.bazel create mode 100644 iceoryx_hoofs/BUILD.bazel create mode 100644 iceoryx_hoofs/platform/BUILD.bazel create mode 100644 iceoryx_hoofs/test/BUILD.bazel create mode 100644 iceoryx_posh/BUILD.bazel create mode 100644 iceoryx_posh/test/BUILD.bazel create mode 100644 tools/introspection/BUILD.bazel diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000000..a5c7ebd867 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,73 @@ +# 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("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") + +exports_files(["VERSION"]) + +alias( + name = "iceoryx_hoofs", + actual = "//iceoryx_hoofs", + visibility = ["//visibility:public"], +) + +alias( + name = "iceoryx_posh", + actual = "//iceoryx_posh", + visibility = ["//visibility:public"], +) + +alias( + name = "iceoryx_binding_c", + actual = "//iceoryx_binding_c", + visibility = ["//visibility:public"], +) + +alias( + name = "roudi", + actual = "//iceoryx_posh:iox-roudi", + visibility = ["//visibility:public"], +) + +# Execute `bazel run //:buildifier` to fix formating of all starlark files in the workspace +buildifier( + name = "buildifier", + verbose = True, +) + +# Execute `bazel run //:buildifier_test` to check all starlark files for correctness +buildifier( + name = "buildifier_test", + mode = "check", + verbose = True, +) + +# Execute `bazel run //:buildifier_lint` to reformat and run the linter on all starlark files +buildifier( + name = "buildifier_lint", + lint_mode = "fix", + lint_warnings = ["all"], + verbose = True, +) + +# Execute `bazel run //:buildifier_lint_check` to reformat and run the linter on all starlark files +buildifier( + name = "buildifier_lint_check", + lint_mode = "warn", + lint_warnings = ["all"], + mode = "check", + verbose = True, +) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel new file mode 100644 index 0000000000..136a69f31d --- /dev/null +++ b/WORKSPACE.bazel @@ -0,0 +1,27 @@ +# 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/BUILD.bazel b/bazel/BUILD.bazel new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bazel/bazelbuild/BUILD.bazel b/bazel/bazelbuild/BUILD.bazel new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bazel/bazelbuild/repositories.bzl b/bazel/bazelbuild/repositories.bzl new file mode 100644 index 0000000000..654687c02c --- /dev/null +++ b/bazel/bazelbuild/repositories.bzl @@ -0,0 +1,73 @@ +""" +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 dependent repositories from https://github.com/bazelbuild +""" + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +BAZELBUILD_RULES_CC_VERSION = "0.0.1" + +def load_com_github_bazelbuild_rules_cc_repositories(): + maybe( + name = "bazelbuild_rules_cc", + repo_rule = http_archive, + sha256 = "4dccbfd22c0def164c8f47458bd50e0c7148f3d92002cdb459c2a96a68498241", + urls = [ + "https://github.com/bazelbuild/rules_cc/releases/download/{version}/rules_cc-{version}.tar.gz".format(version = BAZELBUILD_RULES_CC_VERSION), + ], + ) + +COM_GITHUB_BAZELBUILD_BUILDTOOLS_VERSION = "5.1.0" + +def load_com_github_bazelbuild_buildtools_repositories(): + maybe( + name = "com_github_bazelbuild_buildtools", + repo_rule = http_archive, + sha256 = "e3bb0dc8b0274ea1aca75f1f8c0c835adbe589708ea89bf698069d0790701ea3", + strip_prefix = "buildtools-{version}".format(version = COM_GITHUB_BAZELBUILD_BUILDTOOLS_VERSION), + urls = [ + "https://github.com/bazelbuild/buildtools/archive/refs/tags/{version}.tar.gz".format(version = COM_GITHUB_BAZELBUILD_BUILDTOOLS_VERSION), + ], + ) + +IO_BAZEL_RULES_GO_VERSION = "0.29.0" + +def load_io_bazel_rules_go_repositories(): + maybe( + name = "io_bazel_rules_go", + repo_rule = http_archive, + sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v{version}/rules_go-v{version}.zip".format(version = IO_BAZEL_RULES_GO_VERSION), + "https://github.com/bazelbuild/rules_go/releases/download/v{version}/rules_go-v{version}.zip".format(version = IO_BAZEL_RULES_GO_VERSION), + ], + ) + +COM_GOOGLE_PROTOBUF_VERSION = "3.13.0" + +def load_com_google_protobuf_repositories(): + maybe( + name = "com_google_protobuf", + repo_rule = http_archive, + sha256 = "9b4ee22c250fe31b16f1a24d61467e40780a3fbb9b91c3b65be2a376ed913a1a", + strip_prefix = "protobuf-{version}".format(version = COM_GOOGLE_PROTOBUF_VERSION), + urls = [ + "https://github.com/protocolbuffers/protobuf/archive/v{version}.tar.gz".format(version = COM_GOOGLE_PROTOBUF_VERSION), + ], + ) diff --git a/bazel/bazelbuild/setup.bzl b/bazel/bazelbuild/setup.bzl new file mode 100644 index 0000000000..4dcc07e104 --- /dev/null +++ b/bazel/bazelbuild/setup.bzl @@ -0,0 +1,29 @@ +""" +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 + +Macro for setting the dependencies for the buildtools of bazel +""" + +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") + +def setup_go_protobuf_for_bazelbuild(): + go_rules_dependencies() + + go_register_toolchains(version = "1.17.2") + + protobuf_deps() diff --git a/bazel/configure_file.bzl b/bazel/configure_file.bzl new file mode 100644 index 0000000000..9f15bed069 --- /dev/null +++ b/bazel/configure_file.bzl @@ -0,0 +1,42 @@ +""" +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 + +The configure_file rule imitates the similar CMake function for template expansion: https://cmake.org/cmake/help/latest/command/configure_file.html +""" + +def _configure_file_impl(ctx): + ctx.actions.expand_template( + template = ctx.file.src, + output = ctx.outputs.out, + substitutions = { + "@" + k + "@": v + for k, v in ctx.attr.config.items() + }, + ) + files = depset(direct = [ctx.outputs.out]) + runfiles = ctx.runfiles(files = [ctx.outputs.out]) + return [DefaultInfo(files = files, runfiles = runfiles)] + +configure_file = rule( + implementation = _configure_file_impl, + provides = [DefaultInfo], + attrs = { + "config": attr.string_dict(mandatory = True), + "out": attr.output(mandatory = True), + "src": attr.label(mandatory = True, allow_single_file = True), + }, +) diff --git a/bazel/configure_version.bzl b/bazel/configure_version.bzl new file mode 100644 index 0000000000..c54ccc686d --- /dev/null +++ b/bazel/configure_version.bzl @@ -0,0 +1,67 @@ +""" +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 set compile-time variables and set them accordingly in generated files +""" + +SCRIPT = """#!/bin/bash + +set -e + +version_file="{version_file}" +input_file="{input_file}" +output_file="{output_file}" + +IFS="-" read version_number version_suffix <<< $(<"$version_file") +IFS="." read major_version minor_version patch_version tweak_version <<< $version_number +[ -z "$version_suffix" ] && version_delim="" || version_delim="-" + +data="$(<"$input_file")" +data=${{data/@PROJECT_VERSION_MAJOR@/${{major_version:-0}}}} +data=${{data/@PROJECT_VERSION_MINOR@/${{minor_version:-0}}}} +data=${{data/@PROJECT_VERSION_PATCH@/${{patch_version:-0}}}} +data=${{data/@IOX_VERSION_TWEAK@/${{tweak_version:-0}}}} +data=${{data/@PROJECT_VERSION@/${{version_number}}}} +data=${{data/@IOX_VERSION_SUFFIX@/${{version_delim}}${{version_suffix}}}} +data=${{data/@ICEORYX_BUILDDATE@/builddate_not_set}} +data=${{data/@ICEORYX_SHA1@/sha1_not_set}} + +echo "$data" > $output_file +""" + +def _configure_version_impl(ctx): + ctx.actions.run_shell( + command = SCRIPT.format( + version_file = ctx.files.version_from[0].path, + input_file = ctx.files.src[0].path, + output_file = ctx.outputs.out.path, + ), + inputs = ctx.files.src + ctx.files.version_from, + outputs = [ctx.outputs.out], + ) + files = depset(direct = [ctx.outputs.out]) + return [DefaultInfo(files = files)] + +configure_version = rule( + implementation = _configure_version_impl, + provides = [DefaultInfo], + attrs = { + "out": attr.output(mandatory = True), + "src": attr.label(mandatory = True, allow_single_file = True), + "version_from": attr.label(mandatory = True, allow_single_file = True), + }, +) diff --git a/bazel/cpptoml/BUILD.bazel b/bazel/cpptoml/BUILD.bazel new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bazel/cpptoml/cpptoml.BUILD b/bazel/cpptoml/cpptoml.BUILD new file mode 100644 index 0000000000..e7fe3a407f --- /dev/null +++ b/bazel/cpptoml/cpptoml.BUILD @@ -0,0 +1,24 @@ +# 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 new file mode 100644 index 0000000000..f58b1a9487 --- /dev/null +++ b/bazel/cpptoml/repositories.bzl @@ -0,0 +1,34 @@ +""" +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 = "//bazel/cpptoml:cpptoml.BUILD", + ) diff --git a/bazel/googletest/BUILD.bazel b/bazel/googletest/BUILD.bazel new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bazel/googletest/repositories.bzl b/bazel/googletest/repositories.bzl new file mode 100644 index 0000000000..98d0a09039 --- /dev/null +++ b/bazel/googletest/repositories.bzl @@ -0,0 +1,33 @@ +""" +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 new file mode 100644 index 0000000000..b258c85353 --- /dev/null +++ b/bazel/load_repositories.bzl @@ -0,0 +1,32 @@ +""" +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 new file mode 100644 index 0000000000..7dc1e3cab6 --- /dev/null +++ b/bazel/setup_repositories.bzl @@ -0,0 +1,25 @@ +""" +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_binding_c/BUILD.bazel b/iceoryx_binding_c/BUILD.bazel new file mode 100644 index 0000000000..515205f5b2 --- /dev/null +++ b/iceoryx_binding_c/BUILD.bazel @@ -0,0 +1,26 @@ +# 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 = "iceoryx_binding_c", + srcs = glob(["source/**"]), + hdrs = glob(["include/**"]), + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = ["//iceoryx_posh"], +) diff --git a/iceoryx_binding_c/test/BUILD.bazel b/iceoryx_binding_c/test/BUILD.bazel new file mode 100644 index 0000000000..39e0e0bbd7 --- /dev/null +++ b/iceoryx_binding_c/test/BUILD.bazel @@ -0,0 +1,48 @@ +# 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_test") + +cc_test( + name = "binding_c_moduletests", + srcs = glob([ + "moduletests/*.cpp", + "moduletests/*.hpp", + "mocks/*.hpp", + "*.hpp", + ]), + includes = [ + ".", + "mocks", + "moduletests", + ], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": ["-ldl"], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = [ + "//iceoryx_binding_c", + "//iceoryx_hoofs:iceoryx_hoofs_testing", + "//iceoryx_posh", + "//iceoryx_posh:iceoryx_posh_testing", + ], +) diff --git a/iceoryx_examples/callbacks/BUILD.bazel b/iceoryx_examples/callbacks/BUILD.bazel new file mode 100644 index 0000000000..8dc2d886dd --- /dev/null +++ b/iceoryx_examples/callbacks/BUILD.bazel @@ -0,0 +1,55 @@ +# 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_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-callbacks-publisher", + srcs = [ + "ice_callbacks_publisher.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-callbacks-subscriber", + srcs = [ + "ice_callbacks_subscriber.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-callbacks-listener-as-class-member", + srcs = [ + "ice_callbacks_listener_as_class_member.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/callbacks_in_c/BUILD.bazel b/iceoryx_examples/callbacks_in_c/BUILD.bazel new file mode 100644 index 0000000000..0c8507a142 --- /dev/null +++ b/iceoryx_examples/callbacks_in_c/BUILD.bazel @@ -0,0 +1,63 @@ +# 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_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.h"], +) + +cc_library( + name = "sleep_for", + hdrs = ["sleep_for.h"], +) + +cc_binary( + name = "iox-c-callbacks-publisher", + srcs = [ + "ice_c_callbacks_publisher.c", + ], + deps = [ + ":sleep_for", + ":topic_data", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-callbacks-subscriber", + srcs = [ + "ice_c_callbacks_subscriber.c", + ], + deps = [ + ":sleep_for", + ":topic_data", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-callbacks-with-context-data", + srcs = [ + "ice_c_callbacks_with_context_data.c", + ], + deps = [ + ":sleep_for", + ":topic_data", + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_examples/complexdata/BUILD.bazel b/iceoryx_examples/complexdata/BUILD.bazel new file mode 100644 index 0000000000..bcc696442b --- /dev/null +++ b/iceoryx_examples/complexdata/BUILD.bazel @@ -0,0 +1,66 @@ +# 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_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-publisher-vector", + srcs = [ + "iox_publisher_vector.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber-vector", + srcs = [ + "iox_subscriber_vector.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-publisher-complexdata", + srcs = [ + "iox_publisher_complexdata.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber-complexdata", + srcs = [ + "iox_subscriber_complexdata.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/ice_access_control/BUILD.bazel b/iceoryx_examples/ice_access_control/BUILD.bazel new file mode 100644 index 0000000000..4f83eab867 --- /dev/null +++ b/iceoryx_examples/ice_access_control/BUILD.bazel @@ -0,0 +1,66 @@ +# 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_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-radar", + srcs = [ + "iox_radar_app.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-display", + srcs = [ + "iox_display_app.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-cheeky", + srcs = [ + "iox_cheeky_app.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-roudi-static-segments", + srcs = [ + "roudi_main_static_segments.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh:iceoryx_posh_roudi", + ], +) diff --git a/iceoryx_examples/icedelivery/BUILD.bazel b/iceoryx_examples/icedelivery/BUILD.bazel new file mode 100644 index 0000000000..654fa9872a --- /dev/null +++ b/iceoryx_examples/icedelivery/BUILD.bazel @@ -0,0 +1,66 @@ +# 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_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-publisher", + srcs = [ + "iox_publisher.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-publisher-untyped", + srcs = [ + "iox_publisher_untyped.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber", + srcs = [ + "iox_subscriber.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber-untyped", + srcs = [ + "iox_subscriber_untyped.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/icedelivery_in_c/BUILD.bazel b/iceoryx_examples/icedelivery_in_c/BUILD.bazel new file mode 100644 index 0000000000..b4dbe44f3c --- /dev/null +++ b/iceoryx_examples/icedelivery_in_c/BUILD.bazel @@ -0,0 +1,45 @@ +# 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_binary") + +topic_data_h = "topic_data.h" + +sleep_for_h = "sleep_for.h" + +cc_binary( + name = "iox-c-publisher", + srcs = [ + "ice_c_publisher.c", + topic_data_h, + sleep_for_h, + ], + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-subscriber", + srcs = [ + "ice_c_subscriber.c", + topic_data_h, + sleep_for_h, + ], + deps = [ + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_examples/icediscovery/BUILD.bazel b/iceoryx_examples/icediscovery/BUILD.bazel new file mode 100644 index 0000000000..8e1d85e0e4 --- /dev/null +++ b/iceoryx_examples/icediscovery/BUILD.bazel @@ -0,0 +1,79 @@ +# 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_binary", "cc_library") + +cc_binary( + name = "iox-cpp-offer-service", + srcs = [ + "iox_offer_service.cpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-find-service", + srcs = [ + "iox_find_service.cpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_library( + name = "discovery_blocking", + srcs = ["src/discovery_blocking.cpp"], + hdrs = ["include/discovery_blocking.hpp"], + strip_include_prefix = "include", + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-wait-for-service", + srcs = [ + "iox_wait_for_service.cpp", + ], + deps = [ + ":discovery_blocking", + "//iceoryx_posh", + ], +) + +cc_library( + name = "discovery_monitor", + srcs = ["src/discovery_monitor.cpp"], + hdrs = ["include/discovery_monitor.hpp"], + strip_include_prefix = "include", + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-discovery-monitor", + srcs = [ + "iox_discovery_monitor.cpp", + ], + deps = [ + ":discovery_monitor", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/icediscovery_in_c/BUILD.bazel b/iceoryx_examples/icediscovery_in_c/BUILD.bazel new file mode 100644 index 0000000000..833c571537 --- /dev/null +++ b/iceoryx_examples/icediscovery_in_c/BUILD.bazel @@ -0,0 +1,41 @@ +# 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_binary") + +sleep_for_h = "sleep_for.h" + +cc_binary( + name = "iox-c-offer-service", + srcs = [ + "iox_c_offer_service.c", + sleep_for_h, + ], + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-find-service", + srcs = [ + "iox_c_find_service.c", + sleep_for_h, + ], + deps = [ + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_examples/icehello/BUILD.bazel b/iceoryx_examples/icehello/BUILD.bazel new file mode 100644 index 0000000000..dd9c28f4c2 --- /dev/null +++ b/iceoryx_examples/icehello/BUILD.bazel @@ -0,0 +1,44 @@ +# 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_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-publisher-helloworld", + srcs = [ + "iox_publisher_helloworld.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber-helloworld", + srcs = [ + "iox_subscriber_helloworld.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/iceoptions/BUILD.bazel b/iceoryx_examples/iceoptions/BUILD.bazel new file mode 100644 index 0000000000..c3fc3d5de7 --- /dev/null +++ b/iceoryx_examples/iceoptions/BUILD.bazel @@ -0,0 +1,44 @@ +# 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_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-publisher-with-options", + srcs = [ + "iox_publisher_with_options.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber-with-options", + srcs = [ + "iox_subscriber_with_options.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/iceperf/BUILD.bazel b/iceoryx_examples/iceperf/BUILD.bazel new file mode 100644 index 0000000000..6f9b419cb4 --- /dev/null +++ b/iceoryx_examples/iceperf/BUILD.bazel @@ -0,0 +1,77 @@ +# 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_binary", "cc_library") + +cc_library( + name = "iceperf_base", + srcs = [ + "base.cpp", + "iceoryx.cpp", + "iceoryx_c.cpp", + "mq.cpp", + "uds.cpp", + ], + hdrs = [ + "base.hpp", + "example_common.hpp", + "iceoryx.hpp", + "iceoryx_c.hpp", + "mq.hpp", + "topic_data.hpp", + "uds.hpp", + ], + visibility = ["//visibility:private"], + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iceperf-bench-leader", + srcs = [ + "iceperf_leader.cpp", + "iceperf_leader.hpp", + "main_leader.cpp", + ], + includes = ["."], + deps = [ + ":iceperf_base", + ], +) + +cc_binary( + name = "iceperf-bench-follower", + srcs = [ + "iceperf_follower.cpp", + "iceperf_follower.hpp", + "main_follower.cpp", + ], + includes = ["."], + deps = [ + ":iceperf_base", + ], +) + +cc_binary( + name = "iceperf-roudi", + srcs = [ + "roudi_main_static_config.cpp", + ], + deps = [ + "//iceoryx_posh:iceoryx_posh_roudi", + ], +) diff --git a/iceoryx_examples/request_response/BUILD.bazel b/iceoryx_examples/request_response/BUILD.bazel new file mode 100644 index 0000000000..a3da5eae12 --- /dev/null +++ b/iceoryx_examples/request_response/BUILD.bazel @@ -0,0 +1,94 @@ +# 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_binary", "cc_library") + +cc_library( + name = "request_response_types", + hdrs = ["request_and_response_types.hpp"], +) + +## C++ untyped API client +cc_binary( + name = "iox-cpp-request-response-untyped-client", + srcs = [ + "client_cxx_untyped.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) + +## C++ untyped API server +cc_binary( + name = "iox-cpp-request-response-untyped-server", + srcs = [ + "server_cxx_untyped.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) + +## C++ typed API client +cc_binary( + name = "iox-cpp-request-response-basic-client", + srcs = [ + "client_cxx_basic.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) + +## C++ typed API client with WaitSet +cc_binary( + name = "iox-cpp-request-response-waitset-client", + srcs = [ + "client_cxx_waitset.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) + +## C++ typed API server +cc_binary( + name = "iox-cpp-request-response-basic-server", + srcs = [ + "server_cxx_basic.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) + +## C++ typed API server with Listener +cc_binary( + name = "iox-cpp-request-response-listener-server", + srcs = [ + "server_cxx_listener.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/request_response_in_c/BUILD.bazel b/iceoryx_examples/request_response_in_c/BUILD.bazel new file mode 100644 index 0000000000..63c0f6c5b1 --- /dev/null +++ b/iceoryx_examples/request_response_in_c/BUILD.bazel @@ -0,0 +1,62 @@ +# 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_binary") + +additional_c_header = [ + "sleep_for.h", + "request_and_response_c_types.h", +] + +cc_binary( + name = "iox-c-request-response-client-basic", + srcs = [ + "client_c_basic.c", + ] + additional_c_header, + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-request-response-client-waitset", + srcs = [ + "client_c_waitset.c", + ] + additional_c_header, + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-request-response-server-basic", + srcs = [ + "server_c_basic.c", + ] + additional_c_header, + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-request-response-server-listener", + srcs = [ + "server_c_listener.c", + ] + additional_c_header, + deps = [ + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_examples/singleprocess/BUILD.bazel b/iceoryx_examples/singleprocess/BUILD.bazel new file mode 100644 index 0000000000..e6a944a40d --- /dev/null +++ b/iceoryx_examples/singleprocess/BUILD.bazel @@ -0,0 +1,28 @@ +# 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_binary") + +cc_binary( + name = "single_process", + srcs = [ + "single_process.cpp", + ], + deps = [ + "//iceoryx_posh", + "//iceoryx_posh:iceoryx_posh_roudi", + ], +) diff --git a/iceoryx_examples/user_header/BUILD.bazel b/iceoryx_examples/user_header/BUILD.bazel new file mode 100644 index 0000000000..d67f97c425 --- /dev/null +++ b/iceoryx_examples/user_header/BUILD.bazel @@ -0,0 +1,91 @@ +# 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_binary", "cc_library") + +cc_binary( + name = "iox-cpp-user-header-publisher", + srcs = [ + "publisher_cxx_api.cpp", + "user_header_and_payload_types.hpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-user-header-untyped-publisher", + srcs = [ + "publisher_untyped_cxx_api.cpp", + "user_header_and_payload_types.hpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-user-header-subscriber", + srcs = [ + "subscriber_cxx_api.cpp", + "user_header_and_payload_types.hpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-user-header-untyped-subscriber", + srcs = [ + "subscriber_untyped_cxx_api.cpp", + "user_header_and_payload_types.hpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_library( + name = "additional_c_header", + hdrs = [ + "sleep_for.h", + "user_header_and_payload_types.h", + ], +) + +cc_binary( + name = "iox-c-user-header-publisher", + srcs = [ + "publisher_c_api.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-user-header-subscriber", + srcs = [ + "subscriber_c_api.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_examples/waitset/BUILD.bazel b/iceoryx_examples/waitset/BUILD.bazel new file mode 100644 index 0000000000..347a61ecc8 --- /dev/null +++ b/iceoryx_examples/waitset/BUILD.bazel @@ -0,0 +1,44 @@ +# 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_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +waitset_types = [ + "publisher", + "gateway", + "grouping", + "individual", + "timer_driven_execution", + "trigger", + "basic", +] + +[ + cc_binary( + name = "iox-cpp-waitset-" + type, + srcs = ["ice_waitset_" + type + ".cpp"], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], + ) + for type in waitset_types +] diff --git a/iceoryx_examples/waitset_in_c/BUILD.bazel b/iceoryx_examples/waitset_in_c/BUILD.bazel new file mode 100644 index 0000000000..ad3c8e67b8 --- /dev/null +++ b/iceoryx_examples/waitset_in_c/BUILD.bazel @@ -0,0 +1,80 @@ +# 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_binary", "cc_library") + +cc_library( + name = "additional_c_header", + hdrs = [ + "sleep_for.h", + "topic_data.h", + ], +) + +cc_binary( + name = "iox-c-waitset-publisher", + srcs = [ + "ice_c_waitset_publisher.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-waitset-gateway", + srcs = [ + "ice_c_waitset_gateway.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-waitset-grouping", + srcs = [ + "ice_c_waitset_grouping.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-waitset-individual", + srcs = [ + "ice_c_waitset_individual.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-waitset-timer-driven-execution", + srcs = [ + "ice_c_waitset_timer_driven_execution.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_hoofs/BUILD.bazel b/iceoryx_hoofs/BUILD.bazel new file mode 100644 index 0000000000..50867b86cb --- /dev/null +++ b/iceoryx_hoofs/BUILD.bazel @@ -0,0 +1,49 @@ +# 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 = "iceoryx_hoofs", + srcs = glob([ + "source/**/*.cpp", + "source/**/*.hpp", + ]), + hdrs = glob(["include/**"]), + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-lacl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-lacl"], + }), + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = ["//iceoryx_hoofs/platform:iceoryx_platform"], +) + +cc_library( + name = "iceoryx_hoofs_testing", + srcs = glob(["testing/**/*.cpp"]), + hdrs = glob(["testing/include/**"]), + strip_include_prefix = "testing/include", + visibility = ["//visibility:public"], + deps = [ + ":iceoryx_hoofs", + "@googletest//:gtest", + ], +) diff --git a/iceoryx_hoofs/platform/BUILD.bazel b/iceoryx_hoofs/platform/BUILD.bazel new file mode 100644 index 0000000000..f320b8a912 --- /dev/null +++ b/iceoryx_hoofs/platform/BUILD.bazel @@ -0,0 +1,79 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") + +# +# Config & Platform support +# +config_setting( + name = "linux", + constraint_values = ["@platforms//os:linux"], +) + +config_setting( + name = "qnx", + constraint_values = ["@platforms//os:qnx"], +) + +config_setting( + name = "mac", + constraint_values = ["@platforms//os:osx"], +) + +config_setting( + name = "win", + constraint_values = ["@platforms//os:windows"], +) + +config_setting( + name = "unix", + constraint_values = ["@platforms//os:freebsd"], +) + +# +# Library: iceoryx_platform +# +cc_library( + name = "iceoryx_platform", + srcs = select({ + ":linux": glob(["linux/source/**"]), + ":mac": glob(["mac/source/**"]), + ":qnx": glob(["qnx/source/**"]), + ":unix": glob(["unix/source/**"]), + ":win": glob(["win/source/**"]), + "//conditions:default": glob(["linux/source/**"]), + }), + hdrs = select({ + ":linux": glob(["linux/include/**"]), + ":mac": glob(["mac/include/**"]), + ":qnx": glob(["qnx/include/**"]), + ":unix": glob(["unix/include/**"]), + ":win": glob(["win/include/**"]), + "//conditions:default": glob(["linux/include/**"]), + }), + includes = select({ + ":linux": ["linux/include"], + ":mac": ["mac/include/**"], + ":qnx": ["qnx/include"], + ":unix": ["unix/include/**"], + ":win": ["win/include/**"], + "//conditions:default": ["linux/include/**"], + }), + linkopts = select({ + ":linux": [ + "-lpthread", + "-lrt", + ], + ":mac": [], + ":qnx": ["-lsocket"], + ":unix": [ + "-lpthread", + "-lrt", + ], + ":win": [], + "//conditions:default": [ + "-lpthread", + "-lrt", + ], + }), + visibility = ["//visibility:public"], + deps = [], +) diff --git a/iceoryx_hoofs/test/BUILD.bazel b/iceoryx_hoofs/test/BUILD.bazel new file mode 100644 index 0000000000..94d85778ae --- /dev/null +++ b/iceoryx_hoofs/test/BUILD.bazel @@ -0,0 +1,85 @@ +# 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_test") + +cc_test( + name = "hoofs_moduletests", + srcs = glob([ + "moduletests/*.cpp", + "moduletests/*.hpp", + "*.hpp", + ]), + includes = [ + ".", + "moduletests", + ], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"], +) + +cc_test( + name = "hoofs_integrationtests", + srcs = glob([ + "integrationtests/*.cpp", + "integrationtests/*.hpp", + "*.hpp", + ]), + includes = [ + ".", + "integrationtests", + ], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"], +) + +cc_test( + name = "test_stress_sofi", + srcs = ["stresstests/test_stress_sofi.cpp"], + includes = [ + ".", + "integrationtests", + ], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"], +) diff --git a/iceoryx_posh/BUILD.bazel b/iceoryx_posh/BUILD.bazel new file mode 100644 index 0000000000..e32b1e09eb --- /dev/null +++ b/iceoryx_posh/BUILD.bazel @@ -0,0 +1,166 @@ +# 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_binary", "cc_library") +load("//bazel:configure_file.bzl", "configure_file") +load("//bazel:configure_version.bzl", "configure_version") + +# +########## posh core lib ########## +# +configure_file( + name = "iceoryx_posh_deployment_hpp", + src = "cmake/iceoryx_posh_deployment.hpp.in", + out = "include/iceoryx_posh/iceoryx_posh_deployment.hpp", + config = { + # FIXME: for values see "iceoryx_posh/cmake/IceoryxPoshDeployment.cmake" ... for now some nice defaults + "IOX_COMMUNICATION_POLICY": "ManyToManyPolicy", + "IOX_INTERNAL_MAX_NUMBER_OF_NOTIFIERS": "256", + "IOX_MAX_CHUNKS_ALLOCATED_PER_PUBLISHER_SIMULTANEOUSLY": "8", + "IOX_MAX_CHUNKS_HELD_PER_SUBSCRIBER_SIMULTANEOUSLY": "256", + "IOX_MAX_INTERFACE_NUMBER": "4", + "IOX_MAX_PUBLISHERS": "512", + "IOX_MAX_PUBLISHER_HISTORY": "16", + "IOX_MAX_SUBSCRIBERS": "1024", + "IOX_MAX_SUBSCRIBERS_PER_PUBLISHER": "256", + }, +) + +configure_version( + name = "iceoryx_versions_hpp", + src = "cmake/iceoryx_versions.hpp.in", + out = "include/iceoryx_versions.hpp", + version_from = "//:VERSION", +) + +# +########## posh lib ########## +# + +# Special file handling - part 1: Files which are part of "iceoryx_posh" (despite located in "roudi"-subdirectory) +iceory_posh_extra_roudi_files = [ + "source/roudi/service_registry.cpp", +] + +# Special file handling - part 2: Files which are part of "iceoryx_posh_config" +iceory_posh_config_files = [ + "source/log/posh_config_logging.cpp", + "source/gateway/gateway_config.cpp", + "source/gateway/toml_gateway_config_parser.cpp", + "source/roudi/roudi_config_toml_file_provider.cpp", +] + +# Special file handling - part 3: Files which are part of "iox-roudi" executable +iox_roudi_executable_files = [ + "source/roudi/application/roudi_main.cpp", +] + +cc_library( + name = "iceoryx_posh", + srcs = glob( + [ + "source/log/**", + "source/capro/**", + "source/error_handling/**", + "source/mepoo/**", + "source/popo/**", + "source/version/**", + "source/runtime/**", + ], + exclude = iceory_posh_config_files, + ) + + iceory_posh_extra_roudi_files, + hdrs = glob(["include/**"]) + [ + ":iceoryx_posh_deployment_hpp", + ":iceoryx_versions_hpp", + ], + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = ["//iceoryx_hoofs"], +) + +# +########## posh lib for gateway support ########## +# +cc_library( + name = "iceoryx_posh_gateway", + srcs = glob( + ["source/gateway/**"], + exclude = iceory_posh_config_files, + ), + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = [":iceoryx_posh"], +) + +# +########## posh roudi lib ########## +# + +cc_library( + name = "iceoryx_posh_roudi", + srcs = glob( + ["source/roudi/**"], + exclude = iceory_posh_extra_roudi_files + iceory_posh_config_files + iox_roudi_executable_files, + ), + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = [":iceoryx_posh"], +) + +# +######### posh config lib ########## +# +cc_library( + name = "iceoryx_posh_config", + srcs = iceory_posh_config_files, + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = [ + ":iceoryx_posh", + "@cpptoml", + ], +) + +# +######### posh roudi daemon ########## +# +cc_binary( + name = "iox-roudi", + srcs = iox_roudi_executable_files, + visibility = ["//visibility:public"], + deps = [ + ":iceoryx_posh_config", + ":iceoryx_posh_roudi", + ], +) + +# +########## build iceoryx posh testing lib ########## +# +cc_library( + name = "iceoryx_posh_testing", + srcs = glob(["testing/**/*.cpp"]), + hdrs = glob(["testing/include/**"]), + strip_include_prefix = "testing/include", + visibility = ["//visibility:public"], + deps = [ + ":iceoryx_posh", + ":iceoryx_posh_roudi", + "//iceoryx_hoofs:iceoryx_hoofs_testing", + "@googletest//:gtest", + ], +) diff --git a/iceoryx_posh/test/BUILD.bazel b/iceoryx_posh/test/BUILD.bazel new file mode 100644 index 0000000000..6117da0c94 --- /dev/null +++ b/iceoryx_posh/test/BUILD.bazel @@ -0,0 +1,91 @@ +# 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_test") +load("//bazel:configure_file.bzl", "configure_file") + +configure_file( + name = "test_input_path_hpp", + src = "moduletests/test_input_path.hpp.in", + out = "iceoryx/tests/posh/moduletests/test_input_path.hpp", + config = { + "POSH_TEST_INPUT_FILES_PATH": "iceoryx_posh/test/input/", + }, +) + +cc_test( + name = "posh_moduletests", + srcs = glob([ + "moduletests/*.cpp", + "moduletests/*.hpp", + "mocks/*.hpp", + "stubs/*.hpp", + "*.hpp", + ]) + [":test_input_path_hpp"], + data = glob(["input/**"]), + includes = [ + ".", + "mocks", + "moduletests", + "stubs", + ], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = [ + "//iceoryx_hoofs:iceoryx_hoofs_testing", + "//iceoryx_posh", + "//iceoryx_posh:iceoryx_posh_config", + "//iceoryx_posh:iceoryx_posh_testing", + "@cpptoml", + ], +) + +cc_test( + name = "posh_integrationtests", + srcs = glob([ + "integrationtests/*.cpp", + "integrationtests/*.hpp", + "*.hpp", + ]), + includes = [ + ".", + "integrationtests", + ], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = [ + "//iceoryx_hoofs:iceoryx_hoofs_testing", + "//iceoryx_posh", + "//iceoryx_posh:iceoryx_posh_gateway", + "//iceoryx_posh:iceoryx_posh_testing", + ], +) diff --git a/tools/introspection/BUILD.bazel b/tools/introspection/BUILD.bazel new file mode 100644 index 0000000000..3a1a136bf3 --- /dev/null +++ b/tools/introspection/BUILD.bazel @@ -0,0 +1,49 @@ +# 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_binary", "cc_library") + +cc_library( + name = "iceoryx_introspection", + srcs = [ + "source/iceoryx_introspection_app.cpp", + "source/introspection_app.cpp", + ], + hdrs = glob(["include/iceoryx_introspection/**"]), + linkopts = ["-lncurses"], + strip_include_prefix = "include", + #Windows does not offer ncurses, therefore we do not build the lib + target_compatible_with = select({ + "@platforms//os:windows": ["@platforms//:incompatible"], + "//conditions:default": [], + }), + visibility = ["//visibility:public"], + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-introspection-client", + srcs = [ + "source/introspection_main.cpp", + ], + visibility = ["//visibility:public"], + deps = [ + ":iceoryx_introspection", + "//iceoryx_posh", + ], +) From 19031a11add435d3bf067ff008cc2f255d7119ff Mon Sep 17 00:00:00 2001 From: Karl Wallner Date: Mon, 25 Jul 2022 13:47:56 +0200 Subject: [PATCH 02/14] iox-#1542 Document bazel build Signed-off-by: Karl Wallner --- doc/website/getting-started/installation.md | 62 +++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/doc/website/getting-started/installation.md b/doc/website/getting-started/installation.md index aa57f49162..127c070eab 100644 --- a/doc/website/getting-started/installation.md +++ b/doc/website/getting-started/installation.md @@ -224,3 +224,65 @@ colcon build ``` This build method makes the most sense in combination with [rmw_iceoryx](https://github.com/ros2/rmw_iceoryx.git) + +## Build with Bazel + +A second option is to build iceoryx with [Bazel](https://bazel.build/) as an alternative build and test tool. +In comparison to CMake it offers an easier syntax with better performance and a hermetic build mode for reproducible builds. + +To install Bazel you can use [Bazelisk](https://bazel.build/install/bazelisk). +Bazel uses workspaces and BUILD files to set up the infrastructure. You will notice +that in the root directory of iceoryx a `WORKSPACE` is added that defines the workspace folder. +In general, a Bazel workspace contains the project-specific source code and build outputs. +In the corresponding iceoryx modules (e.g. iceoryx_hoofs) you will find `BUILD` files +that contain instructions for Bazel to build and test targets.[[1]] + +[1]: https://bazel.build/install/bazelisk + +To build a specific target with Bazel you can use the `bazel build` command: + +```bash +cd iceoryx +bazel build //iceoryx_posh:iox-roudi +``` + +The `//iceoryx_posh` argument is the location of the BUILD file for the package. +BUILD files can be seen similar to CMakeLists.txt files where the build targets are defined. +The `iox-roudi` separated by a colon is the actual target defined in the BUILD file. + +!!! tip + Using `bazel build //...` will build all Bazel targets. + +!!! note + The names for iceoryx targets like libraries, applications and test are the same as in the CMake build system. + +You will notice that four additional `bazel-*` folders are created in the iceoryx root folder. +They contain the build artifacts and test log. Bazel compiles the libraries always static and +dynamic and place them into the `bazel-out` folder. + +Executing tests with Bazel is similar like building: + +```bash +cd iceoryx +bazel test //iceoryx_hoofs/test:hoofs_moduletests +``` + +!!! tip + Using `bazel test //...` will run all tests defined in Bazel. + +!!! note + Logs and generated XML files with the results are automatically created and + stored within the `bazel-testlogs` folder. + +Bazel offers the possibility to execute binaries: + +```bash +cd iceoryx +bazel run //iceoryx_posh:iox-roudi +``` + +!!! tip + Calling `bazel test` or `bazel run` directly without a previous `bazel build` is possible and will build the necessary targets automatically. + +The support for Bazel in iceoryx is work in progress but the most important libraries and applications are covered. +Ideas and Remarks are always welcome, feel free to create an issue or discussion on the GitHub repository. From 3ffc183e73f9772e51f9ca4b719530354889f856 Mon Sep 17 00:00:00 2001 From: Karl Wallner Date: Mon, 25 Jul 2022 13:48:47 +0200 Subject: [PATCH 03/14] iox-#1542 Adjust contributor documentation for bazel Signed-off-by: Karl Wallner --- CONTRIBUTING.md | 2 ++ .../installation-guide-for-contributors.md | 33 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3b3d6ca67b..5024b73dee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -119,6 +119,8 @@ codebase follows these rules, things are work in progress. See [error-handling.md](./doc/design/error-handling.md) for additional information about logging and error handling. +For formatting and linting rules on Bazel files see the [installation guide for contributors](./doc/website/advanced/installation-guide-for-contributors.md#bazel). + ### Naming conventions * File names with `lower_snake_case`: `my_thing.hpp` diff --git a/doc/website/advanced/installation-guide-for-contributors.md b/doc/website/advanced/installation-guide-for-contributors.md index e579f899df..77847ca1fb 100644 --- a/doc/website/advanced/installation-guide-for-contributors.md +++ b/doc/website/advanced/installation-guide-for-contributors.md @@ -142,10 +142,41 @@ machine. With `./tools/scripts/ice_env.sh` one can create a docker container with preinstalled dependencies and a configuration similar to the CI target container. -When for instance the target ubuntu 18.04 fails we can start the container with +When for instance the target Ubuntu 18.04 fails we can start the container with ```sh ./tools/scripts/ice_env.sh enter ubuntu:18.04 ``` which enters the environment automatically and one can start debugging. + +## Bazel + +When working with Bazel, additional tools can help the developer to maintain +a consistent codebase similar to the Clang Tools (clang-format and clang-tidy) for C++. +The [Buildifier Tool](https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md) +offers formatting and linting for Bazel files. + +The formatting is based on rules given by Buildifier and the linting is based on +a list of [warnings](https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md). + +To check formatting of the Bazel files the following command needs to run in the iceoryx +workspace. + +```bash +cd iceoryx +bazel run //:buildifier +``` + +Buildifier automatically reformat the code. + +For formatting and linting this command will do the job: + +```bash +cd iceoryx +bazel run //:buildifier_lint +``` + +The CI will check for the correct formatting and linting. +See the [BUILD](https://github.com/eclipse-iceoryx/iceoryx/blob/master/BUILD) file +in iceoryx workspace for available commands. From 2ddb301905ac9960ad9a8ae9b047c133d7983093 Mon Sep 17 00:00:00 2001 From: Karl Wallner Date: Mon, 25 Jul 2022 13:53:55 +0200 Subject: [PATCH 04/14] iox-#1542 Correct include location of inline files Signed-off-by: Karl Wallner --- iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp | 2 +- .../iceoryx_hoofs/internal/concurrent/lockfree_queue/buffer.hpp | 2 +- .../internal/concurrent/lockfree_queue/cyclic_index.hpp | 2 +- .../internal/concurrent/lockfree_queue/index_queue.hpp | 2 +- .../internal/relocatable_pointer/base_relative_pointer.hpp | 2 +- .../internal/relocatable_pointer/relative_pointer.hpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp index bbb088b592..7d967bb83f 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp @@ -19,7 +19,7 @@ #include "iceoryx_hoofs/cxx/type_traits.hpp" #include "iceoryx_hoofs/internal/cxx/string_internal.hpp" -#include "optional.hpp" +#include "iceoryx_hoofs/cxx/optional.hpp" #include #include diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/buffer.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/buffer.hpp index ba4c6a97eb..ed222c7ad5 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/buffer.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/buffer.hpp @@ -61,6 +61,6 @@ class Buffer } // namespace concurrent } // namespace iox -#include "buffer.inl" +#include "iceoryx_hoofs/internal/concurrent/lockfree_queue/buffer.inl" #endif // IOX_HOOFS_CONCURRENT_LOCKFREE_QUEUE_BUFFER_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/cyclic_index.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/cyclic_index.hpp index b84c65c0be..45c8dac649 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/cyclic_index.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/cyclic_index.hpp @@ -90,6 +90,6 @@ class CyclicIndex } // namespace concurrent } // namespace iox -#include "cyclic_index.inl" +#include "iceoryx_hoofs/internal/concurrent/lockfree_queue/cyclic_index.inl" #endif // IOX_HOOFS_LOCKFREE_QUEUE_CYCLIC_INDEX_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/index_queue.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/index_queue.hpp index b3c2e78271..74a0e278ff 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/index_queue.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/index_queue.hpp @@ -148,6 +148,6 @@ class IndexQueue } // namespace concurrent } // namespace iox -#include "index_queue.inl" +#include "iceoryx_hoofs/internal/concurrent/lockfree_queue/index_queue.inl" #endif // IOX_HOOFS_LOCKFREE_QUEUE_INDEX_QUEUE_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/base_relative_pointer.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/base_relative_pointer.hpp index e75dbc56c8..d847cbda03 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/base_relative_pointer.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/base_relative_pointer.hpp @@ -18,7 +18,7 @@ #ifndef IOX_HOOFS_RELOCATABLE_POINTER_BASE_RELATIVE_POINTER_HPP #define IOX_HOOFS_RELOCATABLE_POINTER_BASE_RELATIVE_POINTER_HPP -#include "pointer_repository.hpp" +#include "iceoryx_hoofs/internal/relocatable_pointer/pointer_repository.hpp" #include diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/relative_pointer.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/relative_pointer.hpp index 4ef03a23b4..d92aca1ad8 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/relative_pointer.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/relative_pointer.hpp @@ -18,7 +18,7 @@ #ifndef IOX_HOOFS_RELOCATABLE_POINTER_RELATIVE_POINTER_HPP #define IOX_HOOFS_RELOCATABLE_POINTER_RELATIVE_POINTER_HPP -#include "base_relative_pointer.hpp" +#include "iceoryx_hoofs/internal/relocatable_pointer/base_relative_pointer.hpp" #include #include From 713ed16cf4116cca1df293c9f99bdf245cd98725 Mon Sep 17 00:00:00 2001 From: Karl Wallner Date: Mon, 25 Jul 2022 13:59:37 +0200 Subject: [PATCH 05/14] iox-#1542 Add bazel build configuration file (bazelrc) to use c++14 Signed-off-by: Karl Wallner --- .bazelrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .bazelrc diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000000..18a777b5fc --- /dev/null +++ b/.bazelrc @@ -0,0 +1 @@ +build --cxxopt="-std=c++14" From e5b0f50defb9cc211b94e45e0f12bc8410afd1f9 Mon Sep 17 00:00:00 2001 From: Karl Wallner Date: Mon, 25 Jul 2022 14:28:13 +0200 Subject: [PATCH 06/14] iox-#1542 Update release-notes for bazel-build Signed-off-by: Karl Wallner --- doc/website/release-notes/iceoryx-unreleased.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/website/release-notes/iceoryx-unreleased.md b/doc/website/release-notes/iceoryx-unreleased.md index 234b6afeb1..5bd318a544 100644 --- a/doc/website/release-notes/iceoryx-unreleased.md +++ b/doc/website/release-notes/iceoryx-unreleased.md @@ -26,6 +26,7 @@ - Create convenience macro for `NewType` [\#1425](https://github.com/eclipse-iceoryx/iceoryx/issues/1425) - Add posix thread wrapper [\#1365](https://github.com/eclipse-iceoryx/iceoryx/issues/1365) - Apps send only the heartbeat when monitoring is enabled in roudi [\#1436](https://github.com/eclipse-iceoryx/iceoryx/issues/1436) +- Support [Bazel](https://bazel.build/) as optional build system [\#1542](https://github.com/eclipse-iceoryx/iceoryx/issues/1542) **Bugfixes:** From 842dc09688551f2e15fa2c7238160ed354db3225 Mon Sep 17 00:00:00 2001 From: Karl Wallner Date: Mon, 25 Jul 2022 14:49:12 +0200 Subject: [PATCH 07/14] iox-#1542 Add bazel ignore to not interfere with cmake-build Signed-off-by: Karl Wallner --- .bazelignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .bazelignore diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 0000000000..567609b123 --- /dev/null +++ b/.bazelignore @@ -0,0 +1 @@ +build/ From f8eaf2e1df2dd02cf9182634aa8e9ca272cae641 Mon Sep 17 00:00:00 2001 From: Karl Wallner Date: Mon, 25 Jul 2022 15:24:00 +0200 Subject: [PATCH 08/14] iox-#1542 Support bazel build with clang Signed-off-by: Karl Wallner --- iceoryx_hoofs/BUILD.bazel | 3 ++- iceoryx_hoofs/platform/BUILD.bazel | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/iceoryx_hoofs/BUILD.bazel b/iceoryx_hoofs/BUILD.bazel index 50867b86cb..7e736901b3 100644 --- a/iceoryx_hoofs/BUILD.bazel +++ b/iceoryx_hoofs/BUILD.bazel @@ -24,7 +24,8 @@ cc_library( ]), hdrs = glob(["include/**"]), linkopts = select({ - "//iceoryx_hoofs/platform:linux": ["-lacl"], + "//iceoryx_hoofs/platform:linux-clang": ["-latomic", "-lacl"], + "//iceoryx_hoofs/platform:linux-gcc": ["-lacl"], "//iceoryx_hoofs/platform:mac": [], "//iceoryx_hoofs/platform:qnx": [], "//iceoryx_hoofs/platform:unix": [], diff --git a/iceoryx_hoofs/platform/BUILD.bazel b/iceoryx_hoofs/platform/BUILD.bazel index f320b8a912..a124290c41 100644 --- a/iceoryx_hoofs/platform/BUILD.bazel +++ b/iceoryx_hoofs/platform/BUILD.bazel @@ -28,6 +28,18 @@ config_setting( constraint_values = ["@platforms//os:freebsd"], ) +config_setting( + name = "linux-clang", + flag_values = {"@bazel_tools//tools/cpp:compiler": "clang"}, + constraint_values = ["@platforms//os:linux"], +) + +config_setting( + name = "linux-gcc", + flag_values = {"@bazel_tools//tools/cpp:compiler": "gcc"}, + constraint_values = ["@platforms//os:linux"], +) + # # Library: iceoryx_platform # From ff3568bbb9b8069e4fbdd3b001187b5ea3531d37 Mon Sep 17 00:00:00 2001 From: Karl Wallner Date: Mon, 25 Jul 2022 16:08:17 +0200 Subject: [PATCH 09/14] iox-#1542 Fix clang format issue (as reported by checks) Signed-off-by: Karl Wallner --- iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp index 7d967bb83f..8153b4860b 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp @@ -17,9 +17,9 @@ #ifndef IOX_HOOFS_CXX_STRING_HPP #define IOX_HOOFS_CXX_STRING_HPP +#include "iceoryx_hoofs/cxx/optional.hpp" #include "iceoryx_hoofs/cxx/type_traits.hpp" #include "iceoryx_hoofs/internal/cxx/string_internal.hpp" -#include "iceoryx_hoofs/cxx/optional.hpp" #include #include From d577c9f85e755b276f0c6f8e7908b29037fc818c Mon Sep 17 00:00:00 2001 From: Karl Wallner Date: Mon, 25 Jul 2022 16:35:36 +0200 Subject: [PATCH 10/14] iox-#1542 Add bazel build files to .gitignore Signed-off-by: Karl Wallner --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c6ff55f553..131c71f53c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ doc/website/API-reference/ tools/website/generated/ *.project __pycache__ +/bazel-* From 3bb45acecb7e11158ea85469e5d65104a03f872b Mon Sep 17 00:00:00 2001 From: Karl Wallner Date: Mon, 25 Jul 2022 17:26:08 +0200 Subject: [PATCH 11/14] iox-#1542 Fix document linter issue (missing link) Signed-off-by: Karl Wallner --- doc/website/advanced/installation-guide-for-contributors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/website/advanced/installation-guide-for-contributors.md b/doc/website/advanced/installation-guide-for-contributors.md index 77847ca1fb..7ebc4079d2 100644 --- a/doc/website/advanced/installation-guide-for-contributors.md +++ b/doc/website/advanced/installation-guide-for-contributors.md @@ -178,5 +178,5 @@ bazel run //:buildifier_lint ``` The CI will check for the correct formatting and linting. -See the [BUILD](https://github.com/eclipse-iceoryx/iceoryx/blob/master/BUILD) file +See the `BUILD.bazel` file in iceoryx workspace for available commands. From 278c07ce3f026b7c5f6f69c1cf90b24882222819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietrich=20Kr=C3=B6nke?= Date: Thu, 28 Jul 2022 10:37:41 +0200 Subject: [PATCH 12/14] iox-#1542 Add simple bazel sanity check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dietrich Krönke --- .github/workflows/build-test.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index b85cfe5125..ab9ad296b2 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -124,6 +124,21 @@ jobs: - uses: actions/checkout@v3 - run: ./tools/ci/build-test-ubuntu-with-gcc54.sh + # Bazel sanitiy check + build-test-ubuntu-bazel: + runs-on: ubuntu-latest + needs: pre-flight-check + steps: + - uses: actions/checkout@v3 + - run: sudo apt-get update && sudo apt-get install -y libacl1-dev libncurses5-dev + - uses: bazelbuild/setup-bazelisk@v2 + - name: Mount bazel cache + uses: actions/cache@v3 + with: + path: "~/.cache/bazel" + key: bazel + - run: bazel test //... + coverage-and-docs: runs-on: ubuntu-20.04 needs: pre-flight-check From 378fd8dc000f427e5db8e85308e229daebcc2d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietrich=20Kr=C3=B6nke?= Date: Thu, 28 Jul 2022 14:31:28 +0200 Subject: [PATCH 13/14] iox-#1542 Exclude sofi stress test in GitHub CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add linter check for bazel in CI Signed-off-by: Dietrich Krönke --- .github/workflows/build-test.yml | 5 +++- iceoryx_hoofs/BUILD.bazel | 5 +++- iceoryx_hoofs/platform/BUILD.bazel | 4 +-- iceoryx_hoofs/test/BUILD.bazel | 20 ------------- iceoryx_hoofs/test/stresstests/BUILD.bazel | 33 ++++++++++++++++++++++ 5 files changed, 43 insertions(+), 24 deletions(-) create mode 100644 iceoryx_hoofs/test/stresstests/BUILD.bazel diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index ab9ad296b2..758baf5d56 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -137,7 +137,10 @@ jobs: with: path: "~/.cache/bazel" key: bazel - - run: bazel test //... + # Build everything including stresstests + - run: bazel build //... + # We exclude the sofi stresstest in CI since we cannot set the CPU Affinity in the GitHub Action Runners + - run: bazel test //... --deleted_packages=iceoryx_hoofs/test/stresstests coverage-and-docs: runs-on: ubuntu-20.04 diff --git a/iceoryx_hoofs/BUILD.bazel b/iceoryx_hoofs/BUILD.bazel index 7e736901b3..7b627da20d 100644 --- a/iceoryx_hoofs/BUILD.bazel +++ b/iceoryx_hoofs/BUILD.bazel @@ -24,7 +24,10 @@ cc_library( ]), hdrs = glob(["include/**"]), linkopts = select({ - "//iceoryx_hoofs/platform:linux-clang": ["-latomic", "-lacl"], + "//iceoryx_hoofs/platform:linux-clang": [ + "-latomic", + "-lacl", + ], "//iceoryx_hoofs/platform:linux-gcc": ["-lacl"], "//iceoryx_hoofs/platform:mac": [], "//iceoryx_hoofs/platform:qnx": [], diff --git a/iceoryx_hoofs/platform/BUILD.bazel b/iceoryx_hoofs/platform/BUILD.bazel index a124290c41..d771e6eee1 100644 --- a/iceoryx_hoofs/platform/BUILD.bazel +++ b/iceoryx_hoofs/platform/BUILD.bazel @@ -30,14 +30,14 @@ config_setting( config_setting( name = "linux-clang", - flag_values = {"@bazel_tools//tools/cpp:compiler": "clang"}, constraint_values = ["@platforms//os:linux"], + flag_values = {"@bazel_tools//tools/cpp:compiler": "clang"}, ) config_setting( name = "linux-gcc", - flag_values = {"@bazel_tools//tools/cpp:compiler": "gcc"}, constraint_values = ["@platforms//os:linux"], + flag_values = {"@bazel_tools//tools/cpp:compiler": "gcc"}, ) # diff --git a/iceoryx_hoofs/test/BUILD.bazel b/iceoryx_hoofs/test/BUILD.bazel index 94d85778ae..8e8ba241a6 100644 --- a/iceoryx_hoofs/test/BUILD.bazel +++ b/iceoryx_hoofs/test/BUILD.bazel @@ -63,23 +63,3 @@ cc_test( visibility = ["//visibility:private"], deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"], ) - -cc_test( - name = "test_stress_sofi", - srcs = ["stresstests/test_stress_sofi.cpp"], - includes = [ - ".", - "integrationtests", - ], - linkopts = select({ - "//iceoryx_hoofs/platform:linux": ["-ldl"], - "//iceoryx_hoofs/platform:mac": [], - "//iceoryx_hoofs/platform:qnx": [], - "//iceoryx_hoofs/platform:unix": [], - "//iceoryx_hoofs/platform:win": [], - "//conditions:default": ["-ldl"], - }), - tags = ["exclusive"], - visibility = ["//visibility:private"], - deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"], -) diff --git a/iceoryx_hoofs/test/stresstests/BUILD.bazel b/iceoryx_hoofs/test/stresstests/BUILD.bazel new file mode 100644 index 0000000000..cf7ead1630 --- /dev/null +++ b/iceoryx_hoofs/test/stresstests/BUILD.bazel @@ -0,0 +1,33 @@ +# 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_test") + +cc_test( + name = "test_stress_sofi", + srcs = ["test_stress_sofi.cpp"], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"], +) From 0e1dff1def77f4b062534d7ce20fc4f9dc9fa2ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietrich=20Kr=C3=B6nke?= Date: Thu, 28 Jul 2022 14:38:30 +0200 Subject: [PATCH 14/14] iox-#1543 Add bazel linter check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dietrich Krönke --- .github/workflows/build-test.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 758baf5d56..f23972cae5 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -137,10 +137,14 @@ jobs: with: path: "~/.cache/bazel" key: bazel - # Build everything including stresstests - - run: bazel build //... - # We exclude the sofi stresstest in CI since we cannot set the CPU Affinity in the GitHub Action Runners - - run: bazel test //... --deleted_packages=iceoryx_hoofs/test/stresstests + - name: Bazel Linting + Build + Test + run: | + # Run linter on complete bazel code + bazel run //:buildifier_lint_check + # Build everything including stresstests + bazel build //... + # We exclude the sofi stresstest in CI since we cannot set the CPU Affinity in the GitHub Action Runners + bazel test //... --deleted_packages=iceoryx_hoofs/test/stresstests coverage-and-docs: runs-on: ubuntu-20.04