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

Add ability to compile code from stdin #41166

Merged
merged 10 commits into from Feb 13, 2020
Merged

Conversation

@am11
Copy link
Contributor

am11 commented Jan 23, 2020

csc, vbc, and csi are now able to compile code from standard input. Plumbing for vbi is also done in this PR, however, there were some unimplemented methods in master, which are required to make the vib project itself functional.

When input is redirected from standard input stream and argument - is present, the Console.In is considered as a stream containing source and passed to the compiler; since it is a non-seekable stream, some adjustments has been made in assertions.

Error case: when - is present and input stream is not redirected, compiler shall issue a new error CS8782.

Closes #15802

@am11 am11 force-pushed the am11:feature/compile-stdin branch 5 times, most recently from 51bbedb to f6580ba Jan 24, 2020
@am11 am11 marked this pull request as ready for review Jan 25, 2020
@am11 am11 requested review from dotnet/roslyn-compiler as code owners Jan 25, 2020
@333fred 333fred requested review from jaredpar and agocke Jan 28, 2020
@am11 am11 force-pushed the am11:feature/compile-stdin branch from f6580ba to 9957ba4 Jan 30, 2020
@cston cston requested a review from tmat Jan 30, 2020
@am11 am11 force-pushed the am11:feature/compile-stdin branch from 9957ba4 to ca1ce04 Jan 31, 2020
@cston

This comment has been minimized.

Copy link
Member

cston commented Feb 3, 2020

@jaredpar, @agocke, please review, thanks.

am11 added 3 commits Feb 4, 2020
@cston
cston approved these changes Feb 4, 2020
Copy link
Member

cston left a comment

LGTM, thanks @am11.


Assert.Equal(PortableExecutableKinds.ILOnly, peKind);
var assemblyName = AssemblyName.GetAssemblyName(Path.Combine(tempDir, name));
Assert.Equal(name.Replace(".dll", ", Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"),

This comment has been minimized.

Copy link
@agocke

agocke Feb 4, 2020

Contributor

Instead of testing the name, why don't you use hello world as the input source and then run the emitted exe? That's basically a full end-to-end test.

This comment has been minimized.

Copy link
@am11

am11 Feb 4, 2020

Author Contributor

This test is for compiling library (with empty method) from stdin source; the one above does the exe E2E testing.

This comment has been minimized.

Copy link
@agocke

agocke Feb 6, 2020

Contributor

Ah, I see.

@am11

This comment has been minimized.

Copy link
Contributor Author

am11 commented Feb 6, 2020

I believe the CI integration test failure is unrelated to PR changes.

@agocke
agocke approved these changes Feb 6, 2020

Assert.Equal(PortableExecutableKinds.ILOnly, peKind);
var assemblyName = AssemblyName.GetAssemblyName(Path.Combine(tempDir, name));
Assert.Equal(name.Replace(".dll", ", Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"),

This comment has been minimized.

Copy link
@agocke

agocke Feb 6, 2020

Contributor

Ah, I see.

@agocke

This comment has been minimized.

Copy link
Contributor

agocke commented Feb 6, 2020

@am11 Agreed, the integration tests appear to have fallen over. We're working on bringing them back up

@am11

This comment has been minimized.

Copy link
Contributor Author

am11 commented Feb 12, 2020

@agocke, resolved the merged conflict. All green. 🌱

@cston cston merged commit f4f3aa7 into dotnet:master Feb 13, 2020
18 checks passed
18 checks passed
WIP Ready for review
Details
license/cla All CLA requirements met.
Details
roslyn-CI Build #20200212.9 succeeded
Details
roslyn-CI (Linux_Test coreclr) Linux_Test coreclr succeeded
Details
roslyn-CI (SourceBuild_Test) SourceBuild_Test succeeded
Details
roslyn-CI (Windows_CoreClr_Unit_Tests debug) Windows_CoreClr_Unit_Tests debug succeeded
Details
roslyn-CI (Windows_CoreClr_Unit_Tests release) Windows_CoreClr_Unit_Tests release succeeded
Details
roslyn-CI (Windows_Correctness_Test) Windows_Correctness_Test succeeded
Details
roslyn-CI (Windows_Desktop_Spanish_Unit_Tests) Windows_Desktop_Spanish_Unit_Tests succeeded
Details
roslyn-CI (Windows_Desktop_Unit_Tests debug_32) Windows_Desktop_Unit_Tests debug_32 succeeded
Details
roslyn-CI (Windows_Desktop_Unit_Tests debug_64) Windows_Desktop_Unit_Tests debug_64 succeeded
Details
roslyn-CI (Windows_Desktop_Unit_Tests release_32) Windows_Desktop_Unit_Tests release_32 succeeded
Details
roslyn-CI (Windows_Desktop_Unit_Tests release_64) Windows_Desktop_Unit_Tests release_64 succeeded
Details
roslyn-CI (Windows_Determinism_Test) Windows_Determinism_Test succeeded
Details
roslyn-CI (macOS_Test) macOS_Test succeeded
Details
roslyn-integration-CI Build #20200212.9 succeeded
Details
roslyn-integration-CI (VS_Integration debug_async) VS_Integration debug_async succeeded
Details
roslyn-integration-CI (VS_Integration release_async) VS_Integration release_async succeeded
Details
@cston

This comment has been minimized.

Copy link
Member

cston commented Feb 13, 2020

Thanks @am11 for the contribution.

@am11 am11 deleted the am11:feature/compile-stdin branch Feb 13, 2020
@am11

This comment has been minimized.

Copy link
Contributor Author

am11 commented Feb 14, 2020

Thank you for a great review! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.