WS-1431: Implementing --for-download mode
Another big one, sorry!
There are a few changes in play here:
- Formerly,
LocatedFile
just wrote files to whatever path it knew about. Now there is aFetchContext
that it collaborates with to determine the location. - Because of this, I made
FetchContext
into an interface and replaced the plumbing ofForceMode
withFetchContext
, since it has theForceMode
on it anyway, and I don't want to keep widening the APIs - There is now a
ProductMetadata
type, service, and corresponding fetcher. This required makingFetchPlan
a decorator too, since it didn't seem like there was a good way to interpose creating the singularproducts.json
file as a normalFileFetcher
instance. This also means it isn't part of the progress reporting system, but it's probably OK because it's always cheap to generate - We have a new command line option for choosing the destination, using the aforementioned plumbing
- The
--for-download
option now works by conditionalizing how the destination path is generated and decorating the overallFetchPlan
It would be good to add some tests for the Metadata stuff, but I think this MR is basically ready to go.