0

I want to run a .exe file in bazel build which requires java to run.

This executable creates a directory and some files if run successfully.

My ExampleGenerator.bzl

def _example_generator_impl(ctx):
    outputs = []
    if ctx.outputs.outDir:
        outputs.append(ctx.outputs.outDir)
    
    ctx.actions.run(
        inputs = ctx.files.input,
        arguments = [args],
        outputs = outputs,
        executable = ctx.executable.generator_tool
    )

example_generator = rule(
    implementation = _example_generator_impl,
    attrs = {
        "input": attr.label (
                allow_single_file = [".txt"],
                mandatory = True
        ),
        "outDir": attr.output(),
        "generator_tool": attr.label(
            executable = True,
            allow_files = True,
            cfg = "exec",
            default = Label("generator/ExampleGenerator_x86_64.exe"),
        )
    }
)

And BUILD file

load(":ExampleGenerator.bzl" , "example_generator")
example_generator(
    name = "Example",
    input = "inputFile.txt",
    outDir = "Outdir",
)

Whenever I run bazel build, I get the following windows error diagolue saying bazel did not find jre/jawaw.exe in the path.

enter image description here

How can I make it work? Or any other implementation to run the .exe file will be helpful

Thanks!!

PS: I have installed all required JDK and the .exe runs correctly in command prompt.

RAHUL S K
  • 13
  • 4

0 Answers0