compilation cache: better dependency checking

This commit is contained in:
Araq 2011-10-23 22:45:52 +02:00
commit a702524ae4
5 changed files with 34 additions and 14 deletions

View file

@ -171,6 +171,7 @@ proc CommandScan(filename: string) =
proc CommandSuggest(filename: string) =
msgs.gErrorMax = high(int) # do not stop after first error
semanticPasses()
registerPass(rodwrite.rodwritePass())
compileProject(filename)
proc WantFile(filename: string) =

View file

@ -27,7 +27,7 @@ type # please make sure we have under 32 options
# (for interfacing with C)
optProfiler # profiler turned on
TOptions* = set[TOption]
TGlobalOption* = enum
TGlobalOption* = enum # **keep binary compatible**
gloptNone, optForceFullMake, optBoehmGC, optRefcGC, optDeadCodeElim,
optListCmd, optCompileOnly, optNoLinking,
optSafeCode, # only allow safe code
@ -51,6 +51,7 @@ type # please make sure we have under 32 options
TGlobalOptions* = set[TGlobalOption]
TCommands* = enum # Nimrod's commands
# **keep binary compatible**
cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToOC,
cmdCompileToEcmaScript, cmdCompileToLLVM, cmdInterpret, cmdPretty, cmdDoc,
cmdGenDepend, cmdDump,
@ -93,10 +94,10 @@ const
DocTexConfig* = "nimdoc.tex.cfg"
# additional configuration variables:
var
gConfigVars*: PStringTable
libpath*: string = ""
projectPath*: string = ""
var
gConfigVars* = newStringTable(modeStyleInsensitive)
libpath* = ""
projectPath* = ""
projectName* = ""
nimcacheDir* = ""
gKeepComments*: bool = true # whether the parser needs to keep comments
@ -200,4 +201,3 @@ proc binaryStrSearch*(x: openarray[string], y: string): int =
return mid
result = - 1
gConfigVars = newStringTable(modeStyleInsensitive)

View file

@ -24,6 +24,8 @@
# - a section containing the compiler options and defines this
# module has been compiled with:
# OPTIONS:options\n
# GOPTIONS:options\n # global options
# CMD:command\n
# DEFINES:defines\n
# - FILES(
# myfile.inc
@ -106,7 +108,8 @@ const
"symbol file for $1 has the wrong version",
"file edited since last compilation: $1",
"list of conditional symbols changed for: $1",
"list of options changed for: $1", "an include file edited: $1",
"list of options changed for: $1",
"an include file edited: $1",
"a module $1 depends on has changed"]
type
@ -139,7 +142,7 @@ type
PRodReader* = ref TRodReader
const
FileVersion* = "1023" # modify this if the rod-format changes!
FileVersion* = "1024" # modify this if the rod-format changes!
var rodCompilerprocs*: TStrTable
@ -501,7 +504,15 @@ proc processRodFile(r: PRodReader, crc: TCrc32) =
inc(r.pos) # skip ':'
r.options = cast[TOptions](int32(decodeVInt(r.s, r.pos)))
if options.gOptions != r.options: r.reason = rrOptions
of "DEFINES":
of "GOPTIONS":
inc(r.pos) # skip ':'
var dep = cast[TGlobalOptions](int32(decodeVInt(r.s, r.pos)))
if gGlobalOptions != dep: r.reason = rrOptions
of "CMD":
inc(r.pos) # skip ':'
var dep = cast[TCommands](int32(decodeVInt(r.s, r.pos)))
if gCmd != dep: r.reason = rrOptions
of "DEFINES":
inc(r.pos) # skip ':'
d = 0
while r.s[r.pos] > '\x0A':

View file

@ -421,6 +421,16 @@ proc writeRod(w: PRodWriter) =
encodeVInt(cast[int32](w.options), options)
f.write(options)
f.write(rodNL)
var goptions = "GOPTIONS:"
encodeVInt(cast[int32](gGlobalOptions), goptions)
f.write(goptions)
f.write(rodNL)
var cmd = "CMD:"
encodeVInt(cast[int32](gCmd), cmd)
f.write(cmd)
f.write(rodNL)
f.write("DEFINES:")
f.write(w.defines)

View file

@ -29,8 +29,6 @@ incremental compilation
- test G, A, B example from the documentation
- test init sections
- fix remaining bugs
version 0.9.0
=============
@ -66,9 +64,9 @@ Bugs
result = forward(x)
- bug: DLL generation is broken
- bug: stress testing basic method example (eval) without ``-d:relase`` leaks
memory; good way to figure out how a fixed amount of stack can hold
an arbitrary number of GC roots!
- bug: stress testing basic method example (eval example)
without ``-d:relase`` leaks memory; good way to figure out how a
fixed amount of stack can hold an arbitrary number of GC roots!
version 0.9.XX