Skip to content

Commit 5ab287b

Browse files
authored
Merge pull request #22 from 7bitcoder/dev
Add version 3.2.0
2 parents 9a4583a + 930cdbc commit 5ab287b

File tree

115 files changed

+1437
-1524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+1437
-1524
lines changed

.github/workflows/CodeCoverage.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Code Coverage
2+
3+
on:
4+
push:
5+
branches: [ "dev", "main" ]
6+
paths-ignore:
7+
- "Docs/**"
8+
- ".readthedocs.yaml"
9+
- "README.md"
10+
11+
jobs:
12+
code-coverage:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Create Build Environment
19+
run: cmake -E make_directory ${{runner.workspace}}/build
20+
21+
- name: Configure
22+
run: cmake -B ${{runner.workspace}}/build -D_7BIT_DI_LIBRARY_TYPE=Static -D_7BIT_DI_BUILD_ALL_TESTS=ON -DCMAKE_CXX_FLAGS="-coverage"
23+
24+
- name: Build
25+
run: cmake --build ${{runner.workspace}}/build -j
26+
27+
- name: Test
28+
working-directory: ${{runner.workspace}}/build
29+
run: ctest --output-on-failure
30+
31+
- name: Upload Code Coverage
32+
working-directory: ${{runner.workspace}}/build
33+
run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}

.github/workflows/DevCI.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,4 @@ jobs:
3636

3737
- name: Test
3838
working-directory: ${{runner.workspace}}/build
39-
run: ctest -C ${{matrix.build_type}}
40-
env:
41-
CTEST_OUTPUT_ON_FAILURE: True
39+
run: ctest -C ${{matrix.build_type}} --output-on-failure

.github/workflows/Linux.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,4 @@ jobs:
8282

8383
- name: Test
8484
working-directory: ${{runner.workspace}}/build
85-
run: ctest -C ${{matrix.build_type}}
86-
env:
87-
CTEST_OUTPUT_ON_FAILURE: True
85+
run: ctest -C ${{matrix.build_type}} --output-on-failure

.github/workflows/MacOs.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,4 @@ jobs:
5454

5555
- name: Test
5656
working-directory: ${{runner.workspace}}/build
57-
run: ctest -C ${{matrix.build_type}}
58-
env:
59-
CTEST_OUTPUT_ON_FAILURE: True
57+
run: ctest -C ${{matrix.build_type}} --output-on-failure

.github/workflows/Windows.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,4 @@ jobs:
8080

8181
- name: Test
8282
working-directory: ${{runner.workspace}}/build
83-
run: ctest -C ${{matrix.build_type}}
84-
env:
85-
CTEST_OUTPUT_ON_FAILURE: True
83+
run: ctest -C ${{matrix.build_type}} --output-on-failure

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15.0)
33
set(_7BIT_DI_LIBRARY 7bitDI)
44

55
set(_7BIT_DI_VERSION_MAJOR 3)
6-
set(_7BIT_DI_VERSION_MINOR 1)
6+
set(_7BIT_DI_VERSION_MINOR 2)
77
set(_7BIT_DI_VERSION_PATCH 0)
88

99
set(_7BIT_DI_VERSION ${_7BIT_DI_VERSION_MAJOR}.${_7BIT_DI_VERSION_MINOR}.${_7BIT_DI_VERSION_PATCH})

Cmake/Setup.cmake

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,6 @@ set(_7BIT_DI_DI_DIR "${_7BIT_DI_INCLUDE_DIR}/SevenBit/DI")
3131
set(_7BIT_DI_DETAILS_DIR "${_7BIT_DI_DI_DIR}/Details")
3232

3333
set(_7BIT_DI_MAIN_HEADER "${_7BIT_DI_INCLUDE_DIR}/SevenBit/DI.hpp")
34-
file(GLOB _7BIT_DI_TOP_HEADERS "${_7BIT_DI_DI_DIR}/*.hpp")
35-
file(GLOB _7BIT_DI_DETAILS_HEADERS
36-
"${_7BIT_DI_DETAILS_DIR}/Containers/*.hpp"
37-
"${_7BIT_DI_DETAILS_DIR}/Core/*.hpp"
38-
"${_7BIT_DI_DETAILS_DIR}/Factories/*.hpp"
39-
"${_7BIT_DI_DETAILS_DIR}/Helpers/*.hpp"
40-
"${_7BIT_DI_DETAILS_DIR}/Services/*.hpp"
41-
"${_7BIT_DI_DETAILS_DIR}/Utils/*.hpp"
42-
)
43-
file(GLOB _7BIT_DI_IMPL_HEADERS
44-
"${_7BIT_DI_DI_DIR}/Impl/*.hpp"
45-
"${_7BIT_DI_DETAILS_DIR}/Containers/Impl/*.hpp"
46-
"${_7BIT_DI_DETAILS_DIR}/Core/Impl/*.hpp"
47-
"${_7BIT_DI_DETAILS_DIR}/Factories/Impl/*.hpp"
48-
"${_7BIT_DI_DETAILS_DIR}/Helpers/Impl/*.hpp"
49-
"${_7BIT_DI_DETAILS_DIR}/Utils/Impl/*.hpp"
50-
)
51-
set(_7BIT_DI_ALL_HEADERS ${_7BIT_DI_MAIN_HEADER} ${_7BIT_DI_TOP_HEADERS} ${_7BIT_DI_DETAILS_HEADERS} ${_7BIT_DI_IMPL_HEADERS})
5234

