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 support for C# #498

Merged
merged 8 commits into from
Dec 4, 2024
Merged

Add support for C# #498

merged 8 commits into from
Dec 4, 2024

Conversation

XezolesS
Copy link
Contributor

Add support for C#, both .NET and Mono version of it.

Compiling C# is somewhat different than others, so I have to cook it little different.
I don't really want to break a codebase, but some methods are added to only handle C#.

The way it works is:

for .NET C#

  1. Create a .NET project under the workspace folder. The project name will be .cphcsrun
  2. Copy the C# source code to Program.cs in project folder.
  3. Run dotnet build to compile code.
  4. Run binary where located at <source_name>_bin/.cphcsrun.

for Mono C#

  1. Compile the code with mcs command.
  2. Run binary with mono command.

It is little bit wanky, but it works.

Also, I fixed an error that failed to delete binary after execution if there's a whitespace in the path in Windows.

I've tested every language but Haskell on Windows 10 and C, C++, C#, Python on Ubuntu 20.04 to make sure I didn't break other compilers.

Also some refactorings done.

Tested every language but haskell on Windows 10.
C, C++, C#, Java, Python has been tested on WSL Ubuntu 20.04.
Also wrapPathWhitespace is removed. Just replace by wrapping with double quotes seems okay.
@agrawal-d
Copy link
Owner

@XezolesS looks great, thanks for testing on both Linux and Windows.

  1. Can you please resolve the conflicts?
  2. Also, in some places, you have changed formatting even though you have not changed any code.
    Can you keep the diff limited to your code changes to minimize un-intended changes? Example package.json.

@agrawal-d agrawal-d self-assigned this Dec 3, 2024
@XezolesS
Copy link
Contributor Author

XezolesS commented Dec 4, 2024

@agrawal-d Thanks for the review.
Let me know if I missed something again ;)

@agrawal-d agrawal-d merged commit 5d0fed3 into agrawal-d:main Dec 4, 2024
4 checks passed
@agrawal-d
Copy link
Owner

Looks good, thanks!

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

Successfully merging this pull request may close these issues.

2 participants