Use Gradle `changing` to determine snapshots
From https://github.com/GoogleContainerTools/jib/pull/584#discussion_r204366857. Gradle supports explicitly indicating that a dependency may be changing and provides an API to check. The docs hint that SNAPSHOTs are marked as changing.
It does seem like dependencies with the -SNAPSHOT suffix will get the changing set to true, but it'd be always good to explicitly verify it.
Clearing the milestone on this, since it's low priority and turns out to not be as easy as we thought (using isChanging() means we need to find the ExternalModuleDependency object associated with each jar file, which doesn't seem to be very straightforward).
Hi everyone, I would like to contribute on this, is this issue still open?
Yes, the issue is still open. We would greatly appreciate your help. Maybe both 1) dependencies marked changing; and 2) dependencies whose filename ends with SNAPSHOT should be added to the snapshot layer.
~~Hey @mcabezas this actually requires some underlying changes to where dependent layering is processed. If you look at JavaContainerBuilder you'll see that splitting of snapshot and non-snapshot dependencies is done after gradle has handed off its list of dependencies. We need to update that api first before you will have the tools to handle this.~~
UPDATE: underlying API changes complete
@chanseokoh Thanks to clarify the scope of the change. I'm just looking to retrieve something to this awesome tool builder.
@loosebazooka So may I wait for the API update before starting? Or do you think I can try to do that also? I would like to contribute with something let me know what can I choose as first contribution. I'm open to your suggestions.
Hrmm... The discussion is happening here: #1724
~~I'm not sure if this is the ideal change to tackle as a contributor as I expect the plugins' dependency filtering to happen with the api change. However if I see an opportunity for contribution I will update the bug.~~
UPDATE: underlying API changes and dependency filtering complete
The planned underlying API changes and dependency filtering is complete. This issue is again a "good first issue" for contribution.
Ah right, @mcabezas, you can take a look again if you want.
Most of the relevant code is in https://github.com/GoogleContainerTools/jib/blob/master/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java
@chanseokoh I created a PR #2078