diff --git a/.bazelrc b/.bazelrc index 8a4a828..c9ea24c 100644 --- a/.bazelrc +++ b/.bazelrc @@ -31,11 +31,24 @@ # # -build --enable_platform_specific_config=true build --force_pic=true +build --incompatible_strict_action_env=true build --legacy_external_runfiles=false +build --remote_upload_local_results=false +build --sandbox_default_allow_network=false build:macos --apple_generate_dsym=true +build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain build:macos --apple_platform_type=macos +build:macos --crosstool_top=@local_config_apple_cc//:toolchain +build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain + +common --enable_platform_specific_config=true +common --heap_dump_on_oom=true + +startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1 + +test --incompatible_exclusive_test_sandboxed=true +test --test_verbose_timeout_warnings=true try-import %workspace%/.user.bazelrc diff --git a/.buildifier.json b/.buildifier.json new file mode 100644 index 0000000..fec67e6 --- /dev/null +++ b/.buildifier.json @@ -0,0 +1,8 @@ +{ + "type": "auto", + "mode": "fix", + "lint": "fix", + "warningsList": [ + "all" + ] +} diff --git a/.buildifier.json.license b/.buildifier.json.license new file mode 100644 index 0000000..3669a80 --- /dev/null +++ b/.buildifier.json.license @@ -0,0 +1,30 @@ +.buildifier.json +RVO2 Library + +SPDX-FileCopyrightText: 2008 University of North Carolina at Chapel Hill +SPDX-License-Identifier: Apache-2.0 + +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 + + https://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. + +Please send all bug reports to . + +The authors may be contacted via: + +Jur van den Berg, Stephen J. Guy, Jamie Snape, Ming C. Lin, Dinesh Manocha +Dept. of Computer Science +201 S. Columbia St. +Frederick P. Brooks, Jr. Computer Science Bldg. +Chapel Hill, N.C. 27599-3175 +United States of America + + diff --git a/.gitattributes b/.gitattributes index c79c3ee..3c2cc70 100644 --- a/.gitattributes +++ b/.gitattributes @@ -43,6 +43,7 @@ * text=auto *.bazel text diff=python linguist-language=starlark whitespace-4 +*.bzlmod text diff=python linguist-language=starlark whitespace-4 *.cc text diff=cpp linguist-language=c++ whitespace-2 *.cff text linguist-documentation whitespace-2 *.cfg text whitespace-2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fae5bd..f0dfdae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,7 @@ jobs: - name: checkout uses: actions/checkout@v3 - name: build test package - run: bazel test --flaky_test_attempts=3 ... + run: bazel test --enable_bzlmod=0 --flaky_test_attempts=3 ... shell: bash bazel_macos: @@ -80,6 +80,8 @@ jobs: rm -f \ /usr/local/bin/2to3 \ /usr/local/bin/2to3-3.* \ + /usr/local/bin/go \ + /usr/local/bin/gofmt \ /usr/local/bin/idle3 \ /usr/local/bin/idle3.* \ /usr/local/bin/pydoc3 \ @@ -101,7 +103,7 @@ jobs: HOMEBREW_NO_INSTALL_CLEANUP: 1 shell: zsh -efuo pipefail {0} - name: build test package - run: bazel test --flaky_test_attempts=3 ... + run: bazel test --enable_bzlmod=0 --flaky_test_attempts=3 ... shell: zsh -efuo pipefail {0} bazel_ubuntu: @@ -140,7 +142,107 @@ jobs: - name: checkout uses: actions/checkout@v3 - name: build test package - run: bazel test --flaky_test_attempts=3 ... + run: bazel test --enable_bzlmod=0 --flaky_test_attempts=3 ... + shell: bash + + bzlmod_arch: + name: bzlmod arch latest + runs-on: ubuntu-22.04 + container: archlinux:latest + steps: + - name: setup + run: | + pacman --needed --noconfirm --noprogressbar -S -u -y \ + bazel \ + ca-certificates \ + gcc \ + git \ + python \ + which + rm -rf \ + /var/cache/pacman/pkg/* \ + /var/lib/pacman/sync/* + shell: bash + - name: checkout + uses: actions/checkout@v3 + - name: build test package + run: bazel test --enable_bzlmod=1 --flaky_test_attempts=3 ... + shell: bash + + bzlmod_macos: + name: bzlmod macos latest + runs-on: macos-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup + run: | + rm -f \ + /usr/local/bin/2to3 \ + /usr/local/bin/2to3-3.* \ + /usr/local/bin/go \ + /usr/local/bin/gofmt \ + /usr/local/bin/idle3 \ + /usr/local/bin/idle3.* \ + /usr/local/bin/pydoc3 \ + /usr/local/bin/pydoc3.* \ + /usr/local/bin/python3 \ + /usr/local/bin/python3.* \ + /usr/local/bin/python3-config \ + /usr/local/bin/python3.*-config \ + /usr/local/lib/libtcl8.*.dylib \ + /usr/local/lib/libtk8.*.dylib + brew update-reset -q + brew upgrade -f -q + brew bundle install -q --no-lock + brew cleanup -q -s + rm -rf $(brew --cache) + env: + HOMEBREW_NO_ANALYTICS: 1 + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_CLEANUP: 1 + shell: zsh -efuo pipefail {0} + - name: build test package + run: bazel test --enable_bzlmod=1 --flaky_test_attempts=3 ... + shell: zsh -efuo pipefail {0} + + bzlmod_ubuntu: + name: bzlmod ubuntu 22.04 + runs-on: ubuntu-22.04 + container: ubuntu:latest + steps: + - name: setup + run: | + apt-get -qq -o APT::Acquire::Retries=4 update \ + || (sleep 15; apt-get -qq -o APT::Acquire::Retries=4 update) + apt-get -qq -o APT::Acquire::Retries=4 -o Dpkg::Use-Pty=0 \ + upgrade + apt-get -qq -o APT::Acquire::Retries=4 -o Dpkg::Use-Pty=0 \ + --no-install-recommends install \ + ca-certificates \ + g++ \ + git \ + gnupg \ + python-is-python3 \ + wget + wget -qO - https://bazel.build/bazel-release.pub.gpg 2>/dev/null | gpg --dearmor - \ + > /usr/share/keyrings/bazel-archive-keyring.gpg + echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8' \ + > /etc/apt/sources.list.d/bazel.list + apt-get -qq -o APT::Acquire::Retries=4 update \ + || (sleep 15; apt-get -qq -o APT::Acquire::Retries=4 update) + apt-get -qq -o APT::Acquire::Retries=4 -o Dpkg::Use-Pty=0 \ + --no-install-recommends install \ + bazel + apt-get -qq -o Dpkg::Use-Pty=0 autoremove + rm -rf /var/lib/apt/lists/* + env: + DEBIAN_FRONTEND: noninteractive + shell: bash + - name: checkout + uses: actions/checkout@v3 + - name: build test package + run: bazel test --enable_bzlmod=1 --flaky_test_attempts=3 ... shell: bash cmake_alpine: @@ -290,6 +392,8 @@ jobs: rm -f \ /usr/local/bin/2to3 \ /usr/local/bin/2to3-3.* \ + /usr/local/bin/go \ + /usr/local/bin/gofmt \ /usr/local/bin/idle3 \ /usr/local/bin/idle3.* \ /usr/local/bin/pydoc3 \ diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index dddec1b..e90cbe1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -49,13 +49,13 @@ jobs: name: analyze runs-on: ubuntu-22.04 steps: - - name: checkout - uses: actions/checkout@v3 - - name: initialize codeql - uses: github/codeql-action/init@v2 - with: - languages: cpp - - name: autobuild - uses: github/codeql-action/autobuild@v2 - - name: perform codeql analysis - uses: github/codeql-action/analyze@v2 + - name: checkout + uses: actions/checkout@v3 + - name: initialize codeql + uses: github/codeql-action/init@v2 + with: + languages: cpp + - name: autobuild + uses: github/codeql-action/autobuild@v2 + - name: perform codeql analysis + uses: github/codeql-action/analyze@v2 diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..b94204f --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,40 @@ +# +# .yamllint.yaml +# AVO2 Library +# +# SPDX-FileCopyrightText: 2010 University of North Carolina at Chapel Hill +# SPDX-License-Identifier: Apache-2.0 +# +# 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 +# +# https://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. +# +# Please send all bug reports to . +# +# The authors may be contacted via: +# +# Jur van den Berg, Jamie Snape, Stephen J. Guy, and Dinesh Manocha +# Dept. of Computer Science +# 201 S. Columbia St. +# Frederick P. Brooks, Jr. Computer Science Bldg. +# Chapel Hill, N.C. 27599-3175 +# United States of America +# +# +# + +--- +extends: default + +rules: + line-length: + max: 80 + level: warning diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000..c46130e --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,56 @@ +# -*- mode: bazel; -*- +# vi: set ft=bazel: + +# +# WORKSPACE.bazel +# RVO2 Library +# +# SPDX-FileCopyrightText: 2008 University of North Carolina at Chapel Hill +# SPDX-License-Identifier: Apache-2.0 +# +# 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 +# +# https://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. +# +# Please send all bug reports to . +# +# The authors may be contacted via: +# +# Jur van den Berg, Stephen J. Guy, Jamie Snape, Ming C. Lin, Dinesh Manocha +# Dept. of Computer Science +# 201 S. Columbia St. +# Frederick P. Brooks, Jr. Computer Science Bldg. +# Chapel Hill, N.C. 27599-3175 +# United States of America +# +# +# + +module( + name = "rvo", + version = "2.0.3", +) + +bazel_dep( + name = "apple_support", + version = "1.6.0", + repo_name = "build_bazel_apple_support" +) + +apple_cc_configure = use_extension( + "@build_bazel_apple_support//crosstool:setup.bzl", + "apple_cc_configure_extension", +) +use_repo(apple_cc_configure, "local_config_apple_cc") + +bazel_dep(name = "rules_cc", version = "0.0.6") +bazel_dep(name = "rules_license", version = "0.0.4") +bazel_dep(name = "rules_pkg", version = "0.9.1", dev_dependency = True) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index a0eea37..36d3b42 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -34,23 +34,25 @@ # # -workspace(name = "RVO") +workspace(name = "rvo") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( - name = "bazel_skylib", - sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz", - ], + name = "build_bazel_apple_support", + sha256 = "9f7bb62c3ae889e0eae8c18458fd8764e2e537687d9a1d85885d6af980e4fc31", + urls = ["https://github.com/bazelbuild/apple_support/releases/download/1.6.0/apple_support.1.6.0.tar.gz"], ) +load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") + +apple_support_dependencies() + http_archive( name = "rules_cc", - sha256 = "58bff40957ace85c2de21ebfc72e53ed3a0d33af8cc20abd0ceec55c63be7de2", - urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.2/rules_cc-0.0.2.tar.gz"], + sha256 = "3d9e271e2876ba42e114c9b9bc51454e379cbf0ec9ef9d40e2ae4cec61a31b40", + strip_prefix = "rules_cc-0.0.6", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.6/rules_cc-0.0.6.tar.gz"], ) load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains") @@ -59,28 +61,21 @@ rules_cc_dependencies() rules_cc_toolchains() -http_archive( - name = "rules_python", - sha256 = "c03246c11efd49266e8e41e12931090b613e12a59e6f55ba2efd29a7cb8b4258", - strip_prefix = "rules_python-0.11.0", - urls = ["https://github.com/bazelbuild/rules_python/archive/refs/tags/0.11.0.tar.gz"], -) - http_archive( name = "rules_license", - sha256 = "00ccc0df21312c127ac4b12880ab0f9a26c1cff99442dc6c5a331750360de3c3", + sha256 = "6157e1e68378532d0241ecd15d3c45f6e5cfd98fc10846045509fb2a7cc9e381", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/0.0.3/rules_license-0.0.3.tar.gz", - "https://github.com/bazelbuild/rules_license/releases/download/0.0.3/rules_license-0.0.3.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz", + "https://github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz", ], ) http_archive( name = "rules_pkg", - sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2", + sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz", - "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz", + "https://github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz", ], ) diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod new file mode 100644 index 0000000..c629c3b --- /dev/null +++ b/WORKSPACE.bzlmod @@ -0,0 +1,35 @@ +# -*- mode: bazel; -*- +# vi: set ft=bazel: + +# +# WORKSPACE.bzlmod +# RVO2 Library +# +# SPDX-FileCopyrightText: 2008 University of North Carolina at Chapel Hill +# SPDX-License-Identifier: Apache-2.0 +# +# 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 +# +# https://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. +# +# Please send all bug reports to . +# +# The authors may be contacted via: +# +# Jur van den Berg, Stephen J. Guy, Jamie Snape, Ming C. Lin, Dinesh Manocha +# Dept. of Computer Science +# 201 S. Columbia St. +# Frederick P. Brooks, Jr. Computer Science Bldg. +# Chapel Hill, N.C. 27599-3175 +# United States of America +# +# +# diff --git a/cmake/modules/CheckCXXLinkerFlag.cmake b/cmake/modules/CheckCXXLinkerFlag.cmake index a018ae4..6a9cbef 100644 --- a/cmake/modules/CheckCXXLinkerFlag.cmake +++ b/cmake/modules/CheckCXXLinkerFlag.cmake @@ -70,9 +70,9 @@ include(CMakeCheckCompilerFlagCommonPatterns) # cmake-lint: disable=C0111 function(check_cxx_linker_flag _FLAG _VAR) if(MSVC) - _check_cxx_linker_flag(/WX HRVO_LINKER_SUPPORTS_WX) + _check_cxx_linker_flag(/WX RVO_LINKER_SUPPORTS_WX) - if(HRVO_LINKER_SUPPORTS_WX) + if(RVO_LINKER_SUPPORTS_WX) set(_FATAL_WARNINGS_FLAG /WX) else() set(_FATAL_WARNINGS_FLAG)