-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make wrapper name unique using its source hash #117
Conversation
getCacheDir :: FilePath -> IO FilePath | ||
getCacheDir fp = getXdgDirectory XdgCache (cacheDir </> fp) | ||
getCacheDir fp = do | ||
mbEnvCacheDirectory <- lookupEnv "HIE_BIOS_CACHE_DIR" | ||
cacheBaseDir <- maybe (getXdgDirectory XdgCache cacheDir) return | ||
mbEnvCacheDirectory | ||
return (cacheBaseDir </> fp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More Documentation for this function please!
Also, getCacheDir
is probably a misnomer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm it retrieves the cache directory used by the lib, getHieBiosCacheDir
would be better or you are thinking in another deficiency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe a misnomer... Mainly adding documentation for the env variable and so on suffices for me.
Before this the wrapper used the project version to cache the wrapper executable
That led to false negatives testing the compilation and execution of the wrapper using the
bios-test
test suite cause the tests reused a previous wrapper executable between commits of the same version%XDG_DIRECTORY%\hie-bios
to avoid itI've used
GHC.Fingerprint
to hash the source file and cache the executable using its source (the most accurate one although non semantic changes will cause a cache miss)I've cherry-picked my changes onto
0.3.0
and0.3.1
to check the test suite with them:0.3.0
: https://ci.appveyor.com/project/jneira/hie-bios/builds/29673096/job/9x5k66k9ittfyvy00.3.1
: https://ci.appveyor.com/project/jneira/hie-bios/builds/29673244/job/nxkbys8o1gt737vqIn both cases the test suite fails.
%XDG_DIRECTORY%\hie-bios
between ci builds and the wrapper would be compiled every time.%XDG_DIRECTORY%\hie-bios
in ci for some reason it will suffer the false negatives as wellI am using a new en var
%HIE_BIOS_CACHE_DIR%
to let users change the default one (without change the general%XDG_CACHEDIR%
). It is not strictly necessary but it is a common practice to avoid issues with file permissions (in some envs the creation of executable files inside user directory is forbidden f.e.)Fixes #114