Ability to track files that are not namespaces

Description

Support tracking non-clojure files when performing a refresh. The idea here is to make the reloaded workflow work well for libraries like HugSQL (which may depend on non-clojure files in the project).

See https://github.com/layerware/hugsql/issues/72 for some additional context

Environment

None

Activity

Show:
Stuart Sierra
January 16, 2018, 10:54 PM

I have been aware of the value of this feature for a long time now, but I expect it would require significant, breaking changes to the internal data structures used by tools.namespace.

RH
February 1, 2018, 8:40 AM

I've been thinking about the internal data structures for a bit, I think it may be possible to track this without breaking the internal data structures. The insight is that we need to determine `modified` clojure source files by taking the max modified timestamp of the clojure src file and any of it's external dependencies.

This would require three changes:

1. a way of defining external file dependencies (perhaps as metadata on the namespaces). Example:

2. a new entry in tracker named ::files/filedeps that maps source files -> other files.

3. update the `modified-files` predicate to take in `file-deps`, roughly like so:

RH
February 10, 2018, 6:22 PM

I took a stab at implementing this, would love your thoughts. The docs do need a bit of work to explain how this works though.

RH
July 27, 2018, 7:25 PM

Following Stuart's advice, I've created a fork with some instructions for how to set it up! https://github.com/rymndhng/tools.namespace

Daniel Compton
September 19, 2018, 4:01 AM

I'm trying this out now and it seems to do just what I want. The only thing I'm noticing is that there is no indication that a filedep has changed in the `:reloading` message, it only shows the namespaces. Not sure how/if you want to show that though.

Assignee

Stuart Sierra

Reporter

RH

Labels

None

Approval

None

Patch

None

Priority

Major
Configure