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

node docs generator tool without MetaDataLoadContext #11950

Merged
merged 73 commits into from
Aug 23, 2021

Conversation

mjkkirschner
Copy link
Member

@mjkkirschner mjkkirschner commented Aug 19, 2021

Purpose

Please see @SHKnudsen's PR for a great summary:
#11725

differences between the PRs:

  • MetaDataLoadContext support has been removed for the current time, and we'll explore its necessity when we deploy this tool. This removes ~ 700 LOC.
    • This means that in general full dependencies are required (ie all managed Revit API dlls)
    • As a consequence the tool now generates 100 additional nodes it was missing before - see the readme for details.
  • removes MetaDataLoadContext nuget packages.
  • animated gif compression has been added. -g
  • adds verbose -v mode- I found helpful to track down some issues.
  • adds ImageMagick .net and native to the license and about box.
  • adds a readme - mostly stolen from @SHKnudsen's summary, but also with some of our use cases described - hopefully to help devs understand what aspects are important to maintain.
  • moves layout spec with a type forward attribute so the exe no longer depends on DynamoCoreWPF.

TODO:

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated

@mjkkirschner mjkkirschner added the PTAL Please Take A Look 👀 label Aug 19, 2021

if (!string.IsNullOrEmpty(pathManager.HostApplicationDirectory))
{
var hostDir = new DirectoryInfo(Path.Combine(pathManager.HostApplicationDirectory, FALLBACK_DOC_DIRECTORY_NAME));
Copy link
Member Author

@mjkkirschner mjkkirschner Aug 20, 2021

Choose a reason for hiding this comment

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

@sm6srw to answer your question about how useful this is - it actually uses the DynamoHostPath property as the root - which can be set using a startupconfiguration - for example, DynamoRevit sets this to the location of the DynamoRevit.dll entry point.

so I think this is pretty useful.

Copy link
Contributor

@sm6srw sm6srw left a comment

Choose a reason for hiding this comment

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

I have made a first pass but I need to come back and take another pass on all new files. Looks good. Just a few questions.

private PackageDocumentationManager() { }

/// <summary>
/// Retrieves the markdown node documentation file associated with the input node namespace
/// </summary>
/// <param name="nodeNamespace">Namespace of the node to lookup documentation for</param>
/// <returns></returns>
public string GetAnnotationDoc(string nodeNamespace)
public string GetAnnotationDoc(string nodeNamespace, string packageName)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add packageName to param list?

Copy link
Member Author

@mjkkirschner mjkkirschner Aug 20, 2021

Choose a reason for hiding this comment

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

yes @sm6srw, I had the same reaction initially, https://github.com/DynamoDS/Dynamo/pull/11725/files#r646888243 - but it's actually inside an extension, I think it's okay to break this with chance of risk and if possible it would be nice to decide and/or codify extensions being part of the API boundary or not but it will take a cross team effort / discussion I think.

in this case I'm okay with the change unless there are objections.

src/DynamoCLI/Program.cs Outdated Show resolved Hide resolved
src/DynamoCoreWpf/Interfaces/ILibraryViewCustomization.cs Outdated Show resolved Hide resolved
src/DynamoCoreWpf/Properties/AssemblyInfo.cs Show resolved Hide resolved
src/Tools/NodeDocumentationMarkdownGenerator/readme.md Outdated Show resolved Hide resolved
move ilibraryviewcustomization as well to dynamocore
@pinzart90
Copy link
Contributor

so the what was the reason for the move from Wpf to Core ?

   <Compile Include="Interfaces\ILibraryViewCustomization.cs" />
    <Compile Include="Interfaces\LayoutSpecification.cs" />
    ```
    
 Was it because new projects that needed those interfaces had to depend on the dyn*wpf assembly ?
 And it was really no need to, since all the data in those 2 interfaces is pretty bare metal (no wpf) ?
 
 Also what is the main purpose of those interfaces ? TO provide a simple and uniform way for CustomViews to arrange their data  ?


private static List<MdFileInfo> ScanFolderForAssemblies(string inputFolderPath, IEnumerable<string> filter, IEnumerable<string> referencePaths, SearchOption searchOption)
{
var allAssembliesFromInputFolder = Directory.GetFiles(inputFolderPath, "*.*", searchOption)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure how many filles we expect to parse here.
EnumerateFiles might have some benefits...
The EnumerateFiles and GetFiles methods differ as follows: When you use EnumerateFiles, you can start enumerating the collection of names before the whole collection is returned; when you use GetFiles, you must wait for the whole array of names to be returned before you can access the array. Therefore, when you are working with many files and directories, EnumerateFiles can be more efficient.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd rather stick with the simplicity of GetFiles() - this is not going to affect users, and image compression time completely dwarfs the time it takes to read these files.

I'm thinking back to the last time I ran into trouble groking deferred execution and EnumerateFiles.

<OutputType>Exe</OutputType>
<RootNamespace>NodeDocumentationMarkdownGenerator</RootNamespace>
<AssemblyName>NodeDocumentationMarkdownGenerator</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the PR and at the Readme (The NodeDocumentationGenerator is a CLI tool to generate node documentation markdown stubs.) it seems that there is no UI being done in this project.
What are the reasons for making this project use the full dotnet framework (instead of core or dotnet standard)

Copy link
Member Author

@mjkkirschner mjkkirschner Aug 23, 2021

Choose a reason for hiding this comment

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

It's not clear to me that it's so simple to have a .net standard project depend on assemblies targeting .net framework (they are different targets after all) and this PR is big enough dissuade me from trying to also include multi-targeting our core dynamo assemblies for .net standard.

If I can simply change the target to .net standard and everything works I'm fine with that 😉 - otherwise I think it's probably best to include that improvement later.

Copy link
Member Author

Choose a reason for hiding this comment

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

from stack overflow

No, .NET Standard projects cannot reference framework projects.

.NET Standard projects need to be usable across platforms, forcing a dependency on the .NET framework by referencing an assembly targeting it makes this impossible.

Note that with some of the magic Microsoft is doing with .NET Standard 2.0 this is less true but the overall idea still stands.

Copy link
Member Author

Choose a reason for hiding this comment

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

this answer may be old, so I'll try it.

Copy link
Contributor

@pinzart90 pinzart90 Aug 23, 2021

Choose a reason for hiding this comment

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

Yeah..dotnet standard probably cannot reference dotnet framework....
Unless we take on the gigantic task of braking apart the dependencies into standard vs non standard assemblies
Fine with this even if it stays as it is

@pinzart90
Copy link
Contributor

How are we going to test the new functionality ? Unit tests (with mocked input files....?) ?

@mjkkirschner
Copy link
Member Author

mjkkirschner commented Aug 23, 2021

so the what was the reason for the move from Wpf to Core ?

   <Compile Include="Interfaces\ILibraryViewCustomization.cs" />
    <Compile Include="Interfaces\LayoutSpecification.cs" />
    ```
    
 Was it because new projects that needed those interfaces had to depend on the dyn*wpf assembly ?
 And it was really no need to, since all the data in those 2 interfaces is pretty bare metal (no wpf) ?
 
 Also what is the main purpose of those interfaces ? TO provide a simple and uniform way for CustomViews to arrange their data  ?

I moved them because I wanted to

  1. avoid referencing DynamoCoreWpf in this tool to optionally move it to mono,dotstandard etc.
  2. The types incldue no references to WPF so I changed the namespace to reflect what they depend on, and the fact they are now in DynamoCore.dll

@mjkkirschner
Copy link
Member Author

How are we going to test the new functionality ? Unit tests (with mocked input files....?) ?

I am working on a test PR here:
https://github.com/mjkkirschner/Dynamo/commits/nmgtunittestsmjk
based on Sylvester's work

Copy link
Contributor

@pinzart90 pinzart90 left a comment

Choose a reason for hiding this comment

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

LGTM

@mjkkirschner mjkkirschner merged commit e6b5ab3 into DynamoDS:master Aug 23, 2021
@mjkkirschner mjkkirschner deleted the nmgt-nometadata branch August 30, 2021 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PTAL Please Take A Look 👀
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants