clean up publishPackage API

The call from publish-release --from-checkout has not been updated yet.
This commit is contained in:
David Glasser
2014-11-21 20:20:10 -08:00
parent 960bd07e53
commit c3b545b9aa
2 changed files with 26 additions and 17 deletions

View File

@@ -274,16 +274,17 @@ main.registerCommand({
// We have initialized everything, so perform the publish operation.
var binary = isopack.platformSpecific();
main.captureAndExit(
"=> Errors while publishing the package:",
"=> Errors while publishing:",
"publishing the package",
function () {
// XXX #3006 clean up this ridiculous API
packageClient.publishPackage(
packageSource, conn, projectContext.localCatalog, isopack, projectContext.isopackCache, {
new: options.create,
existingVersion: options['existing-version'],
doNotPublishBuild: binary && !options['existing-version']
});
packageClient.publishPackage({
projectContext: projectContext,
packageSource: packageSource,
connection: conn,
new: options.create,
existingVersion: options['existing-version'],
doNotPublishBuild: binary && !options['existing-version']
});
});
Console.info('Published ' + packageName + '@' + localVersionRecord.version +

View File

@@ -391,17 +391,19 @@ exports.handlePackageServerConnectionError = function (error) {
// doNotPublishBuild: do not publish the build of this package.
//
// Return true on success and an error code otherwise.
exports.publishPackage = function (packageSource, conn, localCatalog, isopack, isopackCache, options) {
// XXX #3006 redo docs
exports.publishPackage = function (options) {
buildmessage.assertInJob();
options = options || {};
if (options.new && options.existingVersion)
throw Error("is it new or does it exist?!?");
var packageSource = options.packageSource;
var conn = options.connection;
var projectContext = options.projectContext;
var name = packageSource.name;
var version = packageSource.version;
if (options.new && options.existingVersion)
throw Error("is it new or does it exist?!?");
// Check that the package name is valid.
utils.validatePackageName(name, { useBuildmessage: true });
if (buildmessage.jobHasMessages())
@@ -451,12 +453,13 @@ exports.publishPackage = function (packageSource, conn, localCatalog, isopack, i
_.each(packageDeps, function(refs, label) {
if (refs.constraint == null) {
if (packageSource.isCore && files.inCheckout() &&
localCatalog.getPackage(label)) {
projectContext.localCatalog.getPackage(label)) {
// Core package is using or implying another core package,
// without a version number. We fill in the version number.
// (Well, we're assuming that the other package is core and
// not some other sort of local package.)
var versionString = localCatalog.getLatestVersion(label).version;
var versionString =
projectContext.localCatalog.getLatestVersion(label).version;
// modify the constraint on this dep that will be sent to troposphere
refs.constraint = versionString;
} else if (label === "meteor") {
@@ -479,6 +482,10 @@ exports.publishPackage = function (packageSource, conn, localCatalog, isopack, i
if (buildmessage.jobHasMessages())
return;
var isopack = projectContext.isopackCache.getIsopack(name);
if (! isopack)
throw Error("no isopack " + name);
var sourceFiles = isopack.getSourceFilesUnderSourceRoot(
packageSource.sourceRoot);
if (! sourceFiles)
@@ -487,7 +494,8 @@ exports.publishPackage = function (packageSource, conn, localCatalog, isopack, i
// We need to have built the test package to get all of its sources, even
// though we're not publishing a BUILD for the test package.
if (packageSource.testName) {
var testIsopack = isopackCache.getIsopack(packageSource.testName);
var testIsopack = projectContext.isopackCache.getIsopack(
packageSource.testName);
if (! testIsopack)
throw Error("no testIsopack " + packageSource.testName);
var testSourceFiles = testIsopack.getSourceFilesUnderSourceRoot(