builder: remove unused cacheKey parameter
This key was intended as some sort of cache key (as the name indicates) but that never happened. Let's remove it to avoid clutter. The cacheLoad and cacheStore functions are only used for C libraries (libc, compiler-rt) so their caching behavior is a bit different from other things worth caching.
Этот коммит содержится в:
родитель
2e9c3a1d8d
коммит
74fe213b15
2 изменённых файлов: 4 добавлений и 9 удалений
|
@ -30,10 +30,7 @@ func cacheTimestamp(paths []string) (time.Time, error) {
|
||||||
// Try to load a given file from the cache. Return "", nil if no cached file can
|
// Try to load a given file from the cache. Return "", nil if no cached file can
|
||||||
// be found (or the file is stale), return the absolute path if there is a cache
|
// be found (or the file is stale), return the absolute path if there is a cache
|
||||||
// and return an error on I/O errors.
|
// and return an error on I/O errors.
|
||||||
//
|
func cacheLoad(name string, sourceFiles []string) (string, error) {
|
||||||
// TODO: the configKey is currently ignored. It is supposed to be used as extra
|
|
||||||
// data for the cache key, like the compiler version and arguments.
|
|
||||||
func cacheLoad(name, configKey string, sourceFiles []string) (string, error) {
|
|
||||||
cachepath := filepath.Join(goenv.Get("GOCACHE"), name)
|
cachepath := filepath.Join(goenv.Get("GOCACHE"), name)
|
||||||
cacheStat, err := os.Stat(cachepath)
|
cacheStat, err := os.Stat(cachepath)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
@ -58,9 +55,7 @@ func cacheLoad(name, configKey string, sourceFiles []string) (string, error) {
|
||||||
|
|
||||||
// Store the file located at tmppath in the cache with the given name. The
|
// Store the file located at tmppath in the cache with the given name. The
|
||||||
// tmppath may or may not be gone afterwards.
|
// tmppath may or may not be gone afterwards.
|
||||||
//
|
func cacheStore(tmppath, name string, sourceFiles []string) (string, error) {
|
||||||
// Note: the configKey is ignored, see cacheLoad.
|
|
||||||
func cacheStore(tmppath, name, configKey string, sourceFiles []string) (string, error) {
|
|
||||||
// get the last modified time
|
// get the last modified time
|
||||||
if len(sourceFiles) == 0 {
|
if len(sourceFiles) == 0 {
|
||||||
panic("cache: no source files")
|
panic("cache: no source files")
|
||||||
|
|
|
@ -71,7 +71,7 @@ func (l *Library) load(target, tmpdir string) (path string, job *compileJob, err
|
||||||
outfile := l.name + "-" + target + ".a"
|
outfile := l.name + "-" + target + ".a"
|
||||||
|
|
||||||
// Try to fetch this library from the cache.
|
// Try to fetch this library from the cache.
|
||||||
if path, err := cacheLoad(outfile, commands["clang"][0], l.sourcePaths(target)); path != "" || err != nil {
|
if path, err := cacheLoad(outfile, l.sourcePaths(target)); path != "" || err != nil {
|
||||||
// Cache hit.
|
// Cache hit.
|
||||||
return path, nil, err
|
return path, nil, err
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ func (l *Library) load(target, tmpdir string) (path string, job *compileJob, err
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Store this archive in the cache.
|
// Store this archive in the cache.
|
||||||
_, err = cacheStore(arpath, outfile, commands["clang"][0], l.sourcePaths(target))
|
_, err = cacheStore(arpath, outfile, l.sourcePaths(target))
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче