This commit is contained in:
Alex Yatskov 2021-04-25 08:57:24 -07:00
parent 14c434a6a4
commit 3155de7542
2 changed files with 8 additions and 8 deletions

View File

@ -67,8 +67,8 @@ func (context *Context) DispatchFile(file *File) {
// dependencies on any input files that are needed to generate it, and then
// passes it to the next link in the chain.
func (context *Context) DispatchAndCacheFile(outputFile *File, inputFiles ...*File) {
if context.goldsmith.fileCache != nil {
context.goldsmith.fileCache.storeFile(context, outputFile, inputFiles)
if context.goldsmith.cache != nil {
context.goldsmith.cache.storeFile(context, outputFile, inputFiles)
}
context.filesOut <- outputFile
@ -79,8 +79,8 @@ func (context *Context) DispatchAndCacheFile(outputFile *File, inputFiles ...*Fi
// will return nil if the desired file is not found in the cache.
func (context *Context) RetrieveCachedFile(outputPath string, inputFiles ...*File) *File {
var outputFile *File
if context.goldsmith.fileCache != nil {
outputFile, _ = context.goldsmith.fileCache.retrieveFile(context, outputPath, inputFiles)
if context.goldsmith.cache != nil {
outputFile, _ = context.goldsmith.cache.retrieveFile(context, outputPath, inputFiles)
}
return outputFile

View File

@ -16,7 +16,7 @@ type Goldsmith struct {
contexts []*Context
contextHasher hash.Hash32
fileCache *cache
cache *cache
filters filterStack
clean bool
@ -37,7 +37,7 @@ func Begin(sourceDir string) *Goldsmith {
// Cache enables caching in cacheDir for the remainder of the chain.
func (goldsmith *Goldsmith) Cache(cacheDir string) *Goldsmith {
goldsmith.fileCache = &cache{cacheDir}
goldsmith.cache = &cache{cacheDir}
return goldsmith
}