Hi! I tried to use Gradle Source Dependencies the ...
# dependency-management
w
Hi! I tried to use Gradle Source Dependencies the other day, however it seems like the functionality is quite limited and the functionality is not actively supported afaik. https://blog.gradle.org/introducing-source-dependencies Our use case is that we want to get certain files from a git repository at a given version (git sha or tag). However sparse checkouts or git sha's are not supported. Also the fetch depth isn't configurable unfortunately. This causes challenges when the source repository is quite large. Then we tried to use a custom Ivy repository with the REST API of our Bitbucket server. For example: `bitbucket_hostrest/api/latest/projects/[organization]/repos/[module]/archive?at=[revision]&format=[ext]`Which almost worked, but somehow Gradle encodes the
?
into
%3F
and we get a 404 response from the Bitbucket server. Note that it only encodes the question mark, not the other characters. And it seems to be a known issue https://github.com/gradle/gradle/issues/21297 Is there a better way to do this? For now we switched to a custom Gradle task that uses a plain Java HttpClient to fetch the archive.
v
Yeah, source dependencies are quite unfinished and still experimental or at least incubating. When I want something similar, I usually use https://melix.github.io/includegit-gradle-plugin/ which works quite nicely. Not sure whether it fulfils your use-case fully though. Unfortunately, shallow clones are also not yet supported: https://github.com/melix/includegit-gradle-plugin/issues/13. But maybe you can make @melix finally add it. 🙂
w
Thanks for your reply! I found the plugin too, and disregarded it because of your open issue 😄
v
Depending on how desperate you are, maybe he also is open for a PR 😉
Ah, just have seen the comments in the issue 🙂
w
Yeah for now Im good with the custom task, but seems like I'm not the only one with the stupid idea to use a git repo as a dependency 😄
😢 1
The workaround with Ivy would have been the best actually, but unfortunately with Bitbucket the revision is a query param and not a path, otherwise it would have worked afaik
If I get bored I might like into it further
❤️ 1
v
Put a reverse proxy in front that translates the path without question mark to the bitbucket path 🙂
w
yeah that was another idea I had indeed! but unfortunately Im not in control of the infra (for this project)
v
Start a local server that does the path translation and use localhost as the repository 🙂
w
ha yes that could work :D