Closed tamnguyenhuy closed 2 years ago
Did you try projectPath
param as described in the README? Seems like it's exactly what you're looking for.
I've tried with projectPath
git {
implementation '<git-repo-link>', {
name 'demo'
tag 'v1.0.4'
projectPath '/release2'
}
}
It will clone the whole project and select release2
as a Gradle module.
Correct me if I'm wrong! If I am correct,
Can we determine to specify a file or a directory before downloading by creating a new param/function?
Or can we clone the whole repo to the temp folder and then will delete unnecessary file/folders, finally we only put a specify resource that we need?
Yes, it will clone entire repo and will add the subfolder defined in projectPath
as gradle module.
It can be optimized a little using sparse checkout but I didn't plan to implement it, and I didn't even check if JGit library I'm using can handle it.
You can probably do a manual clean up in afterEvaluate
callback or similar. I'm not sure why though, do you have a big repo and want to reduce local disk usage?
Yes, I have a big repo. Many thanks @alexvasilkov for explaining, I will remove useless resources manually after that
For instance, I have a repo with a structure as follows:
release-repo │ release │ release 2 │ release 3 └───sub-release 3.1 └───sub-release 3.2
Could I download a subfolder release 2 instead of the whole repo? I meant could we only download a sub directory or a file?