incremental compilation: simple recompilation works
This commit is contained in:
parent
1e08fff2d5
commit
6acffcd28f
4 changed files with 11 additions and 0 deletions
|
|
@ -67,6 +67,7 @@ proc compileModule*(graph: ModuleGraph; fileIdx: FileIndex; flags: TSymFlags): P
|
||||||
graph.config.mainPackageId = result.owner.id
|
graph.config.mainPackageId = result.owner.id
|
||||||
|
|
||||||
result.id = getModuleId(graph, fileIdx, AbsoluteFile toFullPath(graph.config, fileIdx))
|
result.id = getModuleId(graph, fileIdx, AbsoluteFile toFullPath(graph.config, fileIdx))
|
||||||
|
registerModule(graph, result)
|
||||||
discard processModule(graph, result,
|
discard processModule(graph, result,
|
||||||
if sfMainModule in flags and graph.config.projectIsStdin: stdin.llStreamOpen else: nil)
|
if sfMainModule in flags and graph.config.projectIsStdin: stdin.llStreamOpen else: nil)
|
||||||
elif graph.isDirty(result):
|
elif graph.isDirty(result):
|
||||||
|
|
@ -128,6 +129,7 @@ proc compileProject*(graph: ModuleGraph; projectFileIdx = InvalidFileIDX) =
|
||||||
proc makeModule*(graph: ModuleGraph; filename: AbsoluteFile): PSym =
|
proc makeModule*(graph: ModuleGraph; filename: AbsoluteFile): PSym =
|
||||||
result = graph.newModule(fileInfoIdx(graph.config, filename))
|
result = graph.newModule(fileInfoIdx(graph.config, filename))
|
||||||
result.id = getID()
|
result.id = getID()
|
||||||
|
registerModule(graph, result)
|
||||||
|
|
||||||
proc makeModule*(graph: ModuleGraph; filename: string): PSym =
|
proc makeModule*(graph: ModuleGraph; filename: string): PSym =
|
||||||
result = makeModule(graph, AbsoluteFile filename)
|
result = makeModule(graph, AbsoluteFile filename)
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ when not nimIncremental:
|
||||||
|
|
||||||
template storeRemaining*(g: ModuleGraph; module: PSym) = discard
|
template storeRemaining*(g: ModuleGraph; module: PSym) = discard
|
||||||
|
|
||||||
|
template registerModule*(g: ModuleGraph; module: PSym) = discard
|
||||||
|
|
||||||
else:
|
else:
|
||||||
include rodimpl
|
include rodimpl
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -752,6 +752,9 @@ proc loadSym(g; id: int; info: TLineInfo): PSym =
|
||||||
result = loadSymFromBlob(g, b, info)
|
result = loadSymFromBlob(g, b, info)
|
||||||
doAssert id == result.id, "symbol ID is not consistent!"
|
doAssert id == result.id, "symbol ID is not consistent!"
|
||||||
|
|
||||||
|
proc registerModule*(g; module: PSym) =
|
||||||
|
g.incr.r.syms.add(abs module.id, module)
|
||||||
|
|
||||||
proc loadModuleSymTab(g; module: PSym) =
|
proc loadModuleSymTab(g; module: PSym) =
|
||||||
## goal: fill module.tab
|
## goal: fill module.tab
|
||||||
g.incr.r.syms.add(module.id, module)
|
g.incr.r.syms.add(module.id, module)
|
||||||
|
|
@ -868,6 +871,7 @@ proc setupModuleCache*(g: ModuleGraph) =
|
||||||
let dbfile = getNimcacheDir(g.config) / RelativeFile"rodfiles.db"
|
let dbfile = getNimcacheDir(g.config) / RelativeFile"rodfiles.db"
|
||||||
if g.config.symbolFiles == writeOnlySf:
|
if g.config.symbolFiles == writeOnlySf:
|
||||||
removeFile(dbfile)
|
removeFile(dbfile)
|
||||||
|
createDir getNimcacheDir(g.config)
|
||||||
if not fileExists(dbfile):
|
if not fileExists(dbfile):
|
||||||
db = open(connection=string dbfile, user="nim", password="",
|
db = open(connection=string dbfile, user="nim", password="",
|
||||||
database="nim")
|
database="nim")
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,8 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
|
||||||
proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
|
proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
|
||||||
freshDefines=true; conf: ConfigRef) =
|
freshDefines=true; conf: ConfigRef) =
|
||||||
rawMessage(conf, hintConf, scriptName.string)
|
rawMessage(conf, hintConf, scriptName.string)
|
||||||
|
let oldSymbolFiles = conf.symbolFiles
|
||||||
|
conf.symbolFiles = disabledSf
|
||||||
|
|
||||||
let graph = newModuleGraph(cache, conf)
|
let graph = newModuleGraph(cache, conf)
|
||||||
connectCallbacks(graph)
|
connectCallbacks(graph)
|
||||||
|
|
@ -184,3 +186,4 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
|
||||||
#initDefines()
|
#initDefines()
|
||||||
undefSymbol(conf.symbols, "nimscript")
|
undefSymbol(conf.symbols, "nimscript")
|
||||||
undefSymbol(conf.symbols, "nimconfig")
|
undefSymbol(conf.symbols, "nimconfig")
|
||||||
|
conf.symbolFiles = oldSymbolFiles
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue