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

[DRAFT] feat: accept javascript programming language #547

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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: 8 additions & 2 deletions judgels-backends/judgels-grader-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,24 @@ ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
ENV PATH $JAVA_HOME/bin:$PATH

RUN apt-get update \
&& apt-get -y --no-install-recommends install software-properties-common gpg-agent \
&& apt-get install -y --no-install-recommends ca-certificates curl gnupg \
&& 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_18.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 \
curl \
openssh-client \
rsync \
&& apt-get -y --no-install-recommends install \
fp-compiler \
g++-11 \
golang \
libcap-dev \
nodejs \
openjdk-11-jdk-headless \
openjdk-11-jre \
pypy3 \
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 @@ -29,6 +30,7 @@ public class GradingLanguageRegistry {
new Cpp20GradingLanguage(),
new GoGradingLanguage(),
new JavaGradingLanguage(),
new JavaScriptNode18GradingLanguage(),
new PascalGradingLanguage(),
new PyPy3GradingLanguage(),
new Python3GradingLanguage(),
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
Loading