Skip to content

codingame_tools.language.toolchain.subsystems

subsystems

Subsystem fragments: the toolchains languages install and share.

A subsystem is a fragment that isn't a language. It exists because the mapping between languages and toolchains is neither one-to-one nor one-way:

  • Several languages, one toolchain. C and C++ are the same gcc; C# / F# / VB.NET are one .NET runtime; JavaScript and TypeScript are one Node. Installing that toolchain once, and having each language depend on it, is the only way an image containing both isn't carrying it twice.
  • One language family, several incompatible toolchains. CodinGame runs Java on Oracle JDK 21.0.4 but Clojure, Groovy and Scala on JVM 1.8, so an image with Java and Scala needs both JDKs present and neither global. Separate subsystems, separate activation scripts.

Versions here are not arbitrary--they mirror what CodinGame actually runs, because the entire value of a pinned toolchain is that a local run predicts a submission. Getting one wrong is worse than having no container at all: it produces confident local success followed by remote failure. See codingame_tools.language.languages for the per-language fragments that depend on these.

Only the subsystems backing implemented languages live here. Adding a language means adding its subsystem alongside it, rather than shipping toolchains nothing can drive--which would inflate every image for no benefit.

BASE_IMAGE module-attribute

BASE_IMAGE = 'debian:bookworm-slim'

The one neutral base every fragment installs onto.

Deliberately not a language image such as gcc:14. A per-language base cannot compose--two of them cannot both be FROM--and it hides the toolchain version in an image tag, which is exactly how the C++ build came to be silently two major gcc releases ahead of CodinGame's.

PREAMBLE module-attribute

PREAMBLE = '# Common to every cg toolchain image, whatever languages it carries.\nENV DEBIAN_FRONTEND=noninteractive\nRUN apt-get update \\\n    && apt-get install -y --no-install-recommends ca-certificates coreutils \\\n    && rm -rf /var/lib/apt/lists/*\nRUN mkdir -p /opt/cg/env.d /build\nWORKDIR /build\n'

Statements shared by every image, before any fragment.

coreutils supplies the timeout and stdbuf the run and debug paths depend on (already present on Debian; named so a swapped base still gets them).

SUBSYSTEMS module-attribute

SUBSYSTEMS = (_GCC11, _PYTHON311, _JDK21, _DOTNET8, _NODE20)

Every subsystem cg ships. Collected by codingame_tools.language.toolchain.registry.