restore toml cache regression
This commit is contained in:
11
package.cm
11
package.cm
@@ -5,6 +5,9 @@ var json = use('json')
|
||||
var os = use('os')
|
||||
var link = use('link')
|
||||
|
||||
// Cache for loaded configs to avoid toml re-parsing corruption
|
||||
var config_cache = {}
|
||||
|
||||
// Convert package name to a safe directory name
|
||||
// For absolute paths (local packages), replace / with _
|
||||
// For remote packages, keep slashes as they use nested directories
|
||||
@@ -43,6 +46,10 @@ package.load_config = function(name)
|
||||
{
|
||||
var config_path = get_path(name) + '/cell.toml'
|
||||
|
||||
// Return cached config if available
|
||||
if (config_cache[config_path])
|
||||
return config_cache[config_path]
|
||||
|
||||
if (!fd.is_file(config_path)) {
|
||||
throw Error(`${config_path} does not exist`)
|
||||
}
|
||||
@@ -56,6 +63,10 @@ package.load_config = function(name)
|
||||
return {}
|
||||
}
|
||||
|
||||
// Deep copy to avoid toml module's shared state bug and cache it
|
||||
result = json.decode(json.encode(result))
|
||||
config_cache[config_path] = result
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ if (target_pkg) {
|
||||
}
|
||||
}
|
||||
|
||||
if (length(updated_packages)) > 0) {
|
||||
if (length(updated_packages) > 0) {
|
||||
log.console("Updated " + text(length(updated_packages)) + " package" + (length(updated_packages) == 1 ? "" : "s") + ".")
|
||||
} else {
|
||||
log.console("All packages are up to date.")
|
||||
@@ -135,13 +135,12 @@ if (run_build && length(updated_packages) > 0) {
|
||||
arrfor(updated_packages, function(pkg) {
|
||||
try {
|
||||
var lib = build.build_dynamic(pkg, target_triple, 'release')
|
||||
if (lib) {
|
||||
if (lib)
|
||||
log.console(" Built: " + lib)
|
||||
}
|
||||
} catch (e) {
|
||||
log.error(" Failed to build " + pkg + ": " + e)
|
||||
}
|
||||
}, null, null)
|
||||
})
|
||||
}
|
||||
|
||||
$stop()
|
||||
|
||||
Reference in New Issue
Block a user