mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
cache built packages in package cache
This commit is contained in:
@@ -609,6 +609,9 @@ _.extend(CompleteCatalog.prototype, {
|
||||
// And put a build record for it in the catalog
|
||||
var versionId = self.getLatestVersion(name);
|
||||
|
||||
packageCache.packageCache.cachePackageAtPath(
|
||||
name, sourcePath, unipackage);
|
||||
|
||||
self.builds.push({
|
||||
packageName: name,
|
||||
architecture: unipackage.architectures().join('+'),
|
||||
@@ -618,11 +621,6 @@ _.extend(CompleteCatalog.prototype, {
|
||||
lastUpdated: null,
|
||||
buildPublished: null
|
||||
});
|
||||
|
||||
// XXX XXX maybe you actually want to, like, save the unipackage
|
||||
// in memory into a cache? rather than leaving packageCache to
|
||||
// reload it? or maybe packageCache is unified into catalog
|
||||
// somehow? sleep on it
|
||||
},
|
||||
// Add a local package to the catalog. `name` is the name to use for
|
||||
// the package and `directory` is the directory that contains the
|
||||
|
||||
@@ -44,6 +44,19 @@ _.extend(PackageCache.prototype, {
|
||||
self.loadedPackages = {};
|
||||
},
|
||||
|
||||
|
||||
cachePackageAtPath : function (name, loadPath, unipackage) {
|
||||
var self = this;
|
||||
var key = name + "@" + loadPath;
|
||||
var buildDir = path.join(loadPath, '.build.'+ name);
|
||||
|
||||
self.loadedPackages[key] = {
|
||||
pkg: unipackage,
|
||||
sourceDir: loadPath,
|
||||
buildDir: buildDir
|
||||
};
|
||||
},
|
||||
|
||||
// Given a path to a package on disk, retrieve a Package
|
||||
// object.
|
||||
//
|
||||
@@ -90,7 +103,7 @@ _.extend(PackageCache.prototype, {
|
||||
}
|
||||
|
||||
if (isUpToDate) {
|
||||
// Cache hit
|
||||
// Cache it
|
||||
self.loadedPackages[key] = entry;
|
||||
return entry.pkg;
|
||||
}
|
||||
@@ -121,7 +134,7 @@ _.extend(PackageCache.prototype, {
|
||||
if (fs.existsSync(buildDir)) {
|
||||
unipackage = new Unipackage.Unipackage;
|
||||
unipackage.initFromPath(name, buildDir);
|
||||
if (compiler.checkUpToDate(packageSource, unipackage)) {
|
||||
if (compiler.checkUpToDate(packageSource, unipackage)) {
|
||||
self.loadedPackages[key] = { pkg: unipackage,
|
||||
sourceDir: loadPath,
|
||||
buildDir: buildDir
|
||||
@@ -179,6 +192,7 @@ _.extend(PackageCache.prototype, {
|
||||
packageSource.initFromAppDir(appDir, ignoreFiles);
|
||||
return compiler.compile(packageSource).unipackage;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
packageCache.packageCache = new PackageCache;
|
||||
|
||||
Reference in New Issue
Block a user