rules_ocaml icon indicating copy to clipboard operation
rules_ocaml copied to clipboard

Make src_root optional when there's only one srcs

Open laurentlb opened this issue 6 years ago • 2 comments

It would be nice to allow this:

ocaml_native_binary(
    name = "ocaml",
    srcs = "hello.ml",
)

In other words, when there's only one source file, it should be used as the root one.

Suggestion: Maybe rename src_root to main? I think it's a more common name.

laurentlb avatar Jan 03 '18 15:01 laurentlb

Which of the following do you think is better?

ocaml_native_binary(
    name = "hello",
    srcs = ["hello.ml"],
    # implies: main = "hello.ml"
)

or

ocaml_native_binary(
    name = "hello",
    main = "hello.ml",
    # implies: srcs = ["hello.ml"]
)

I prefer the first.

jin avatar Jan 04 '18 15:01 jin

Yes, I also prefer the first one. You may add allow_empty=False to srcs.

laurentlb avatar Jan 05 '18 13:01 laurentlb