5335
set(_7BIT_DI_LIBRARY_TYPE "Static" CACHE STRING "Library build type: Shared;Static;HeaderOnly")
5436
set(_7BIT_DI_LIBRARY_TYPE_VALUES "Shared;Static;HeaderOnly" CACHE STRING "List of possible _7BIT_DI_LIBRARY_TYPE values")

Docs/advanced-guides/using-aliases.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ Using Aliases
22
========================================
33

44
With the use of aliases, one service can be injected through its multiple base classes, also aliases can be chained.
5-
If multiple aliases are registered with the same base class only last will be used.
5+
In case of injecting multiple aliases all real services will be fetched.
66

7+
.. warning::
8+
Using aliases is resource intensive, especially for injecting transient and multiple services, provider recursively
9+
traverses through aliases chain to find proper service. Mixing scoped and singleton aliases for same base type will
10+
lead to undefined behavior
711

812
.. literalinclude:: ../../Examples/Guides/ServiceAliases.cpp
913
:caption: Examples/Guides/ServiceAliases

Docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def createIfNotExists(path):
1212
project = "7bitDI"
1313
copyright = "2023, 7BitCoder Sylwester Dawida"
1414
author = "Sylwester Dawida"
15-
version = "3.1.0"
15+
version = "3.2.0"
1616

1717
extensions = [
1818
"sphinx.ext.autodoc",

Docs/getting-started.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Installation
3636
FetchContent_Declare(
3737
7bitDI
3838
GIT_REPOSITORY https://github.com/7bitcoder/7bitDI.git
39-
GIT_TAG v3.1.0
39+
GIT_TAG v3.2.0
4040
)
4141
FetchContent_MakeAvailable(7bitDI)
4242
@@ -48,7 +48,7 @@ Installation
4848
.. code-block:: Txt
4949
5050
[requires]
51-
7bitdi/3.1.0
51+
7bitdi/3.2.0
5252
5353
change the version to newer if available, then run the command:
5454

Docs/reference/di/details/core.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sb::di::details - Core
66
:titlesonly:
77

88
core/iserviceinstanceproviderroot.rst
9-
core/serviceinstancecreator.rst
9+
core/servicealiasescreator.rst
1010
core/serviceinstanceprovider.rst
1111
core/serviceinstanceproviderroot.rst
12-
core/serviceinstancesresolver.rst
12+
core/serviceinstancescreator.rst
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ServiceAliasesCreator
2+
========================================
3+
4+
.. doxygenclass:: sb::di::details::ServiceAliasesCreator
5+
:members:
6+
:undoc-members:

Docs/reference/di/details/core/serviceinstancecreator.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ServiceInstancesCreator
2+
========================================
3+
4+
.. doxygenclass:: sb::di::details::ServiceInstancesCreator
5+
:members:
6+
:undoc-members:

Docs/reference/di/details/core/serviceinstancesresolver.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

Include/SevenBit/DI/CmakeDef.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
#endif
1414

1515
#define _7BIT_DI_VERSION_MAJOR 3
16-
#define _7BIT_DI_VERSION_MINOR 1
16+
#define _7BIT_DI_VERSION_MINOR 2
1717
/* #undef _7BIT_DI_VERSION_PATCH */

Include/SevenBit/DI/Details/Containers/Impl/ServiceDescriptorList.hpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77

88
namespace sb::di::details
99
{
10-
11-
INLINE ServiceDescriptorList::ServiceDescriptorList(ServiceDescriptor &&descriptor)
12-
: _oneOrList(std::move(descriptor))
13-
{
14-
}
15-
1610
INLINE void ServiceDescriptorList::add(ServiceDescriptor &&descriptor)
1711
{
1812
if (!empty())
@@ -22,20 +16,9 @@ namespace sb::di::details
2216
checkAlias(descriptor);
2317
checkLifeTime(descriptor);
2418
}
25-
_oneOrList.add(std::move(descriptor));
19+
OneOrList::add(std::move(descriptor));
2620
}
2721

28-
INLINE OneOrList<ServiceDescriptor> &ServiceDescriptorList::getInnerList() { return _oneOrList; }
29-
INLINE const OneOrList<ServiceDescriptor> &ServiceDescriptorList::getInnerList() const { return _oneOrList; }
30-
31-
INLINE const ServiceDescriptor &ServiceDescriptorList::first() const { return _oneOrList.first(); }
32-
33-
INLINE const ServiceDescriptor &ServiceDescriptorList::last() const { return _oneOrList.last(); }
34-
35-
INLINE bool ServiceDescriptorList::empty() const { return _oneOrList.empty(); }
36-
37-
INLINE std::size_t ServiceDescriptorList::size() const { return _oneOrList.size(); }
38-
3922
INLINE ServiceLifeTime ServiceDescriptorList::getLifeTime() const { return first().getLifeTime(); }
4023

4124
INLINE TypeId ServiceDescriptorList::getServiceTypeId() const { return first().getServiceTypeId(); }
@@ -76,7 +59,4 @@ namespace sb::di::details
7659
throw ServiceLifeTimeMismatchException{descriptor.getImplementationTypeId(), getServiceTypeId()};
7760
}
7861
}
79-
80-
INLINE void ServiceDescriptorList::seal() { _oneOrList.shrink(); }
81-
8262
} // namespace sb::di::details

