Skip to content

main_class as mandatory attribute in kt_jvm_binary #1374

@jxramos

Description

@jxramos

I'm stumbling across this restriction trying to write the most basic hello world application to verify our integration of the bazel rules was successful.

"main_class": attr.string(mandatory = True, doc = ""),

This is composed of the simple source given below...

// hello_world_app.kt
fun main() {
    println("Hello, World!")
}

and the BUILD file

kt_jvm_binary(
    name = "hello_world_app",
    srcs = ["hello_world_main.kt"],
)

That simple combination yields the mandatory attribute error

ERROR: /home/userX/orgY/repoQ/third_party/external/rules_kotlin/tests/BUILD:29:14: //third_party/external/rules_kotlin/tests:hello_world_app: missing value for mandatory attribute 'main_class' in 'kt_jvm_binary' rule

Is there something flawed or incomplete with the hello world example above that I'm missing, or perhaps this reveals some underlying Java dependency for these rules that isn't obvious from the surface of this all? What is the reason why a kotlin JVM binary would need a main class precisely? Sorry for the confusion, and lack of background I'm very new to the Kotlin language and and trying to see how much of the language is standalone and independent vs standing on the shoulders of Java.

Metadata

Metadata

Assignees

Labels

status: need more informationThis issue needs response/confirmation/update from the reporter

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions