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

Enable using live ref pack in source generator unit tests #60605

Closed
Tracked by #60212
elinor-fung opened this issue Oct 19, 2021 · 6 comments · Fixed by #63410
Closed
Tracked by #60212

Enable using live ref pack in source generator unit tests #60605

elinor-fung opened this issue Oct 19, 2021 · 6 comments · Fixed by #63410

Comments

@elinor-fung
Copy link
Member

elinor-fung commented Oct 19, 2021

Currently, source generator unit tests either directly reference implementation assemblies or use a non-live ref pack. To enable using live ref assemblies in source generator unit tests, we should add infrastructure to zip the live ref assemblies, include in the Helix payload, and unzip / resolve against in the unit tests

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Oct 19, 2021
@elinor-fung elinor-fung added area-System.Runtime.InteropServices and removed untriaged New issue has not been triaged by the area owner labels Oct 19, 2021
@elinor-fung elinor-fung added this to the 7.0.0 milestone Oct 19, 2021
@elinor-fung elinor-fung changed the title Use live ref assemblies for source generator unit tests Enable using live ref pack in source generator unit tests Oct 19, 2021
@ghost
Copy link

ghost commented Oct 19, 2021

Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer
See info in area-owners.md if you want to be subscribed.

Issue Details

Currently, source generator unit tests either directly reference implementation assemblies or use a non-live ref pack. To enable using live ref assemblies in source generator unit tests, we should add infrastructure to zip the live ref assemblies, include in the Helix payload, and unzip / resolve against in the unit tests

Author: elinor-fung
Assignees: -
Labels:

area-Infrastructure-libraries

Milestone: 7.0.0

@ViktorHofer
Copy link
Member

To enable using live ref assemblies in source generator unit tests, we should add infrastructure to zip the live ref assemblies, include in the Helix payload

As the targeting pack (ref pack) is only needed for building and not running, why would we need that on a Helix machine? Do we actually build on Helix now?

@jkoritzinsky
Copy link
Member

The ref pack is needed to add to a Roslyn Compilation object so we can run our analyzer/source-generator/code-fix tests against the actual assemblies our customers will compile against.

So yes, in a sense we're building code on Helix now, just as part of tests that hook into our customer's compilation experience.

@ViktorHofer
Copy link
Member

we should add infrastructure to zip the live ref assemblies, include in the Helix payload, and unzip / resolve against in the unit tests

Can you just use the live built targeting pack nuget package? That's the common path that our customers use as well. We should be able to build the targeting pack package as part of the libraries build as there are no dependencies on the runtime.

@jkoritzinsky
Copy link
Member

Using the package is actually more annoying than using the zip. We’d still need to upload it to Helix since it wouldn’t be on a feed yet, and we’d need to calculate the version to restore. Additionally, we would need to continue to override the NUGET_PACKAGES environment variable to a new value every run since each local build has the same version (7.0.0-dev). Using a zip of the ref assemblies is actually significantly easier.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jan 5, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jan 6, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Feb 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants