4
votes

I am trying to make SBT work with IPFS. I want to publish artifacts to IPFS and then depend on them in another project.

In the depending project I am using this SBT resolver:

resolvers += "ipfs-iscpif" at "https://ipfs.iscpif.fr/ipns/QmXTLZWz1VQqv9nFKersuNnRgPmMEkiHuRnS8i1c8A9XSF/ivy"

Everything is working except that the dependencies are downloaded on each update or ;clean; compile. The ivy cache is not working at all.

> ;clean;compile
[success] Total time: 0 s, completed 19 sept. 2016 13:19:41
[info] Updating {file:/tmp/test/}test...
[info] Resolving fr.iscpif.gridscale#http_2.11;1.88-SNAPSHOT ...
[warn] Unable to reparse fr.iscpif.gridscale#http_2.11;1.88-SNAPSHOT from ipfs-iscpif, using Mon Sep 19 13:19:43 CEST 2016
[info] Resolving fr.iscpif.gridscale#gridscale_2.11;1.88-SNAPSHOT ...
[warn] Unable to reparse fr.iscpif.gridscale#gridscale_2.11;1.88-SNAPSHOT from ipfs-iscpif, using Mon Sep 19 13:19:43 CEST 2016
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://ipfs.iscpif.fr/ipns/QmXTLZWz1VQqv9nFKersuNnRgPmMEkiHuRnS8i1c8A9XSF/ivy/fr/iscpif/gridscale/http_2.11/1.88-SNAPSHOT/http_2.11-1.88-20160919.103956-1.jar ...
[info]  [SUCCESSFUL ] fr.iscpif.gridscale#http_2.11;1.88-SNAPSHOT!http_2.11.jar (86ms)
[info] downloading https://ipfs.iscpif.fr/ipns/QmXTLZWz1VQqv9nFKersuNnRgPmMEkiHuRnS8i1c8A9XSF/ivy/fr/iscpif/gridscale/gridscale_2.11/1.88-SNAPSHOT/gridscale_2.11-1.88-20160919.103953-1.jar ...
[info]  [SUCCESSFUL ] fr.iscpif.gridscale#gridscale_2.11;1.88-SNAPSHOT!gridscale_2.11.jar (92ms)
[info] Done updating.
[success] Total time: 3 s, completed 19 sept. 2016 13:19:44
> ;clean;compile
[success] Total time: 0 s, completed 19 sept. 2016 13:19:45
[info] Updating {file:/tmp/test/}test...
[info] Resolving fr.iscpif.gridscale#http_2.11;1.88-SNAPSHOT ...
[warn] Unable to reparse fr.iscpif.gridscale#http_2.11;1.88-SNAPSHOT from ipfs-iscpif, using Mon Sep 19 13:19:45 CEST 2016
[info] Resolving fr.iscpif.gridscale#gridscale_2.11;1.88-SNAPSHOT ...
[warn] Unable to reparse fr.iscpif.gridscale#gridscale_2.11;1.88-SNAPSHOT from ipfs-iscpif, using Mon Sep 19 13:19:45 CEST 2016
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://ipfs.iscpif.fr/ipns/QmXTLZWz1VQqv9nFKersuNnRgPmMEkiHuRnS8i1c8A9XSF/ivy/fr/iscpif/gridscale/http_2.11/1.88-SNAPSHOT/http_2.11-1.88-20160919.103956-1.jar ...
[info]  [SUCCESSFUL ] fr.iscpif.gridscale#http_2.11;1.88-SNAPSHOT!http_2.11.jar (86ms)
[info] downloading https://ipfs.iscpif.fr/ipns/QmXTLZWz1VQqv9nFKersuNnRgPmMEkiHuRnS8i1c8A9XSF/ivy/fr/iscpif/gridscale/gridscale_2.11/1.88-SNAPSHOT/gridscale_2.11-1.88-20160919.103953-1.jar ...
[info]  [SUCCESSFUL ] fr.iscpif.gridscale#gridscale_2.11;1.88-SNAPSHOT!gridscale_2.11.jar (93ms)
[info] Done updating.
[success] Total time: 1 s, completed 19 sept. 2016 13:19:46

The jar gets downloaded every time. After a long investigation it seems to be due to the http header "Last-Modified". The IPFS protocol as no notion of modification time, therefore this header is set to the current date by the gateway. Would it be possible to make SBT consider the publication time published in metadata (ivy.xml for ivy or maven-metdata.xml for maven) instead of this http header?

best regards, Romain

Edit 1: IPFS based SBT repo would be really good. However I think it cannot work with the current state of SBT and IPFS. SBT relies on the http header Last-Modified, which is set to the current date for IPNS and which is absent for IPFS. Meaning that either the snapshot dependency gets updated on each update or never gets updated. I spent my last 24 hours on this subject and I think there is no solution to publish snapshot artifact to IPFS for now.

1

1 Answers

0
votes

just found this question. It shouldn't be hard to add the info to the name API of when the record was last published so that you can have that info on the http header. That said, have you found https://github.com/magik6k/sbt-publish-ipfs ?