aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/src
diff options
context:
space:
mode:
authorBrad Richardson <everythingfunctional@protonmail.com>2020-10-20 14:24:55 -0500
committerBrad Richardson <everythingfunctional@protonmail.com>2020-10-20 14:24:55 -0500
commit55590e78dd6df0eac312eaadfc230533adfe0018 (patch)
tree63f413b4d669a1158a034d8241c3bfeae3cff48c /bootstrap/src
parent5db397ddca9ffa5558fb80ebfad73332f8c52cd6 (diff)
downloadfpm-55590e78dd6df0eac312eaadfc230533adfe0018.tar.gz
fpm-55590e78dd6df0eac312eaadfc230533adfe0018.zip
Add tests for module's compile time info
Diffstat (limited to 'bootstrap/src')
-rw-r--r--bootstrap/src/BuildModel.hs21
1 files changed, 17 insertions, 4 deletions
diff --git a/bootstrap/src/BuildModel.hs b/bootstrap/src/BuildModel.hs
index f4c809f..c6e422b 100644
--- a/bootstrap/src/BuildModel.hs
+++ b/bootstrap/src/BuildModel.hs
@@ -94,15 +94,28 @@ processRawSource rawSource =
else undefined
constructCompileTimeInfo :: Source -> [String] -> FilePath -> CompileTimeInfo
-constructCompileTimeInfo program@(Program{}) availableModules buildDirectory =
+constructCompileTimeInfo p@(Program{}) availableModules buildDirectory =
CompileTimeInfo
- { compileTimeInfoSourceFileName = programSourceFileName program
- , compileTimeInfoObjectFileProduced = (programObjectFileName program)
+ { compileTimeInfoSourceFileName = programSourceFileName p
+ , compileTimeInfoObjectFileProduced = (programObjectFileName p)
buildDirectory
, compileTimeInfoOtherFilesProduced = []
, compileTimeInfoDirectDependencies = map
(\mName -> buildDirectory </> mName <.> "mod")
- (filter (`elem` availableModules) (programModulesUsed program))
+ (filter (`elem` availableModules) (programModulesUsed p))
+ }
+constructCompileTimeInfo m@(Module{}) availableModules buildDirectory =
+ CompileTimeInfo
+ { compileTimeInfoSourceFileName = moduleSourceFileName m
+ , compileTimeInfoObjectFileProduced = (moduleObjectFileName m)
+ buildDirectory
+ , compileTimeInfoOtherFilesProduced =
+ (buildDirectory </> moduleName m <.> "mod") : if moduleProducesSmod m
+ then [buildDirectory </> moduleName m <.> "smod"]
+ else []
+ , compileTimeInfoDirectDependencies = map
+ (\mName -> buildDirectory </> mName <.> "mod")
+ (filter (`elem` availableModules) (moduleModulesUsed m))
}
constructCompileTimeInfo _ otherSources buildDirectory = undefined