Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup some build scripts

  • Loading branch information...
commit bab0024e0cba8e1e6f635c036b077426d27a8c05 1 parent deed92c
tlrobinson authored
Showing with 67 additions and 30 deletions.
  1. +8 −8 Jakefile
  2. +51 −18 Objective-J/Jakefile
  3. +5 −4 Rakefile
  4. +3 −0  common.jake
View
16 Jakefile
@@ -48,7 +48,7 @@ task ("install", ["CommonJS"], function()
{
// FIXME: require("narwhal/tusk/install").install({}, $COMMONJS);
// Doesn't work due to some weird this.print business.
- OS.system("sudo tusk install --force " + $BUILD_CJS_OBJECTIVE_J + " " + $BUILD_CJS_CAPPUCCINO);
+ OS.system(["sudo", "tusk", "install", "--force", $BUILD_CJS_OBJECTIVE_J, $BUILD_CJS_CAPPUCCINO]);
});
// Documentation
@@ -61,7 +61,7 @@ task ("documentation", function()
{
if (executableExists("doxygen"))
{
- if (OS.system("doxygen " + FILE.join("Tools", "Documentation", "Cappuccino.doxygen")))
+ if (OS.system(["doxygen", FILE.join("Tools", "Documentation", "Cappuccino.doxygen")]))
OS.exit(1); //rake abort if ($? != 0)
rm_rf($DOCUMENTATION_BUILD);
@@ -95,7 +95,7 @@ filedir ($STARTER_DOWNLOAD_APPLICATION, ["CommonJS"], function()
rm_rf($STARTER_DOWNLOAD_APPLICATION);
FILE.mkdirs($STARTER_DOWNLOAD);
- if (OS.system("capp gen " + $STARTER_DOWNLOAD_APPLICATION + " -t Application --noconfig"))
+ if (OS.system(["capp", "gen", $STARTER_DOWNLOAD_APPLICATION, "-t", "Application", "--noconfig"]))
// FIXME: uncomment this: we get conversion errors
//OS.exit(1); // rake abort if ($? != 0)
{}
@@ -161,13 +161,14 @@ task ("deploy", ["downloads"], function()
// Testing
-task ("test", ["build"], function()
+task("test", ["build", "test-only"]);
+
+task("test-only", function()
{
var tests = new FileList('Tests/**/*Test.j');
var cmd = ["ojtest"].concat(tests.items());
- var cmdString = cmd.map(OS.enquote).join(" ");
- var code = OS.system(cmdString);
+ var code = OS.system(cmd);
if (code !== 0)
OS.exit(code);
});
@@ -198,8 +199,7 @@ function pushPackage(path, remote)
["git", "push", "origin", "master"]
];
- var cmdString = cmds.map(function(cmd)
- {
+ var cmdString = cmds.map(function(cmd) {
return cmd.map(OS.enquote).join(" ");
}).join(" && ");
View
69 Objective-J/Jakefile
@@ -28,20 +28,32 @@ require("../common.jake");
$BUILD_OBJECTIVE_J = FILE.join($BUILD_CONFIGURATION_DIR, "Objective-J");
-Files = new FileList("Runtime/constants.js", "Runtime/utilities.js", "Runtime/json2.js", "Runtime/runtime.js", "Runtime/dictionary.js", "Runtime/plist.js", "Runtime/file.js", "Runtime/exception.js", "Runtime/preprocess.js", "Runtime/evaluate.js", "Runtime/bootstrap.js");
+var OBJECTIVE_J_FILES = new FileList(
+ "Runtime/constants.js",
+ "Runtime/utilities.js",
+ "Runtime/json2.js",
+ "Runtime/runtime.js",
+ "Runtime/dictionary.js",
+ "Runtime/plist.js",
+ "Runtime/file.js",
+ "Runtime/exception.js",
+ "Runtime/preprocess.js",
+ "Runtime/evaluate.js",
+ "Runtime/bootstrap.js"
+);
if ($CONFIGURATION === "Debug")
- Files.include("Runtime/debug.js");
+ OBJECTIVE_J_FILES.include("Runtime/debug.js");
$BUILD_BROWSER_FILE = FILE.join($BUILD_OBJECTIVE_J, "Objective-J.js");
$BUILD_CJS_FILE = FILE.join($BUILD_OBJECTIVE_J, "CommonJS.environment", "Objective-J.js");
-filedir ($BUILD_BROWSER_FILE, Files, function(aTask)
+filedir($BUILD_BROWSER_FILE, OBJECTIVE_J_FILES, function(aTask)
{
build_product(aTask.name(), environmentFlags("ObjJ") + " -DPLATFORM_USERAGENT");
});
-filedir ($BUILD_CJS_FILE, Files, function(aTask)
+filedir($BUILD_CJS_FILE, OBJECTIVE_J_FILES, function(aTask)
{
flags = environmentFlags("CommonJS", "ObjJ");
flags += ' -DRHINO'
@@ -52,7 +64,7 @@ filedir ($BUILD_CJS_FILE, Files, function(aTask)
$LICENSE = FILE.join("CommonJS", "lib", "objective-j", "jake", "LICENSES", "LGPL-v2.1");
$BUILD_LICENSE = FILE.join($BUILD_OBJECTIVE_J, "LICENSE");
-filedir ($BUILD_LICENSE, [$LICENSE], function()
+filedir($BUILD_LICENSE, [$LICENSE], function()
{
FILE.copy($LICENSE, $BUILD_LICENSE);
});
@@ -83,7 +95,7 @@ new FileList("CommonJS/**/*").forEach(function(aFilename)
$BUILD_CJS_OBJECTIVE_J_FRAMEWORK = FILE.join($BUILD_CJS_OBJECTIVE_J, "Frameworks", "Objective-J");
-filedir ($BUILD_CJS_OBJECTIVE_J_FRAMEWORK, function()
+filedir($BUILD_CJS_OBJECTIVE_J_FRAMEWORK, function()
{
cp_r($BUILD_OBJECTIVE_J, $BUILD_CJS_OBJECTIVE_J_FRAMEWORK);
});
@@ -92,24 +104,45 @@ CLOBBER.include($BUILD_OBJECTIVE_J);
function environmentFlags()
{
- return "-DENVIRONMENTS=\"[" + Array.prototype.map.apply(arguments, [function(anEnvironment)
- {
+ return "-DENVIRONMENTS=\"[" + Array.prototype.map.apply(arguments, [function(anEnvironment) {
return "\\\"" + anEnvironment + "\\\"";
}]).join(", ") + "]\"";
}
function build_product(path, flags)
{
- OS.system("cat Runtime/header.txt > " + OS.enquote(path));
- OS.system("cat " +
- Files.filter(function(aName)
- {
- return !!aName.match(/\.js$/);
- }).map(function(aName)
- {
- return OS.enquote(aName);
- }).join(' ') + " | gcc " + flags + " -E -x c -P - >> " + OS.enquote(path));
+ var sources = OBJECTIVE_J_FILES.filter(function(aName) { return !!aName.match(/\.js$/); });
+
+ var productOut = FILE.open(path, "w", { charset : "UTF-8" });
+
+ FILE.open("Runtime/header.txt", "r", { charset : "UTF-8" })
+ .copy(productOut)
+ .close();
+
+ var preprocessor = OS.popen("gcc " + flags + " -E -x c -P -");
+
+ sources.forEach(function(source) {
+ FILE.open(source, "r", { charset : "UTF-8" })
+ .copy(preprocessor.stdin)
+ .close();
+ });
+
+ preprocessor.stdin.close();
+ preprocessor.stdout.copy(productOut);
+
+ productOut.close();
+
+ var code = preprocessor.wait();
+
+ // this is equivalent to the above, but less cross platform:
+ //OS.system(["cp", "Runtime/header.txt", path]);
+ //var code = OS.system("cat " + sources.map(OS.enquote).join(' ') + " | gcc " + flags + " -E -x c -P - >> " + OS.enquote(path));
+
+ if (code !== 0) {
+ FILE.remove(path);
+ OS.exit(1);
+ }
// rake abort if ($? != 0)
}
-task ("build", [$BUILD_BROWSER_FILE, $BUILD_CJS_FILE, $BUILD_LICENSE, $BUILD_CJS_OBJECTIVE_J_FRAMEWORK]);
+task("build", [$BUILD_BROWSER_FILE, $BUILD_CJS_FILE, $BUILD_LICENSE, $BUILD_CJS_OBJECTIVE_J_FRAMEWORK]);
View
9 Rakefile
@@ -1,12 +1,13 @@
#!/usr/bin/env ruby
-print('
+puts <<-eos
Building with rake is no longer supported, use "jake" instead.
The commands are all the same (e.g. rake install -> jake install).
- If you do not have jake, you can run sudo ./bootstrap.sh to install it and its dependencies.
+ If you do not have jake, you can run sudo ./bootstrap.sh to install jake and it's dependencies.
+
+ PLEASE remove your Build folder ($CAPP_BUILD if it's set) when switching from rake to jake.
+eos
- PLEASE remove your Build folder when switching from rake to jake.
-');
exit(1);
View
3  common.jake
@@ -113,6 +113,9 @@ function partial_require(path, exports)
// FIXME: is there a better way to do this???
OS.system = function(aCommand)
{
+ if (Array.isArray(aCommand))
+ aCommand = aCommand.map(OS.enquote).join(" ");
+
return system("PATH=" + OS.enquote(bin) + ":$PATH " + aCommand);
}
Please sign in to comment.
Something went wrong with that request. Please try again.