-
Notifications
You must be signed in to change notification settings - Fork 21
refactor(metadata): integrate Boost.Describe #1130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
gennaroprota
wants to merge
5
commits into
cppalliance:develop
Choose a base branch
from
gennaroprota:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+696
−295
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
394c55a
refactor(metadata): integrate Boost.Describe to remove manual mapping…
gennaroprota 33ed1ad
fix: really exclude symbols defined by Boost.Describe
gennaroprota 86f39bd
fix: fix
gennaroprota 4699061
fix: Releases CI steps
gennaroprota 14342ee
fix: also clone Boost.Describe and Boost.Mp11 in the CI release steps
gennaroprota File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -432,6 +432,38 @@ jobs: | |
| run: | | ||
| rm -r ../third-party/llvm-project | ||
|
|
||
| - name: Install Boost.Describe | ||
| uses: alandefreitas/cpp-actions/[email protected] | ||
| with: | ||
| source-dir: build/third-party/source/boost_describe | ||
| git-repository: https://github.com/boostorg/describe | ||
| git-tag: boost-1.89.0 | ||
| build-dir: ${sourceDir}/build | ||
| cc: ${{ steps.setup-cpp.outputs.cc }} | ||
| cxx: ${{ steps.setup-cpp.outputs.cxx }} | ||
| build-type: Release | ||
| shared: false | ||
| install: true | ||
| install-prefix: ${sourceDir}/install | ||
| run-tests: false | ||
| trace-commands: true | ||
|
|
||
| - name: Install Boost.Mp11 | ||
| uses: alandefreitas/cpp-actions/[email protected] | ||
| with: | ||
| source-dir: build/third-party/source/boost_mp11 | ||
| git-repository: https://github.com/boostorg/mp11 | ||
| git-tag: boost-1.89.0 | ||
| build-dir: ${sourceDir}/build | ||
| cc: ${{ steps.setup-cpp.outputs.cc }} | ||
| cxx: ${{ steps.setup-cpp.outputs.cxx }} | ||
| build-type: Release | ||
| shared: false | ||
| install: true | ||
| install-prefix: ${sourceDir}/install | ||
| run-tests: false | ||
| trace-commands: true | ||
|
|
||
| - name: Install Duktape | ||
| uses: alandefreitas/cpp-actions/[email protected] | ||
| with: | ||
|
|
@@ -804,6 +836,24 @@ jobs: | |
| modules-exclude-paths: '' | ||
| trace-commands: true | ||
|
|
||
| - name: Clone Boost.Describe | ||
| uses: alandefreitas/cpp-actions/[email protected] | ||
| id: boost-describe-clone | ||
| with: | ||
| branch: develop | ||
| modules: describe | ||
| boost-dir: boost | ||
| trace-commands: true | ||
|
|
||
| - name: Clone Boost.Mp11 | ||
| uses: alandefreitas/cpp-actions/[email protected] | ||
| id: boost-mp11-clone | ||
| with: | ||
| branch: develop | ||
| modules: mp11 | ||
| boost-dir: boost | ||
| trace-commands: true | ||
|
|
||
| - name: Set up llvm-symbolizer | ||
| if: ${{ runner.os != 'Windows' }} | ||
| run: | | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| // Copyright (c) 2024 Alan de Freitas ([email protected]) | ||
| // Copyright (c) 2025 Gennaro Prota ([email protected]) | ||
| // | ||
| // Official repository: https://github.com/cppalliance/mrdocs | ||
| // | ||
|
|
@@ -211,6 +212,26 @@ TransformArray(T const& arr, F const& f) | |
| } | ||
|
|
||
| } // dom | ||
|
|
||
| class DomCorpus; | ||
|
|
||
| /** Map a vector of strings to a @ref dom::Value object. | ||
| @param v The output parameter to receive the dom::Value. | ||
| @param elems The vector of T's to convert. | ||
| @param domCorpus The DomCorpus used to resolve references. | ||
| */ | ||
| template <typename T> | ||
| void | ||
| tag_invoke( | ||
| dom::ValueFromTag, | ||
| dom::Value& v, | ||
| std::vector<T> const& elems, | ||
| DomCorpus const* domCorpus) | ||
| { | ||
| v = dom::LazyArray(elems, domCorpus); | ||
| } | ||
|
|
||
| } // mrdocs | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,16 +5,19 @@ | |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| // Copyright (c) 2025 Alan de Freitas ([email protected]) | ||
| // Copyright (c) 2025 Gennaro Prota ([email protected]) | ||
| // | ||
| // Official repository: https://github.com/cppalliance/mrdocs | ||
| // | ||
|
|
||
| #ifndef MRDOCS_API_METADATA_DOCCOMMENT_INLINE_IMAGEINLINE_HPP | ||
| #define MRDOCS_API_METADATA_DOCCOMMENT_INLINE_IMAGEINLINE_HPP | ||
|
|
||
| #include <boost/describe/class.hpp> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. includes should be ordered from most specific to most general. describe is general. std includes are most general |
||
| #include <mrdocs/Platform.hpp> | ||
| #include <mrdocs/ADT/Polymorphic.hpp> | ||
| #include <mrdocs/Metadata/DocComment/Inline/TextInline.hpp> | ||
| #include <mrdocs/Metadata/Symbol/SymbolDescribeMapper.hpp> | ||
| #include <string> | ||
|
|
||
| namespace mrdocs::doc { | ||
|
|
@@ -52,6 +55,12 @@ struct ImageInline final | |
| bool operator==(ImageInline const&) const noexcept = default; | ||
| }; | ||
|
|
||
| BOOST_DESCRIBE_STRUCT( | ||
| ImageInline, | ||
| (InlineCommonBase<InlineKind::Image>, InlineContainer), | ||
| (src, alt) | ||
| ) | ||
|
|
||
| /** Map the @ref ImageInline to a @ref dom::Object. | ||
|
|
||
| @param t The tag. | ||
|
|
@@ -69,8 +78,7 @@ tag_invoke( | |
| { | ||
| tag_invoke(t, io, dynamic_cast<Inline const&>(I), domCorpus); | ||
| tag_invoke(t, io, dynamic_cast<InlineContainer const&>(I), domCorpus); | ||
| io.map("src", I.src); | ||
| io.map("alt", I.alt); | ||
| mapWithDescribe(io, I, domCorpus); | ||
| } | ||
|
|
||
| /** Return the @ref ImageInline as a @ref dom::Value object. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| // Copyright (c) 2023 Krystian Stasiowski ([email protected]) | ||
| // Copyright (c) 2025 Gennaro Prota ([email protected]) | ||
| // | ||
| // Official repository: https://github.com/cppalliance/mrdocs | ||
| // | ||
|
|
@@ -13,12 +14,17 @@ | |
|
|
||
| #include <mrdocs/Platform.hpp> | ||
| #include <mrdocs/ADT/Optional.hpp> | ||
| #include <mrdocs/Dom/Array.hpp> | ||
| #include <mrdocs/Dom/LazyObject.hpp> | ||
| #include <mrdocs/Dom/Value.hpp> | ||
| #include <concepts> | ||
| #include <optional> | ||
| #include <string> | ||
|
|
||
| namespace mrdocs { | ||
|
|
||
| class DomCorpus; | ||
|
|
||
| /** Represents an expression | ||
| */ | ||
| struct ExprInfo | ||
|
|
@@ -90,6 +96,39 @@ static void merge( | |
| } | ||
| } | ||
|
|
||
| /** Map an ExprInfo to a @ref dom::Value object. | ||
|
|
||
| @param v The output parameter to receive the dom::Value. | ||
| @param expr The expression info to convert. | ||
| */ | ||
| inline | ||
| void | ||
| tag_invoke( | ||
| dom::ValueFromTag, | ||
| dom::Value& v, | ||
| ExprInfo const& expr, | ||
| DomCorpus const*) | ||
| { | ||
| v = expr.Written; | ||
| } | ||
|
|
||
| /** Map an ExprInfo to a @ref dom::Value object. | ||
|
|
||
| @param v The output parameter to receive the dom::Value. | ||
| @param expr The expression info to convert. | ||
| */ | ||
| inline | ||
| void | ||
| tag_invoke( | ||
| dom::LazyObjectMapTag, | ||
| dom::Value& v, | ||
| ExprInfo const& expr, | ||
| DomCorpus const* | ||
| ) | ||
| { | ||
| v = expr.Written; | ||
gennaroprota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| } // mrdocs | ||
|
|
||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,19 +4,22 @@ | |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| // Copyright (c) 2024 Krystian Stasiowski ([email protected]) | ||
| // Copyright (c) 2025 Gennaro Prota ([email protected]) | ||
| // | ||
| // Official repository: https://github.com/cppalliance/mrdocs | ||
| // | ||
|
|
||
| #ifndef MRDOCS_API_METADATA_SYMBOL_CONCEPT_HPP | ||
| #define MRDOCS_API_METADATA_SYMBOL_CONCEPT_HPP | ||
|
|
||
| #include <boost/describe/class.hpp> | ||
| #include <mrdocs/Platform.hpp> | ||
| #include <mrdocs/ADT/Optional.hpp> | ||
| #include <mrdocs/ADT/Polymorphic.hpp> | ||
| #include <mrdocs/Metadata/Expression.hpp> | ||
| #include <mrdocs/Metadata/Symbol.hpp> | ||
| #include <mrdocs/Metadata/Symbol/Source.hpp> | ||
| #include <mrdocs/Metadata/Symbol/SymbolDescribeMapper.hpp> | ||
| #include <mrdocs/Metadata/Template.hpp> | ||
|
|
||
| namespace mrdocs { | ||
|
|
@@ -49,6 +52,12 @@ struct ConceptSymbol final | |
| operator<=>(ConceptSymbol const& other) const; | ||
| }; | ||
|
|
||
| BOOST_DESCRIBE_STRUCT( | ||
| ConceptSymbol, | ||
| (SymbolCommonBase<SymbolKind::Concept>), | ||
| (Template, Constraint) | ||
| ) | ||
|
|
||
| /** Merge another ConceptSymbol into this one. | ||
| */ | ||
| MRDOCS_DECL | ||
|
|
@@ -71,11 +80,8 @@ tag_invoke( | |
| DomCorpus const* domCorpus) | ||
| { | ||
| tag_invoke(t, io, I.asInfo(), domCorpus); | ||
| io.map("template", I.Template); | ||
| if (!I.Constraint.Written.empty()) | ||
| { | ||
| io.map("constraint", I.Constraint.Written); | ||
| } | ||
| mapWithDescribe(io, I, domCorpus); | ||
|
|
||
| } | ||
|
|
||
| /** Map the ConceptSymbol to a @ref dom::Value object. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,18 +5,21 @@ | |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| // Copyright (c) 2023 Vinnie Falco ([email protected]) | ||
| // Copyright (c) 2025 Gennaro Prota ([email protected]) | ||
| // | ||
| // Official repository: https://github.com/cppalliance/mrdocs | ||
| // | ||
|
|
||
| #ifndef MRDOCS_API_METADATA_SYMBOL_ENUM_HPP | ||
| #define MRDOCS_API_METADATA_SYMBOL_ENUM_HPP | ||
|
|
||
| #include <boost/describe/class.hpp> | ||
| #include <mrdocs/Platform.hpp> | ||
| #include <mrdocs/ADT/Polymorphic.hpp> | ||
| #include <mrdocs/Dom/LazyArray.hpp> | ||
| #include <mrdocs/Metadata/Symbol.hpp> | ||
| #include <mrdocs/Metadata/Symbol/Source.hpp> | ||
| #include <mrdocs/Metadata/Symbol/SymbolDescribeMapper.hpp> | ||
| #include <mrdocs/Metadata/Type.hpp> | ||
|
|
||
| namespace mrdocs { | ||
|
|
@@ -65,6 +68,12 @@ struct EnumSymbol final | |
| } | ||
| }; | ||
|
|
||
| BOOST_DESCRIBE_STRUCT( | ||
| EnumSymbol, | ||
| (SymbolCommonBase<SymbolKind::Enum>), | ||
| (Scoped, UnderlyingType, Constants) | ||
| ) | ||
|
|
||
| /** Return the list of enum constants for this symbol. | ||
| */ | ||
| inline | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,15 +4,18 @@ | |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| // Copyright (c) 2023 Krystian Stasiowski ([email protected]) | ||
| // Copyright (c) 2025 Gennaro Prota ([email protected]) | ||
| // | ||
| // Official repository: https://github.com/cppalliance/mrdocs | ||
| // | ||
|
|
||
| #ifndef MRDOCS_API_METADATA_SYMBOL_ENUMCONSTANT_HPP | ||
| #define MRDOCS_API_METADATA_SYMBOL_ENUMCONSTANT_HPP | ||
|
|
||
| #include <boost/describe/class.hpp> | ||
| #include <mrdocs/Metadata/Expression.hpp> | ||
| #include <mrdocs/Metadata/Symbol.hpp> | ||
| #include <mrdocs/Metadata/Symbol/SymbolDescribeMapper.hpp> | ||
| #include <mrdocs/Metadata/Symbol/Source.hpp> | ||
|
|
||
| namespace mrdocs { | ||
|
|
@@ -36,6 +39,12 @@ struct EnumConstantSymbol final | |
| } | ||
| }; | ||
|
|
||
| BOOST_DESCRIBE_STRUCT( | ||
| EnumConstantSymbol, | ||
| (SymbolCommonBase<SymbolKind::EnumConstant>), | ||
| (Initializer) | ||
| ) | ||
|
|
||
| /** Merge another EnumConstantSymbol into this one. | ||
| @param I Destination symbol to update. | ||
| @param Other Source symbol providing data. | ||
|
|
@@ -60,10 +69,7 @@ tag_invoke( | |
| DomCorpus const* domCorpus) | ||
| { | ||
| tag_invoke(t, io, I.asInfo(), domCorpus); | ||
| if (!I.Initializer.Written.empty()) | ||
| { | ||
| io.map("initializer", I.Initializer.Written); | ||
| } | ||
| mapWithDescribe(io, I, domCorpus); | ||
| } | ||
|
|
||
| /** Map the EnumConstantSymbol to a @ref dom::Value object. | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting the url is cheaper in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?