   # Build the source tree
   setRootPath: (p) ->
     @sourcePath = path.join p, 'src'
-    @compilePath = path.join p, 'tmp/compiled'
+    @tmpPath = path.join p, 'tmp'
     @outputPath = path.join p, 'build'
   build: (version) ->
     version = @defaultVersion unless version?

    throw "#{version} is not a valid version name" unless @versions[version]?
    builtFiles = []
    compiledFiles = []
    cvPath = path.join @compilePath, version
    for c, f of @generateCompileConfigTree() when not f.ignore
      compiledFiles.push f.targetFile(c)
    for bf, bfConf of @files
      # Check if we need update, searching sources one by one to get correct
      # dependency order
      bfPath = path.join @compilePath, version, bf
      sources = [bfConf.source] unless _.isArray bfConf.source
      matchedFiles = []
      requiresBuild = false
      for s in sources
        for cf in compiledFiles when (matchedFiles.indexOf cf is -1) and

        pathConf = @fileConfigTree[p][cJson][f] or {}
        pathConf = _.defaults c, pathConf
        @fileConfigTree[p][cJson][f] = pathConf
    @fileConfigTree[p][cJson]
  getHash: (data) ->
    hash = crypto.createHash 'sha1'
    hash.update data
    hash.digest 'base64'
  getFileHash: (file) -> @getHash fs.readFileSync(file, 'utf8')
  getCompilePath: (version) -> path.join @tmpPath, version, @compileDir
  getDatabaseFileName: (version, name) ->
    "#{path.join(@tmpPath, version, name)}.json"
  loadDatabase: (version, name) ->
    file = @getDatabaseFileName version, name
    return {} unless path.existsSync file
    JSON.parse fs.readFileSync(file, 'utf8')
  saveDatabase: (version, name, data) ->
    file = @getDatabaseFileName version, name
    fs.writeFileSync file, JSON.stringify(data)
  # Link to top level, made accessible inside the object for configuration.
  generateCompilerConfig: generateCompilerConfig
