leakcanary icon indicating copy to clipboard operation
leakcanary copied to clipboard

[Ft] : Add a support to generate a fat jar

Open radityagumay opened this issue 1 year ago • 2 comments

Background

I have a use case where I want to utilize a shark-cli to capture memory leaks in our CI infrastructure, where it would run on every single merge request.

However, in the current stages, either we install leakcanary-shark using Homebrew, or we embed the shark-cli along with the fat JARs within the infrastructure test code. Both approaches work; however, they have their drawbacks.

Homebrew Install

This approach would require us to download the dependencies in our runner and cache those dependencies. It involves both required external downloads and internal downloads. The latter would run very frequently with each MR request, resulting in costs associated with downloading and caching the dependencies.

Embedded shark-cli and Fat JARs

This approach works, but the number of JARs that would be embedded in our infrastructure tests would be substantial. This is not my preferred approach.

Proposal

To generate a single fat JAR, which we can embed in our infrastructure without incurring download costs or the need for extensive caching.

How to generate a jar

./gradlew generateVersionProperties && ./gradlew :shark:shark-cli:jar

radityagumay avatar Oct 29 '23 03:10 radityagumay

Thanks! Sorry it took me so long to review.

If I understand right, your current plan is to retrieve the sources then run the jar command to get your own, right?

Ideally we'd upload the jar with dependencies to maven central together with the other artifacts. This probably requires more changes so that we build and include that artifact as part of release / upload, not sure what exactly.

pyricau avatar Nov 14 '23 23:11 pyricau

I believe you can generate fatJar and binaryJar like these:

https://github.com/JakeWharton/diffuse/blob/377951ba0cd3f3739706dbf010e65f2ab9bf3484/diffuse/build.gradle#L22-L54 https://github.com/JakeWharton/diffuse/blob/377951ba0cd3f3739706dbf010e65f2ab9bf3484/diffuse/build.gradle#L78-L93

Goooler avatar Jan 09 '24 09:01 Goooler

@radityagumay I'm closing this because it sounds like you've moved on to other things, which is ok. Happy to reopen if you ever have an update.

pyricau avatar Mar 27 '24 01:03 pyricau