<commit_before>#!/bin/bash
set -e

SCRIPT_DIR=$( cd "$(dirname "$0")"; pwd -P)
ROOT_DIR="${SCRIPT_DIR}/../.."
VOLUME="${SCRIPT_DIR}/build.windows-x86_64"
mkdir -p "${VOLUME}"

REPOSITORY="tinyspline"
TAG="build.windows-x86_64"
IMAGE_NAME="${REPOSITORY}:${TAG}"
STORAGE="/dist"

SETUP_CMDS=$(cat << END
RUN echo 'debconf debconf/frontend select Noninteractive' \
		| debconf-set-selections && \
	apt-get update && \
	apt-get install -y --no-install-recommends cmake swig mingw-w64
COPY src/. /tinyspline
WORKDIR /tinyspline
END
)

BUILD_RUN_DELETE() {
	docker build -t ${IMAGE_NAME} -f - "${ROOT_DIR}" <<-END
		${1}
	END
	docker run \
		--rm \
		--volume "${VOLUME}:${STORAGE}" \
		${IMAGE_NAME} \
		/bin/bash -c "${2}"
	docker rmi ${IMAGE_NAME}
}

RUNTIME_LIBRARIES="\
/usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/libstdc++-6.dll\
\;/usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/libgcc_s_seh-1.dll"

################################# C#, D, Java #################################
JDK8_URL="https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jdk_x64_windows_hotspot_8u222b10.zip"

BUILD_CSHARP_JAVA() {
	BUILD_RUN_DELETE \
	"FROM buildpack-deps:stretch
	${SETUP_CMDS}
	RUN apt-get install -y --no-install-recommends 	\
		mono-mcs nuget \
		dub \
		default-jdk maven" \
	"wget ${JDK8_URL} -O /opt/jdk8.zip && mkdir /opt/java && \
		unzip -d /opt /opt/jdk8.zip && mv /opt/jdk*/* /opt/java && \
	CC=x86_64-w64-mingw32-gcc-win32 CXX=x86_64-w64-mingw32-g++-win32 \
		JAVA_HOME=/opt/java \
		cmake . \
		-DCMAKE_SYSTEM_NAME=Windows \
		-DCMAKE_BUILD_TYPE=Release \<commit_msg>CI: Build C# with SDK 2.<commit_after>#!/bin/bash
set -e

SCRIPT_DIR=$( cd "$(dirname "$0")"; pwd -P)
ROOT_DIR="${SCRIPT_DIR}/../.."
VOLUME="${SCRIPT_DIR}/build.windows-x86_64"
mkdir -p "${VOLUME}"

REPOSITORY="tinyspline"
TAG="build.windows-x86_64"
IMAGE_NAME="${REPOSITORY}:${TAG}"
STORAGE="/dist"

SETUP_CMDS=$(cat << END
RUN echo 'debconf debconf/frontend select Noninteractive' \
		| debconf-set-selections && \
	apt-get update && \
	apt-get install -y --no-install-recommends cmake swig mingw-w64
COPY src/. /tinyspline
WORKDIR /tinyspline
END
)

BUILD_RUN_DELETE() {
	docker build -t ${IMAGE_NAME} -f - "${ROOT_DIR}" <<-END
		${1}
	END
	docker run \
		--rm \
		--volume "${VOLUME}:${STORAGE}" \
		${IMAGE_NAME} \
		/bin/bash -c "${2}"
	docker rmi ${IMAGE_NAME}
}

RUNTIME_LIBRARIES="\
/usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/libstdc++-6.dll\
\;/usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/libgcc_s_seh-1.dll"

################################# C#, D, Java #################################
JDK8_URL="https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jdk_x64_windows_hotspot_8u222b10.zip"

BUILD_CSHARP_JAVA() {
	BUILD_RUN_DELETE \
	"FROM buildpack-deps:stretch
	${SETUP_CMDS}
	RUN apt-get install -y --no-install-recommends 	\
		mono-mcs mono-reference-assemblies-2.0 nuget \
		dub \
		default-jdk maven" \
	"wget ${JDK8_URL} -O /opt/jdk8.zip && mkdir /opt/java && \
		unzip -d /opt /opt/jdk8.zip && mv /opt/jdk*/* /opt/java && \
	CC=x86_64-w64-mingw32-gcc-win32 CXX=x86_64-w64-mingw32-g++-win32 \
		JAVA_HOME=/opt/java \
		cmake . \
		-DCMAKE_SYSTEM_NAME=Windows \
		-DCMAKE_BUILD_TYPE=Release \
{'fraction_non_alphanumeric': 0.2197226502311248, 'fraction_numerical': 0.049614791987673344, 'mean_word_length': 3.873873873873874, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4101561', 'n_tokens_mistral': 1600, 'n_tokens_neox': 1419, 'n_words': 216}