-
Notifications
You must be signed in to change notification settings - Fork 254
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
.NET 6 support #1064
Draft
timbussmann
wants to merge
10
commits into
DMOJ:master
Choose a base branch
from
timbussmann:dotnet6-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
.NET 6 support #1064
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d69a427
dotnet 6 executor
timbussmann dc51b6c
remove get_versionable_commands
timbussmann 3857f0e
add newline at end of file
timbussmann 7d950bd
implement hello world behavior
timbussmann e948982
remove PublishSingleFile due to lack of reliable runtime identifier
timbussmann 94ba0f9
cleanup imports
timbussmann 414ed20
fix executable path
timbussmann a462bb9
minor tweak
timbussmann 94b5f8f
fix linter complaints
timbussmann 4c740a7
fix csproj const
timbussmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import os | ||
|
||
from dmoj.cptbox.filesystem_policies import ExactFile, RecursiveDir | ||
from dmoj.executors.compiled_executor import CompiledExecutor | ||
|
||
CSPROJ = b"""\ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<PublishSingleFile>true</PublishSingleFile> | ||
</PropertyGroup> | ||
</Project> | ||
""" | ||
|
||
HELLO_WORLD_PROGRAM = """\ | ||
Console.WriteLine("Hello, World!"); | ||
""" | ||
timbussmann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
class Executor(CompiledExecutor): | ||
ext = 'cs' | ||
command = 'dotnet' | ||
test_program = HELLO_WORLD_PROGRAM | ||
compiler_time_limit = 20 | ||
compiler_write_fs = [ | ||
RecursiveDir('~/.nuget/packages'), | ||
RecursiveDir('~/.local/share/NuGet'), | ||
RecursiveDir('/tmp/NuGetScratch'), | ||
] | ||
|
||
def create_files(self, problem_id, source_code, *args, **kwargs): | ||
with open(self._file('Program.cs'), 'wb') as f: | ||
f.write(source_code) | ||
|
||
with open(self._file('DMOJ.csproj'), 'wb') as f: | ||
f.write(CSPROJ) | ||
|
||
def get_compile_args(self): | ||
return [self.get_command(), 'publish', '--configuration', 'release', '--self-contained', 'false'] | ||
|
||
def get_compiled_file(self): | ||
return self._file('bin', 'release', 'net6.0', 'DMOJ.exe') | ||
timbussmann marked this conversation as resolved.
Show resolved
Hide resolved
timbussmann marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This program should echo input to output, not just write out "Hello, World!". See e.g. https://github.com/DMOJ/judge-server/blob/master/dmoj/executors/C.py#L11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is Rust's program wrong then? https://github.com/DMOJ/judge-server/blob/master/dmoj/executors/RUST.py#L78
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not "wrong" because it so happens the string we pass as input is "Hello, World!". But not testing input means it might be broken (for syscall whitelist reasons) and CI wouldn't catch it. Rust should be switched to echoing, but it seems more likely that .NET would have wacky syscalls during input than Rust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update it sometime later then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 will change the behavior