view third_party/tectonic/runtime.bzl @ 260:1f9877b637e9

Add Copilot-powered cyberpunk JRPG chat Integrate the production JRPG chat with Seobeo streaming, Deita persistence, and a Bazel-managed Copilot SDK and LiteLLM inference stack. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <mrjunejune@users.noreply.github.com>
date Wed, 05 Aug 2026 09:19:41 -0700
parents 70f2a3dafc1c
children
line wrap: on
line source

def _tectonic_runtime_impl(ctx):
    output = ctx.actions.declare_directory(ctx.label.name)
    commands = [
        "set -e",
        "mkdir -p {}/bin {}/cache {}/sysroot/etc/fonts {}/sysroot/usr/share/fontconfig/conf.avail".format(
            output.path,
            output.path,
            output.path,
            output.path,
        ),
        "cp {} {}/bin/tectonic".format(ctx.file.binary.path, output.path),
        "cp {} {}/sysroot/etc/fonts/fonts.conf".format(
            ctx.file.fontconfig.path,
            output.path,
        ),
        "cp {} {}/LICENSE".format(ctx.file.license.path, output.path),
        "cp {} {}/THIRD_PARTY_NOTICES.md".format(
            ctx.file.notices.path,
            output.path,
        ),
        "tar -xzf {} -C {}/cache".format(
            ctx.file.cache_archive.path,
            output.path,
        ),
        "chmod 0555 {}/bin/tectonic".format(output.path),
        "chmod 0444 {}/sysroot/etc/fonts/fonts.conf".format(output.path),
        "chmod 0444 {}/LICENSE {}/THIRD_PARTY_NOTICES.md".format(
            output.path,
            output.path,
        ),
    ]
    commands.append("chmod -R a-w {}/cache".format(output.path))

    ctx.actions.run_shell(
        inputs = [
            ctx.file.binary,
            ctx.file.cache_archive,
            ctx.file.fontconfig,
            ctx.file.license,
            ctx.file.notices,
        ],
        outputs = [output],
        command = "\n".join(commands),
        progress_message = "Assembling offline Tectonic runtime",
    )
    return [
        DefaultInfo(
            files = depset([output]),
            runfiles = ctx.runfiles(files = [output]),
        ),
    ]

tectonic_runtime = rule(
    implementation = _tectonic_runtime_impl,
    attrs = {
        "binary": attr.label(allow_single_file = True, mandatory = True),
        "cache_archive": attr.label(allow_single_file = True, mandatory = True),
        "fontconfig": attr.label(allow_single_file = True, mandatory = True),
        "license": attr.label(allow_single_file = True, mandatory = True),
        "notices": attr.label(allow_single_file = True, mandatory = True),
    },
)