ktfmt icon indicating copy to clipboard operation
ktfmt copied to clipboard

Consider providing a binary jar

Open Goooler opened this issue 1 year ago • 7 comments

chmod +x ktfmt-0.50-jar-with-dependencies.jar
./ktfmt-0.50-jar-with-dependencies.jar
zsh: exec format error: ./ktfmt-0.50-jar-with-dependencies.jar

We can't execute this jar directly now, I did something to ktlint like:

https://github.com/pinterest/ktlint/blob/c7083ada451ff0d72a3edb2b3a9d485ee3f0cf96/ktlint-cli/build.gradle.kts#L84-L104

or

https://github.com/Goooler/StringResExporter/blob/5ccfe8ae50aedb10523d3f05ae701a6653ea8763/build.gradle.kts#L74-L94

so that jars can be executed directly.

I'm unfamiliar with Maven, but I would be willing to send a PR if I can do...

Goooler avatar Jun 17 '24 02:06 Goooler

Interesting proposition. Are there any tradeoffs from doing this? Would we still be able to do java -jar ktfmt-0.50-jar-with-dependencies.jar? Might be useful in case you want to run ktfmt with a java version other than the "standard" in your machine, or if you don't have java in your path (my_java -jar ktfmt.jar)

hick209 avatar Jun 17 '24 13:06 hick209

Yeah, you can run it like a normal jar with java -jar. Actually, it still depends on your local JDK, but you can execute it like binary applications like the others on Unix.

Goooler avatar Jun 18 '24 01:06 Goooler

Sounds good to me then! @Goooler feel free to submit a PR since from our end this is unlikely to get prioritized any time soon.

hick209 avatar Jun 19 '24 12:06 hick209

It would be easier to do this if we could migrate the core project build to Gradle, is there any plan to migrate?

Goooler avatar Jun 20 '24 00:06 Goooler

No plans on our side, but I don't see a reason not to do that other than the work required for it and extensive testing to make sure nothing breaks/regresses.

It would actually be a really nice change since other parts of this project are on Gradle already. This is just not something that is currently on the roadmap.

hick209 avatar Jun 20 '24 00:06 hick209

May I file a new issue and try to send a PR?

Goooler avatar Jun 20 '24 00:06 Goooler

If you are feeling like it, feel free to send a PR, I'll gladly take that in 😃

hick209 avatar Jun 20 '24 01:06 hick209

Closing the issue as this is not something we'll actively work on and it's also not on our roadmap. Again we'd be happy to take a PR for it

hick209 avatar Aug 27 '24 18:08 hick209