mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Cleanup Jakefiles, enquote arguments, add built packages bin to PATH so ojtest runs / uses the correct Cappuccino, etc.
This commit is contained in:
@@ -165,13 +165,13 @@ task ("deploy", ["downloads"], function()
|
||||
var starter_zip_output = FILE.join($BUILD_DIR, 'Cappuccino', 'Starter.zip');
|
||||
rm_rf(starter_zip_output);
|
||||
|
||||
OS.system("cd " + cappuccino_output_path + " && zip -ry -8 Starter.zip Starter");
|
||||
OS.system("cd " + OS.enquote(cappuccino_output_path) + " && zip -ry -8 Starter.zip Starter");
|
||||
|
||||
// zip the tools pack
|
||||
var tools_zip_output = FILE.join($BUILD_DIR, 'Cappuccino', 'Tools.zip')
|
||||
rm_rf(tools_zip_output);
|
||||
|
||||
OS.system("cd " + cappuccino_output_path + " && zip -ry -8 Tools.zip Tools");
|
||||
OS.system("cd " + OS.enquote(cappuccino_output_path) + " && zip -ry -8 Tools.zip Tools");
|
||||
});
|
||||
|
||||
// Testing
|
||||
@@ -183,7 +183,7 @@ task("test-only", function()
|
||||
var tests = new FileList('Tests/**/*Test.j');
|
||||
var cmd = ["ojtest"].concat(tests.items());
|
||||
|
||||
var code = OS.system(cmd);
|
||||
var code = OS.system(serializedENV() + " " + cmd.map(OS.enquote).join(" "));
|
||||
if (code !== 0)
|
||||
OS.exit(code);
|
||||
});
|
||||
|
||||
+10
-11
@@ -32,8 +32,8 @@ $BROWSER_FILE = FILE.join("Browser", "Objective-J.js");
|
||||
$BUILD_OBJECTIVE_J = FILE.join($BUILD_CONFIGURATION_DIR, "Objective-J");
|
||||
$BUILD_BROWSER_FILE = FILE.join($BUILD_OBJECTIVE_J, "Objective-J.js");
|
||||
|
||||
$INCLUDE_FLAGS = " -I" + FILE.cwd();
|
||||
$DEBUG_FLAGS = $CONFIGURATION === "Debug" ? " -DDEBUG=1 " : "";
|
||||
$INCLUDE_FLAGS = ["-I" + FILE.cwd()];
|
||||
$DEBUG_FLAGS = $CONFIGURATION === "Debug" ? ["-DDEBUG=1"] : [""];
|
||||
$OBJECTIVEJ_FILES = new FileList("*.js");
|
||||
|
||||
$BROWSER_FILES = new FileList($BROWSER_FILE).include($OBJECTIVEJ_FILES);
|
||||
@@ -42,7 +42,7 @@ filedir($BUILD_BROWSER_FILE, $BROWSER_FILES, function(aTask)
|
||||
{
|
||||
gcc($BROWSER_FILE,
|
||||
$BUILD_BROWSER_FILE,
|
||||
environmentFlags("Browser", "ObjJ") + $INCLUDE_FLAGS + $DEBUG_FLAGS, $CONFIGURATION !== "Debug");
|
||||
environmentFlags("Browser", "ObjJ").concat($INCLUDE_FLAGS, $DEBUG_FLAGS), $CONFIGURATION !== "Debug");
|
||||
});
|
||||
|
||||
$LICENSE = FILE.join("CommonJS", "lib", "objective-j", "jake", "LICENSES", "LGPL-v2.1");
|
||||
@@ -71,7 +71,7 @@ new FileList("CommonJS/**/*").forEach(function(aFilename)
|
||||
else
|
||||
gcc(aFilename,
|
||||
buildFilename,
|
||||
environmentFlags("CommonJS", "ObjJ") + $INCLUDE_FLAGS + $DEBUG_FLAGS, false);
|
||||
environmentFlags("CommonJS", "ObjJ").concat($INCLUDE_FLAGS, $DEBUG_FLAGS), false);
|
||||
});
|
||||
|
||||
if (FILE.dirname(aFilename) === FILE.join("CommonJS", "bin"))
|
||||
@@ -97,13 +97,11 @@ CLOBBER.include($BUILD_OBJECTIVE_J);
|
||||
|
||||
function environmentFlags()
|
||||
{
|
||||
return Array.prototype.map.apply(arguments, [function(anEnvironment)
|
||||
{
|
||||
var environments = Array.prototype.slice.call(arguments)
|
||||
|
||||
return environments.map(function(anEnvironment) {
|
||||
return "-D" + anEnvironment.toUpperCase();
|
||||
}]).join(" ") +
|
||||
" -DENVIRONMENTS=\"[" + Array.prototype.map.apply(arguments, [function(anEnvironment) {
|
||||
return "\\\"" + anEnvironment + "\\\"";
|
||||
}]).join(", ") + "]\"";
|
||||
}).concat("-DENVIRONMENTS=" + JSON.stringify(environments));
|
||||
}
|
||||
|
||||
var SHRINKSAFE = require("minify/shrinksafe");
|
||||
@@ -116,7 +114,8 @@ function gcc(inputFilePath, outputFilePath, flags, compress)
|
||||
stream.print("Building... \0green(" + outputFilePath +"\0)");
|
||||
|
||||
// GCC preprocess the file.
|
||||
var gcc = OS.popen("gcc -E -x c -P " + flags + " " + inputFilePath, { charset:"UTF-8" });
|
||||
var cmd = ["gcc", "-E", "-x", "c", "-P"].concat(flags, inputFilePath);
|
||||
var gcc = OS.popen(cmd, { charset:"UTF-8" });
|
||||
|
||||
var contents = FILE.read("header.txt", { charset : "UTF-8" });
|
||||
contents += gcc.stdout.read();
|
||||
|
||||
+3
-3
@@ -94,7 +94,7 @@ fi
|
||||
|
||||
install_narwhal=""
|
||||
if which "narwhal" > /dev/null; then
|
||||
dir=$(dirname -- $(dirname -- $(which "narwhal")))
|
||||
dir=$(dirname -- "$(dirname -- $(which "narwhal"))")
|
||||
echo "Using Narwhal installation at \"$dir\". Is this correct?"
|
||||
if ! prompt; then
|
||||
echo "================================================================================"
|
||||
@@ -116,7 +116,7 @@ if [ "$install_narwhal" ]; then
|
||||
echo "To use the default location, \"$install_directory\", just hit enter/return, or enter another path:"
|
||||
read input
|
||||
if [ "$input" ]; then
|
||||
install_directory="`cd \`dirname $input\`; pwd`/`basename $input`"
|
||||
install_directory="`cd \`dirname "$input"\`; pwd`/`basename "$input"`"
|
||||
fi
|
||||
|
||||
if [ -d "$install_directory" ]; then
|
||||
@@ -158,7 +158,7 @@ if ! which "narwhal" > /dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install_directory=$(dirname $(dirname $(which narwhal)))
|
||||
install_directory=$(dirname -- "$(dirname -- "$(which narwhal)")")
|
||||
|
||||
echo "================================================================================"
|
||||
echo "Using Narwhal installation at \"$install_directory\". Is this correct?"
|
||||
|
||||
+8
-5
@@ -100,7 +100,7 @@ global.$BUILD_CONFIGURATION_DIR = FILE.join($BUILD_DIR, $CONFIGURATION);
|
||||
|
||||
global.$BUILD_CJS_OBJECTIVE_J = FILE.join($BUILD_CONFIGURATION_DIR, "CommonJS", "objective-j");
|
||||
|
||||
global.$BUILD_CJS_CAPPUCCINO = FILE.join($BUILD_DIR, $CONFIGURATION, "CommonJS", "cappuccino");
|
||||
global.$BUILD_CJS_CAPPUCCINO = FILE.join($BUILD_CONFIGURATION_DIR, "CommonJS", "cappuccino");
|
||||
global.$BUILD_CJS_CAPPUCCINO_BIN = FILE.join($BUILD_CJS_CAPPUCCINO, "bin");
|
||||
global.$BUILD_CJS_CAPPUCCINO_LIB = FILE.join($BUILD_CJS_CAPPUCCINO, "lib");
|
||||
global.$BUILD_CJS_CAPPUCCINO_FRAMEWORKS = FILE.join($BUILD_CJS_CAPPUCCINO, "Frameworks");
|
||||
@@ -149,7 +149,7 @@ function packageInCatalog(path)
|
||||
return false;
|
||||
}
|
||||
|
||||
function serializedENV()
|
||||
serializedENV = function()
|
||||
{
|
||||
var envNew = {};
|
||||
|
||||
@@ -161,8 +161,10 @@ function serializedENV()
|
||||
|
||||
// pseudo-HACK: add NARWHALOPT with packages we should ensure are loaded
|
||||
var packages = additionalPackages();
|
||||
if (packages.length)
|
||||
if (packages.length) {
|
||||
envNew["NARWHALOPT"] = packages.map(function(p) { return "-p " + p; }).join(" ");
|
||||
envNew["PATH"] = packages.map(function(p) { return FILE.join(p, "bin"); }).concat(SYSTEM.env["PATH"]).join(":");
|
||||
}
|
||||
|
||||
return Object.keys(envNew).map(function(key) {
|
||||
return key + "=" + OS.enquote(envNew[key]);
|
||||
@@ -182,7 +184,7 @@ reforkWithPackages();
|
||||
|
||||
function handleSetupEnvironmentError(e) {
|
||||
if (String(e).indexOf("require error")==-1) {
|
||||
print("setupEnvironment: " + e);
|
||||
print("setupEnvironment warning: " + e);
|
||||
//throw e;
|
||||
}
|
||||
}
|
||||
@@ -235,7 +237,8 @@ global.subjake = function(/*Array<String>*/ directories, /*String*/ aTaskName)
|
||||
{
|
||||
if (FILE.isDirectory(aDirectory) && FILE.isFile(FILE.join(aDirectory, "Jakefile")))
|
||||
{
|
||||
var returnCode = OS.system("cd " + aDirectory + " && " + serializedENV() + " " + SYSTEM.args[0] + " " + aTaskName);
|
||||
var cmd = "cd " + OS.enquote(aDirectory) + " && " + serializedENV() + " " + OS.enquote(SYSTEM.args[0]) + " " + OS.enquote(aTaskName);
|
||||
var returnCode = OS.system(cmd);
|
||||
if (returnCode)
|
||||
OS.exit(returnCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user