Support working directory without copying files
mgsloan opened this issue · 3 comments
ide-backend is currently implemented in a fashion which assumes it's being used as a server. In particular, source files and data files are sent to it via the API, and it writes them to its own session directory structure.
Even if updateSourceFileFromFile
or updateDataFileFromFile
are used, it ends up copying the file.
I'd imagine the implementation of this looking something like the following (but of course I haven't tried this change, so I may well be missing some detail):
A new field for SessionConfig, which specifies a filepath to use for the local working directory - both source files and data files. This would look something like configLocalWorkingDirectory :: Maybe FilePath
. When this field is set to a Just
value:
- Possibly throw errors when "updateSourceFile*" / "updateDataFile*" are requested (as this would indicate using the server-style API)
- Always request a recompile, by adding something like
|| hasLocalWorkingDirectory
to needsRecompile. Then, we rely on GHC's timestamp checking for figuring out what needs to be recompiled. - Replace all usages of
ideSessionSourceDir
/ideSessionDataDir
with a function that uses theconfigLocalWorkingDirectory
field (except perhaps the bit that creates the directories, maybe other uses). I'm almost inclined to suggest removing these functions fromide-backend-common
, but hopefully any user of theide-backend
api will know to not rely on these directories when this new field is set.
+1
What happened to this issue and the pull request @mgsloan made? Shouldn't we close it? It seems to me that changes were merged. cc @chrisdone @snoyberg
This got merged in, yep.