diff --git a/.appveyor.yml b/.appveyor.yml index 81608ee7c..7361f870b 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,6 +1,6 @@ # Copyright 2016, 2017 Peter Dimov # Copyright 2017 - 2019 James E. King III -# Copyright 2020 Alexander Grund +# Copyright 2019 - 2021 Alexander Grund # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) @@ -22,7 +22,7 @@ version: 1.0.{build}-{branch} -shallow_clone: true +shallow_clone: false branches: only: @@ -34,6 +34,7 @@ branches: - /pr\/.*/ matrix: + fast_finish: false # Adding MAYFAIL to any matrix job allows it to fail but the build stays green: allow_failures: - MAYFAIL: true @@ -41,6 +42,7 @@ matrix: environment: global: B2_CI_VERSION: 1 + GIT_FETCH_JOBS: 4 # see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties # to use the default for a given environment, comment it out; recommend you build debug and release however: # on Windows it is important to exercise all the possibilities, especially shared vs static, however most @@ -49,41 +51,24 @@ environment: B2_LINK: shared,static # B2_THREADING: threading=multi,single B2_VARIANT: release - B2_FLAGS: "warnings=extra warnings-as-errors=on" matrix: - - FLAVOR: clang-cl - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - B2_ADDRESS_MODEL: 64 - B2_CXXSTD: 11,14,17 - B2_TOOLSET: clang-win - - - FLAVOR: cygwin (64-bit) - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - ADDPATH: C:\cygwin64\bin; - B2_ADDRESS_MODEL: 64 - B2_CXXSTD: 11,14,1z - B2_THREADING: threadapi=pthread - B2_TOOLSET: gcc - - - FLAVOR: mingw32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - ARCH: i686 - B2_ADDRESS_MODEL: 32 - B2_CXXSTD: 11 - SCRIPT: ci\appveyor\mingw.bat - B2_VARIANT: debug + - FLAVOR: Visual Studio 2022 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + B2_CXXFLAGS: -permissive- + B2_CXXSTD: 14,17,20 + B2_TOOLSET: msvc-14.3 - FLAVOR: Visual Studio 2019 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 B2_CXXFLAGS: -permissive- - B2_CXXSTD: 14,17,latest # 2a + B2_CXXSTD: 14,17,2a B2_TOOLSET: msvc-14.2 - FLAVOR: Visual Studio 2017 C++2a Strict APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 B2_CXXFLAGS: -permissive- - B2_CXXSTD: latest # 2a + B2_CXXSTD: 2a B2_TOOLSET: msvc-14.1 - FLAVOR: Visual Studio 2017 C++14/17 @@ -91,26 +76,56 @@ environment: B2_CXXSTD: 14,17 B2_TOOLSET: msvc-14.1 + - FLAVOR: clang-cl + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + ADDCOMMANDS: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"' + B2_ADDRESS_MODEL: 64 + B2_CXXSTD: 11,14,17 + B2_TOOLSET: clang-win + + # not supported + # - FLAVOR: Visual Studio 2015, 2013 + # APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + # B2_TOOLSET: msvc-12.0,msvc-14.0 + + # - FLAVOR: Visual Studio 2008, 2010, 2012 + # APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + # B2_TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0 + # B2_ADDRESS_MODEL: 32 # No 64bit support + - FLAVOR: cygwin (32-bit) APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 ADDPATH: C:\cygwin\bin; B2_ADDRESS_MODEL: 32 B2_CXXSTD: 11,14,1z - B2_THREADING: threadapi=pthread B2_TOOLSET: gcc - - FLAVOR: mingw64 + - FLAVOR: cygwin (64-bit) APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - ARCH: x86_64 + ADDPATH: C:\cygwin64\bin; + B2_ADDRESS_MODEL: 64 + B2_CXXSTD: 11,14,1z + B2_TOOLSET: gcc + + - FLAVOR: mingw32 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + B2_ADDRESS_MODEL: 32 + ADDPATH: C:\mingw\bin; + B2_CXXSTD: 11,14,17,2a + B2_TOOLSET: gcc + + - FLAVOR: mingw64 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + ADDPATH: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin; B2_ADDRESS_MODEL: 64 - B2_CXXSTD: 11,17 - B2_DEFINES: __USE_ISOC99 - SCRIPT: ci\appveyor\mingw.bat + B2_CXXSTD: 11,14,17,2a + B2_TOOLSET: gcc install: - #- git submodule update --init --recursive - - git clone https://github.com/boostorg/boost-ci.git C:\boost-ci-cloned - - xcopy /s /e /q /i /y C:\boost-ci-cloned\ci .\ci + - '%ADDCOMMANDS%' + - git clone --depth 1 https://github.com/boostorg/boost-ci.git C:\boost-ci-cloned + # Copy ci folder if not testing Boost.CI + - if NOT "%APPVEYOR_PROJECT_NAME%" == "boost-ci" xcopy /s /e /q /i /y C:\boost-ci-cloned\ci .\ci - rmdir /s /q C:\boost-ci-cloned - ci\appveyor\install.bat diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml deleted file mode 100644 index 08ae10489..000000000 --- a/.azure-pipelines.yml +++ /dev/null @@ -1,261 +0,0 @@ -# Copyright 2015-2019 Rene Rivera. -# Copyright 2019 Mateusz Loskot -# Copyright 2020 Alexander Grund -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) - -# -# Generic Azure Pipelines build script for boostorg repositories -# See: https://github.com/boostorg/boost-ci/ -# -# Instructions for customizing this script for your library: -# -# 1. Customize the compilers and language levels you want. -# 2. If you have more than include/, src/, test/, example/, examples/, -# benchmark/ or tools/ directories, set the environment variable DEPINST. -# For example if your build uses code in "bench/" and "fog/" directories: -# - DEPINST: --include bench --include fog -# 3. Enable pull request builds in your boostorg/ account. -# -# That's it - the script will do everything else for you. - -trigger: - branches: - include: - - develop - - master - - bugfix/* - - feature/* - - fix/* - - pr/* - -pr: - branches: - include: - - develop - -variables: - B2_CI_VERSION: 1 - B2_VARIANT: release,debug - B2_LINK: shared,static - B2_FLAGS: "warnings=extra warnings-as-errors=on" - -stages: - -- stage: Test - jobs: - - - job: 'Linux' - pool: - vmImage: 'ubuntu-16.04' - strategy: - matrix: - GCC_8: - B2_TOOLSET: gcc - B2_CXXSTD: 14,17,2a - CXX: g++-8 - PACKAGES: g++-8 - GCC_7: - B2_TOOLSET: gcc - B2_CXXSTD: 11,14,17 - CXX: g++-7 - PACKAGES: g++-7 - GCC_6: - B2_TOOLSET: gcc - B2_CXXSTD: 11,14 - CXX: g++-6 - PACKAGES: g++-6 - GCC_5: - B2_TOOLSET: gcc - B2_CXXSTD: 11 - CXX: g++-5 - PACKAGES: g++-5 - GCC_4_9: - B2_TOOLSET: gcc - B2_CXXSTD: 11 - CXX: g++-4.9 - PACKAGES: g++-4.9 - GCC_4_8: - B2_TOOLSET: gcc - B2_CXXSTD: 11 - CXX: g++-4.8 - PACKAGES: g++-4.8 - Clang_8: - B2_TOOLSET: clang - B2_CXXSTD: 14,17,2a - CXX: clang++-8 - PACKAGES: clang-8 - LLVM_REPO: llvm-toolchain-xenial-8 - Clang_7: - B2_TOOLSET: clang - B2_CXXSTD: 14,17,2a - CXX: clang++-7 - PACKAGES: clang-7 - LLVM_REPO: llvm-toolchain-xenial-7 - Clang_6_libcxx: - B2_TOOLSET: clang - B2_CXXSTD: 11,14,17,2a - B2_STDLIB: libc++ - CXX: clang++-6.0 - PACKAGES: clang-6.0 - LLVM_REPO: llvm-toolchain-xenial-6.0 - Clang_6: - B2_TOOLSET: clang - B2_CXXSTD: 14,17,2a - CXX: clang++-6.0 - PACKAGES: clang-6.0 - LLVM_REPO: llvm-toolchain-xenial-6.0 - Clang_5: - B2_TOOLSET: clang - B2_CXXSTD: 11,14,17 - PACKAGES: clang-5.0 - CXX: clang++-5.0 - LLVM_REPO: llvm-toolchain-xenial-5.0 - Clang_4: - B2_TOOLSET: clang - B2_CXXSTD: 11,14 - CXX: clang++-4.0 - PACKAGES: clang-4.0 - LLVM_REPO: llvm-toolchain-xenial-4.0 - Clang_3_9: - B2_TOOLSET: clang - B2_CXXSTD: 11,14 - CXX: clang++-3.9 - PACKAGES: clang-3.9 - Clang_3_8: - B2_TOOLSET: clang - CXX: clang++-3.8 - B2_CXXSTD: 11,14 - PACKAGES: clang-3.8 - Clang_3_7: - B2_TOOLSET: clang - B2_CXXSTD: 11 - CXX: clang++-3.7 - PACKAGES: clang-3.7 - Clang_3_6: - B2_TOOLSET: clang - B2_CXXSTD: 11 - CXX: clang++-3.6 - PACKAGES: clang-3.6 - Clang_3_5: - B2_TOOLSET: clang - B2_CXXSTD: 11 - CXX: clang++-3.5 - PACKAGES: clang-3.5 - steps: - - bash: | - set -e - - git clone --branch master https://github.com/boostorg/boost-ci.git boost-ci-cloned - cp -prf boost-ci-cloned/ci . - rm -rf boost-ci-cloned - source ci/azure-pipelines/install.sh - displayName: 'Install' - - bash: | - set -e - echo "SELF=$SELF" - echo "BOOST_ROOT=$BOOST_ROOT" - - cd $BOOST_ROOT/libs/$SELF - ci/azure-pipelines/build.sh - displayName: 'Build' - - - job: 'Windows' - strategy: - matrix: - VS_2019_cxx2a_strict: - B2_TOOLSET: msvc-14.2 - B2_CXXSTD: latest # 2a - B2_CXXFLAGS: -permissive- - B2_ADDRESS_MODEL: 64 - VM_IMAGE: 'windows-2019' - VS_2017_cxx2a_strict: - B2_TOOLSET: msvc-14.1 - B2_CXXSTD: latest # 2a - B2_CXXFLAGS: -permissive- - B2_ADDRESS_MODEL: 64 - VM_IMAGE: 'vs2017-win2016' - VS_2017_cxx17: - B2_TOOLSET: msvc-14.1 - B2_CXXSTD: 17 - B2_ADDRESS_MODEL: 64,32 - VM_IMAGE: 'vs2017-win2016' - VS_2017_cxx14: - B2_TOOLSET: msvc-14.1 - #B2_CXXSTD: 14 # default - B2_ADDRESS_MODEL: 64,32 - VM_IMAGE: 'vs2017-win2016' - - pool: - vmImage: $(VM_IMAGE) - steps: - - script: | - git clone --branch master https://github.com/boostorg/boost-ci.git boost-ci-cloned - xcopy /s /e /q /i /y boost-ci-cloned\ci .\ci - rmdir /s /q boost-ci-cloned - ci\azure-pipelines\install.bat - displayName: 'Install' - - script: ci\build.bat - displayName: 'Build' - - - job: 'macOS' - pool: - vmImage: 'macOS-10.14' - strategy: - matrix: - Xcode_11_3_1: - B2_TOOLSET: clang - B2_CXXSTD: 14,17,2a - XCODE_APP: /Applications/Xcode_11.3.1.app - Xcode_11_2_1: - B2_TOOLSET: clang - B2_CXXSTD: 14,17,2a - XCODE_APP: /Applications/Xcode_11.2.1.app - Xcode_11_2: - B2_TOOLSET: clang - B2_CXXSTD: 14,17,2a - XCODE_APP: /Applications/Xcode_11.2.app - Xcode_11_1: - B2_TOOLSET: clang - B2_CXXSTD: 14,17,2a - XCODE_APP: /Applications/Xcode_11.1.app - Xcode_10_3: - B2_TOOLSET: clang - B2_CXXSTD: 11,14,17,2a - XCODE_APP: /Applications/Xcode_10.3.app - Xcode_10_2_1: - B2_TOOLSET: clang - B2_CXXSTD: 11,14,17,2a - XCODE_APP: /Applications/Xcode_10.2.1.app - Xcode_10_2: - B2_TOOLSET: clang - B2_CXXSTD: 11,14,17,2a - XCODE_APP: /Applications/Xcode_10.2.app - - # These get mysterious link errors for std::basic_string members - #Xcode_10_1: - # B2_TOOLSET: clang - # B2_CXXSTD: 11,14,17,2a - # XCODE_APP: /Applications/Xcode_10.1.app - #Xcode_10_0: - # B2_TOOLSET: clang - # B2_CXXSTD: 11,14,17,2a - # XCODE_APP: /Applications/Xcode_10.app - - steps: - - bash: | - set -e - - git clone --branch master https://github.com/boostorg/boost-ci.git boost-ci-cloned - cp -prf boost-ci-cloned/ci . - rm -rf boost-ci-cloned - source ci/azure-pipelines/install.sh - displayName: Install - - bash: | - set -e - echo "SELF=$SELF" - echo "BOOST_ROOT=$BOOST_ROOT" - - cd $BOOST_ROOT/libs/$SELF - ci/azure-pipelines/build.sh - displayName: 'Build' diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..4e80d1cac --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,25 @@ +# Copyright 2019 - 2021 Alexander Grund +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) +# +# Sample codecov configuration file. Edit as required + +codecov: + max_report_age: off + require_ci_to_pass: yes + notify: + # Increase this if you have multiple coverage collection jobs + after_n_builds: 1 + wait_for_ci: yes + +# Change how pull request comments look +comment: + layout: "reach,diff,flags,files,footer" + +# Ignore specific files or folders. Glob patterns are supported. +# See https://docs.codecov.com/docs/ignoring-paths +ignore: + - extra/* + - extra/**/* + - test/* + - test/**/* diff --git a/.drone.star b/.drone.star new file mode 100644 index 000000000..5ba95ce09 --- /dev/null +++ b/.drone.star @@ -0,0 +1,74 @@ +# Use, modification, and distribution are +# subject to the Boost Software License, Version 1.0. (See accompanying +# file LICENSE.txt) +# +# Copyright Rene Rivera 2020. + +# For Drone CI we use the Starlark scripting language to reduce duplication. +# As the yaml syntax for Drone CI is rather limited. +# +# +globalenv={'B2_CI_VERSION': '1', 'B2_VARIANT': 'debug,release', 'B2_FLAGS': 'warnings=extra warnings-as-errors=on'} +linuxglobalimage="cppalliance/droneubuntu1804:1" +windowsglobalimage="cppalliance/dronevs2019" + +def main(ctx): + return [ + linux_cxx("Clang 12 s390x", "clang++-12", packages="clang-12 libstdc++-9-dev", llvm_os="focal", llvm_ver="12", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:multiarch", environment={'B2_TOOLSET': 'clang-12', 'B2_CXXSTD': '17,20'}, arch="s390x", globalenv=globalenv), + linux_cxx("gcc 11 s390x", "g++-11", packages="g++-11", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:multiarch", environment={'B2_TOOLSET': 'gcc-11', 'B2_CXXSTD': '17,2a'}, arch="s390x", globalenv=globalenv), + linux_cxx("Clang 12 arm64", "clang++-12", packages="clang-12 libstdc++-9-dev", llvm_os="focal", llvm_ver="12", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:multiarch", environment={'B2_TOOLSET': 'clang-12', 'B2_CXXSTD': '17,20', 'DRONE_JOB_UUID': '7719a1c783m'}, arch="arm64", globalenv=globalenv), + linux_cxx("gcc 11 arm64", "g++-11", packages="g++-11", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:multiarch", environment={'B2_TOOLSET': 'gcc-11', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '0716d9708dm'}, arch="arm64", globalenv=globalenv), + linux_cxx("docs", "g++", buildtype="docs", buildscript="drone", image="cppalliance/boost_superproject_build:24.04-v3", environment={'COMMENT': 'docs', 'DRONE_JOB_UUID': 'b6589fc6ab'}, globalenv=globalenv), + linux_cxx("codecov", "g++-8", packages="g++-8", buildtype="codecov", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'codecov.io', 'LCOV_BRANCH_COVERAGE': '0', 'B2_CXXSTD': '17', 'B2_TOOLSET': 'gcc-8', 'B2_DEFINES': 'BOOST_JSON_EXPENSIVE_TESTS BOOST_NO_STRESS_TEST=1', 'CODECOV_TOKEN': {'from_secret': 'codecov_token'}, 'B2_FLAGS': 'warnings=extra warnings-as-errors=on linkflags=-lstdc++fs', 'DRONE_JOB_UUID': '356a192b79'}, globalenv=globalenv), + linux_cxx("Valgrind", "clang++-14", packages="clang-14 libc6-dbg libc++-dev libstdc++-9-dev", llvm_os="jammy", llvm_ver="14", buildscript="drone", buildtype="valgrind", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'valgrind', 'B2_TOOLSET': 'clang-14', 'B2_CXXSTD': '11,14,17', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', 'B2_VARIANT': 'debug', 'B2_TESTFLAGS': 'testing.launcher=valgrind', 'VALGRIND_OPTS': '--error-exitcode=1'}, globalenv=globalenv), + linux_cxx("ASan GCC", "g++-12", packages="g++-12", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'asan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-12', 'B2_CXXSTD': '11,14,17', 'B2_ASAN': '1', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', 'DRONE_EXTRA_PRIVILEGED': 'True'}, globalenv=globalenv, privileged=True), + linux_cxx("ASan Clang", "clang++-14", packages="clang-14 libstdc++-10-dev", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'asan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'clang-14', 'B2_CXXSTD': '11,14,17', 'B2_ASAN': '1', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1'}, globalenv=globalenv, privileged=True), + linux_cxx("UBSan GCC", "g++-12", packages="g++-12", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'ubsan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-12', 'B2_CXXSTD': '11,14,17', 'B2_UBSAN': '1', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1', 'B2_LINKFLAGS': '-fuse-ld=gold'}, globalenv=globalenv), + linux_cxx("UBSan Clang", "clang++-14", packages="clang-14 libstdc++-10-dev", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'ubsan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'clang-14', 'B2_CXXSTD': '11,14,17', 'B2_UBSAN': '1', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1'}, globalenv=globalenv), + linux_cxx("TSan", "g++-12", packages="g++-12", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'tsan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-12', 'B2_CXXSTD': '11,14,17', 'B2_TSAN': '1', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1'}, globalenv=globalenv, privileged=True), + linux_cxx("GDB printers", "g++-12", packages="g++-12 gdb", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'gdb', 'B2_TOOLSET': 'gcc-12', 'B2_CXXSTD': '11,14,17', 'B2_TARGETS': 'libs/json/test//gdb-printers', 'B2_VARIANT': 'debug', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1'}, globalenv=globalenv), + linux_cxx("gcc 4.8 C++03 (no op)", "g++-4.8", packages="g++-4.8", image=linuxglobalimage, buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "gcc-4.8", "B2_CXXSTD": "03", 'B2_SEPARATE_BOOTSTRAP': '1'}, globalenv=globalenv), + linux_cxx("gcc 5", "g++-5", packages="g++-5", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-5', 'B2_CXXSTD': '11', 'DRONE_JOB_UUID': '17ba079149'}, globalenv=globalenv), + linux_cxx("gcc 6", "g++-6", packages="g++-6", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-6', 'B2_CXXSTD': '11,14', 'DRONE_JOB_UUID': '7b52009b64'}, globalenv=globalenv), + linux_cxx("gcc 7", "g++-7", packages="g++-7", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-7', 'B2_CXXSTD': '14,17', 'DRONE_JOB_UUID': 'bd307a3ec3'}, globalenv=globalenv), + linux_cxx("gcc 8", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '17,2a', 'B2_FLAGS': 'warnings=extra warnings-as-errors=on linkflags=-lstdc++fs', 'DRONE_JOB_UUID': 'fa35e19212'}, globalenv=globalenv), + linux_cxx("gcc 8.3.0", "g++-8", packages="", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1804:gcc-8.3.0", environment={'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '17,2a', 'B2_FLAGS': 'warnings=extra warnings-as-errors=on linkflags=-lstdc++fs'}, globalenv=globalenv), + linux_cxx("gcc 9", "g++-9", packages="g++-9", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-9', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': 'f1abd67035'}, globalenv=globalenv), + linux_cxx("gcc 10", "g++-10", packages="g++-10", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'B2_TOOLSET': 'gcc-10', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '0716d9708d'}, globalenv=globalenv), + linux_cxx("gcc 10 cmake-superproject", "g++-10", packages="g++-10", image=linuxglobalimage, buildtype="cmake-superproject", buildscript="drone", environment={"COMMENT": "cmake-superproject", "CXX": "g++-10"}, globalenv=globalenv), + linux_cxx("gcc 10 cmake-mainproject", "g++-10", packages="g++-10", image=linuxglobalimage, buildtype="cmake-mainproject", buildscript="drone", environment={"COMMENT": "cmake-superproject", "CXX": "g++-10"}, globalenv=globalenv), + linux_cxx("gcc 10 cmake-subdirectory", "g++-10", packages="g++-10", image=linuxglobalimage, buildtype="cmake-subdirectory", buildscript="drone", environment={"COMMENT": "cmake-superproject", "CXX": "g++-10"}, globalenv=globalenv), + linux_cxx("gcc 11", "g++-11", packages="g++-11", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'B2_TOOLSET': 'gcc-11', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '0716d9708d'}, globalenv=globalenv), + linux_cxx("gcc 12", "g++-12", packages="g++-12", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'gcc-12', 'B2_CXXSTD': '17,20'}, globalenv=globalenv), + linux_cxx("gcc 13", "g++-13", packages="g++-13", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2404:1", environment={'B2_TOOLSET': 'gcc-13', 'B2_CXXSTD': '17,20,23'}, globalenv=globalenv), + linux_cxx("gcc 14", "g++-14", packages="g++-14", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2404:1", environment={'B2_TOOLSET': 'gcc-14', 'B2_CXXSTD': '20'}, globalenv=globalenv), + linux_cxx("Clang 3.8", "clang++-3.8", packages="clang-3.8 g++", llvm_os='xenial', llvm_ver='3.8', buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1604:1", environment={'B2_TOOLSET': 'clang-3.8', 'B2_CXXSTD': '11', 'B2_SEPARATE_BOOTSTRAP': '1', 'DRONE_JOB_UUID': 'b3f0c7f6bb'}, globalenv=globalenv), + linux_cxx("Clang 4.0", "clang++-4.0", packages="clang-4.0 libstdc++-6-dev", llvm_os="xenial", llvm_ver="4.0", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1604:1", environment={'B2_TOOLSET': 'clang-4.0', 'B2_CXXSTD': '11,14', 'DRONE_JOB_UUID': '91032ad7bb'}, globalenv=globalenv), + linux_cxx("Clang 5.0", "clang++-5.0", packages="clang-5.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-5.0', 'B2_CXXSTD': '11,14', 'DRONE_JOB_UUID': '472b07b9fc', 'UBUNTU_TOOLCHAIN_DISABLE': 'true'}, globalenv=globalenv), + linux_cxx("Clang 6.0", "clang++-6.0", packages="clang-6.0 libc6-dbg libstdc++-8-dev", llvm_os="bionic", llvm_ver="6.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-6.0', 'B2_CXXSTD': '14,17', 'B2_FLAGS': 'warnings=extra warnings-as-errors=on linkflags=-lstdc++fs', 'DRONE_JOB_UUID': '12c6fc06c9'}, globalenv=globalenv), + linux_cxx("Clang 7", "clang++-7", packages="clang-7 libstdc++-8-dev", llvm_os="bionic", llvm_ver="7", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-7', 'B2_CXXSTD': '17,2a', 'B2_FLAGS': 'warnings=extra warnings-as-errors=on linkflags=-lstdc++fs', 'DRONE_JOB_UUID': 'd435a6cdd7'}, globalenv=globalenv), + linux_cxx("Clang 8", "clang++-8", packages="clang-8 libstdc++-8-dev", llvm_os="bionic", llvm_ver="8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-8', 'B2_CXXSTD': '17,2a', 'B2_FLAGS': 'warnings=extra warnings-as-errors=on linkflags=-lstdc++fs', 'DRONE_JOB_UUID': '4d134bc072'}, globalenv=globalenv), + linux_cxx("Clang 9", "clang++-9", packages="clang-9 libstdc++-9-dev", llvm_os="bionic", llvm_ver="9", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-9', 'B2_CXXSTD': '17,2a', 'B2_FLAGS': 'warnings=extra warnings-as-errors=on linkflags=-lstdc++fs', 'DRONE_JOB_UUID': 'f6e1126ced'}, globalenv=globalenv), + linux_cxx("Clang 10", "clang++-10", packages="clang-10 libstdc++-9-dev", llvm_os="bionic", llvm_ver="10", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-10', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': 'bc33ea4e26'}, globalenv=globalenv), + linux_cxx("Clang 11", "clang++-11", packages="clang-11 libstdc++-9-dev", llvm_os="bionic", llvm_ver="11", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-11', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '7719a1c782'}, globalenv=globalenv), + linux_cxx("Clang 12", "clang++-12", packages="clang-12 libstdc++-9-dev", llvm_os="focal", llvm_ver="12", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'B2_TOOLSET': 'clang-12', 'B2_CXXSTD': '17,20', 'DRONE_JOB_UUID': '7719a1c783'}, globalenv=globalenv), + linux_cxx("Clang 13 libstdc++-9", "clang++-13", packages="clang-13 libstdc++-9-dev", llvm_os="jammy", llvm_ver="13", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'clang-13', 'B2_CXXSTD': '17,20'}, globalenv=globalenv), + linux_cxx("Clang 13 libstdc++-10", "clang++-13", packages="clang-13 libstdc++-10-dev", llvm_os="jammy", llvm_ver="13", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'clang-13', 'B2_CXXSTD': '17,20'}, globalenv=globalenv), + linux_cxx("Clang 14 libstdc++-9", "clang++-14", packages="clang-14 libstdc++-9-dev", llvm_os="jammy", llvm_ver="14", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'clang-14', 'B2_CXXSTD': '17,20'}, globalenv=globalenv), + linux_cxx("Clang 14 libstdc++-10", "clang++-14", packages="clang-14 libstdc++-10-dev", llvm_os="jammy", llvm_ver="14", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'clang-14', 'B2_CXXSTD': '17,20'}, globalenv=globalenv), + linux_cxx("Clang 15 libstdc++-9", "clang++-15", packages="clang-15 libstdc++-9-dev", llvm_os="jammy", llvm_ver="15", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'clang-15', 'B2_CXXSTD': '17,20'}, globalenv=globalenv), + linux_cxx("Clang 15 libstdc++-10", "clang++-15", packages="clang-15 libstdc++-10-dev", llvm_os="jammy", llvm_ver="15", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'clang-15', 'B2_CXXSTD': '17,20'}, globalenv=globalenv), + linux_cxx("Coverity", "g++", packages="", buildtype="coverity", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'Coverity Scan', 'B2_TOOLSET': 'clang', 'DRONE_JOB_UUID': '632667547e'}, globalenv=globalenv), + windows_cxx("msvc-14.0", "", image="cppalliance/dronevs2015", buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.0", "B2_CXXSTD": "11,14", "B2_DONT_EMBED_MANIFEST": 1}, globalenv=globalenv), + windows_cxx("msvc-14.1", "", image="cppalliance/dronevs2017", buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.1", "B2_CXXSTD": "11,14,17"}, globalenv=globalenv), + windows_cxx("msvc-14.2", "", image="cppalliance/dronevs2019:2", buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.2", "B2_CXXSTD": "17,latest"}, globalenv=globalenv), + windows_cxx("msvc-14.3", "", image="cppalliance/dronevs2022:1", buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.3", "B2_CXXSTD": "17,20"}, globalenv=globalenv), + windows_cxx("msvc-14.3 cmake-superproject", "", image="cppalliance/dronevs2022:1", buildtype="cmake-superproject", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.3", "B2_CXXSTD": "17,20"}, globalenv=globalenv), + windows_cxx("msvc-14.3 cmake-mainproject", "", image="cppalliance/dronevs2022:1", buildtype="cmake-mainproject", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.3", "B2_CXXSTD": "17,20"}, globalenv=globalenv), + windows_cxx("msvc-14.3 cmake-subdirectory", "", image="cppalliance/dronevs2022:1", buildtype="cmake-subdirectory", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.3", "B2_CXXSTD": "17,20"}, globalenv=globalenv), + osx_cxx("macOS: Clang", "clang++", packages="", buildscript="drone", buildtype="boost", xcode_version="13.4.1", environment={'B2_TOOLSET': 'clang', 'B2_CXXSTD': '17'}, globalenv=globalenv) + # osx_cxx("macOS: gcc-12", "g++-12", packages="", buildscript="drone", buildtype="boost", xcode_version="13.4.1", environment={'B2_TOOLSET': 'gcc-12', 'B2_CXXSTD': '17'}, globalenv=globalenv) + ] + +# from https://github.com/boostorg/boost-ci +load("@boost_ci//ci/drone/:functions.star", "linux_cxx","windows_cxx","osx_cxx","freebsd_cxx") diff --git a/.drone/drone.bat b/.drone/drone.bat new file mode 100755 index 000000000..8ed484f27 --- /dev/null +++ b/.drone/drone.bat @@ -0,0 +1,191 @@ + +@ECHO ON +setlocal enabledelayedexpansion + +set TRAVIS_OS_NAME=windows + +IF "!DRONE_BRANCH!" == "" ( + for /F %%i in ("!GITHUB_REF!") do @set TRAVIS_BRANCH=%%~nxi +) else ( + SET TRAVIS_BRANCH=!DRONE_BRANCH! +) + +if "%DRONE_JOB_BUILDTYPE%" == "boost" ( + +echo "Running boost job" +echo '==================================> INSTALL' +REM there seems to be some problem with b2 bootstrap on Windows +REM when CXX env variable is set +SET "CXX=" + +git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 +cp -prf boost-ci-cloned/ci . +rm -rf boost-ci-cloned +REM source ci/travis/install.sh +REM The contents of install.sh below: + +for /F %%i in ("%DRONE_REPO%") do @set SELF=%%~nxi +SET BOOST_CI_TARGET_BRANCH=!TRAVIS_BRANCH! +SET BOOST_CI_SRC_FOLDER=%cd% + +call ci\common_install.bat + +echo '==================================> COMPILE' + +set B2_TARGETS=libs/!SELF!/test libs/!SELF!/example +call !BOOST_ROOT!\libs\!SELF!\ci\build.bat + +) else if "%DRONE_JOB_BUILDTYPE%" == "cmake-superproject" ( + +echo "Running cmake superproject job" +echo '==================================> INSTALL' +REM there seems to be some problem with b2 bootstrap on Windows +REM when CXX env variable is set +SET "CXX=" + +git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 +cp -prf boost-ci-cloned/ci . +rm -rf boost-ci-cloned +REM source ci/travis/install.sh +REM The contents of install.sh below: + +for /F %%i in ("%DRONE_REPO%") do @set SELF=%%~nxi +SET BOOST_CI_TARGET_BRANCH=!TRAVIS_BRANCH! +SET BOOST_CI_SRC_FOLDER=%cd% + +call ci\common_install.bat + +echo '==================================> COMPILE' + +if "!CMAKE_NO_TESTS!" == "" ( + SET CMAKE_NO_TESTS=error +) +if "!CMAKE_NO_TESTS!" == "error" ( + SET CMAKE_BUILD_TESTING=-DBUILD_TESTING=ON +) + + +cd ../../ + +mkdir __build_static && cd __build_static +cmake -DBoost_VERBOSE=1 !CMAKE_BUILD_TESTING! -DCMAKE_INSTALL_PREFIX=iprefix ^ +-DBOOST_INCLUDE_LIBRARIES=!SELF! !CMAKE_OPTIONS! .. + +cmake --build . --target install --config Debug +if NOT "!CMAKE_BUILD_TESTING!" == "" ( + cmake --build . --target tests --config Debug +) +ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Debug + +cmake --build . --target install --config Release +if NOT "!CMAKE_BUILD_TESTING!" == "" ( + cmake --build . --target tests --config Release +) +ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Release +cd .. + + +if "!CMAKE_SHARED_LIBS!" == "" ( + SET CMAKE_SHARED_LIBS=1 +) +if "!CMAKE_SHARED_LIBS!" == "1" ( + +mkdir __build_shared && cd __build_shared +cmake -DBoost_VERBOSE=1 !CMAKE_BUILD_TESTING! -DCMAKE_INSTALL_PREFIX=iprefix ^ +-DBOOST_INCLUDE_LIBRARIES=!SELF! -DBUILD_SHARED_LIBS=ON !CMAKE_OPTIONS! .. + +cmake --build . --config Debug +cmake --build . --target install --config Debug +if NOT "!CMAKE_BUILD_TESTING!" == "" ( + cmake --build . --target tests --config Debug +) +ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Debug + +cmake --build . --config Release +cmake --build . --target install --config Release +if NOT "!CMAKE_BUILD_TESTING!" == "" ( + cmake --build . --target tests --config Release +) +ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Release + +) + +) else if "%DRONE_JOB_BUILDTYPE%" == "cmake-mainproject" ( + +echo "Running cmake main project job" +echo '==================================> INSTALL' +REM there seems to be some problem with b2 bootstrap on Windows +REM when CXX env variable is set +SET "CXX=" + +git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 +cp -prf boost-ci-cloned/ci . +rm -rf boost-ci-cloned +REM source ci/travis/install.sh +REM The contents of install.sh below: + +for /F %%i in ("%DRONE_REPO%") do @set SELF=%%~nxi +SET BOOST_CI_TARGET_BRANCH=!TRAVIS_BRANCH! +SET BOOST_CI_SRC_FOLDER=%cd% + +call ci\common_install.bat + +echo '==================================> COMPILE' + +if "!CMAKE_NO_TESTS!" == "" ( + SET CMAKE_NO_TESTS=error +) +if "!CMAKE_NO_TESTS!" == "error" ( + SET CMAKE_BUILD_TESTING=-DBUILD_TESTING=ON +) + + +cd ../../ + +mkdir __build_static && cd __build_static +cmake -DBoost_VERBOSE=1 !CMAKE_BUILD_TESTING! -DCMAKE_INSTALL_PREFIX=iprefix ^ +!CMAKE_OPTIONS! ../libs/json +cmake --build . --target install --config Debug +ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Debug + +cmake --build . --target install --config Release +ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Release + +) else if "%DRONE_JOB_BUILDTYPE%" == "cmake-subdirectory" ( + +echo "Running cmake subdirectory job" +echo '==================================> INSTALL' +REM there seems to be some problem with b2 bootstrap on Windows +REM when CXX env variable is set +SET "CXX=" + +git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 +cp -prf boost-ci-cloned/ci . +rm -rf boost-ci-cloned +REM source ci/travis/install.sh +REM The contents of install.sh below: + +for /F %%i in ("%DRONE_REPO%") do @set SELF=%%~nxi +SET BOOST_CI_TARGET_BRANCH=!TRAVIS_BRANCH! +SET BOOST_CI_SRC_FOLDER=%cd% + +call ci\common_install.bat + +echo '==================================> COMPILE' + +if "!CMAKE_NO_TESTS!" == "" ( + SET CMAKE_NO_TESTS=error +) +if "!CMAKE_NO_TESTS!" == "error" ( + SET CMAKE_BUILD_TESTING=-DBUILD_TESTING=ON +) + + +cd ../../ + +mkdir __build_static && cd __build_static +cmake !CMAKE_BUILD_TESTING! !CMAKE_OPTIONS! ../libs/json/test/cmake-subdir +cmake --build . --target check --config Debug +cmake --build . --target check --config Release + +) diff --git a/.drone/drone.sh b/.drone/drone.sh new file mode 100755 index 000000000..255eb531f --- /dev/null +++ b/.drone/drone.sh @@ -0,0 +1,246 @@ +#!/bin/bash + +# Copyright 2020 Rene Rivera, Sam Darwin +# Copyright 2021 Dmitry Arkhipov (grisumbras@gmail.com) +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt) + +set -e +export TRAVIS_OS_NAME=linux +export TRAVIS_BUILD_DIR=$(pwd) +export DRONE_BUILD_DIR=$(pwd) +export DRONE_BRANCH=${DRONE_BRANCH:-$(echo $GITHUB_REF | cut -d/ -f3-)} +export TRAVIS_BRANCH=$DRONE_BRANCH +export TRAVIS_EVENT_TYPE=$DRONE_BUILD_EVENT +export VCS_COMMIT_ID=$DRONE_COMMIT +export GIT_COMMIT=$DRONE_COMMIT +export REPO_NAME=$DRONE_REPO +export USER=$(whoami) +export CC=${CC:-gcc} +export PATH=~/.local/bin:/usr/local/bin:$PATH + +common_install () { + git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 + cp -prf boost-ci-cloned/ci . + rm -rf boost-ci-cloned + + if [ "$TRAVIS_OS_NAME" == "osx" ]; then + unset -f cd + fi + + export SELF=`basename $REPO_NAME` + export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" + export BOOST_CI_SRC_FOLDER=$(pwd) + : ${B2_DONT_BOOTSTRAP:=$B2_SEPARATE_BOOTSTRAP} + + . ./ci/common_install.sh + + if [ "x$B2_TOOLSET" = "xgcc-4.9" ]; then + # this is ridiculously hacky, but the alternative is building gcc-4.9 + # for Ubuntu 18.04 manually + pushd /etc/apt + + # temporally pretend we are Ubuntu 16.04 + sed 's/bionic/xenial/g' < sources.list > sources.list-xenial + mv sources.list sources.list-bionic + ln -sT sources.list-xenial sources.list + sudo -E apt-get -o Acquire::Retries=3 update + sudo -E DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=3 -y \ + --no-install-suggests --no-install-recommends install g++-4.9 + + # put everything back + rm sources.list sources.list-xenial + mv sources.list-bionic sources.list + sudo -E apt-get -o Acquire::Retries=3 update + + popd + fi + + if [ "$B2_SEPARATE_BOOTSTRAP" = 1 ]; then + pushd tools/build + B2_TOOLSET= ./bootstrap.sh + popd + cp tools/build/b2 . + fi +} + +common_cmake () { + export CXXFLAGS="-Wall -Wextra -Werror" + export CMAKE_SHARED_LIBS=${CMAKE_SHARED_LIBS:-1} + export CMAKE_NO_TESTS=${CMAKE_NO_TESTS:-error} + if [ $CMAKE_NO_TESTS = "error" ]; then + CMAKE_BUILD_TESTING="-DBUILD_TESTING=ON" + fi +} + + +if [ "$DRONE_JOB_BUILDTYPE" == "boost" ]; then + +if [[ $(uname) == "Linux" && ( "$COMMENT" == tsan || "$COMMENT" == asan ) ]]; then + echo 0 | sudo tee /proc/sys/kernel/randomize_va_space + sudo sysctl vm.mmap_rnd_bits=28 +fi + +echo '==================================> INSTALL' + +common_install + +echo '==================================> SCRIPT' + +printf "add-auto-load-safe-path $PWD/bin.v2\n" > ~/.gdbinit + +export special_targets=$B2_TARGETS +export B2_TARGETS=${B2_TARGETS:-"libs/$SELF/test//common libs/$SELF/example libs/$SELF/bench"} +$BOOST_ROOT/libs/$SELF/ci/travis/build.sh + +if [ -z "$special_targets" ]; then + export B2_JOBS=1 + export B2_TARGETS="libs/$SELF/test//heavy" + $BOOST_ROOT/libs/$SELF/ci/travis/build.sh +fi + +elif [ "$DRONE_JOB_BUILDTYPE" == "docs" ]; then + +echo '==================================> INSTALL' + +common_install +git submodule update --init tools/docca +git submodule update --init tools/boostlook + +echo '==================================> SCRIPT' + +cat >$BOOST_ROOT/tools/build/src/user-config.jam < INSTALL' + +common_install + +echo '==================================> SCRIPT' + +cd $BOOST_ROOT/libs/$SELF +ci/travis/codecov.sh + +elif [ "$DRONE_JOB_BUILDTYPE" == "valgrind" ]; then + +echo '==================================> INSTALL' + +common_install + +echo '==================================> SCRIPT' + +cd $BOOST_ROOT/libs/$SELF +ci/travis/valgrind.sh + +elif [ "$DRONE_JOB_BUILDTYPE" == "coverity" ]; then + +echo '==================================> INSTALL' + +common_install + +echo '==================================> SCRIPT' + +if [ -n "${COVERITY_SCAN_NOTIFICATION_EMAIL}" -a \( "$TRAVIS_BRANCH" = "develop" -o "$TRAVIS_BRANCH" = "master" \) -a \( "$DRONE_BUILD_EVENT" = "push" -o "$DRONE_BUILD_EVENT" = "cron" \) ] ; then +cd $BOOST_ROOT/libs/$SELF +ci/travis/coverity.sh +fi + +elif [ "$DRONE_JOB_BUILDTYPE" == "cmake-superproject" ]; then + +echo '==================================> INSTALL' + +common_install + +echo '==================================> COMPILE' + +common_cmake + +mkdir __build_static +cd __build_static +cmake -DBoost_VERBOSE=1 ${CMAKE_BUILD_TESTING} -DCMAKE_INSTALL_PREFIX=iprefix \ + -DBOOST_INCLUDE_LIBRARIES=$SELF ${CMAKE_OPTIONS} .. +if [ -n "${CMAKE_BUILD_TESTING}" ]; then + cmake --build . --target tests +fi +cmake --build . --target install +ctest --output-on-failure --no-tests=$CMAKE_NO_TESTS -R boost_$SELF +cd .. + +if [ "$CMAKE_SHARED_LIBS" = 1 ]; then + +mkdir __build_shared +cd __build_shared +cmake -DBoost_VERBOSE=1 ${CMAKE_BUILD_TESTING} -DCMAKE_INSTALL_PREFIX=iprefix \ + -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON ${CMAKE_OPTIONS} .. +if [ -n "${CMAKE_BUILD_TESTING}" ]; then + cmake --build . --target tests +fi +cmake --build . --target install +ctest --output-on-failure --no-tests=$CMAKE_NO_TESTS -R boost_$SELF + +fi + +elif [ "$DRONE_JOB_BUILDTYPE" == "cmake-mainproject" ]; then + +echo '==================================> INSTALL' + +common_install + +echo '==================================> COMPILE' + +common_cmake + +mkdir __build_static +cd __build_static +cmake -DBoost_VERBOSE=1 ${CMAKE_BUILD_TESTING} -DCMAKE_INSTALL_PREFIX=iprefix \ + ${CMAKE_OPTIONS} ../libs/json +cmake --build . --target install +ctest --output-on-failure --no-tests=$CMAKE_NO_TESTS +cd .. + +if [ "$CMAKE_SHARED_LIBS" = 1 ]; then + +mkdir __build_shared +cd __build_shared +cmake -DBoost_VERBOSE=1 ${CMAKE_BUILD_TESTING} -DCMAKE_INSTALL_PREFIX=iprefix \ + -DBUILD_SHARED_LIBS=ON ${CMAKE_OPTIONS} ../libs/json +cmake --build . --target install +ctest --output-on-failure --no-tests=$CMAKE_NO_TESTS + +fi + +elif [ "$DRONE_JOB_BUILDTYPE" == "cmake-subdirectory" ]; then + +echo '==================================> INSTALL' + +common_install + +echo '==================================> COMPILE' + +common_cmake + +mkdir __build_static +cd __build_static +cmake ${CMAKE_BUILD_TESTING} ${CMAKE_OPTIONS} ../libs/json/test/cmake-subdir +cmake --build . --target check +cd .. + +if [ "$CMAKE_SHARED_LIBS" = 1 ]; then + +mkdir __build_shared +cd __build_shared +cmake ${CMAKE_BUILD_TESTING} -DBUILD_SHARED_LIBS=ON ${CMAKE_OPTIONS} \ + ../libs/json/test/cmake-subdir +cmake --build . --target check + +fi + +fi diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..d64f436f6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,22 @@ +PLEASE DON'T FORGET TO "STAR" THIS REPOSITORY :) + +When reporting a bug please include the following: + +### Version of Boost + +You can find the version number in the file `` + +### Steps necessary to reproduce the problem + +A small compiling program is the best. If your code is +public, you can provide a link to the repository. + +### All relevant compiler information + +If you are unable to compile please include the type and +version of compiler you are using as well as all compiler +output including the error message, file, and line numbers +involved. + +The more information you provide the sooner your issue +can get resolved! diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml new file mode 100644 index 000000000..5b29a79c0 --- /dev/null +++ b/.github/actions/build/action.yml @@ -0,0 +1,108 @@ +name: Run and build +description: Build the project + +inputs: + toolset: + description: B2 toolset module to use + required: true + version: + description: B2 toolset version to use + required: false + default: '' + comment: + description: Human-readable job description + required: false + default: '' + path: + description: Path to project root + required: false + default: '' + buildtype: + description: Build type + required: false + default: '' + cxxstd: + description: C++ standard versions to use (separated by commas) + required: false + default: '' + defines: + description: Macro definitions to use (separated by commas) + required: false + default: '' + variant: + description: B2 build variant to use + required: false + default: release + testflags: + description: B2 test properties to set + required: false + default: '' + targets: + description: B2 targets to build (separated by spaces) + required: false + default: '' + b2_flags: + description: Extra B2 flags to use + required: false + default: 'warnings=extra warnings-as-errors=on' + valgrind_options: + description: Valgrind options to use + required: false + default: '' + asan: + description: Use '1' to enable address sanitizer + required: false + default: '' + ubsan: + description: Use '1' to enable UB sanitizer + required: false + default: '' + +runs: + using: composite + steps: + - name: Setup environment variables + shell: bash + run: | + B2_TOOLSET=${{ inputs.toolset }} + case $B2_TOOLSET in + gcc) CXX=g++ ;; + clang) CXX=clang++ ;; + *) CXX=$B2_TOOLSET ;; + esac + if [ -n "${{ inputs.version }}" ]; then + B2_TOOLSET=$B2_TOOLSET-${{ inputs.version }} + CXX=$CXX-${{ inputs.version }} + fi + + echo "CXX=$CXX" >> $GITHUB_ENV + echo "COMMENT=${{ inputs.comment }}" >> $GITHUB_ENV + echo "LCOV_BRANCH_COVERAGE=$LCOV_BRANCH_COVERAGE" >> $GITHUB_ENV + echo "B2_CI_VERSION=1" >> $GITHUB_ENV + echo "B2_CXXSTD=${{ inputs.cxxstd }}" >> $GITHUB_ENV + echo "B2_TOOLSET=$B2_TOOLSET" >> $GITHUB_ENV + echo "B2_DEFINES=${{ inputs.defines }}" >> $GITHUB_ENV + echo "B2_VARIANT=${{ inputs.variant }}" >> $GITHUB_ENV + echo "B2_TESTFLAGS=${{ inputs.testflags }}" >> $GITHUB_ENV + echo "VALGRIND_OPTS=${{ inputs.valgrind_opts }}" >> $GITHUB_ENV + echo "B2_ASAN=${{ inputs.asan }}" >> $GITHUB_ENV + echo "B2_UBSAN=${{ inputs.ubsan }}" >> $GITHUB_ENV + echo "B2_TARGETS=${{ inputs.targets }}" >> $GITHUB_ENV + echo "B2_FLAGS=${{ inputs.b2_flags }}" >> $GITHUB_ENV + echo "DRONE_BUILD_EVENT=${{ github.event_name }}" >> $GITHUB_ENV + echo "DRONE_JOB_BUILDTYPE=${{ inputs.buildtype }}" >> $GITHUB_ENV + echo "DRONE_COMMIT=${{ github.sha }}" >> $GITHUB_ENV + echo "DRONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "DRONE_REPO=${{ github.repository }}" >> $GITHUB_ENV + + - name: linux + if: runner.os == 'Linux' + shell: bash + run: . .drone/drone.sh + working-directory: ${{ inputs.path }} + + - name: windows + if: runner.os == 'Windows' + shell: cmd + run: call .drone/drone.bat + working-directory: ${{ inputs.path }} diff --git a/.github/workflows/run_analyze-bloat.yml b/.github/workflows/run_analyze-bloat.yml new file mode 100644 index 000000000..932538a9e --- /dev/null +++ b/.github/workflows/run_analyze-bloat.yml @@ -0,0 +1,54 @@ +name: analyze-bloat + +on: [push, pull_request] + +env: + CMAKE_SHARED_LIBS: '0' + CMAKE_NO_TESTS: ignore + CMAKE_OPTIONS: > + -DBOOST_JSON_BUILD_TESTS=OFF + -DBOOST_JSON_BUILD_FUZZERS=OFF + -DBOOST_JSON_BUILD_BENCHMARKS=OFF + -DCMAKE_BUILD_TYPE=Release + -DVISIBILITY_INLINES_HIDDEN=TRUE + -DCMAKE_CXX_VISIBILITY_PRESET=hidden + +jobs: + analyze-bloat: + runs-on: ubuntu-latest + steps: + - name: Fetch head + uses: actions/checkout@v4 + with: + path: 'head_ref/root' + - name: Compile static lib for head ref + uses: ./head_ref/root/.github/actions/build + with: + buildtype: 'cmake-superproject' + toolset: gcc + path: 'head_ref/root' + - name: Bloat analysis - absolute values + uses: djarek/bloaty-analyze@v1.0.0 + with: + file: head_ref/boost-root/__build_static/stage/lib/libboost_json.a + rows: 0 # 0 indicates unlimited number of rows + - name: Fetch base + if: ${{ github.event_name == 'pull_request' }} + uses: actions/checkout@v4 + with: + ref: ${{ github.base_ref }} + path: 'base_ref/root' + - name: Compile static lib for base ref + if: ${{ github.event_name == 'pull_request' }} + uses: ./head_ref/root/.github/actions/build + with: + buildtype: 'cmake-superproject' + toolset: gcc + path: 'base_ref/root' + - name: Bloat analysis - diff + uses: djarek/bloaty-analyze@v1.0.0 + if: ${{ github.event_name == 'pull_request' }} + with: + file: head_ref/boost-root/__build_static/stage/lib/libboost_json.a + base-file: base_ref/boost-root/__build_static/stage/lib/libboost_json.a + rows: 0 # 0 indicates unlimited number of rows diff --git a/.github/workflows/run_fuzzer.yml b/.github/workflows/run_fuzzer.yml index 200ffb2ba..37b17b950 100644 --- a/.github/workflows/run_fuzzer.yml +++ b/.github/workflows/run_fuzzer.yml @@ -1,9 +1,5 @@ name: fuzz -env: - BINTRAYUSER: vinniefalco - BINTRAYORG: cppalliance - on: push: pull_request: @@ -15,26 +11,74 @@ jobs: fuzz: runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: download the old corpus - # - run: "curl -O --location -J https://dl.bintray.com/cppalliance/boost.json/corpus.tar" - working-directory: fuzzing/ - - name: build and run - run: ./fuzz.sh - working-directory: fuzzing/ - - name: Upload the corpus to bintray - working-directory: fuzzing/ + container: + image: "cppalliance/droneubuntu2204:1" + + steps: + - name: Fetch head + uses: actions/checkout@v4 + with: + path: 'head' + - uses: actions/cache@v4 + id: cache-corpus + with: + path: head/fuzzing/corpus.tar + key: corpus-${{ github.run_id }} + restore-keys: corpus- + - name: Install packages + shell: bash run: | - echo uploading each artifact twice, otherwise it will not be published - tar cf - cmin > corpus.tar - curl -T corpus.tar -u$BINTRAYUSER:${{ secrets.bintrayApiKey }} https://api.bintray.com/content/$BINTRAYORG/boost.json/corpus/0/corpus.tar";publish=1;override=1" - curl -T corpus.tar -u$BINTRAYUSER:${{ secrets.bintrayApiKey }} https://api.bintray.com/content/$BINTRAYORG/boost.json/corpus/0/corpus.tar";publish=1;override=1" + set -e + + function add_repository { + for i in {1..3}; do + sudo -E apt-add-repository -y "$1" && return 0 || sleep 10; + done + return 1 + } + + curl -sSL --retry 5 https://apt.llvm.org/llvm-snapshot.gpg.key | \ + sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/llvm-snapshot.gpg + add_repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" + + sudo -E apt-get -o Acquire::Retries=3 update + sudo -E DEBIAN_FRONTEND=noninteractive \ + apt-get -o Acquire::Retries=3 -y --no-install-suggests \ + --no-install-recommends install \ + clang-18 \ + libclang-rt-18-dev + if [ ! -d /usr/lib/llvm-18/lib/clang/18/lib/linux ]; then + mkdir -p /usr/lib/llvm-18/lib/clang/18/lib/linux + for f in ls /usr/lib/llvm-18/lib/clang/18/lib/x86_64-pc-linux-gnu/libclang_rt.*.a; do + ln -sfT "$f" \ + "/usr/lib/llvm-18/lib/clang/18/lib/linux/$(basename ${f%.*})-x86_64.a" + ls -al /usr/lib/llvm-18/lib/clang/18/lib/linux/"$(basename ${f%.*})"-x86_64.a + done + fi + - uses: ./head/.github/actions/build + with: + buildtype: 'boost' + path: 'head' + toolset: clang-18 + cxxstd: 17 + targets: libs/json/fuzzing//run + - name: Pack the corpus + working-directory: boost-root/libs/json/fuzzing/ + run: | + tar cf - cmin > corpus.tar.tmp && mv corpus.tar.tmp "${GITHUB_WORKSPACE}"/head/fuzzing - name: Save the corpus as a github artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 + if: success() with: name: corpus - path: fuzzing/corpus.tar - + path: head/fuzzing/corpus.tar + - name: Archive any crashes as an artifact + uses: actions/upload-artifact@v4 + if: always() + with: + name: crashes + path: | + boost-root/crash-* + boost-root/leak-* + boost-root/timeout-* + if-no-files-found: ignore diff --git a/.gitignore b/.gitignore index 42d344c21..a17f7cad7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /bin +/bin.v2 /bin64 /_build* temp @@ -15,3 +16,10 @@ temp # Visual Studio Code /.vscode + +# local copy of bench +/bench/bench +/bench/bench.exe + +# Python +__pycache__ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 724deacea..000000000 --- a/.travis.yml +++ /dev/null @@ -1,345 +0,0 @@ -# Copyright 2016 Peter Dimov -# Copyright 2017 - 2019 James E. King III -# Copyright 2019 - 2020 Alexander Grund -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) - -# -# Generic Travis CI build script for boostorg repositories -# See: https://github.com/boostorg/boost-ci -# -# Instructions for customizing this script for your library: -# -# 1. Customize the compilers and language levels you want in the 'jobs'. -# 2. If you have more than include/, src/, test/, example/, examples/, or -# tools/ directories, modify your Travis CI project and add the environment -# variable DEPINST. For example if your build uses code in "bench/" and -# "fog/" directories, then set DEPINST to the following: -# --include bench --include fog -# 3. If you want to enable Coverity Scan, you need to provide the environment -# variables COVERITY_SCAN_TOKEN and COVERITY_SCAN_NOTIFICATION_EMAIL in -# your github settings. -# 4. If you want to enable a big-endian build, you need to uncomment the -# big-endian build job. -# 5. Enable pull request builds in your boostorg/ account. -# -# That's it - the scripts will do everything else for you. - -language: cpp -os: linux -dist: xenial - -cache: - directories: - - $HOME/cache - -branches: - only: - - master - - develop - - /bugfix\/.*/ - - /feature\/.*/ - - /fix\/.*/ - - /pr\/.*/ - -env: - global: - - B2_CI_VERSION=1 - # see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties - # - B2_ADDRESS_MODEL=64,32 - # - B2_LINK=shared,static - # - B2_THREADING=threading=multi,single - - B2_VARIANT=release - - B2_FLAGS="warnings=extra warnings-as-errors=on" - -install: - - git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned - - cp -prf boost-ci-cloned/ci . - - rm -rf boost-ci-cloned - - source ci/travis/install.sh - -script: $BOOST_ROOT/libs/$SELF/ci/travis/build.sh - -# Default toolsets in Ubuntu -# -# trusty xenial bionic -# 14.04 16.04 18.04 -# ------ ------ ------ -# clang 3.4 3.8 6.0 -# gcc 4.8.2 5.3.1 7.3.0 - -anchors: - libcpp: &libcpp { apt: { packages: [libc++-dev, libc++-helpers] } } - # More reliable way to add this as "ubuntu-toolchain-r-test" may fail on travis whitelisting - ubuntu-toolchain-r-test: - - &ubuntu-toolchain-r-test - sourceline: "ppa:ubuntu-toolchain-r/test" - llvm-toolchain-xenial-9: &llvm-toolchain-xenial-9 - sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main' - key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - - clang-33: &clang-33 { apt: { packages: [ "clang-3.3"] } } - clang-34: &clang-34 { apt: { packages: [ "clang-3.4"] } } - clang-35: &clang-35 { apt: { packages: [ "clang-3.5"], sources: [ *ubuntu-toolchain-r-test ] } } - clang-36: &clang-36 { apt: { packages: [ "clang-3.6"], sources: [ *ubuntu-toolchain-r-test ] } } - clang-37: &clang-37 { apt: { packages: [ "clang-3.7"], sources: [ *ubuntu-toolchain-r-test ] } } - clang-38: &clang-38 { apt: { packages: [ "clang-3.8"], sources: [ *ubuntu-toolchain-r-test ] } } - clang-39: &clang-39 { apt: { packages: [ "clang-3.9"], sources: [ *ubuntu-toolchain-r-test ] } } - clang-4: &clang-4 { apt: { packages: [ "clang-4.0", - "libstdc++-6-dev" ], sources: [ "llvm-toolchain-xenial-4.0", - *ubuntu-toolchain-r-test ] } } - clang-5: &clang-5 { apt: { packages: [ "clang-5.0", - "libstdc++-7-dev" ], sources: [ "llvm-toolchain-xenial-5.0", - *ubuntu-toolchain-r-test ] } } - clang-6: &clang-6 { apt: { packages: [ "clang-6.0", - "libc6-dbg", - "libc++-dev", - "libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-6.0", - *ubuntu-toolchain-r-test ] } } - clang-7: &clang-7 { apt: { packages: [ "clang-7", - "libc6-dbg", - "libc++-dev", - "libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-7", - *ubuntu-toolchain-r-test ] } } - clang-8: &clang-8 { apt: { packages: [ "clang-8", - "libc6-dbg", - "libc++-dev", - "libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-8", - *ubuntu-toolchain-r-test ] } } - clang-9: &clang-9 { apt: { packages: [ "clang-9", - "libc6-dbg", - "libc++-dev", - "libstdc++-9-dev" ], sources: [ *llvm-toolchain-xenial-9, - *ubuntu-toolchain-r-test ] } } - - gcc-44: &gcc-44 { apt: { packages: [ "g++-4.4" ], sources: [ *ubuntu-toolchain-r-test ] } } - gcc-46: &gcc-46 { apt: { packages: [ "g++-4.6" ], sources: [ *ubuntu-toolchain-r-test ] } } - gcc-47: &gcc-47 { apt: { packages: [ "g++-4.7" ], sources: [ *ubuntu-toolchain-r-test ] } } - gcc-48: &gcc-48 { apt: { packages: [ "g++-4.8" ], sources: [ *ubuntu-toolchain-r-test ] } } - gcc-49: &gcc-49 { apt: { packages: [ "g++-4.9" ], sources: [ *ubuntu-toolchain-r-test ] } } - gcc-5: &gcc-5 { apt: { packages: [ "g++-5" ], sources: [ *ubuntu-toolchain-r-test ] } } - gcc-6: &gcc-6 { apt: { packages: [ "g++-6" ], sources: [ *ubuntu-toolchain-r-test ] } } - gcc-7: &gcc-7 { apt: { packages: [ "g++-7" ], sources: [ *ubuntu-toolchain-r-test ] } } - gcc-8: &gcc-8 { apt: { packages: [ "g++-8" ], sources: [ *ubuntu-toolchain-r-test ] } } - gcc-9: &gcc-9 { apt: { packages: [ "g++-9" ], sources: [ *ubuntu-toolchain-r-test ] } } - -jobs: - allow_failures: - - env: - - COPY="all the environment settings from your job" - - include: - # Documentation build - - os: linux - dist: xenial - env: COMMENT=docs - addons: - apt: - packages: - - docbook - - docbook-xml - - docbook-xsl - - xsltproc - - libsaxonhe-java - - default-jre-headless - install: - - pwd - - cd .. - - mkdir -p $HOME/cache && cd $HOME/cache - - if [ ! -d doxygen ]; then git clone -b 'Release_1_8_15' --depth 1 https://github.com/doxygen/doxygen.git && echo "not-cached" ; else echo "cached" ; fi - - cd doxygen - - cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release - - cd build - - sudo make install - - cd ../.. - - if [ ! -f saxonhe.zip ]; then wget -O saxonhe.zip https://sourceforge.net/projects/saxon/files/Saxon-HE/9.9/SaxonHE9-9-1-4J.zip/download && echo "not-cached" ; else echo "cached" ; fi - - unzip -o saxonhe.zip - - sudo rm /usr/share/java/Saxon-HE.jar - - sudo cp saxon9he.jar /usr/share/java/Saxon-HE.jar - - cd .. - - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true - - git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root - - cd boost-root - - export BOOST_ROOT=$(pwd) - - git submodule update --init libs/context - - git submodule update --init tools/boostbook - - git submodule update --init tools/boostdep - - git submodule update --init tools/docca - - git submodule update --init tools/quickbook - - rsync -av $TRAVIS_BUILD_DIR/ libs/json - - python tools/boostdep/depinst/depinst.py ../tools/quickbook - - ./bootstrap.sh - - ./b2 headers - script: - - |- - echo "using doxygen ; using boostbook ; using saxonhe ;" > tools/build/src/user-config.jam - - ./b2 -j3 libs/json/doc//boostrelease - # install -# VFALCO no libboost-assert-dev on this version of Linux? -# - os: linux -# dist: bionic -# compiler: g++ -# env: CMAKE_INSTALL_TEST=1 -# install: -# - pip install --user cmake -# addons: -# apt: -# packages: -# - libboost-system-dev -# - libboost-container-dev -# script: -# - mkdir __build__ && cd __build__ -# - cmake -DCMAKE_INSTALL_PREFIX=~/.local .. -# - cmake --build . --target install -# - cd ../test/cmake_install_test && mkdir __build__ && cd __build__ -# - cmake -DCMAKE_INSTALL_PREFIX=~/.local .. -# - cmake --build . -# - cmake --build . --target check - - # standalone - - env: - - COMMENT=standalone - - CXX=g++-9 - install: - - pip install --user cmake - addons: *gcc-9 - script: - - mkdir __build - - cd __build - - cmake -DBOOST_JSON_STANDALONE=1 .. - - cmake --build . - - ctest -V . - - # standalone - - env: - - COMMENT=standalone - - CXX=clang++-9 - install: - - pip install --user cmake - addons: *clang-9 - script: - - mkdir __build - - cd __build - - cmake -DBOOST_JSON_STANDALONE=1 .. - - cmake --build . - - ctest -V . - - # coverage - - env: - - COMMENT=codecov.io - - LCOV_BRANCH_COVERAGE=0 - - B2_CXXSTD=11 - - B2_TOOLSET=gcc-8 - - B2_DEFINES="BOOST_NO_STRESS_TEST=1" - addons: *gcc-8 - script: - - cd $BOOST_ROOT/libs/$SELF - - ci/travis/codecov.sh - - - { env: [ "B2_TOOLSET=clang-8", "B2_CXXSTD=17,2a" ], addons: *clang-8 } - - - env: - - COMMENT=valgrind - - B2_TOOLSET=clang-6.0 - - B2_CXXSTD=11,14 - - B2_DEFINES="BOOST_NO_STRESS_TEST=1" - - B2_VARIANT=debug - - B2_TESTFLAGS=testing.launcher=valgrind - - VALGRIND_OPTS=--error-exitcode=1 - addons: *clang-6 - script: - - cd $BOOST_ROOT/libs/$SELF - - ci/travis/valgrind.sh - - - env: - - COMMENT=asan - - B2_VARIANT=debug - - B2_TOOLSET=gcc-8 - - B2_CXXSTD=11,14 - - B2_ASAN=1 - - B2_DEFINES="BOOST_NO_STRESS_TEST=1" - addons: *gcc-8 - - - env: - - COMMENT=tsan - - B2_VARIANT=debug - - B2_TOOLSET=gcc-8 - - B2_CXXSTD=11,14 - - B2_TSAN=1 - - B2_DEFINES="BOOST_NO_STRESS_TEST=1" - addons: *gcc-8 - - - env: - - COMMENT=ubsan - - B2_VARIANT=debug - - B2_TOOLSET=gcc-8 - - B2_CXXSTD=11,14 - - B2_UBSAN=1 - - B2_DEFINES="define=BOOST_NO_STRESS_TEST=1 define=BOOST_JSON_HEADER_ONLY=1" - - B2_LINKFLAGS="-fuse-ld=gold" - addons: *gcc-8 - - # libstdc++ - - { dist: "trusty", # xenial has libstdc++ from gcc 5.4.0 with newer ABI - env: [ "B2_TOOLSET=gcc-4.8", "B2_CXXSTD=11" ], addons: *gcc-48 } - - { dist: "trusty", # xenial has libstdc++ from gcc 5.4.0 with newer ABI - env: [ "B2_TOOLSET=gcc-4.9", "B2_CXXSTD=11" ], addons: *gcc-49 } - - { env: [ "B2_TOOLSET=gcc-5", "B2_CXXSTD=11" ], addons: *gcc-5 } - - { env: [ "B2_TOOLSET=gcc-6", "B2_CXXSTD=11,14" ], addons: *gcc-6 } - - { env: [ "B2_TOOLSET=gcc-7", "B2_CXXSTD=14,17" ], addons: *gcc-7 } - - { env: [ "B2_TOOLSET=gcc-8", "B2_CXXSTD=17,2a" ], addons: *gcc-8 } - - { env: [ "B2_TOOLSET=gcc-9", "B2_CXXSTD=17,2a" ], addons: *gcc-9 } - - { dist: "trusty", # xenial has libstdc++ from gcc 5.4.0 with newer ABI - env: [ "B2_TOOLSET=clang-3.8", "B2_CXXSTD=11" ], addons: *clang-38 } - - { env: [ "B2_TOOLSET=clang-4.0", "B2_CXXSTD=11,14" ], addons: *clang-4 } - - { env: [ "B2_TOOLSET=clang-5.0", "B2_CXXSTD=11,14" ], addons: *clang-5 } - - { env: [ "B2_TOOLSET=clang-6.0", "B2_CXXSTD=14,17" ], addons: *clang-6 } - - { env: [ "B2_TOOLSET=clang-7", "B2_CXXSTD=17,2a" ], addons: *clang-7 } -# - { env: [ "B2_TOOLSET=clang-8", "B2_CXXSTD=17,2a" ], addons: *clang-8 } - - { env: [ "B2_TOOLSET=clang-9", "B2_CXXSTD=11,14,17,2a" ], addons: *clang-8 } - - # libc++ - - { env: [ "B2_TOOLSET=clang-6.0", "B2_CXXSTD=11,14", - "B2_STDLIB=libc++" ], addons: *clang-6 } - - { os: "osx" , - env: [ "B2_TOOLSET=clang", "B2_CXXSTD=11,17" ] } - - # to enable Intel ICC define INTEL_ICC_SERIAL_NUMBER and the following (under development): - # - { env: [ "B2_TOOLSET=intel-linux", "B2_CXXSTD=11,14,17" ], addons: *gcc-7, - # script: cd $BOOST_ROOT/libs/$SELF && ci/travis/intelicc.sh } - - # uncomment to enable a big-endian build job, just note that it is 5-10 times slower - # than a regular build and travis has a 50 minute time limit per job - # - os: linux - # env: - # - COMMENT=big-endian - # - B2_CXXSTD=11 - # - B2_TOOLSET=gcc - # - B2_DEFINES="BOOST_NO_STRESS_TEST=1" - # - BDDE_OS=red - # - BDDE_ARCH=ppc64 - # script: - # - cd $BOOST_ROOT/libs/$SELF - # - ci/travis/bdde.sh - - # - os: linux - # env: - # - COMMENT=cppcheck - # script: - # - cd $BOOST_ROOT/libs/$SELF - # - ci/travis/cppcheck.sh - - #################### Jobs to run on pushes to master, develop ################### - - # Coverity Scan - - if: (env(COVERITY_SCAN_NOTIFICATION_EMAIL) IS present) AND (branch IN (develop, master)) AND (type IN (cron, push)) - env: - - COMMENT="Coverity Scan" - - B2_TOOLSET=clang - script: - - cd $BOOST_ROOT/libs/$SELF - - ci/travis/coverity.sh - -notifications: - email: - false diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc new file mode 100644 index 000000000..e0e186f00 --- /dev/null +++ b/CHANGELOG.adoc @@ -0,0 +1,252 @@ +[pagelevels=1,toclevels=1] += Release Notes + +:issue: https://github.com/boostorg/json/issues/ + +include::doc/pages/definitions.adoc[] + +== Boost 1.89.0 + +.Documentation +* New documentation style. New reference documentation structure. + +.API Changes +* {issue}1050[#1050] Optionals that are ranges are categorised as optionals. +* {issue}1086[#1086] Described class support is enabled for types with bases. + +== Boost 1.87.0 + +.API Changes +* {issue}991[#991] Conversion into structs ignores unknown keys. +* {issue}1041[#1041] Exception wrapping behaviour for `value_to` is simplified. +* {issue}1040[#1040] Deprecated initilaizer list behavior was removed. +* {issue}1040[#1040] Deprecated type aliases were removed. + +.New Features +* {issue}956[#956] <>. +* {issue}644[#644] Add GDB pretty printers for Boost.JSON types. + +.Fixes +* {issue}1057[#1057] Use correct 64bit full multiplication for MinGW on ARM64. +* {issue}1048[#1048] Fix parse_into handling of tuple of the wrong size. +* {issue}1047[#1047] Check for input size larger than allowed size of sequence. +* {issue}1034[#1034] Fix `value_ref` segfaulting on GCC 14. + +== Boost 1.86.0 + +.Deprecation +* Support for GCC versions older than version 5.0 is deprecated and **will + stop in Boost 1.88.0**. + +.API Changes +* {issue}941[#941] `source_location` parameter was added to throwing accessor + functions. + +.New Features +* {issue}940[#940] Parse option to tolerate invalid UTF-16 surrogate pairs, + and produce https://simonsapin.github.io/wtf-8/[WTF-8]. +* {issue}941[#941] Added accessor functions that return `system::result`. + +.Fixes +* Handle missing error case in direct parsing. + +== Boost 1.85.0 + +.New Dependencies +* {issue}915[#915] Boost.Endian is now used to deal with endianness. + +.API Changes +* {issue}881[#881] Aliases to Boost.System and Boost.Container components are + deprecated and **will be completely removed in 1.87.0**. + +.New Features +* {issue}979[#979] Conversion of described classes supports private members +* {issue}979[#979] Rvalue reference overload for `visit`. +* {issue}977[#977] Add conversion support for path-like types. + +.Fixes +* {issue}988[#988] Parsing into described classes correctly considers inherited + members. +* {issue}975[#975] Conversion of self-referential sequences is disabled. +* {issue}952[#952] Fixed reference handling in visit. + +== Boost 1.84.0 + +.API Changes +* {issue}925[#925] Add a conversion category for variants. +* {issue}833[#833] Add a conversion category for optionals. +* {issue}840[#840] Relax iterator requirements for constructors from iterator + pairs. + +.New Features +* {issue}627[#627] Parsing directly into user types. See + <>. + +.Fixes +* {issue}933[#933] Fix reading beyond input buffer. +* {issue}920[#920] Fix inconsistent choice of init list constructor. +* Documentation improvements. + +== Boost 1.83.0 + +.API Changes +* {issue}859[#859] The library now only throws {ref_system_error}, except for + when allocation failed, in which case `std::bad_alloc` is thrown. +* {issue}884[#884] Serialization behavior can now be changed by + <>. + +.New Features +* {issue}819[#819] <>. +* {issue}599[#599] <> for more precise + number parsing. +* {issue}885[#885] Support <> in stream + `operator<<`. +* {issue}397[#397] <> to allow `Infinity` and + `NaN` JSON literals. +* {issue}901[#901] <> that only validates + numbers rather than parsing them. +* {issue}892[#892] Numbers with exponent larger than `INT_MAX` are accepted by + the parser and treated as infinity. + +.Fixes +* {issue}901[#901] Fix `object` member functions that should provide strong + guarantee. +* {issue}887[#887] Fix ambiguity of `end` call when `boost/range.hpp` is + included. +* {issue}902[#902] Fix ASan failures. +* {issue}904[#904] Fix error message for `error::size_mismatch`. +* Fix conversion into tuple with const elements. + +== Boost 1.82.0 + +.New Features +* {issue}800[#800] <>. +* {issue}570[#570] <>. + +.Improvements +* {issue}848[#848] <> . +* {issue}807[#807] `value_to` supports missing elements for `std::optional`. +* Documentation improvements. + +.Fixes +* {issue}876[#876] Fix parser suspend inside an escape character. +* {issue}814[#814] Make sentinel() return a unique pointer. + +== Boost 1.81.0 + +.API Changes +* {issue}686[#686] Conversion traits were redesigned. +* {issue}756[#756] Removed `condition::assign_error`. +* {issue}758[#758] Removed `generic_category` alias. + +.New Features + +* {issue}749[#749] `object::stable_erase`. +* {issue}778[#778] Added error condition for generic library errors. +* {issue}619[#619] Added `parse` overload for `std::istream`. +* {issue}619[#619] `operator>>` for `value`. + +.Improvements +* {issue}686[#686] Null-like type conversion support (including + `std::nullptr_t`). +* {issue}736[#736] Non-throwing conversion from `value` to user types. +* {issue}677[#677] `value_to/from` supports `std::optional` and + `std::nullopt_t`. +* {issue}517[#517] `value_to/from` supports `std::variant` and `std::monotype`. +* {issue}626[#626] `value_to/from` supports supports described classes + and enums. +* {issue}757[#757] Rvalue ref-qualified accessors for `value`. + +.Fixes +* {issue}745[#745] Support for self-swap and self-move in `string`. +* {issue}747[#747] Support for self-swap and self-move in `array`. +* {issue}735[#735] Replaced C floating point constants with C++ equivalents. +* Documentation improvements. + +== Boost 1.80.0 + +.API Changes +* {issue}703[#703] Add non-const `value::at` overloads. +* {issue}717[#717] Add the ability to manually choose endianness of the + platform. +* Add `string::subview()` overload. + +.Fixes +* {issue}692[#692] Fix segfault in `array::erase(it)`. +* {issue}697[#697] Fix low performance of `serialize` on libc{pp}. +* {issue}708[#708] Fix ambiguous conversion to `std::string_view` on GCC 8. +* {issue}717[#717] Fix parsing on big-endian platforms. +* {issue}726[#726] Fix handling of comment after trailing comma. +* Minor documentation fixes. + +== Boost 1.79.0 + +.API Changes +* {issue}650[#650] Standalone mode of the library is removed. Users who wish to + continue using standalone JSON can switch to + https://github.com/CPPAlliance/standalone-json.git[the C++ Alliance fork]. + +.New Features +* {issue}480[#480] Add support for JSON Pointer. + +.Improvements +* Add `std::error_code` overloads. +* {issue}680[#680] Add `boost::source_location` to `error_codes`. + +.Fixes +* {issue}668[#668] Naturally grow string during serialization. + +== Boost 1.78.0 + +.API Changes +* {issue}628[#628] Standalone mode of the library is removed. + +== Boost 1.78.0 + +.API Changes +* {issue}628[#628] Standalone mode of the library is deprecated. + +.New Features +* {issue}549[#549] {issue}550[#550] Allow external libraries to forward declare + <> and <>. + +.Fixes +* {issue}608[#608] {issue}612[#612] Fixed signed integer overflow in number + parsing. +* {issue}620[#620] Documentation fixes. + +.Improvements +* {issue}557[#557] Add support for `/Zc:implicitNoexcept-` on MSVC. + +== Boost 1.77.0 + +.New Features +* {issue}538[#538] <>. +* {issue}521[#521] {std_hash} specializations for JSON types. + +.Fixes +* <> deallocates the correct size. +* Fixed crash when constructing <> from a pair of iterators + that form an empty range. +* <> allocates with the correct alignment. + +.Improvements +* <> supports `TupleLike` types. +* <> and <> support + {std_array} and similar types. + +== Boost 1.76.0 + +.Fixes +* {issue}481[#481] Refactored <> implementation; + user customizations are now always preferred over library-provided overloads. +* {issue}484[#484] Fixed imprecise parsing for some floating point numbers. +* {issue}485[#485] Fixed link errors in standalone mode, when used alongside + Boost. +* {issue}497[#497] Fix Boost.Build builds on GCC 4.8. + +== Boost 1.75.0 + +* Initial release. diff --git a/CMakeLists.txt b/CMakeLists.txt index fbbbed986..c01ebcb9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,153 +1,140 @@ # # Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) +# Copyright (c) 2021 Dmitry Arkhipov (grisumbras@gmail.com) # # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # -# Official repository: https://github.com/cppalliance/json +# Official repository: https://github.com/boostorg/json # -cmake_minimum_required(VERSION 3.5...3.16) +cmake_minimum_required(VERSION 3.8...3.16) -set(BOOST_JSON_VERSION 1) +set(BOOST_JSON_VERSION 2) if(BOOST_SUPERPROJECT_VERSION) set(BOOST_JSON_VERSION ${BOOST_SUPERPROJECT_VERSION}) endif() project(boost_json VERSION "${BOOST_JSON_VERSION}" LANGUAGES CXX) -option(BOOST_JSON_STANDALONE "Build boost::json as a standalone library" OFF) -option(BOOST_JSON_BUILD_TESTS "Build boost::json tests" ON) -option(BOOST_JSON_BUILD_FUZZERS "Build boost::json fuzzers" ON) -option(BOOST_JSON_BUILD_EXAMPLES "Build boost::json examples" ON) -option(BOOST_JSON_BUILD_BENCHMARKS "Build boost::json benchmarks" OFF) -file(GLOB_RECURSE BOOST_JSON_HEADERS $<$:CONFIGURE_DEPENDS> - include/boost/*.hpp - include/boost/*.ipp - include/boost/*.natvis -) - -set(BOOST_JSON_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src/src.cpp -) - -set_property(GLOBAL PROPERTY USE_FOLDERS ON) - -source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost PREFIX "" FILES ${BOOST_JSON_HEADERS}) -source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/src PREFIX "" FILES ${BOOST_JSON_SOURCES}) +set(BOOST_JSON_IS_ROOT OFF) +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + set(BOOST_JSON_IS_ROOT ON) +endif() -# TODO: For Boost superproject, do we want to support header-only mode? -# Then, this needs to read `add_library(boost_json INTERFACE)` -# and related settings need to be INTERFACE-ed as well. -add_library(boost_json ${BOOST_JSON_HEADERS} ${BOOST_JSON_SOURCES}) -add_library(Boost::json ALIAS boost_json) +if(BOOST_JSON_IS_ROOT) + include(CTest) +endif() +if(NOT BOOST_SUPERPROJECT_VERSION) + option(BOOST_JSON_INSTALL "Install boost::json files" ON) + option(BOOST_JSON_BUILD_TESTS "Build boost::json tests" ${BUILD_TESTING}) + option(BOOST_JSON_BUILD_FUZZERS "Build boost::json fuzzers" ${BOOST_JSON_IS_ROOT}) + option(BOOST_JSON_BUILD_EXAMPLES "Build boost::json examples" ${BOOST_JSON_IS_ROOT}) + option(BOOST_JSON_BUILD_BENCHMARKS "Build boost::json benchmarks" OFF) +else() + set(BOOST_JSON_BUILD_TESTS ${BUILD_TESTING}) +endif() -target_compile_features(boost_json PUBLIC cxx_constexpr) -# TODO: For Boost superproject, this may need to be INTERFACE setting. include(GNUInstallDirs) -target_include_directories(boost_json - PUBLIC - "$" - "$" -) - -target_compile_definitions(boost_json PUBLIC BOOST_JSON_NO_LIB=1) - -if(BUILD_SHARED_LIBS) - target_compile_definitions(boost_json PUBLIC BOOST_JSON_DYN_LINK=1) -else() - target_compile_definitions(boost_json PUBLIC BOOST_JSON_STATIC_LINK=1) +if(BOOST_JSON_IS_ROOT) + # + # Building inside Boost tree, but as a separate project e.g. on Travis or + # other CI, or when producing Visual Studio Solution and Projects. + + set(BOOST_INCLUDE_LIBRARIES json) + set(BOOST_EXCLUDE_LIBRARIES json) + if(BOOST_JSON_BUILD_EXAMPLES) + list(APPEND BOOST_INCLUDE_LIBRARIES optional) + endif() + + set(CMAKE_FOLDER _deps) + add_subdirectory(../.. _deps/boost EXCLUDE_FROM_ALL) + unset(CMAKE_FOLDER) endif() -if(BOOST_JSON_STANDALONE) - # - # Building out of Boost superproject tree, without Boost as dependency. - # e.g. for packaging or added with add_subdirectory. - # - target_compile_definitions(boost_json PUBLIC BOOST_JSON_STANDALONE) - target_compile_features(boost_json PUBLIC cxx_std_17) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pretty_printers") +find_package(BoostPrettyPrinters QUIET) +if(BoostPrettyPrinters_FOUND) + boost_pretty_printers_gdb_python_header( + TARGET boost_json_regenerate_printers + INPUT src/boost_json_gdb_printers.py + OUTPUT include/boost/json/detail/gdb_printers.hpp + HEADER_GUARD BOOST_JSON_DETAIL_GDB_PRINTERS_HPP + NO_DISABLE_MACRO + EXCLUDE_FROM_ALL) +endif() -elseif(BOOST_SUPERPROJECT_VERSION) - # - # Building as part of Boost superproject tree, with Boost as dependency. - # - # TODO: This CMake support for Boost.Json is currently experimental. - # This needs to be reviewed, tested - target_link_libraries(boost_json +function(boost_json_setup_properties target) + if(MSVC) + target_compile_definitions(${target} PRIVATE _SCL_SECURE_NO_WARNINGS) + endif() + target_compile_features(${target} PUBLIC cxx_constexpr) + target_compile_definitions(${target} PUBLIC BOOST_JSON_NO_LIB=1) + + if(BOOST_SUPERPROJECT_VERSION) + target_include_directories(${target} PUBLIC "${PROJECT_SOURCE_DIR}/include") + else() + target_include_directories(${target} + PUBLIC + "$" + "$" + ) + endif() + + target_link_libraries(${target} PUBLIC + Boost::align Boost::assert Boost::config Boost::container + Boost::container_hash Boost::core - Boost::exception + Boost::describe + Boost::endian + Boost::mp11 Boost::system - Boost::utility + Boost::throw_exception ) +endfunction() - include(BoostInstall) - boost_install(TARGETS boost_json HEADER_DIRECTORY include/) -elseif(BOOST_JSON_IN_BOOST_TREE) - # - # Building inside Boost tree, out of Boost superproject tree, with Boost as dependency. - # e.g. on Travis or other CI, or when producing Visual Studio Solution and Projects. - # - get_filename_component(BOOST_ROOT ../.. ABSOLUTE) - target_include_directories(boost_json PUBLIC ${BOOST_ROOT}) - target_link_directories(boost_json PUBLIC ${BOOST_ROOT}/stage/lib) +file(GLOB_RECURSE BOOST_JSON_HEADERS CONFIGURE_DEPENDS + include/boost/*.hpp + include/boost/*.ipp + include/boost/*.natvis +) -else() - # - # Building out of Boost tree, out of Boost superproject tree, with Boost as dependency. - # e.g. for packaging or added with add_subdirectory. - # - find_package(Boost REQUIRED COMPONENTS container system) - target_link_libraries(boost_json - PUBLIC - Boost::container - Boost::system - ) -endif() +set(BOOST_JSON_SOURCES src/src.cpp) -if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND NOT BOOST_JSON_IN_BOOST_TREE) - set_target_properties(boost_json PROPERTIES EXPORT_NAME json) - install(TARGETS boost_json - EXPORT boost_json_targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) +set_property(GLOBAL PROPERTY USE_FOLDERS ON) - install(EXPORT boost_json_targets - FILE boost_json-targets.cmake - NAMESPACE Boost:: - DESTINATION lib/cmake/boost_json - ) +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost PREFIX "" FILES ${BOOST_JSON_HEADERS}) +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/src PREFIX "" FILES ${BOOST_JSON_SOURCES}) - include(CMakePackageConfigHelpers) - configure_package_config_file(cmake/config.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/boost_json-config.cmake - INSTALL_DESTINATION lib/cmake/boost_json - ) +add_library(boost_json ${BOOST_JSON_HEADERS} ${BOOST_JSON_SOURCES}) +add_library(Boost::json ALIAS boost_json) +boost_json_setup_properties(boost_json) - write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/boost_json-config-version.cmake - VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion - ) +if(BUILD_SHARED_LIBS) + target_compile_definitions(boost_json PUBLIC BOOST_JSON_DYN_LINK=1) +else() + target_compile_definitions(boost_json PUBLIC BOOST_JSON_STATIC_LINK=1) +endif() - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/boost_json-config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/boost_json-config-version.cmake - DESTINATION lib/cmake/boost_json - ) - install(DIRECTORY include/ DESTINATION include) +if(BOOST_JSON_INSTALL AND NOT BOOST_SUPERPROJECT_VERSION) + install(TARGETS boost_json + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ) endif() + if(BOOST_JSON_BUILD_TESTS) - include(CTest) add_subdirectory(test) endif() @@ -155,10 +142,10 @@ if(BOOST_JSON_BUILD_FUZZERS) add_subdirectory(fuzzing) endif() -if(BOOST_JSON_BUILD_EXAMPLES AND NOT BOOST_SUPERPROJECT_VERSION) +if(BOOST_JSON_BUILD_EXAMPLES) add_subdirectory(example) endif() -if(BOOST_JSON_BUILD_BENCHMARKS AND NOT BOOST_SUPERPROJECT_VERSION) +if(BOOST_JSON_BUILD_BENCHMARKS) add_subdirectory(bench) endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 84c179c5d..23b15bb82 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,16 +4,13 @@ Here is minimal sequence of steps required to prepare development environment: -1. Download Boost superproject -2. Download Boost.JSON -3. Bootstrap Boost -4. Build Boost.JSON tests, benchmarks and examples +1. Download Boost +2. Bootstrap Boost +3. Build Boost.JSON tests, benchmarks and examples ``` git clone --recurse-submodules --jobs 8 https://github.com/boostorg/boost.git -cd boost/libs -git clone --recurse-submodules https://github.com/cppalliance/json.git -cd .. +cd boost ./bootstrap.sh ./b2 headers cd libs/json diff --git a/Jamfile b/Jamfile deleted file mode 100644 index 1210b1e71..000000000 --- a/Jamfile +++ /dev/null @@ -1,15 +0,0 @@ -# -# Copyright (c) 2013-2019 Vinnie Falco (vinnie dot falco at gmail dot com) -# -# Distributed under the Boost Software License, Version 1.0. (See accompanying -# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -# -# Official repository: https://github.com/cppalliance/json -# - -path-constant LIB_DIR : . ; - -build-project bench ; -build-project test ; -build-project fuzzing ; -build-project example ; diff --git a/README.adoc b/README.adoc new file mode 100644 index 000000000..2b75ab58e --- /dev/null +++ b/README.adoc @@ -0,0 +1,258 @@ +ifdef::env-github[] + +:tip-caption: :bulb: +:note-caption: :information_source: +:important-caption: :heavy_exclamation_mark: +:caution-caption: :fire: +:warning-caption: :warning: +:source-highlighter: rouge +:source-language: c++ + +[link=https://www.boost.org/doc/libs/latest/libs/json] +image:https://raw.githubusercontent.com/CPPAlliance/json/master/doc/images/repo-logo-3.png[Boost.JSON] + +[cols=3] +|=== +|Branch +|https://github.com/boostorg/json/tree/master[`master`] +|https://github.com/boostorg/json/tree/develop[`develop`] + +|https://azure.microsoft.com/en-us/services/devops/pipelines/[Azure] +a| +[link=https://vinniefalco.visualstudio.com/json/_build/latest?definitionId=5&branchName=master] +image::https://img.shields.io/azure-devops/build/vinniefalco/2571d415-8cc8-4120-a762-c03a8eda0659/8/master[Build Status] +a| +[link=https://vinniefalco.visualstudio.com/json/_build/latest?definitionId=8&branchName=develop] +image::https://img.shields.io/azure-devops/build/vinniefalco/2571d415-8cc8-4120-a762-c03a8eda0659/8/develop[Build Status] + +|Docs +a| +[link=https://www.boost.org/doc/libs/master/libs/json/] +image::https://img.shields.io/badge/docs-master-brightgreen.svg[Documentation] +a| +[link=https://www.boost.org/doc/libs/develop/libs/json/] +image::https://img.shields.io/badge/docs-develop-brightgreen.svg[Documentation] + +|https://drone.io/[Drone] +a| +[link=https://drone.cpp.al/boostorg/json] +image::https://drone.cpp.al/api/badges/boostorg/json/status.svg?ref=refs/heads/master[Build Status] +a| +[link=https://drone.cpp.al/boostorg/json] +image::https://drone.cpp.al/api/badges/boostorg/json/status.svg?ref=refs/heads/develop[Build Status] + +|Matrix +a| +[link=http://www.boost.org/development/tests/master/developer/json.html] +image::https://img.shields.io/badge/matrix-master-brightgreen.svg[Matrix] +a| +[link=https://img.shields.io/badge/matrix-develop-brightgreen.svg] +image::https://img.shields.io/badge/matrix-develop-brightgreen.svg[Matrix] + +|Fuzzing +| --- +a| +[link=https://github.com/boostorg/json/workflows/fuzz/badge.svg?branch=develop] +image::https://github.com/boostorg/json/workflows/fuzz/badge.svg?branch=develop[fuzz] + +|https://ci.appveyor.com/[Appveyor] +a| +[link=https://ci.appveyor.com/project/vinniefalco/cppalliance-json/branch/master] +image::https://ci.appveyor.com/api/projects/status/8csswcnmfm798203?branch=master&svg=true[Build status] +a| +[link=https://ci.appveyor.com/project/vinniefalco/cppalliance-json/branch/develop] +image::https://ci.appveyor.com/api/projects/status/8csswcnmfm798203?branch=develop&svg=true[Build status] + +|https://codecov.io[codecov.io] +a| +[link=https://codecov.io/gh/boostorg/json/branch/master] +image::https://codecov.io/gh/boostorg/json/branch/master/graph/badge.svg[codecov] +a| +[link=https://codecov.io/gh/boostorg/json/branch/develop] +image::https://codecov.io/gh/boostorg/json/branch/develop/graph/badge.svg[codecov] +|=== + += Boost.JSON + +endif::[] + +[pagelevels=0,toclevels=0] +== Overview +Boost.JSON is a portable {cpp} library which provides containers and algorithms +that implement https://json.org/[JavaScript Object Notation], or simply "JSON", +a lightweight data-interchange format. This format is easy for humans to read +and write, and easy for machines to parse and generate. It is based on a subset +of the JavaScript Programming Language +(https://www.ecma-international.org/ecma-262/10.0/index.html[Standard +ECMA-262]), and is currently standardised in +(https://datatracker.ietf.org/doc/html/rfc8259[RFC 8259]). JSON is a text +format that is language-independent but uses conventions that are familiar to +programmers of the C-family of languages, including C, {cpp}, C#, Java, +JavaScript, Perl, Python, and many others. These properties make JSON an ideal +data-interchange language. + +This library focuses on a common and popular use-case: parsing and serializing +to and from a container called `value` which holds JSON types. Any `value` +which you build can be serialized and then deserialized, guaranteeing that the +result will be equal to the original value. Whatever JSON output you produce +with this library will be readable by most common JSON implementations in any +language. + +The `value` container is designed to be well suited as a vocabulary type +appropriate for use in public interfaces and libraries, allowing them to be +composed. The library restricts the representable data types to the ranges +which are almost universally accepted by most JSON implementations, especially +JavaScript. The parser and serializer are both highly performant, meeting or +exceeding the benchmark performance of the best comparable libraries. +Allocators are very well supported. Code which uses these types will be easy to +understand, flexible, and performant. + +Boost.JSON offers these features: + +* Fast compilation +* Require only {cpp}11 +* Fast streaming parser and serializer +* Constant-time key lookup for objects +* Options to allow non-standard JSON +* Easy and safe modern API with allocator support +* Optional header-only, without linking to a library + +ifdef::env-github[] + +Visit https://boost.org/libs/json for complete documentation. + +endif::[] + +=== Requirements + +* Requires only {cpp}11 +* Link to a built static or dynamic Boost library (build instructions can be + found https://www.boost.org/doc/libs/latest/more/getting_started/index.html[here]), + or use header-only (see below) +* Additional link to Boost.Container may be required + (as described in its + https://www.boost.org/doc/libs/latest/doc/html/container.html#container.intro.introduction_building_container[documentation]) +* Supports `-fno-exceptions`, detected automatically (but read + <> on this page). + +The library relies heavily on these well known C++ types in +its interfaces (henceforth termed _standard types_): + +* `string_view` +* `memory_resource`, `polymorphic_allocator` +* `error_category`, `error_code`, `error_condition`, `system_error` + +==== Header-Only +To use as header-only; that is, to eliminate the requirement to link a program +to a static or dynamic Boost.JSON library, simply place the following line in +exactly one new or existing source file in your project. + +[source] +---- +#include +---- + +MSVC users must also define the macro `BOOST_JSON_NO_LIB` to disable +auto-linking. Note, that if you also want to avoid linking to Boost.Container, +which is a dependency of Boost.JSON, you have to define +`BOOST_CONTAINER_NO_LIB`. In order to disable auto-linking to Boost libraries +completely you can define `BOOST_ALL_NO_LIB` instead. + +==== Disabling Exceptions +In order to support building with exceptions disabled this library uses another +Boost library, +https://www.boost.org/doc/libs/latest/libs/throw_exception[Boost.ThrowException]. +This allows to automatically discover whether exception support is available. +On the other hand, as explained in Boost.ThrowException's documentation, if +exceptions are disabled, the users need to provide their own implementation for +`boost::throw_exception`, in order to link their binaries successfully. Here's +a very simple example of such implementation: + +[source] +---- +void throw_exception( const std::exception&, const boost::source_location& ) +{ + std::printf("Exceptions are not supported!"); + std::abort(); +} +---- + +==== Embedded +Boost.JSON works great on embedded devices. The library uses local stack +buffers to increase the performance of some operations. On Intel platforms +these buffers are large (4KB), while on non-Intel platforms they are small (256 +bytes). To adjust the size of the stack buffers for embedded applications +define this macro when building the library or including the function +definitions: + +[source] +---- +#define BOOST_JSON_STACK_BUFFER_SIZE 1024 +#include +---- + +==== Endianness +Boost.JSON uses +https://www.boost.org/doc/libs/latest/libs/endian/doc/html/endian.html[Boost.Endian] +in order to support both little endian and big endian platforms. + +==== Supported Compilers +Boost.JSON has been tested with the following compilers: + +* clang: 3.5, 3.6, 3.7, 3.8, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 +* gcc: 5, 6, 7, 8, 9, 10, 11, 12 +* msvc: 14.0, 14.1, 14.2, 14.3 + +==== Supported JSON Text +The library expects input text to be encoded using UTF-8, which is +a requirement put on all JSON exchanged between systems by the +(https://datatracker.ietf.org/doc/html/rfc8259#section-8.1[RFC]). Similarly, +the text generated by the library is valid UTF-8. + +The RFC does not allow byte order marks (BOM) to appear in JSON text, so the +library considers BOM syntax errors. + +The library supports several popular JSON extensions. These have to be +explicitly enabled. + +ifdef::env-github[] + +==== Visual Studio Solution + +[source,shell] +---- +cmake -G "Visual Studio 16 2019" -A Win32 -B bin -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/msvc.cmake +cmake -G "Visual Studio 16 2019" -A x64 -B bin64 -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/msvc.cmake +---- + +endif::[] + +=== Quality Assurance +The development infrastructure for the library includes these per-commit +analyses: + +* Coverage reports +* Benchmark performance comparisons +* Compilation and tests on Drone.io, Azure Pipelines, Appveyor +* Fuzzing using clang-llvm and machine learning + +==== Security Review (Bishop Fox) +As part of our commitment to producing the very finest C++ libraries that +application developers can trust, the C++ Alliance has commissioned Bishop Fox +to perform a security audit of the Boost.JSON library. The report is linked +here: + +https://cppalliance.org/pdf/C%20Plus%20Plus%20Alliance%20-%20Boost%20JSON%20Security%20Assessment%202020%20-%20Assessment%20Report%20-%2020210317.pdf[C Plus Plus Alliance - Boost JSON Security Assessment 2020 - Assessment Report - 20210317] + +=== Credits +This library wouldn't be where it is today without the help of +https://github.com/pdimov[Peter Dimov] for design advice and optimization +assistance. + +ifdef::env-github[] + +== License +Distributed under the Boost Software License, Version 1.0. (See accompanying +file link:LICENSE_1_0.txt[LICENSE_1_0.txt] or copy at +https://www.boost.org/LICENSE_1_0.txt). + +endif::[] diff --git a/README.md b/README.md deleted file mode 100644 index d1a5f70d1..000000000 --- a/README.md +++ /dev/null @@ -1,61 +0,0 @@ -Boost.JSON Title - -Branch | Travis | Appveyor | Azure Pipelines | codecov.io | Docs | Matrix | -:-------------: | ------ | -------- | --------------- | ---------- | ---- | ------ | -[`master`](https://github.com/CPPAlliance/json/tree/master) | [![Build Status](https://travis-ci.org/CPPAlliance/json.svg?branch=master)](https://travis-ci.org/CPPAlliance/json) | [![Build status](https://ci.appveyor.com/api/projects/status/8csswcnmfm798203?branch=master&svg=true)](https://ci.appveyor.com/project/vinniefalco/cppalliance-json/branch/master) | [![Build Status](https://img.shields.io/azure-devops/build/vinniefalco/2571d415-8cc8-4120-a762-c03a8eda0659/5/master)](https://vinniefalco.visualstudio.com/json/_build/latest?definitionId=5&branchName=master) | [![codecov](https://codecov.io/gh/CPPAlliance/json/branch/master/graph/badge.svg)](https://codecov.io/gh/CPPAlliance/json/branch/master) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://master.json.cpp.al/) | [![Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/json.html) -[`develop`](https://github.com/CPPAlliance/json/tree/develop) | [![Build Status](https://travis-ci.org/CPPAlliance/json.svg?branch=develop)](https://travis-ci.org/CPPAlliance/json) | [![Build status](https://ci.appveyor.com/api/projects/status/8csswcnmfm798203?branch=develop&svg=true)](https://ci.appveyor.com/project/vinniefalco/cppalliance-json/branch/develop) | [![Build Status](https://img.shields.io/azure-devops/build/vinniefalco/2571d415-8cc8-4120-a762-c03a8eda0659/5/develop)](https://vinniefalco.visualstudio.com/json/_build/latest?definitionId=5&branchName=develop) | [![codecov](https://codecov.io/gh/CPPAlliance/json/branch/develop/graph/badge.svg)](https://codecov.io/gh/CPPAlliance/json/branch/develop) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://develop.json.cpp.al/) | [![Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/json.html) - -# Boost.JSON - -## This is currently **NOT** an official Boost library. - -## Introduction - -This library provides containers and algorithms which implement JSON -("JavaScript Object Notation"), a lightweight data-interchange format. -This format is easy for humans to read and write, and easy for machines -to parse and generate. It is based on a subset of the Javascript Programming -Language, Standard ECMA-262. JSON is a text format that is language-indepdent -but uses conventions that are familiar to programmers of the C-family of -languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many -others. These properties make JSON an ideal data-interchange language. - -## Motivation - -A survey of existing JSON libraries shows impressive diversity and features. -However, no library is known to meet all of the design goals mentioned here. -In particular, we know of no library that supports incremental parsing and -serialization, and also supports custom allocators robustly. - -## Design Goals - -There are an overwhelming number of JSON libraries. A common theme -throughout is an emphasis on parsing performance or feature richness. -This library uses a different approach: it provides a carefully -designed JSON container, `value`, engineered from the ground up to be -ideally suited as a vocabulary type. In particular it provides an interface -which is stable, lightweight, and appropriate for use as parameter or -return types in public interfaces. - -The design of the library also achieves these goals: - -* Requires only C++11. -* Support stateful allocators. -* Top performance of general libraries. -* Uniform interface on all C++ versions. -* Key lookup in objects has constant average complexity. -* Strict parser and serializer which work incrementally. -* Security-aware treatment of untrusted inputs. -* Fast compilation performance. - -## CMake - - cmake -G "Visual Studio 16 2019" -A Win32 -B bin -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/msvc.cmake - cmake -G "Visual Studio 16 2019" -A x64 -B bin64 -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/msvc.cmake - -## License - -Distributed under the Boost Software License, Version 1.0. -(See accompanying file [LICENSE_1_0.txt](LICENSE_1_0.txt) or copy at -https://www.boost.org/LICENSE_1_0.txt) diff --git a/bench/CMakeLists.txt b/bench/CMakeLists.txt index 7bbe64fd6..332ce6e5c 100644 --- a/bench/CMakeLists.txt +++ b/bench/CMakeLists.txt @@ -4,7 +4,7 @@ # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # -# Official repository: https://github.com/cppalliance/json +# Official repository: https://github.com/boostorg/json # source_group("" FILES @@ -19,3 +19,11 @@ add_executable(bench target_include_directories(bench PRIVATE ../test) target_link_libraries(bench PRIVATE Boost::json) + +if(EXISTS lib/nlohmann/single_include/nlohmann/json.hpp) + target_compile_definitions(bench PRIVATE BOOST_JSON_HAS_NLOHMANN_JSON) +endif() + +if(EXISTS lib/rapidjson/include/rapidjson/rapidjson.h) + target_compile_definitions(bench PRIVATE BOOST_JSON_HAS_RAPIDJSON) +endif() diff --git a/bench/Jamfile b/bench/Jamfile index 83e72c973..687163b46 100644 --- a/bench/Jamfile +++ b/bench/Jamfile @@ -4,28 +4,78 @@ # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # -# Official repository: https://github.com/cppalliance/json +# Official repository: https://github.com/boostorg/json # +import boost-json-bench ; +import common ; +import feature ; +import notfile ; import os ; +import path ; +import property ; +import toolset ; -STANDALONE = [ os.environ STANDALONE ] ; -if $(STANDALONE) +local has_nlohmann_json = [ + glob lib/nlohmann/single_include/nlohmann/json.hpp ] ; +if $(has_nlohmann_json) { - LIB = - BOOST_JSON_STANDALONE=1 - ../src/src.cpp - ; + has_nlohmann_json = "" ; } -else + +local has_rapidjson = [ + glob lib/rapidjson/include/rapidjson/rapidjson.h ] ; +if $(has_rapidjson) { - LIB = /boost/json//boost_json ; + has_rapidjson = "" ; } exe bench : bench.cpp + /boost/json//boost_json : ../test - : - $(LIB) + ../example + $(has_nlohmann_json)BOOST_JSON_HAS_NLOHMANN_JSON + $(has_rapidjson)BOOST_JSON_HAS_RAPIDJSON + ; + +exe bench-conv + : bench-conv.cpp + /boost/json//boost_json + : ../test + ../example ; + +install bench-local : bench : . true ; +explicit bench-local ; +always bench-local ; + +local bench-files = [ glob-tree-ex data : *.json ] ; +notfile run : @run-bench : bench : : $(bench-files) ; +notfile run-conv : @run-bench : bench-conv : : $(bench-files) ; +explicit run run-conv ; + +rule run-bench ( target : sources * : props * ) +{ + local launcher = [ property.select bench.launcher : $(props) ] ; + if $(launcher) + { + launcher = "$(launcher:G=) " ; + launcher = "$(launcher:J=) " ; + } + else + { + launcher = "" ; + } + LAUNCHER on $(target) = $(launcher) ; +} + +actions run-bench bind FILES +{ + $(LAUNCHER) $(>) $(FLAGS) $(FILES) +} + +toolset.flags $(__name__).run-bench FLAGS : ; +toolset.flags $(__name__).run-bench FLAGS : ; +toolset.flags $(__name__).run-bench FILES : ; diff --git a/bench/README.md b/bench/README.md index 3119f4530..19ce796c1 100644 --- a/bench/README.md +++ b/bench/README.md @@ -5,5 +5,69 @@ fetch the third party repositories. Then run the bench program with no arguments for a list of command line options. +``` +Usage: bench [options...] ... + +Options: -t:[p][s] Test parsing, serialization or both + (default both) + -i:[b][d][r][c][n] Test the specified implementations + (b: Boost.JSON, pool storage) + (d: Boost.JSON, default storage) + (u: Boost.JSON, null parser) + (s: Boost.JSON, convenient functions) + (o: Boost.JSON, stream operators) + (r: RapidJSON, memory storage) + (c: RapidJSON, CRT storage) + (n: nlohmann/json) + (default all) + -n: Number of trials (default 6) + -b: Branch label for boost implementations + -m:(i|p|n) Number parsing mode + (i: imprecise) + (p: precise) + (n: none) + (default imprecise) + -f Include file IO into consideration when testing parsers +``` + +When building with b2, it is possible to create several different copies of the +bench program for different build properties (toolset, build variant, etc.). +Rather than figuring out where those programs are located from b2 output you +can simply run them directly from the build system. For this, use the +`bench//run` target. For example: + +```sh +b2 variant=release toolset=gcc,clang bench//run +``` + +You can set bench options using the flag `bench.option`. By default the +target uses all files from the `bench/data` directory as benchmark data. If you +want to use just a few of those files or use different files altogether, use +the flag `bench.file`. Finally, when running benchmarks it is often necessary +to use a wrapper program that sets up the process for better result stability. +This can be achieved with the flag `bench.launcher`. In this case also consider +telling b2 to not run several jobs at a time with `-j1`, as they would +interfere with each other. Combining everything together we get: + +```sh +b2 -j1 variant=release toolset=gcc,clang bench//run bench.option=-t:p bench.option=-n:10 bench.option=-i:b bench.launcher="nice -n -20 taskset -c 1" bench.file=mydata.json +``` + +Which is the equivalent of + +```sh +nice -n -20 taskset -c 1 path/to/gcc/version/of/bench -t:p -n:10 -i:b mydata.json +nice -n -20 taskset -c 1 path/to/clang/version/of/bench -t:p -n:10 -i:b mydata.json +``` + +Alternatively, you can copy the version of bench that you want into the bench +directory by requesting the target `bench//bench-local` and then run it +manually: + +```sh +b2 variant=release toolset=gcc bench//bench-local +nice -n -20 taskset -c 1 bench/bench-local -t:p -n:10 -i:b mydata.json +``` + The benchmarked files were sourced from the [simdjson](https://github.com/simdjson/simdjson) repository. diff --git a/bench/apache_builds.hpp b/bench/apache_builds.hpp new file mode 100644 index 000000000..0de5bb798 --- /dev/null +++ b/bench/apache_builds.hpp @@ -0,0 +1,93 @@ +// +// Copyright (c) 2024 Dmitry Arkhipov (grisumbras@yandex.ru) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/json +// + +#ifndef BOOST_JSON_BENCH_APACHE_BUILDS_HPP +#define BOOST_JSON_BENCH_APACHE_BUILDS_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace json { +namespace apache_builds { + +struct label +{ + boost::optional name; +}; +BOOST_DESCRIBE_STRUCT( label, (), (name) ) + +struct job +{ + std::string name; + std::string url; + std::string color; +}; +BOOST_DESCRIBE_STRUCT( job, (), (name, url, color) ) + +struct view +{ + std::string name; + std::string url; +}; +BOOST_DESCRIBE_STRUCT( view, (), (name, url) ) + +struct builds +{ + std::vector