mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
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:
+3
-3
@@ -3,7 +3,7 @@
|
|||||||
require("../common.jake");
|
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/**/*');
|
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.setSummary("AppKit classes for Cappuccino");
|
||||||
appKitTask.setIdentifier("com.280n.AppKit");
|
appKitTask.setIdentifier("com.280n.AppKit");
|
||||||
appKitTask.setLicense(BundleTask.License.LGPL_v2_1);
|
appKitTask.setLicense(BundleTask.License.LGPL_v2_1);
|
||||||
appKitTask.setSources(AppKitFiles);//terrible!
|
appKitTask.setSources(AppKitFiles);
|
||||||
appKitTask.setResources(new FileList("Resources/**/*"));
|
appKitTask.setResources(new FileList("Resources/**/*"));
|
||||||
appKitTask.setPlatforms([BundleTask.Platform.Browser, BundleTask.Platform.CommonJS]);
|
appKitTask.setPlatforms([BundleTask.Platform.Browser, BundleTask.Platform.CommonJS]);
|
||||||
appKitTask.setFlattensSources(true);
|
appKitTask.setFlattensSources(true);
|
||||||
@@ -47,4 +47,4 @@ task ("Theme", [$COMMONJS_PRODUCT_APPKIT], function()
|
|||||||
|
|
||||||
task ("build", ["AppKit", $COMMONJS_PRODUCT_APPKIT, "Theme"]);
|
task ("build", ["AppKit", $COMMONJS_PRODUCT_APPKIT, "Theme"]);
|
||||||
|
|
||||||
//CLOBBER.include($ENVIRONMENT_PRODUCT)
|
CLOBBER.include($COMMONJS_PRODUCT_APPKIT);
|
||||||
|
|||||||
+1
-1
@@ -32,4 +32,4 @@ filedir ($COMMONJS_PRODUCT_FOUNDATION, ["Foundation"], function()
|
|||||||
|
|
||||||
task ("build", ["Foundation", $COMMONJS_PRODUCT_FOUNDATION]);
|
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"),
|
OS = require("os"),
|
||||||
UTIL = require("util"),
|
UTIL = require("util"),
|
||||||
Jake = require("jake"),
|
Jake = require("jake"),
|
||||||
objj_dictionary = require("objective-j").objj_dictionary,
|
CLEAN = require("jake/clean").CLEAN,
|
||||||
compiler = require("objective-j/compiler"),
|
CLOBBER = require("jake/clean").CLOBBER,
|
||||||
plist = require("objective-j/plist"),
|
|
||||||
base64 = require("base64");
|
base64 = require("base64");
|
||||||
|
|
||||||
var Task = Jake.Task,
|
var Task = Jake.Task,
|
||||||
@@ -36,7 +35,7 @@ function BundleTask(aName, anApplication)
|
|||||||
this._buildIntermediatesPath = null;
|
this._buildIntermediatesPath = null;
|
||||||
this._buildPath = FILE.cwd();
|
this._buildPath = FILE.cwd();
|
||||||
|
|
||||||
this._replacedFiles = new objj_dictionary();
|
this._replacedFiles = { };
|
||||||
this._nib2cibFlags = null;
|
this._nib2cibFlags = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +260,9 @@ BundleTask.prototype.defineTasks = function()
|
|||||||
this.defineInfoPlistTask();
|
this.defineInfoPlistTask();
|
||||||
this.defineLicenseTask();
|
this.defineLicenseTask();
|
||||||
this.defineStaticTask();
|
this.defineStaticTask();
|
||||||
// CLOBBER.include(build_path)
|
|
||||||
|
CLEAN.include(this.buildIntermediatesProductPath());
|
||||||
|
CLOBBER.include(this.buildPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
BundleTask.prototype.packageType = function()
|
BundleTask.prototype.packageType = function()
|
||||||
@@ -271,17 +272,26 @@ BundleTask.prototype.packageType = function()
|
|||||||
|
|
||||||
BundleTask.prototype.infoPlist = function()
|
BundleTask.prototype.infoPlist = function()
|
||||||
{
|
{
|
||||||
var infoPlist = new objj_dictionary();
|
var objj_dictionary = require("objective-j").objj_dictionary,
|
||||||
//util = require("util"),
|
infoPlist = new objj_dictionary();
|
||||||
|
|
||||||
infoPlist.setValue("CPBundleInfoDictionaryVersion", 6.0);
|
infoPlist.setValue("CPBundleInfoDictionaryVersion", 6.0);
|
||||||
infoPlist.setValue("CPBundleName", this.productName());
|
infoPlist.setValue("CPBundleName", this.productName());
|
||||||
infoPlist.setValue("CPBundleIdentifier", this.identifier());
|
infoPlist.setValue("CPBundleIdentifier", this.identifier());
|
||||||
infoPlist.setValue("CPBundleVersion", this.version());
|
infoPlist.setValue("CPBundleVersion", this.version());
|
||||||
infoPlist.setValue("CPBundlePackageType", this.packageType());
|
infoPlist.setValue("CPBundlePackageType", this.packageType());
|
||||||
infoPlist.setValue("CPBundleReplacedFiles", this._replacedFiles);
|
|
||||||
infoPlist.setValue("CPBundlePlatforms", this.platforms());
|
infoPlist.setValue("CPBundlePlatforms", this.platforms());
|
||||||
infoPlist.setValue("CPBundleExecutable", this.productName() + ".sj");
|
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;
|
return infoPlist;
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -303,7 +313,7 @@ BundleTask.prototype.defineInfoPlistTask = function()
|
|||||||
|
|
||||||
filedir (infoPlistProductPath, function()
|
filedir (infoPlistProductPath, function()
|
||||||
{
|
{
|
||||||
plist.writePlist(infoPlistProductPath, bundleTask.infoPlist());
|
require("objective-j/plist").writePlist(infoPlistProductPath, bundleTask.infoPlist());
|
||||||
});
|
});
|
||||||
|
|
||||||
this.enhance([infoPlistProductPath]);
|
this.enhance([infoPlistProductPath]);
|
||||||
@@ -568,7 +578,7 @@ BundleTask.prototype.defineSourceTasks = function()
|
|||||||
filedir (compiledPlatformSource, [aFilename], function()
|
filedir (compiledPlatformSource, [aFilename], function()
|
||||||
{
|
{
|
||||||
print("Compiling " + aFilename + "...");
|
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]);
|
filedir (staticPath, [compiledPlatformSource]);
|
||||||
@@ -578,7 +588,7 @@ BundleTask.prototype.defineSourceTasks = function()
|
|||||||
replacedFiles.push(flattensSources ? FILE.basename(aFilename) : FILE.relative(sourcesPath, aFilename));
|
replacedFiles.push(flattensSources ? FILE.basename(aFilename) : FILE.relative(sourcesPath, aFilename));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this._replacedFiles.setValue(aPlatform, replacedFiles);
|
this._replacedFiles[aPlatform] = replacedFiles;
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+34
-31
@@ -12,6 +12,10 @@ global.directory = Jake.directory;
|
|||||||
global.filedir = Jake.filedir;
|
global.filedir = Jake.filedir;
|
||||||
global.FileList = Jake.FileList;
|
global.FileList = Jake.FileList;
|
||||||
|
|
||||||
|
global.CLEAN = require("jake/clean").CLEAN;
|
||||||
|
global.CLOBBER = require("jake/clean").CLOBBER;
|
||||||
|
|
||||||
|
|
||||||
// Read in and set up development environment variables.
|
// Read in and set up development environment variables.
|
||||||
if (!ENV["BUILD_PATH"])
|
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.$HOME_DIR = FILE.absolute(FILE.dirname(module.path));
|
||||||
global.$LICENSE_FILE = FILE.absolute(FILE.join(FILE.dirname(module.path), 'LICENSE'));
|
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"),
|
// FIXME: is there a better way to do this???
|
||||||
objectiveJLibJS = FILE.join($BUILD_DIR, $CONFIGURATION, "CommonJS", "objective-j", "lib-js");
|
OS.system = function(aCommand)
|
||||||
|
|
||||||
if (FILE.exists(objectiveJLibJS))
|
|
||||||
{
|
{
|
||||||
require.paths.unshift(objectiveJLibJS);
|
system("PATH=" + OS.enquote(objectiveJBin) + ":$PATH " + aCommand)
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user