Include/SevenBit/DI/Details/Containers/Impl/ServiceInstanceList.hpp

Lines changed: 0 additions & 59 deletions
This file was deleted.

Include/SevenBit/DI/Details/Containers/ServiceDescriptorList.hpp

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,19 @@
99

1010
namespace sb::di::details
1111
{
12-
class EXPORT ServiceDescriptorList
12+
class EXPORT ServiceDescriptorList : public OneOrList<ServiceDescriptor>
1313
{
14-
OneOrList<ServiceDescriptor> _oneOrList;
15-
1614
public:
17-
explicit ServiceDescriptorList(ServiceDescriptor &&descriptor);
15+
using OneOrList::OneOrList;
1816

1917
ServiceDescriptorList(const ServiceDescriptorList &) = delete;
2018
ServiceDescriptorList(ServiceDescriptorList &&) = default;
2119

2220
ServiceDescriptorList &operator=(const ServiceDescriptorList &) = delete;
2321
ServiceDescriptorList &operator=(ServiceDescriptorList &&) = default;
2422

25-
OneOrList<ServiceDescriptor> &getInnerList();
26-
[[nodiscard]] const OneOrList<ServiceDescriptor> &getInnerList() const;
27-
2823
void add(ServiceDescriptor &&descriptor);
2924

30-
[[nodiscard]] auto begin() const { return _oneOrList.getAsList().begin(); }
31-
[[nodiscard]] auto end() const { return _oneOrList.getAsList().end(); }
32-
33-
[[nodiscard]] const ServiceDescriptor &first() const;
34-
35-
[[nodiscard]] const ServiceDescriptor &last() const;
36-
37-
[[nodiscard]] bool empty() const;
38-
39-
[[nodiscard]] std::size_t size() const;
40-
4125
[[nodiscard]] ServiceLifeTime getLifeTime() const;
4226

4327
[[nodiscard]] TypeId getServiceTypeId() const;
@@ -46,8 +30,6 @@ namespace sb::di::details
4630

4731
[[nodiscard]] bool isAlias() const;
4832

49-
void seal();
50-
5133
private:
5234
void checkBaseType(const ServiceDescriptor &descriptor) const;
5335
void checkKey(const ServiceDescriptor &descriptor) const;

Include/SevenBit/DI/Details/Containers/ServiceDescriptorsMap.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ namespace sb::di::details
3636
}
3737

3838
ServiceDescriptorsMap(const ServiceDescriptorsMap &) = delete;
39-
ServiceDescriptorsMap(ServiceDescriptorsMap &&) noexcept = default;
39+
ServiceDescriptorsMap(ServiceDescriptorsMap &&) = default;
4040

4141
ServiceDescriptorsMap &operator=(const ServiceDescriptorsMap &) = delete;
42+
ServiceDescriptorsMap &operator=(ServiceDescriptorsMap &&) = delete;
4243

4344
void add(ServiceDescriptor descriptor);
4445

0 commit comments

Comments
 (0)