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

Improve support for package-with-macro-application #3687

Merged
merged 1 commit into from
Feb 28, 2024

Commits on Feb 28, 2024

  1. Improve support for package-with-macro-application

    The previous fix is no good; it was concerned with _augmentations_, assuming
    they cannot be read from disk. This is not the case. Only a macro-generated
    augmentation cannot be read from disk.
    
    Instead we change tactics and say we _can_ include source code from a macro
    (maybe we shouldn't), and just ask analyzer for all source files, from the
    AnalysisContext.
    
    Other changes to facilitate this:
    
    * Do not dispose the AnalysisContextCollection right away; we should wait until
      all docs are generated.
    * Pass the AnalysisContext to ModelNode, and no longer pass the
      ResourceProvider.
    * Remove the file cache thing in model_utils; instead ModelNode.sourceCode only
      relies on the AnalysisContext. Theoretically there is already caching over
      that at analyzer? But I benchmarked with Flutter and saw no time-to-document
      or max-RSS changes.
    * Do not ask the AnalysisContextCollection for the AnalysisContext _for every
      file_! Cache it. To facilitate that, change `PubPackageBuilder()` into a
      factory.
    * Sort the fields instantiated by the `PackageGraph.uninitialized` constructor
      above it.
    * In `addFilesReferencedBy`, also look at augmentation imports.
    srawlins committed Feb 28, 2024
    Configuration menu
    Copy the full SHA
    df080df View commit details
    Browse the repository at this point in the history