aboutsummaryrefslogtreecommitdiff
path: root/cobol/internal/rules.bzl
blob: 8dac74745b72e5ca3d1439d5011de3721008f9b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"Rules for building COBOL programs"

load(":actions.bzl", "cobol_compile_executable")

def _cobol_binary_impl(ctx):
    prefix = ctx.label.name + "%/"
    executable = ctx.actions.declare_file(prefix + ctx.label.name)

    cobol_compile_executable(
        ctx,
        srcs = ctx.files.srcs,
        out = executable,
    )

    return [DefaultInfo(
        files = depset([executable]),
        executable = executable,
    )]

cobol_binary = rule(
    _cobol_binary_impl,
    attrs = {
        "srcs": attr.label_list(
            allow_files = True,
            doc = "The COBOL source files to compile for this binary",
        ),
    },
    doc = "Builds an executable program from COBOL source code",
    executable = True,
)