Sign in

    mproc_examples

    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    4 months ago
    Downloads
    32

    Dependencies

    #mproc examples

    This directory contains runnable downstream generator examples for mproc_gen.

    #Minimal generator

    This example contains the source of a downstream generator binary:

    examples/minimal_generator/cmd/main

    When a generator is published as a MoonBit binary dependency, package authors should invoke that installed binary from a rule and dev_build, not shell out to moon run.

    rule(
    name: "minimal_generator",
    command: "$mod_dir/.mooncakes/Milky2018/minimal_generator/minimal_generator $input -o $output",
    )
    dev_build(
    rule: "minimal_generator",
    input: "fixtures/input.mbt",
    output: "generated.g.mbt",
    )

    dev_build runs for package authors during moon check, moon build, and moon test. It is not triggered when the package is used as a dependency, so generated outputs should be committed.

    For local source validation before publishing the binary, run:

    mkdir -p .test-tmp/examples/minimal_generator moon run examples/minimal_generator/cmd/main \ examples/minimal_generator/fixtures/input.mbt \ examples/minimal_generator/fixtures/extra.mbt \ -o .test-tmp/examples/minimal_generator/generated.g.mbt diff -u examples/minimal_generator/expected/generated.g.mbt \ .test-tmp/examples/minimal_generator/generated.g.mbt

    The example parses the positional input sources, invokes a downstream callback with the runner-owned builder, and writes the explicit output target. It does not interpret attributes or infer package context.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io