on master help sign in
language: fix: move interface files to a different (#1074)

* language: fix: move interface files to a different This fixes https://github.com/digital-asset/daml/issues/1009. We move the created interface files and hie files to a hidden directory ".interfaces" when creating a package. * removing the ifaceDir option and hardcode the dir

commit160554ac95608130fc01062af8a7bddeeedfd1a3 authorRobin Krom <robin@digitalasset.com> dateFri 10 May 2019, 18:40 (7 years ago) parent0ac72a4
1 file changed+5−2
src/Development/IDE/Functions/Compile.hs+5−2
src/Development/IDE/Functions/Compile.hs+5−2
@@ -62,6 +62,7 @@ import Data.Time
6262import Development.IDE.Types.SpanInfo
6363import GHC.Generics (Generic)
6464import System.FilePath
65+import System.Directory
6566
6667-- | 'CoreModule' together with some additional information required for the
6768-- conversion to DAML-LF.
@@ -274,12 +275,14 @@ mkTcModuleResult (WriteInterface writeIface) tcm = do
274275 nc <- liftIO $ readIORef (hsc_NC session)
275276 (iface,_) <- liftIO $ mkIfaceTc session Nothing Sf_None details tcGblEnv
276277 liftIO $ when writeIface $ do
277− writeIfaceFile (hsc_dflags session) (replaceExtension (file tcm) ".hi") iface
278+ let path = ".interfaces" </> file tcm
279+ createDirectoryIfMissing True (takeDirectory path)
280+ writeIfaceFile (hsc_dflags session) (replaceExtension path ".hi") iface
278281 -- For now, we write .hie files whenever we write .hi files which roughly corresponds to
279282 -- when we are building a package. It should be easily decoupable if that turns out to be
280283 -- useful.
281284 hieFile <- runHsc session $ mkHieFile (tcModSummary tcm) tcGblEnv (fromJust $ renamedSource tcm)
282− writeHieFile (replaceExtension (file tcm) ".hie") hieFile
285+ writeHieFile (replaceExtension path ".hie") hieFile
283286 let mod_info = HomeModInfo iface details Nothing
284287 origNc = nsNames nc
285288 case lookupModuleEnv origNc (tcmModule tcm) of