1. Added clean and clobber functionality to bundletask.

2. Prepared Foundation and Appkit for clean and clobber
3. Placed built-necessary requires in bundletask in the calling functions so that it can be included without being built for clean and clobber.
4. Made common.jake include unbuilt CommonJS files if built ones aren't present.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2009-10-26 02:10:25 -07:00
parent 4870ac86ef
commit b6cf4ad0a4
4 changed files with 59 additions and 46 deletions
+3 -3
View File
@@ -3,7 +3,7 @@
require("../common.jake");
$BUILD_PATH = FILE.join($BUILD_DIR, $CONFIGURATION, 'AppKit');
$BUILD_PATH = FILE.join($BUILD_DIR, $CONFIGURATION, 'AppKit');
AppKitFiles = new FileList("**/*.j").exclude('CoreGraphics/CGContextCanvas.j', 'CoreGraphics/CGContextVML.j', 'Themes/**/*', 'Tools/**/*');
@@ -17,7 +17,7 @@ appKitTask = framework ("AppKit", function(appKitTask)
appKitTask.setSummary("AppKit classes for Cappuccino");
appKitTask.setIdentifier("com.280n.AppKit");
appKitTask.setLicense(BundleTask.License.LGPL_v2_1);
appKitTask.setSources(AppKitFiles);//terrible!
appKitTask.setSources(AppKitFiles);
appKitTask.setResources(new FileList("Resources/**/*"));
appKitTask.setPlatforms([BundleTask.Platform.Browser, BundleTask.Platform.CommonJS]);
appKitTask.setFlattensSources(true);
@@ -47,4 +47,4 @@ task ("Theme", [$COMMONJS_PRODUCT_APPKIT], function()
task ("build", ["AppKit", $COMMONJS_PRODUCT_APPKIT, "Theme"]);
//CLOBBER.include($ENVIRONMENT_PRODUCT)
CLOBBER.include($COMMONJS_PRODUCT_APPKIT);
+1 -1
View File
@@ -32,4 +32,4 @@ filedir ($COMMONJS_PRODUCT_FOUNDATION, ["Foundation"], function()
task ("build", ["Foundation", $COMMONJS_PRODUCT_FOUNDATION]);
//CLOBBER.include($ENVIRONMENT_PRODUCT)
CLOBBER.include($COMMONJS_PRODUCT_FOUNDATION);
@@ -3,9 +3,8 @@ var FILE = require("file"),
OS = require("os"),
UTIL = require("util"),
Jake = require("jake"),
objj_dictionary = require("objective-j").objj_dictionary,
compiler = require("objective-j/compiler"),
plist = require("objective-j/plist"),
CLEAN = require("jake/clean").CLEAN,
CLOBBER = require("jake/clean").CLOBBER,
base64 = require("base64");
var Task = Jake.Task,
@@ -36,7 +35,7 @@ function BundleTask(aName, anApplication)
this._buildIntermediatesPath = null;
this._buildPath = FILE.cwd();
this._replacedFiles = new objj_dictionary();
this._replacedFiles = { };
this._nib2cibFlags = null;
}
@@ -261,7 +260,9 @@ BundleTask.prototype.defineTasks = function()
this.defineInfoPlistTask();
this.defineLicenseTask();
this.defineStaticTask();
// CLOBBER.include(build_path)
CLEAN.include(this.buildIntermediatesProductPath());
CLOBBER.include(this.buildPath());
}
BundleTask.prototype.packageType = function()
@@ -271,17 +272,26 @@ BundleTask.prototype.packageType = function()
BundleTask.prototype.infoPlist = function()
{
var infoPlist = new objj_dictionary();
//util = require("util"),
var objj_dictionary = require("objective-j").objj_dictionary,
infoPlist = new objj_dictionary();
infoPlist.setValue("CPBundleInfoDictionaryVersion", 6.0);
infoPlist.setValue("CPBundleName", this.productName());
infoPlist.setValue("CPBundleIdentifier", this.identifier());
infoPlist.setValue("CPBundleVersion", this.version());
infoPlist.setValue("CPBundlePackageType", this.packageType());
infoPlist.setValue("CPBundleReplacedFiles", this._replacedFiles);
infoPlist.setValue("CPBundlePlatforms", this.platforms());
infoPlist.setValue("CPBundleExecutable", this.productName() + ".sj");
var replacedFiles = this._replacedFiles,
replacedFilesDictionary = new objj_dictionary();
for (var engine in replacedFiles)
if (replacedFiles.hasOwnProperty(engine))
replacedFilesDictionary.setValue(engine, replacedFiles[engine]);
infoPlist.setValue("CPBundleReplacedFiles", replacedFilesDictionary);
return infoPlist;
/*
@@ -303,7 +313,7 @@ BundleTask.prototype.defineInfoPlistTask = function()
filedir (infoPlistProductPath, function()
{
plist.writePlist(infoPlistProductPath, bundleTask.infoPlist());
require("objective-j/plist").writePlist(infoPlistProductPath, bundleTask.infoPlist());
});
this.enhance([infoPlistProductPath]);
@@ -568,7 +578,7 @@ BundleTask.prototype.defineSourceTasks = function()
filedir (compiledPlatformSource, [aFilename], function()
{
print("Compiling " + aFilename + "...");
FILE.write(compiledPlatformSource, compiler.compile(aFilename, flags + " " + compilerFlags), { charset:"UTF-8" });
FILE.write(compiledPlatformSource, require("objective-j/compiler").compile(aFilename, flags + " " + compilerFlags), { charset:"UTF-8" });
});
filedir (staticPath, [compiledPlatformSource]);
@@ -578,7 +588,7 @@ BundleTask.prototype.defineSourceTasks = function()
replacedFiles.push(flattensSources ? FILE.basename(aFilename) : FILE.relative(sourcesPath, aFilename));
}, this);
this._replacedFiles.setValue(aPlatform, replacedFiles);
this._replacedFiles[aPlatform] = replacedFiles;
}, this);
}
+34 -31
View File
@@ -12,6 +12,10 @@ global.directory = Jake.directory;
global.filedir = Jake.filedir;
global.FileList = Jake.FileList;
global.CLEAN = require("jake/clean").CLEAN;
global.CLOBBER = require("jake/clean").CLOBBER;
// Read in and set up development environment variables.
if (!ENV["BUILD_PATH"])
{
@@ -51,40 +55,39 @@ global.$ENVIRONMENT_FRAMEWORKS_DIR = FILE.join($ENVIRONMENT_LIB_DIR, 'Frameworks
global.$HOME_DIR = FILE.absolute(FILE.dirname(module.path));
global.$LICENSE_FILE = FILE.absolute(FILE.join(FILE.dirname(module.path), 'LICENSE'));
if(!global.COMMON_DO_ONCE)
var objectiveJLibJS = FILE.join($BUILD_DIR, $CONFIGURATION, "CommonJS", "objective-j", "lib-js");
if (!FILE.exists(objectiveJLibJS))
objectiveJLibJS = FILE.join($HOME_DIR, "Objective-J", "CommonJS", "objective-j", "lib-js");
require.paths.unshift(objectiveJLibJS);
require("objective-j/loader");
var OBJECTIVE_J_JAKE = require("objective-j/jake");
global.app = OBJECTIVE_J_JAKE.app;
global.bundle = OBJECTIVE_J_JAKE.bundle;
global.framework = OBJECTIVE_J_JAKE.framework;
if (OBJECTIVE_J_JAKE.blend)
global.blend = OBJECTIVE_J_JAKE.blend;
global.BundleTask = OBJECTIVE_J_JAKE.BundleTask;
var objectiveJBin = FILE.join($BUILD_DIR, $CONFIGURATION, "CommonJS", "objective-j", "bin")
if (!FILE.exists(objectiveJBin))
objectiveJBin = FILE.join($HOME_DIR, "Objective-J", "CommonJS", "objective-j", "bin");
if (FILE.exists(objectiveJBin))
{
global.COMMON_DO_ONCE = true;
var system = OS.system;
var objectiveJBin = FILE.join($BUILD_DIR, $CONFIGURATION, "CommonJS", "objective-j", "bin"),
objectiveJLibJS = FILE.join($BUILD_DIR, $CONFIGURATION, "CommonJS", "objective-j", "lib-js");
if (FILE.exists(objectiveJLibJS))
// FIXME: is there a better way to do this???
OS.system = function(aCommand)
{
require.paths.unshift(objectiveJLibJS);
require("objective-j/loader");
var OBJECTIVE_J_JAKE = require("objective-j/jake");
global.app = OBJECTIVE_J_JAKE.app;
global.bundle = OBJECTIVE_J_JAKE.bundle;
global.framework = OBJECTIVE_J_JAKE.framework;
if (OBJECTIVE_J_JAKE.blend)
global.blend = OBJECTIVE_J_JAKE.blend;
global.BundleTask = OBJECTIVE_J_JAKE.BundleTask;
}
if (FILE.exists(objectiveJBin))
{
var system = OS.system;
// FIXME: is there a better way to do this???
OS.system = function(aCommand)
{
system("PATH=" + OS.enquote(objectiveJBin) + ":$PATH " + aCommand)
}
system("PATH=" + OS.enquote(objectiveJBin) + ":$PATH " + aCommand)
}
}