Skip to content
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

File Hierarchy Cannot Handle Nested Directories #61

Closed
davidvanwyk opened this issue Mar 6, 2019 · 7 comments
Closed

File Hierarchy Cannot Handle Nested Directories #61

davidvanwyk opened this issue Mar 6, 2019 · 7 comments

Comments

@davidvanwyk
Copy link

It seems that the file hierarchy option cannot handle nested directories.

For example, if I have:

Project/
   include/
      foo.h
      nestedInclude/
         bar.h

I get the error:

"Could not find directory parent of file [bar.h] with location [Project\include\nestedInclude\bar.h]."

bar.h still shows up in the file hierarchy, just without a parent directory.

Would it be possible to include functionality such that the include directory in the file hierarchy is able to have sub-directories as part of the list and not just files?

@svenevs
Copy link
Owner

svenevs commented Mar 6, 2019

Hmm. Nested directories are (supposed to be) supported. So what this means is that Doxygen did not create a directory node for this. Or at least os.path.dirname(file) did not result in the same name as any of the directories reported by Doxygen.

Is this code public? It could be a Doxygen config problem, a file documentation comment problem, or a bug in exhale. Doxygen does weird things on Windows where sometimes they report Windows paths and sometimes they report Unix paths. I thought I fixed all of those though.

If the project is not public, can you include the xml for both the file and the directory? I need to see what path names it's using

@davidvanwyk
Copy link
Author

davidvanwyk commented Mar 6, 2019

@svenevs

Unfortunately not a public project.

The relevant file structure is as follows:

    Project/
       docs/
          conf.py
          api/
          doxygen/
             build
             .doxyfile
       test/
          utests/
       include/

If I put the documented .h files from doxygen into utests/; I get the warning and subsequent problem.
If I then go an delete the test/ directory from the doxygen xml folder (both in index and the generated dir xml file), it displays in the html with a folder name of utests

I tried putting in a nested include and had the same issue/"fix"

Here's the xml.zip folder from the doxygen generation.

@svenevs
Copy link
Owner

svenevs commented Mar 6, 2019

dir_9350652c807819cafbc8c3aca0b83c13.xml

  <compounddef id="dir_9350652c807819cafbc8c3aca0b83c13" kind="dir">
    <compoundname>C:/...workspace/M..._Test/include/includeAswell</compoundname>
    <innerfile refid="_m_a_x..._8h">MAX....h</innerfile>
    <!-- ... -->
    <location file="C:/...workspace/M..._Test/include/includeAswell/"/>
  • directory location is include/includeAswell
  • <innerfile> listed is MAX....h (refid in that file tells you what xml to look in for file, refid.xml)

_m_a_x..._8h.xml

    <location file="C:/...workspace/M..._Test/include/MAX....h"/>
  </compounddef>
</doxygen>
  • file definition says it's in include/, not include/includeAswell

That seems to be the conflict. So exhale gets confused about which directory to put it in. Did you put a comment like /** \file MAX....h */ at the top of the file? If so, try changing it to just /** \file */ without the filename in there?

"Could not find directory parent of file [bar.h] with location [Project\include\nestedInclude\bar.h]."

This seems to be the opposite of the reported message though, where this one the file said it was there in include/includeAswell? Which file was bar.h?

If you share the doxygen configuration you are using / the relevant section of conf.py that sets up exhale I'm happy to take a look and see if anything stands out, but I'm hoping it's a /** \file */ mishap 🙂

@davidvanwyk
Copy link
Author

Oops - I introduced that error by not doing a clean build :P Sorry! I removed the "includeAswell" directory and shifted the associated .h to the parent so the problem would just exist with the utests directory so it could be isolated.

Rather look at this.

dir_13e138d54eb8818da29c3992edef070a.xml

Is the one throwing the warning. It has an "Innerdir" of:

dir_347f78c5bf8b9dbad860aafd5b962aba.xml

Which has the 2 "innerfile"s that I get the warnings from. In this particular instance it states (for the .h file):

"Could not find directory parent of file [test_MAX31855K.h] with location [MAX31855K_Test\test\utests\test_MAX31855K.h"]

The \file issue did actually exist - funnily enough. But I adjusted to just have \file without the filename appended and nothing changed.

@svenevs
Copy link
Owner

svenevs commented Mar 7, 2019

Hmmmmm ok this seems good, doxygen is now producing valid stuff. I think the path stripping is the problem.

How are you calling doxygen, specifically what do you set STRIP_FROM_PATH as and what do you put for doxygenStripFromPath in exhale_args?

The path stripping logic is probably the cause here, I'm digging around right now....

@svenevs
Copy link
Owner

svenevs commented Mar 7, 2019

Are you able to edit exhale (just find exhale/graph.py) and add this:

--- a/exhale/graph.py
+++ b/exhale/graph.py
@@ -1882,6 +1882,19 @@ class ExhaleRoot(object):
 
         all_directories.sort()
 
+        err = StringIO()
+        err.write("\nDirectories\n")
+        err.write(("-" * 44) + "\n")
+        for d in all_directories:
+            err.write("- {0}\n".format(d.name))
+
+        err.write("\n\nFiles\n")
+        err.write(("-" * 44) + "\n")
+        for f in self.files:
+            err.write("- {0}\n".format(f.location))
+
+        raise RuntimeError(err.getvalue())
+
         for f in self.files:
             if not f.location:
                 sys.stderr.write(utils.critical(

Just shoving an error message in to see what's going on, I think the cause of what we're seeing here is something related to how the doxygenStripFromPath gets taken out. When you make html it'll fail with the error message, paste that back here. This one is kind of hard for me to test blindly :/

@davidvanwyk
Copy link
Author

Based on your comments and where they were leading - I managed to resolve the issue by changing the STRIP_FROM_PATH setting in doxygen to match what was being done by exhale (ie. everything up to and including project directory name). This has resolved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants