rules_kotlin
rules_kotlin copied to clipboard
kotlin binary rules should include meta-inf info for the main method
Description of the problem / feature request:
Currently when building a .jar file it's missing a meta-inf describing where to locate the main method. The rule itself has all the info required to include all that info in the jar so why not do it?
Feature requests: what underlying problem are you trying to solve with this feature?
Produce an executable .jar with least amount of effort
What operating system are you running Bazel on?
Mac
What's the output of bazel info release?
release 0.29.0
What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
[email protected]:Snapchat/android.git
41bc3d71f811fe3c06ea0d186a5081b4cedc0c48
30c67edb628fe2da9a4b56cf4e93d5676d8675cd
Have you found anything relevant by searching the web?
https://bazelbuild.slack.com/archives/CE6AZ22NR/p1570157740027600?thread_ts=1570133401.023500&cid=CE6AZ22NR
What meta-info info are you expecting that isn't there? The _deploy.jar created by a java_binary includes a Main-Class entry in the manifest:
$ bazel build examples/java-native/src/main/java/com/example/myproject:hello-world_deploy.jar
$ unzip -p bazel-bin/examples/java-native/src/main/java/com/example/myproject/hello-world_deploy.jar META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: singlejar
Main-Class: com.example.myproject.Greeter
This issue should be refactored to call out only the Kotlin rules. Sorry, I did in fact notice that when using _deploy.jar in Java it does the right thing. However, I couldn't create a _deploy.jar in Kotlin -- not sure if this is still the case with the newly added support of Kotlin rules that work with Kotlin v1.3
@nkoroste I usually just wrap a kotlin_jvm_library in a java_binary (runtime dep for the library works well) with a main_class attribute. That works fine for me and you can create deploy jars