Language.Java.Inline.Plugin can only be compiled from top level directory
Fuuzetsu opened this issue · 3 comments
Fuuzetsu commented
This file includes a C header at compile time with TH:
bctable_header :: String
bctable_header = $(do
let f = "cbits/bctable.h"
TH.addDependentFile f
TH.lift =<< TH.runIO (readFile f)
)
This only works if we compile the file from the root of inline-java
: this works fine for things like stack
but does not work for things like bazel
where the compilation might be occurring from "higher up". I don't know a good solution here.
facundominguez commented
I can think of two approaches:
- Put
cbits/bctable.h
in the data files and definebctable_header = unsafePerformIO $ getDataFile "bctable.h"
- Include the contents of
cbits/bctable.h
verbatim in the generated C stub so no file needs to be found at build or runtime.
Fuuzetsu commented
- Doesn't work for us as it requires on Paths_ which we don't support in bazel
- I don't know. I don't understand the details of why we're inlining it in the first place: clearly something to do with plugins. Are you suggesting that it's inlined in Plugin.hs? I'm not sure if it's that simple…
facundominguez commented
Are you suggesting that it's inlined in Plugin.hs? I'm not sure if it's that simple…
#include "path/to/bctable.h"
is inserted in a C stub in the plugin. Instead of doing this, we could expand the include with the contents of bctable.h
and remove bctable.h
from the repo.