Skip to content

Consider using source generators for currently generated code #13236

Closed

Description

@rjmholt

Currently PowerShell uses a fair amount of generated code, for example:

Instead, we could keep generated code out of the checked-in files by defining it as generated at build time using .NET Source Generators.

Activity

  1. added
    Issue-Enhancement
    WG-Engine
    on Jul 21, 2020
  2. SeeminglyScience commented on Jul 22, 2020

    @SeeminglyScience
    Contributor

    Related: #12760

  3. iSazonov commented on Jul 22, 2020

    @iSazonov
    Collaborator

    The issue looks like Meta. Could you add more info where you want to use RSG (Roslyn Source Generators)?

    I only know we use TypeGen utility at pre-build time.

  4. rjmholt commented on Jul 22, 2020

    @rjmholt
    CollaboratorAuthor

    Thinking about CDXML more, I think because that's a runtime code emission thing, that might be more a question of Reflection.Emit-type usages. AFAIK, Source Generators only occur at compile time, whereas CDXML files we must process when loaded at runtime

  5. SeeminglyScience commented on Jul 22, 2020

    @SeeminglyScience
    Contributor

    CDXML files we must process when loaded at runtime

    The idea would be instead of generating a PowerShell module based on the cdxml, generate a binary module at compile time and ship that instead. afaik nothing changes based on the environment it's loaded into, just based on the cdxml.

    I know PowerShell doesn't specifically ship any cdxml (right?), but a PS team supported build time cmdletization API would be ideal.

  6. added
    Resolution-Duplicate
    and removed
    Resolution-Duplicate
    on Jul 23, 2020
  7. iSazonov commented on Jul 23, 2020

    @iSazonov
    Collaborator

    The default formatters are all autogenerated

    In #10898 Dongbo Wang (@daxian-dbw) used internal tool to convert type files in optimal format. We could do the same for format files without creating RSGs. Or vice versa, use generators in both cases (and share them for other projects). Although I'm not sure if it will зука win.

    Much of the core interpreter was generated in Python many years ago. There has been discussion in the past about updating our dependency on the LightCompiler.

    Do you mean #2230? I believe the code was copy-pasted from old .Net with a little change.

  8. added
    Resolution-No Activity
    on Nov 16, 2023
  9. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EnhancementResolution-No ActivityWG-Engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions