Change jakefile to throw exception if there's a syntax error, etc in one of the optionally required modules.

This commit is contained in:
Tom Robinson
2010-02-08 23:44:44 -08:00
parent 1f7afe7a49
commit cebff75992
+10 -8
View File
@@ -118,20 +118,15 @@ global.FIXME_fileDependency = function(destinationPath, sourcePath)
// used in serializedENV()
function additionalPackages()
{
var unbuiltObjectiveJPackage = FILE.path($HOME_DIR).join("Objective-J", "CommonJS", "");
var builtObjectiveJPackage = FILE.path($BUILD_CONFIGURATION_DIR).join("CommonJS", "objective-j", "");
var builtCappuccinoPackage = FILE.path($BUILD_CONFIGURATION_DIR).join("CommonJS", "cappuccino", "");
var packages = [];
// load built objective-j if exists, otherwise unbuilt
// FIXME: this isn't quite correct. sometimes we want the unbuilt one to have priority.
if (builtObjectiveJPackage.join("package.json").exists()) {
if (!packageInCatalog(builtObjectiveJPackage))
packages.push(builtObjectiveJPackage);
} else {
if (!packageInCatalog(unbuiltObjectiveJPackage))
packages.push(unbuiltObjectiveJPackage);
}
// load built cappuccino if it exists
@@ -184,6 +179,13 @@ function reforkWithPackages()
reforkWithPackages();
function throwIfNotRequireError(e) {
if (String(e).indexOf("require error")==-1) {
print("setupEnvironment: " + e);
throw e;
}
}
function setupEnvironment()
{
// TODO: deprecate these globals
@@ -196,13 +198,13 @@ function setupEnvironment()
global.BundleTask = OBJECTIVE_J_JAKE.BundleTask;
} catch (e) {
//print("setupEnvironment (app, bundle, framework, BundleTask): " + e);
throwIfNotRequireError(e);
}
try {
require("objective-j").OBJJ_INCLUDE_PATHS.push(FILE.join($BUILD_CONFIGURATION_DIR, "CommonJS", "cappuccino", "Frameworks"));
} catch (e) {
//print("setupEnvironment (OBJJ_INCLUDE_PATHS): " + e);
throwIfNotRequireError(e);
}
try {
@@ -213,7 +215,7 @@ function setupEnvironment()
// print("no blend!")
}
catch (e) {
//print("setupEnvironment (blend): " + e);
throwIfNotRequireError(e);
}
}