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

feat: accept javascript programming language #546

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion judgels-backends/judgels-grader-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ ENV RUSTUP_HOME /usr
ENV XDG_CACHE_HOME /tmp
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
ENV PATH $JAVA_HOME/bin:$PATH
ENV NODE_MAJOR 18
kadeksuryam marked this conversation as resolved.
Show resolved Hide resolved

RUN apt-get update \
&& apt-get -y --no-install-recommends install software-properties-common gpg-agent \
&& apt-get install -y ca-certificates curl gnupg \
kadeksuryam marked this conversation as resolved.
Show resolved Hide resolved
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list

RUN apt-get update \
&& apt-get -y --no-install-recommends install software-properties-common gpg-agent \
&& add-apt-repository -y ppa:pypy/ppa \
&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \
&& apt-get -y --no-install-recommends install \
Expand All @@ -37,6 +44,7 @@ RUN apt-get update \
openjdk-11-jre \
pypy3 \
python3 \
nodejs \
kadeksuryam marked this conversation as resolved.
Show resolved Hide resolved
&& ln -s /usr/bin/gcc-11 /usr/bin/gcc \
&& ln -s /usr/bin/g++-11 /usr/bin/g++ \
&& curl -sSf https://sh.rustup.rs/ | bash -s -- -y -q --default-toolchain=1.57.0 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import judgels.gabriel.languages.cpp.CppGradingLanguage;
import judgels.gabriel.languages.go.GoGradingLanguage;
import judgels.gabriel.languages.java.JavaGradingLanguage;
import judgels.gabriel.languages.javascript.JavaScriptNode18GradingLanguage;
import judgels.gabriel.languages.pascal.PascalGradingLanguage;
import judgels.gabriel.languages.python.PyPy3GradingLanguage;
import judgels.gabriel.languages.python.Python3GradingLanguage;
Expand All @@ -33,6 +34,7 @@ public class GradingLanguageRegistry {
new PyPy3GradingLanguage(),
new Python3GradingLanguage(),
new Rust2021GradingLanguage(),
new JavaScriptNode18GradingLanguage(),
kadeksuryam marked this conversation as resolved.
Show resolved Hide resolved
new OutputOnlyGradingLanguage());

private static final List<GradingLanguage> VISIBLE_LANGUAGES = LANGUAGES.stream()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package judgels.gabriel.languages.javascript;

import com.google.common.collect.ImmutableList;
import java.util.List;
import judgels.gabriel.api.GradingLanguage;

public class JavaScriptNode18GradingLanguage implements GradingLanguage {
@Override
public String getName() {
return "JavaScript (Node 18)";
}

@Override
public boolean isVisible() {
return true;
}

@Override
public List<String> getAllowedExtensions() {
return ImmutableList.of("js");
}

@Override
public List<String> getCompilationCommand(String sourceFilename, String... sourceFilenames) {
return ImmutableList.of("/bin/true");
}

@Override
public String getExecutableFilename(String sourceFilename) {
return sourceFilename;
}

@Override
public List<String> getExecutionCommand(String sourceFilename) {
return ImmutableList.of("/usr/bin/node", sourceFilename);
}
}
5 changes: 5 additions & 0 deletions judgels-client/src/modules/api/gabriel/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const gradingLanguageNamesMap = {
Cpp20: 'C++20',
Go: 'Go',
Java: 'Java 11',
JavaScriptNode18: 'JavaScript (Node 18)',
Pascal: 'Pascal',
Python3: 'Python 3',
PyPy3: 'PyPy 3',
Expand All @@ -24,6 +25,7 @@ export const gradingLanguageFamiliesMap = {
Cpp20: 'C++',
Go: 'Go',
Java: 'Java',
JavaScriptNode18: 'JavaScript',
Pascal: 'Pascal',
Python3: 'Python',
PyPy3: 'Python',
Expand All @@ -37,6 +39,7 @@ export const gradingLanguageFilenameExtensionsMap = {
Cpp20: ['cc', 'cpp'],
Go: ['go'],
Java: ['java'],
JavaScriptNode18: ['js'],
Pascal: ['pas'],
Python3: ['py'],
PyPy3: ['py'],
Expand All @@ -51,6 +54,7 @@ export const gradingLanguageSyntaxHighlighterValueMap = {
Cpp20: 'cpp',
Go: 'go',
Java: 'java',
JavaScriptNode18: 'JavaScript',
Pascal: 'pascal',
Python3: 'python',
PyPy3: 'python',
Expand All @@ -65,6 +69,7 @@ export const gradingLanguageEditorSubmissionFilenamesMap = {
Cpp20: 'solution.cpp',
Go: 'solution.go',
Java: 'Solution.java',
JavaScriptNode18: 'solution.js',
Pascal: 'solution.pas',
Python3: 'solution.py',
PyPy3: 'solution.py',
Expand Down