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

Fix XML documentation generation and add Markdown docs to VS solution #315

Closed
wants to merge 7 commits into from
Closed

Conversation

ghost
Copy link

@ghost ghost commented Oct 9, 2017

Bringing docs in on both sides and ignoring unstaged xml doc files

@@ -31,6 +31,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Castle.Services.Logging.Ser
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Castle Services", "Castle Services", "{A598EE9B-41CE-4BE8-BF93-2C91F919F97E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Castle Docs", "Castle Docs", "{EC3FDC8C-1D6C-49DA-AD19-E1521A75728E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Documentation", "docs\Documentation.csproj", "{5F7AA0D3-FE16-40BD-9492-7B8BD509FD57}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new tooling allows project files to support wildcards, do solution files not support wildcards for files?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if they sorted solution files out, but I have not come across anything that allows that behaviour in VS latest.

Nothing here either

.gitignore Outdated
src/Castle.Core/Castle.Core.xml
src/Castle.Services.Logging.NLogIntegration/Castle.Services.Logging.NLogIntegration.xml
src/Castle.Services.Logging.SerilogIntegration/Castle.Services.Logging.SerilogIntegration.xml
src/Castle.Services.Logging.log4netIntegration/Castle.Services.Logging.log4netIntegration.xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, don't these usually get written to the output bin directory next to the DLL and PDB files? That is what VS used to default to before the new CLI tooling.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was almost sure that OutputPath was the way to do it. But it isn't working here for some reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what is different to Windsor because Windsor 4.1.0 has XML files for each target framework in their bin/debug or bin/release and in the NuGet packages, and it doesn't specify the DocumentationFile element.

We need to fix this because I just realised that if the file is getting written here than wouldn't that mean that the last target to get built becomes the output for all targets, i.e. if netstandard1.6 is built last than that's the docs for all targets.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will have a fix for this soon.

@jonorossi jonorossi added this to the vNext milestone Oct 13, 2017
@@ -19,6 +19,7 @@
<PublicSign Condition="'$(OS)'=='Unix'">true</PublicSign>
<FrameworkPathOverride Condition="'$(OS)'=='Unix'">$(NuGetPackageFolders)microsoft.targetingpack.netframework.v4.6.1\1.0.1\lib\net461\</FrameworkPathOverride>
<PackageTags>castle dynamicproxy dynamic proxy dynamicproxy2 dictionaryadapter emailsender</PackageTags>
<OutputPath>bin\$(Configuration)\$(TargetFramework)\</OutputPath>
<DocumentationFile>$(OutputPath)Castle.Core.xml</DocumentationFile>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will have a fix for this soon.

I thought the fix was going to be removing the DocumentationFile since Windsor has XML docs in its packages without this element.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is actually

<GenerateDocumentationFile>true</GenerateDocumentationFile>

I must have missed that earlier.

Copy link
Member

@jonorossi jonorossi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing it in common.props, forget to check there just assumed those two files matched between both projects.

.gitignore Outdated

# Docs artifacts
docs/obj/
docs/bin/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should just ignore obj and bin directories everywhere, we've got 4 sets of these patterns now.

.gitignore Outdated
docs/bin/

# Xml doc/test files
*.xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think ignoring all XML files everywhere is a good idea, this isn't needed anymore anyway.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind you, this is only the root folder. It also prevents DesktopClrTestResults.xml and NetCoreClrTestResults.xml from being unstaged and accidentally committed.

@jonorossi jonorossi changed the title Harmonise Castle Core and Windsor Fix XML documentation generation and add Markdown docs to VS solution Oct 18, 2017
@jonorossi
Copy link
Member

@Fir3pho3nixx ping

@ghost
Copy link
Author

ghost commented Nov 24, 2017

@jonorossi pong

tools/**/build/

# Xml doc/test files
*.xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind you, this is only the root folder. It also prevents DesktopClrTestResults.xml and NetCoreClrTestResults.xml from being unstaged and accidentally committed.

@Fir3pho3nixx I think you misunderstand how gitignores work, sorry for this pull request being death by a thousand cuts.

If the pattern does not contain a slash /, Git treats it as a shell glob pattern and checks for a match against the pathname relative to the location of the .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file).

If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words, foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo (this is consistent with the way how pathspec works in general in Git).

A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".

(https://git-scm.com/docs/gitignore)

*.xml is a glob pattern across all directories (like the *.suo pattern), it would need to be /*.xml to just match the root.

There is also no need for the **, you can just do bin/ to match the directory rather the contents.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okiday, I checked the globs by running git status and it appeared to be OK. Will fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers, I know I'm a nitpicking bastard 😉

P.S. this PR now also conflicts because of another PR I merged earlier.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry I will sort that.

Copy link
Author

@ghost ghost Jan 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonorossi - I think I misled you earlier when I said the XML artifacts are only in the root.

I cleaned the project, using git clean -x -f -d, then changed the .gitignore to have a leading slash in front of the *.xml -> /*.xml.

After running a full build and tests, I then double checked using git status with the following result.

Your branch is up-to-date with 'origin/harmonising-core-and-windsor-2'.

All conflicts fixed but you are still merging.
  (use "git commit" to conclude merge)

Changes to be committed:

        modified:   CHANGELOG.md
        modified:   src/Castle.Services.Logging.log4netIntegration/Castle.Services.Logging.log4netIntegration.csproj

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   .gitignore
        modified:   Castle.Core.sln.DotSettings

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        src/Castle.Services.Logging.log4netIntegration/Castle.Services.Logging.Log4netIntegration.xml

Notice how git thinks it needs to add the xml build artifact from the Log4netIntegration?

I believe my original approach is correct because this is a build artifact. It was my fault for not being clear on this in the first place but I do test my work before committing(admittedly I don't always test it on linux hence the previous casing issue). I am also puzzled as to why the casing issue cropped up and was not detected by Travis. Bizarre.

The globbing pattern I thought would be OK because of this:

Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:

A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo". <- !! Why I put the glob on the front of bin/obj. !!

A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc", relative to the location of the .gitignore file, with infinite depth. <- !! Why I put the glob on the end !!

A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.

Other consecutive asterisks are considered invalid.

You might consider it unnecessary although it is still valid. I just failed to explain myself perhaps properly.

If none of this is good for you, my alternative is to close out the PR. I am done wasting time on this.

@ghost ghost closed this Jan 17, 2018
@ghost
Copy link
Author

ghost commented Jan 17, 2018

I will harmonise the projects after we get this through: castleproject/Windsor#351

@jonorossi
Copy link
Member

I've committed 5a9bcab that fixes XML documentation file generation to use GenerateDocumentationFile to avoid the race condition between building multiple TFMs, and also fixes shipping the same XML file for each TFM because each one overwrites the previous.

Sorry for not realising you were talking about 3 different XML files from the unit test execution, we obviously want the XML doc files written to the bin directories paired with their DLL and PDB. I've explicitly ignored those 3 other XML files so if we add an XML file for something else it'll show up to be committed.

This pull request was closed.
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

Successfully merging this pull request may close these issues.

1 participant