-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: tagfiles generation for cross-referencing in doxygen format #670
base: develop
Are you sure you want to change the base?
feat: tagfiles generation for cross-referencing in doxygen format #670
Conversation
dd39c17
to
30d3333
Compare
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.
The logic for the Writer looks great. I think the only issue is where it would be called from.
669e5ee
to
518dfe5
Compare
The problem CI has been fixed. Could you rebase this? |
However, we will still have a problem with the USR from Krystian's commit blocking CI. I want to start by comparing the XML in the artifacts. Do you have the result for Boost.URL multipage? That's the one we can't risk breaking because it's already in production. It has to be compatible with the existing one. |
5728d41
to
4ea091f
Compare
An automated preview of the documentation is available at https://670.mrdocs.prtest2.cppalliance.org/index.html |
4ea091f
to
10d6cca
Compare
An automated preview of the documentation is available at https://670.mrdocs.prtest2.cppalliance.org/index.html |
10d6cca
to
08cbc26
Compare
An automated preview of the documentation is available at https://670.mrdocs.prtest2.cppalliance.org/index.html |
08cbc26
to
120b717
Compare
An automated preview of the documentation is available at https://670.mrdocs.prtest2.cppalliance.org/index.html |
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.
It fails with
assertion failed: n <= indent_.size() on line 203 in src/lib/Gen/xml/XMLTags.cpp
120b717
to
e469482
Compare
An automated preview of the documentation is available at https://670.mrdocs.prtest2.cppalliance.org/index.html |
e469482
to
7b9455e
Compare
An automated preview of the documentation is available at https://670.mrdocs.prtest2.cppalliance.org/index.html |
The implementation of the tagfile write is excellent. CI failed after I rebased. That was a good thing because it helped me catch a bug. So, the reason CI is failing is trivial. The The real issue causing all of that is the API design. Your new
This bug was already there, but CI only made it evident. It worked before rebasing because Because of how If this is hard to achieve because we can't decouple the logic of This fixes the underlying problem and the original issue with |
7b9455e
to
f04184a
Compare
This issue is addressed. I’ll let you know once CI passes so you can review, and if it’s good to go, feel free to merge. |
An automated preview of the documentation is available at https://670.mrdocs.prtest2.cppalliance.org/index.html |
f04184a
to
9b74877
Compare
An automated preview of the documentation is available at https://670.mrdocs.prtest2.cppalliance.org/index.html |
9b74877
to
4452a6b
Compare
An automated preview of the documentation is available at https://670.mrdocs.prtest2.cppalliance.org/index.html |
@alandefreitas done |
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.
This solution is still not quite there yet.
*/ | ||
template <InfoParent T, class Pred, class F, class... Args> | ||
void | ||
traverseIf( |
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.
Do we need this function? Can't the caller use traverse
as usual, evaluate the predicate in the callable f
, and do nothing if the predicate is false? It seems like less cognitive bandwidth—one less function to remember and maintain.
buildOne( | ||
std::ostream& os, | ||
Corpus const& corpus, | ||
GenerationContext const& context) const = 0; |
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.
My impression is that this solution expands the problem rather than solves it. Now, not only we expect a std::string tagFileName;
(which breaks the contract of the class) but we expect a redundant std::ostream& tagFileOs;
that needs to be handled and maintained.
I don't know if you're familiar with SOLID, but maybe have a look at https://medium.com/@oleksandra_shershen/solid-principles-implementation-and-examples-in-c-99f0d7e3e868.
The original problem is that expecting std::string tagFileName
as a parameter breaks the contract of the parent class because the single responsibility of buildOne
should be streaming the documentation results to any output. In other words, ideally, the parent Generator
class shouldn't mention anything related to tagfiles because being able to generate tagfiles is not a property of all generators. If only some generators have this functionality, ideally, there should be an intermediary class (say GeneratorThatAlsoGeneratesTagfiles
to avoid bikeshedding for now) between Generator
and the generators that so have tagfiles functionality (AdocGenerator
and HTMLGenerator
). "GeneratorThatAlsoGeneratesTagfiles
" would inherit from Generator
and define the common API for generating tagfiles (which might have many similarities for all generators). AdocGenerator
and HTMLGenerator
would then inherit from "GeneratorThatAlsoGeneratesTagfiles
" and only implement whatever is different for Adoc and HTML, which I don't expect to be much because only the file extension of the filenames should be different.
The solution I proposed is a buildTagfile(std::ostream& os, Corpus const& corpus)
, ideally in this new intermediary base class with the common logic for tagfiles. If we really don't want an intermediary class for "convenience", then this buildTagfile(std::ostream& os, Corpus const& corpus)
function could go directly in the generator and do nothing when the Generator cannot generate tagfiles.
If the logic for tag files can't be decoupled from the logic for buildOne
, maybe we could consider more complex solutions because it's impossible to implement its single responsibility. But it's clear that tagfiles can be implemented separately because they're basically an XML generator with a different schema.
@@ -69,10 +76,35 @@ build( | |||
if(! ex) | |||
return ex.error(); | |||
|
|||
MultiPageVisitor visitor(*ex, outputPath, corpus); | |||
std::string path = files::appendPath(outputPath, "reference.tag.xml"); |
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.
We need an option here, such as:
https://www.doxygen.nl/manual/config.html#cfg_generate_tagfile
Its default value can be "reference.tag.xml"
or whatever and tagfiles won't be generated when it's empty.
} | ||
|
||
RawOstream raw_os(os); | ||
auto tagfileWriter = TagfileWriter(raw_os, corpus); |
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.
Completely independent behavior. It's not even using the domCorpus
that includes the reference file names. It shouldn't be made dependent on build
for "convenience".
Fixed #650