diff --git a/.docker/ml.Dockerfile b/.docker/ml.Dockerfile index 73fb6859..0bb2d464 100644 --- a/.docker/ml.Dockerfile +++ b/.docker/ml.Dockerfile @@ -1,14 +1,16 @@ -FROM gcc:8.5.0 +FROM ubuntu:24.04 -ENV OCAML_VERSION 4.01.0 +ENV OCAML_VERSION 4.05.0 -RUN apt update && apt upgrade -y && apt install -y --force-yes make +RUN apt update && apt upgrade -y && apt install -y --force-yes opam -RUN wget https://github.com/ocaml/ocaml/archive/refs/tags/${OCAML_VERSION}.zip -RUN unzip ${OCAML_VERSION}.zip -RUN cd ocaml-${OCAML_VERSION} && ./configure && make world.opt && make install +RUN opam init --disable-sandboxing +RUN opam update -RUN mkdir /code +RUN opam install -y ocaml=${OCAML_VERSION} +RUN opam switch create ${OCAML_VERSION} + +RUN mkdir code WORKDIR /code CMD /code/scripts/docker/run-ml.sh diff --git a/Makefile b/Makefile index 316f426c..3f70c9f1 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,7 @@ SUPPORTED_LANGUAGES = \ $(JAVA) \ $(JS) \ $(LUA) \ + $(ML) \ $(PHP) \ $(PY) \ $(R) \ @@ -54,7 +55,6 @@ SUPPORTED_LANGUAGES = \ $(SCALA) \ $(SQL) \ $(TS) -# $(ML) # $(PAS) ifdef LANGUAGES diff --git a/scripts/docker/run-ml.sh b/scripts/docker/run-ml.sh index 74e88a00..fe5b7395 100755 --- a/scripts/docker/run-ml.sh +++ b/scripts/docker/run-ml.sh @@ -9,20 +9,24 @@ echo for folder in ${FOLDERS}; do [[ -f "${folder}WRONG" ]] && continue - if [[ "$(find "${folder}" -name '*.ml' | wc -l)" -eq 1 ]]; then + rm -rf "${folder}main.ml" 2> /dev/null + + if [[ "$(find "${folder}" -name '*.ml' | wc -l)" -ge 1 ]]; then echo "${folder}" cd "${folder}" || exit 1 + rm -rf "${folder}main.ml" 2> /dev/null + cp ./*.ml main.ml - ocamlc -o ml.out main.ml + ocamlc -o ml main.ml if [[ -f in.txt ]]; then - ./ml.out < in.txt > result-ml.txt + ./ml < in.txt > result-ml.txt else - ./ml.out > result-ml.txt + ./ml > result-ml.txt fi - rm -rf ml.out main.ml main.cmi main.cmo + rm -rf ml main.ml main.cmi main.cmo diff result-ml.txt out.txt