<commit_before>-- Moss favors explicit definition over automatic discovery.
-- The build tree is a structure used to explicitly define how software is built.
-- This is in contrast to tools like autoconf that attempt to discover aspects of this.

-- Definition
function artifact(a)
    return function(v) return v end
end

-- Directive
function build(artifact)
    if(type(artifact) == "string") then
        print("build directory: " .. artifact);
    else
        print("build artifact: " .. artifact.name);
    end
    return function(e) return artifact end
end

-- Directive
function with(g)
    return function(c) return c end
end

-- Directive
function using(t)
    return function(c) return c end
end

math_lib = artifact("static_lib") {
    name = "fastmath.lib";
    source = [[ math1.c math2.c ]];
}

main_image = artifact("executable") {
    name = "main.exe";
    -- main_image requires math_lib within it's build
    libs = {math_lib};
};

-- The build directive is one of the most important concepts within moss
-- build(<artifact>) { }
-- A build directive may contain
--  - Nested 'build' directive (for directories only)
--  - 'with' directives for specializing genes
--  - 'using' directives for selecting tools
--  This encourages a natural language syntax like build(artifact) with(gene) using(tool)

-- Build structures used to explicitly define everything that is created
-- A directory artifact without name could imply current directory
build("output") {
    using { clangld, clangcc };

    with(myconfig) {
        memory_model = "large";
        debug = false;
    };

    build("debug") {
        -- math_lib will be created in this build as a dependency of main_image
        build(main_image);

        with(clang_config) {
            -- math_lib will inherit these cflags
            cc = { cflags = "-Og -DDEBUG" };
        };
    };
    build("release") {
        -- specify math_lib explicitly for this build
        build(math_lib) {
            -- special options for this build of math_lib
            with(clang_config) { flags = "-Mfpu" };
        };

        build(main_image);

        with(clang_config) {
            cc = { cflags = "-O3" };
        };
        with(myconfig) { debug = true };
    };

    build("package") {
        using { gzip };
        build(artifact "zipfile" {
            name = "release.zip";
            source = { main_image, "help.doc", "release-notes.txt" };
        });
    }
};<commit_msg>Accept variable args in using directive function<commit_after>-- Moss favors explicit definition over automatic discovery.
-- The build tree is a structure used to explicitly define how software is built.
-- This is in contrast to tools like autoconf that attempt to discover aspects of this.

-- Definition
function artifact(a)
    return function(v) return v end
end

-- Directive
function build(artifact)
    if(type(artifact) == "string") then
        print("build directory: " .. artifact);
    else
        print("build artifact: " .. artifact.name);
    end
    return function(e) return artifact end
end

-- Directive
function with(g)
    return function(c) return c end
end

-- Directive
function using(...)
    return function(c) return c end
end

math_lib = artifact("static_lib") {
    name = "fastmath.lib";
    source = [[ math1.c math2.c ]];
}

main_image = artifact("executable") {
    name = "main.exe";
    -- main_image requires math_lib within it's build
    libs = {math_lib};
};

-- The build directive is one of the most important concepts within moss
-- build(<artifact>) { }
-- A build directive may contain
--  - Nested 'build' directive (for directories only)
--  - 'with' directives for specializing genes
--  - 'using' directives for selecting tools
--  This encourages a natural language syntax like build(artifact) with(gene) using(tool)

-- Build structures used to explicitly define everything that is created
-- A directory artifact without name could imply current directory
build("output") {
    using(clangld, clangcc);

    with(myconfig) {
        memory_model = "large";
        debug = false;
    };

    build("debug") {
        -- math_lib will be created in this build as a dependency of main_image
        build(main_image);

        with(clang_config) {
            -- math_lib will inherit these cflags
            cc = { cflags = "-Og -DDEBUG" };
        };
    };
    build("release") {
        -- specify math_lib explicitly for this build
        build(math_lib) {
            -- special options for this build of math_lib
            with(clang_config) { flags = "-Mfpu" };
        };

        build(main_image);

        with(clang_config) {
            cc = { cflags = "-O3" };
        };
        with(myconfig) { debug = true };
    };

    build("package") {
        using(gzip);
        build(artifact("zipfile") {
            name = "release.zip";
            source = { main_image, "help.doc", "release-notes.txt" };
        });
    }
};
{'fraction_non_alphanumeric': 0.11108870967741935, 'fraction_numerical': 0.0012096774193548388, 'mean_word_length': 2.46680642907058, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2467161', 'n_tokens_mistral': 1437, 'n_tokens_neox': 1367, 'n_words': 475}