diff --git a/error/.clang-format b/.clang-format similarity index 100% rename from error/.clang-format rename to .clang-format diff --git a/error/.cmake-format b/.cmake-format similarity index 100% rename from error/.cmake-format rename to .cmake-format diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b31c04..c2dccec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,35 +8,31 @@ on: jobs: debug: runs-on: ubuntu-latest - strategy: - matrix: - package: [error] steps: - name: Checkout repository uses: actions/checkout@v4.1.1 - name: Configure CMake run: | - cmake ${{ matrix.package }} \ - -B ${{ matrix.package }}/build \ + cmake . \ + -B build \ -D BUILD_TESTING=ON \ -D CHECK_FORMAT=ON \ -D CHECK_WARNING=ON \ -D CHECK_COVERAGE=ON - name: Build project - run: cmake --build ${{ matrix.package }}/build + run: cmake --build build - name: Run unit tests - run: ctest --test-dir ${{ matrix.package }}/build --output-on-failure --no-tests=error + run: ctest --test-dir build --output-on-failure --no-tests=error - name: Check code coverage uses: threeal/gcovr-action@main with: - root: ${{ matrix.package }} excludes: | - ${{ matrix.package }}/build/* - ${{ matrix.package }}/test/* + build/* + test/* fail-under-line: 100 - name: Check diff @@ -44,32 +40,26 @@ jobs: debug-msvc: runs-on: windows-latest - strategy: - matrix: - package: [error] steps: - name: Checkout repository uses: actions/checkout@v4.1.1 - name: Configure CMake run: | - cmake ${{ matrix.package }} ` - -B ${{ matrix.package }}/build ` + cmake . ` + -B build ` -D CMAKE_CXX_COMPILER=cl ` -D BUILD_TESTING=ON ` -D CHECK_WARNING=ON - name: Build project - run: cmake --build ${{ matrix.package }}/build + run: cmake --build build - name: Run unit tests - run: ctest --test-dir ${{ matrix.package }}/build --output-on-failure --no-tests=error + run: ctest --test-dir build --output-on-failure --no-tests=error release: runs-on: ubuntu-latest - strategy: - matrix: - package: [error] steps: - name: Checkout repository uses: actions/checkout@v4.1.1 @@ -77,14 +67,10 @@ jobs: - name: Configure and build project uses: threeal/cmake-action@v1.3.0 with: - source-dir: ${{ matrix.package }} run-build: true release-msvc: runs-on: windows-latest - strategy: - matrix: - package: [error] steps: - name: Checkout repository uses: actions/checkout@v4.1.1 @@ -92,7 +78,6 @@ jobs: - name: Configure and build project uses: threeal/cmake-action@v1.3.0 with: - source-dir: ${{ matrix.package }} cxx-compiler: cl run-build: true diff --git a/error/CMakeLists.txt b/CMakeLists.txt similarity index 79% rename from error/CMakeLists.txt rename to CMakeLists.txt index a2ab2a8..24a5f86 100644 --- a/error/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,16 +1,16 @@ cmake_minimum_required(VERSION 3.0) -project(error) +project(errors) # Import dependencies include(cmake/CPM.cmake) cpmaddpackage("gh:fmtlib/fmt#10.0.0") # Build the main library -add_library(error src/error.cpp) -target_include_directories(error PUBLIC include) -target_link_libraries(error PUBLIC fmt) -target_compile_features(error PRIVATE cxx_std_20) +add_library(errors src/error.cpp) +target_include_directories(errors PUBLIC include) +target_link_libraries(errors PUBLIC fmt) +target_compile_features(errors PRIVATE cxx_std_20) # Check if this project is the main project if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) @@ -22,7 +22,7 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) # Import Format.cmake to format source code if(CHECK_FORMAT) cpmaddpackage("gh:threeal/Format.cmake#auto-install-cmake-format") - add_dependencies(error fix-format) + add_dependencies(errors fix-format) endif() if(BUILD_TESTING) @@ -33,9 +33,9 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) include("${Catch2_SOURCE_DIR}/extras/Catch.cmake") # Build tests for the main library - add_executable(error_test test/error_test.cpp) - target_link_libraries(error_test PRIVATE error Catch2::Catch2WithMain) - catch_discover_tests(error_test) + add_executable(errors_test test/error_test.cpp) + target_link_libraries(errors_test PRIVATE errors Catch2::Catch2WithMain) + catch_discover_tests(errors_test) endif() # Get all targets in this directory @@ -61,6 +61,6 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) # Build XML documentation if(BUILD_DOCS) include(cmake/add_xml_docs.cmake) - add_xml_docs(docs include/error/error.hpp) + add_xml_docs(docs include/errors/error.hpp) endif() endif() diff --git a/README.md b/README.md index 238545c..c2791ce 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,9 @@ -# Overview +# Error C++ -[![build status](https://img.shields.io/github/actions/workflow/status/threeal/cpp/build.yml?branch=main)](https://github.com/threeal/cpp/actions/workflows/build.yml) -[![deploy status](https://img.shields.io/github/actions/workflow/status/threeal/cpp/deploy.yaml?branch=main&label=deploy)](https://github.com/threeal/cpp/actions/workflows/deploy.yaml) +[![build status](https://img.shields.io/github/actions/workflow/status/threeal/errors-cpp/build.yml?branch=main)](https://github.com/threeal/errors-cpp/actions/workflows/build.yml) +[![deploy status](https://img.shields.io/github/actions/workflow/status/threeal/errors-cpp/deploy.yaml?branch=main&label=deploy)](https://github.com/threeal/errors-cpp/actions/workflows/deploy.yaml) -A comprehensive collection of [C++](https://isocpp.org/) utility packages. - -## Packages - -- [Error](./error) [WIP]: Provides utilities for error handling. +A C++ package that provides utilities for error handling. ## License diff --git a/error/cmake/CPM.cmake b/cmake/CPM.cmake similarity index 100% rename from error/cmake/CPM.cmake rename to cmake/CPM.cmake diff --git a/error/cmake/add_xml_docs.cmake b/cmake/add_xml_docs.cmake similarity index 100% rename from error/cmake/add_xml_docs.cmake rename to cmake/add_xml_docs.cmake diff --git a/docs/conf.py b/docs/conf.py index 4349ca0..7e000c6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,16 +1,16 @@ import os, subprocess -project = 'cpp' +project = 'Errors C++' copyright = '2023, Alfi Maulana' author = 'Alfi Maulana' extensions = ['breathe'] -subprocess.call('cmake ../error -B ../error/build -D BUILD_DOCS=ON', shell=True) -subprocess.call('cmake --build ../error/build --target docs', shell=True) +subprocess.call('cmake .. -B ../build -D BUILD_DOCS=ON', shell=True) +subprocess.call('cmake --build ../build --target docs', shell=True) -breathe_projects = {"error": "../error/build/docs"} -breathe_default_project = "error" +breathe_projects = {"errors": "../build/docs"} +breathe_default_project = "errors" html_theme = 'furo' html_static_path = ['_static'] diff --git a/docs/error/index.rst b/docs/error/index.rst deleted file mode 100644 index 87e9c8d..0000000 --- a/docs/error/index.rst +++ /dev/null @@ -1,54 +0,0 @@ -Error Package -============= - -A C++ package that provides utilities for error handling. - -API Docs --------- - -.. doxygenfunction:: error::make - -.. doxygenfunction:: error::format - -.. doxygenstruct:: error::Error - :members: - -License -------- - -.. image:: https://opensource.org/wp-content/uploads/2022/10/osi-badge-dark.svg - :class: only-light - :width: 150 - :align: right - :target: https://opensource.org/licenses - -.. image:: https://opensource.org/wp-content/uploads/2022/10/osi-badge-light.svg - :class: only-dark - :width: 150 - :align: right - :target: https://opensource.org/licenses - -This project is licensed under the terms of the `MIT License`_. - -Copyright © 2023 `Alfi Maulana`_ - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -.. _Alfi Maulana: https://github.com/threeal -.. _MIT License: https://opensource.org/licenses/MIT diff --git a/docs/index.rst b/docs/index.rst index 25682cb..90c042a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,17 +1,19 @@ -Overview -======== +Errors C++ +============= -A comprehensive collection of `C++`_ utility packages. +A `C++`_ package that provides utilities for error handling. .. _C++: https://isocpp.org -Packages +API Docs -------- -.. toctree:: - :maxdepth: 1 +.. doxygenfunction:: error::make - error/index.rst +.. doxygenfunction:: error::format + +.. doxygenstruct:: error::Error + :members: License ------- diff --git a/error/LICENSE b/error/LICENSE deleted file mode 100644 index c5ebe52..0000000 --- a/error/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Alfi Maulana - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/error/README.md b/error/README.md deleted file mode 100644 index a672b77..0000000 --- a/error/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Error - -A C++ package that provides utilities for error handling. - -## License - -This project is licensed under the terms of the [MIT License](./LICENSE). - -Copyright © 2023 [Alfi Maulana](https://github.com/threeal) diff --git a/error/include/error/error.hpp b/include/errors/error.hpp similarity index 100% rename from error/include/error/error.hpp rename to include/errors/error.hpp diff --git a/error/src/error.cpp b/src/error.cpp similarity index 96% rename from error/src/error.cpp rename to src/error.cpp index 49d28ce..eec5477 100644 --- a/error/src/error.cpp +++ b/src/error.cpp @@ -1,4 +1,4 @@ -#include +#include namespace error { diff --git a/error/test/error_test.cpp b/test/error_test.cpp similarity index 97% rename from error/test/error_test.cpp rename to test/error_test.cpp index a82b05d..b9775e6 100644 --- a/error/test/error_test.cpp +++ b/test/error_test.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include