nib2cib and capp building with jake.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2009-09-25 21:52:41 -07:00
parent be2ffe95c5
commit 9856e6bfd7
14 changed files with 310 additions and 308 deletions
+38 -62
View File
@@ -1,8 +1,6 @@
#!/usr/bin/env ruby
#!/usr/bin/env narwhal
var FILE = require("file");
require(FILE.absolute("../common.jake"));
require("../common.jake");
$BUILD_PATH = FILE.join($BUILD_DIR, $CONFIGURATION, 'AppKit');
@@ -13,40 +11,35 @@ $ENVIRONMENT_THEME_PRODUCT = FILE.join($ENVIRONMENT_PRODUCT, 'Resources', 'Aris
//AppKitFiles = FileList['**/*.j'].exclude('CoreGraphics/CGContextCanvas.j', 'CoreGraphics/CGContextVML.j', 'Themes/**', 'Tools/**')
framework ("AppKit", function(AppKitTask)
{
AppKitTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "AppKit.build", $CONFIGURATION))
AppKitTask.setBuildPath(FILE.join($BUILD_DIR, $CONFIGURATION));
AppKitFiles = FILE.glob("*.j").concat(FILE.glob("Cib/*.j")).concat(FILE.glob("CoreAnimation/*.j")).concat(FILE.glob("CPWindow/*.j")).concat(FILE.glob("Platform/*.j")).concat(FILE.glob("CoreGraphics/*.j"));
AppKitTask.setIdentifier("com.280n.AppKit");
AppKitTask.setLicense(BundleTask.License.LGPL_v2_1);
AppKitTask.setSources(FILE.glob("**/*.j").concat(FILE.glob("*.j")));//terrible!
AppKitTask.setResources(FILE.glob("Resources/*"));
AppKitTask.setPlatforms([BundleTask.Platform.Browser, BundleTask.Platform.CommonJS]);
AppKitTask.setFlattensSources(true);
appKitTask = framework ("AppKit", function(appKitTask)
{
appKitTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "AppKit.build", $CONFIGURATION))
appKitTask.setBuildPath(FILE.join($BUILD_DIR, $CONFIGURATION));
appKitTask.setAuthor("280 North, Inc.");
appKitTask.setEmail("feedback @nospam@ 280north.com");
appKitTask.setSummary("AppKit classes for Cappuccino");
appKitTask.setIdentifier("com.280n.AppKit");
appKitTask.setLicense(BundleTask.License.LGPL_v2_1);
appKitTask.setSources(AppKitFiles);//terrible!
appKitTask.setResources(FILE.glob("Resources/*"));
appKitTask.setPlatforms([BundleTask.Platform.Browser, BundleTask.Platform.CommonJS]);
appKitTask.setFlattensSources(true);
if ($CONFIGURATION === "Release")
AppKitTask.setCompilerFlags("-O");
appKitTask.setCompilerFlags("-O");
else
AppKitTask.setCompilerFlags("-DDEBUG -g");
appKitTask.setCompilerFlags("-DDEBUG -g");
});
$COMMONJS_PRODUCT_APPKIT = FILE.join($COMMONJS_PRODUCT_FRAMEWORKS, "AppKit");
filedir ($COMMONJS_PRODUCT_APPKIT, ["AppKit"], function()
{
cp_r(appKitTask.buildProductPath(), $COMMONJS_PRODUCT_APPKIT);
});
/*
ObjectiveJ::BundleTask.new(:AppKit) do |t|
t.name = 'AppKit'
t.identifier = 'com.280n.AppKit'
t.version = '0.7.1'
t.author = '280 North, Inc.'
t.email = 'feedback @nospam@ 280north.com'
t.summary = 'AppKit classes for Cappuccino'
t.sources = AppKitFiles
t.resources = FileList['Resources/*']
t.license = ObjectiveJ::License::LGPL_v2_1
t.build_path = $BUILD_PATH
t.flag = '-DDEBUG -g' if $CONFIGURATION == 'Debug'
t.flag = '-O' if $CONFIGURATION == 'Release'
t.platforms = [ObjectiveJ::Platform::Browser, ObjectiveJ::Platform::Rhino]
t.type = ObjectiveJ::Bundle::Type::Framework
end*/
//# It would be nice to just have ENVIRONMENT_PRODUCT depend on THEME_PRODUCT,
//# but this would be a circular dependency because THEME_PRODUCT needs
@@ -60,38 +53,21 @@ end*/
// cp_r(File.join($THEME_PRODUCT, '.'), $ENVIRONMENT_THEME_PRODUCT)
//end
//ThemeFiles = FileList['Themes/Aristo/*']
$THEME_PRODUCT = FILE.join(appKitTask.buildProductPath(), "Resources", "Aristo.blend");
ThemeFiles = FILE.glob("Themes/Aristo/*");//FileList['Themes/Aristo/*']
//file_d $THEME_PRODUCT => ThemeFiles << $ENVIRONMENT_PRODUCT do
// File.popen("blend -d Themes/Aristo/ThemeDescriptors.j -o #{$THEME_PRODUCT} -R Themes/Aristo/Resources") do |blend|
// blend.sync = true
//
// while str = blend.gets
// puts str
// end
// end
filedir ($THEME_PRODUCT, ThemeFiles, function()
{print("IN HERE");
var blend = OS.popen("blend -d Themes/Aristo/ThemeDescriptors.j -o " + $THEME_PRODUCT + " -R Themes/Aristo/Resources"),
output = "";
while (output = blend.stdout.read())
print(output);
// rake abort if ($? != 0)
//end
});
task ("build", ["AppKit"]);//, $ENVIRONMENT_PRODUCT, $THEME_PRODUCT, $ENVIRONMENT_THEME_PRODUCT]
task ("build", ["AppKit", $COMMONJS_PRODUCT_APPKIT, $THEME_PRODUCT]);
subprojects = ["Tools"];
function subtasks(subprojects, taskNames)
{
taskNames.forEach(function(aTaskName)
{
var subtaskName = taskNames + "_subprojects";
task (aTaskName, [subtaskName]);
task (subtaskName, function()
{
subjake(subprojects, aTaskName);
});
});
}
subtasks (subprojects, ["build", "clean", "clobber"]);
subtasks (["Tools"], ["build"/*, "clean", "clobber"*/]);
//CLOBBER.include($ENVIRONMENT_PRODUCT)
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env narwhal
require("../../../common.jake");
blendKitTask = framework ("BlendKit", function(blendKitTask)
{
blendKitTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "BlendKit.build", $CONFIGURATION))
blendKitTask.setBuildPath(FILE.join($BUILD_DIR, $CONFIGURATION));
blendKitTask.setIdentifier("com.280n.BlendKit");
blendKitTask.setVersion("0.7.1");
// t.author = '280 North, Inc.'
// t.email = 'feedback @nospam@ 280north.com'
// t.summary = 'BlendKit classes for Cappuccino'
blendKitTask.setSources(FILE.glob("*.j")); //t.sources = FileList['*.j']
blendKitTask.setResources(FILE.glob("Resources/*"));
blendKitTask.setLicense(BundleTask.License.LGPL_v2_1);
if ($CONFIGURATION === "Release")
blendKitTask.setCompilerFlags("-O");
else
blendKitTask.setCompilerFlags("-DDEBUG -g");
});
$COMMONJS_PRODUCT_BLENDKIT = FILE.join($COMMONJS_PRODUCT_FRAMEWORKS, "BlendKit");
filedir ($COMMONJS_PRODUCT_BLENDKIT, ["BlendKit"], function()
{print("copying...");
cp_r(blendKitTask.buildProductPath(), $COMMONJS_PRODUCT_BLENDKIT);
});
print("here?...");
task ("build", ["BlendKit", $COMMONJS_PRODUCT_BLENDKIT]);
//CLOBBER.include($ENVIRONMENT_PRODUCT)
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env ruby
require("../../common.jake");
subtasks(["BlendKit", "blend"], ["build"/*, "clean", "clobber"*/]);
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env narwhal
require("../../../common.jake");
app ("blend", function(blendTask)
{
blendTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "blend.build", $CONFIGURATION));
blendTask.setBuildPath($COMMONJS_PRODUCT_LIB);
blendTask.setAuthor("280 North, Inc.");
blendTask.setEmail("feedback @nospam@ 280north.com");
blendTask.setSummary("blend classes for Cappuccino");
blendTask.setIdentifier("blend");
blendTask.setVersion("0.7.1");
blendTask.setSources(FILE.glob("*.j"));// = FileList['**/*.j']
blendTask.setResources(FILE.glob("Resources/*"));// t.resources = FileList['Resources/*']
blendTask.setLicense(BundleTask.License.LGPL_v2_1);
if ($CONFIGURATION === "Release")
blendTask.setCompilerFlags("-O");
else
blendTask.setCompilerFlags("-DDEBUG -g");
});
$COMMONJS_BLEND_BIN_PRODUCT = FILE.join($COMMONJS_PRODUCT_BIN, "blend");
// executable in environment directory
filedir($COMMONJS_BLEND_BIN_PRODUCT, ["blend"], function()
{
make_objj_executable($COMMONJS_BLEND_BIN_PRODUCT);
});
task ("build", ["blend", $COMMONJS_BLEND_BIN_PRODUCT]);
/*
CLOBBER.include($ENVIRONMENT_BIN_PRODUCT, $ENVIRONMENT_LIB_PRODUCT)
*/
+24 -18
View File
@@ -1,29 +1,35 @@
#!/usr/bin/env narwhal
require("../common.jake");
var FILE = require("file");
require(FILE.absolute("../common.jake"));
$BUILD_PATH = FILE.join($BUILD_DIR, $CONFIGURATION, "Foundation");
task ("build", ["Foundation"]);
framework ("Foundation", function(FoundationTask)
foundationTask = framework ("Foundation", function(foundationTask)
{
FoundationTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "Foundation.build", $CONFIGURATION))
FoundationTask.setBuildPath(FILE.join($BUILD_DIR, $CONFIGURATION));
FoundationTask.setIdentifier("com.280n.Foundation");
FoundationTask.setLicense(BundleTask.License.LGPL_v2_1);
FoundationTask.setSources(FILE.glob("**/*.j").concat(FILE.glob("*.j")));//terrible!
FoundationTask.setResources(FILE.glob("Resources/*"));
FoundationTask.setFlattensSources(true);
foundationTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "Foundation.build", $CONFIGURATION))
foundationTask.setBuildPath(FILE.join($BUILD_DIR, $CONFIGURATION));
foundationTask.setAuthor("280 North, Inc.");
foundationTask.setEmail("feedback @nospam@ 280north.com");
foundationTask.setSummary("Foundation classes for Cappuccino");
foundationTask.setIdentifier("com.280n.Foundation");
foundationTask.setLicense(BundleTask.License.LGPL_v2_1);
foundationTask.setSources(FILE.glob("**/*.j").concat(FILE.glob("*.j")));//terrible!
foundationTask.setResources(FILE.glob("Resources/*"));
foundationTask.setFlattensSources(true);
if ($CONFIGURATION === "Release")
FoundationTask.setCompilerFlags("-O");
foundationTask.setCompilerFlags("-O");
else
FoundationTask.setCompilerFlags("-DDEBUG -g");
foundationTask.setCompilerFlags("-DDEBUG -g");
});
$COMMONJS_PRODUCT_FOUNDATION = FILE.join($COMMONJS_PRODUCT_FRAMEWORKS, "Foundation");
filedir ($COMMONJS_PRODUCT_FOUNDATION, ["Foundation"], function()
{
cp_r(foundationTask.buildProductPath(), $COMMONJS_PRODUCT_FOUNDATION);
});
task ("build", ["Foundation", $COMMONJS_PRODUCT_FOUNDATION]);
//CLOBBER.include($ENVIRONMENT_PRODUCT)
-23
View File
@@ -1,23 +0,0 @@
#!/usr/bin/env narwhal
var FILE = require("file");
require("../../common.jake");
$COMMONJS_PRODUCT = FILE.join($BUILD_DIR, $CONFIGURATION, "objective-j"),
$COMMONJS_OBJECTIVE_J_PRODUCT = FILE.join($COMMONJS_PRODUCT, "lib", "Frameworks", "Objective-J");
task ("build", [$COMMONJS_PRODUCT, $COMMONJS_OBJECTIVE_J_PRODUCT]);
filedir ($COMMONJS_PRODUCT, FILE.glob("objective-j/**/*"), function()
{
rm_rf($COMMONJS_PRODUCT);
cp_r('objective-j', $COMMONJS_PRODUCT);
});
filedir ($COMMONJS_OBJECTIVE_J_PRODUCT, function()
{
cp_r(FILE.join($BUILD_DIR, $CONFIGURATION, "Objective-J"), $COMMONJS_OBJECTIVE_J_PRODUCT);
});
//CLOBBER.include($ENVIRONMENT_OBJJ_PRODUCT)
+1 -1
View File
@@ -1,3 +1,3 @@
#!/usr/bin/env narwhal
require("objective-j/objj").run(system.args);
require("objective-j").run(system.args);
+1 -1
View File
@@ -1,3 +1,3 @@
#!/usr/bin/env narwhal
require("objective-j/objjc").main(system.args);
require("objective-j/compiler").main(system.args);
@@ -20,4 +20,33 @@ exports.app = function(aName, aFunction)
{
// No .apply necessary because the parameters aren't variable.
return ApplicationTask.defineTask(aName, aFunction);
}
}
/*
if type == Bundle::Type::Application and index_file
index_file_path = File.join(build_path, File.basename(index_file))
file_d index_file_path => [index_file] do |t|
cp(index_file, t.name)
end
enhance([index_file_path])
frameworks_path = File.join(build_path, 'Frameworks')
file_d frameworks_path do
IO.popen("capp gen -f " + build_path) do |capp|
capp.sync = true
while str = capp.gets
puts str
end
end
rake abort if ($? != 0)
end
enhance([frameworks_path])
end
*/
@@ -4,21 +4,20 @@ var FILE = require("file"),
Jake = require("jake"),
objj_dictionary = require("objective-j").objj_dictionary,
compiler = require("objective-j/compiler"),
plist = require("objective-j/plist");
plist = require("objective-j/plist"),
base64 = require("base64");
var Task = Jake.Task,
filedir = Jake.filedir;
exports.bundle = function(aName, aFunction)
{
// No .apply necessary because the parameters aren't variable.
return BundleTask.defineTask(aName, aFunction);
}
function BundleTask(aName, anApplication)
{
Task.apply(this, arguments);
this._author = null;
this._email = null;
this._summary = null;
this._license = null;
this._platforms = [BundleTask.Platform.ObjJ];
this._sources = null;
@@ -28,6 +27,7 @@ function BundleTask(aName, anApplication)
this._compilerFlags = null;
this._flattensSources = false;
this._includesNibsAndXibs = false;
this._productName = this.name();
@@ -37,7 +37,6 @@ function BundleTask(aName, anApplication)
this._replacedFiles = new objj_dictionary();
// this._nib2cibFlags = [];
// this.shouldnib
}
BundleTask.__proto__ = Task;
@@ -55,59 +54,6 @@ BundleTask.defineTask = function(/*String*/ aName, /*Function*/ aFunction)
return bundleTask;
}
/*
required_attribute :name
required_attribute :version
required_attribute :summary
required_attribute :identifier
required_attribute :include_nibs, false
required_attribute :nib2cib_flags, []
required_attribute :platforms, [Platform::ObjJ]
required_attribute :type, Bundle::Type::Application
# ------------------------- OPTIONAL gemspec attributes.
attributes :email, :homepage, :github_project, :description, :license_file, :license
attributes :build_path, :intermediates_path
attribute :principal_class
attribute :index_file
attribute :info_plist
# attributes :autorequire, :default_executable
# attribute :platform, Gem::Platform::RUBY
array_attribute :authors
attributes :sources
array_attribute :resources
array_attribute :flags
# array_attribute :test_files
# array_attribute :executables
# array_attribute :extensions
# array_attribute :requirements
# array_attribute :dependencies
#read_only :dependencies
# ------------------------- ALIASED gemspec attributes.
# attribute_alias_singular :executable, :executables
attribute_alias_singular :author, :authors
attribute_alias_singular :flag, :flags
attribute_alias_singular :nib2cib_flag, :nib2cib_flags
attribute_alias_singular :platform, :platforms
# attribute_alias_singular :require_path, :require_paths
# attribute_alias_singular :test_file, :test_files
# ------------------------- RUNTIME attributes (not persisted).
attr_writer :loaded
attr_accessor :loaded_from
this._sources =
}
*/
BundleTask.Platform = {
"ObjJ" : "ObjJ",
"CommonJS" : "CommonJS",
@@ -119,35 +65,36 @@ BundleTask.PLATFORM_DEFAULT_FLAGS = {
"CommonJS" : ['-DPLATFORM_RHINO -DPLATFORM_COMMONJS'],
"Browser" : ['-DPLATFORM_BROWSER', '-DPLATFORM_DOM']
};
/*
if type == Bundle::Type::Application and index_file
index_file_path = File.join(build_path, File.basename(index_file))
BundleTask.prototype.setAuthor = function(anAuthor)
{
this._author = anAuthor;
}
file_d index_file_path => [index_file] do |t|
cp(index_file, t.name)
end
BundleTask.prototype.author = function()
{
return this._author;
}
enhance([index_file_path])
BundleTask.prototype.setEmail = function(anEmail)
{
this._email = anEmail;
}
frameworks_path = File.join(build_path, 'Frameworks')
BundleTask.prototype.email = function()
{
return this._email;
}
file_d frameworks_path do
IO.popen("capp gen -f " + build_path) do |capp|
capp.sync = true
BundleTask.prototype.setSummary = function(aSummary)
{
this._summary = aSummary;
}
while str = capp.gets
puts str
end
end
rake abort if ($? != 0)
end
enhance([frameworks_path])
end
*/
BundleTask.prototype.summary = function()
{
return this._summary;
}
BundleTask.prototype.setIdentifier = function(anIdentifier)
{
@@ -199,6 +146,16 @@ BundleTask.prototype.resources = function(resources)
this._resources = resources;
}
BundleTask.prototype.setIncludesNibsAndXibs = function(shouldIncludeNibsAndXibs)
{
this._includesNibsAndXibs = shouldIncludeNibsAndXibs;
}
BundleTask.prototype.includesNibsAndXibs = function()
{
return this._includesNibsAndXibs;
}
BundleTask.prototype.setProductName = function(aProductName)
{
this._productName = aName;
@@ -357,98 +314,67 @@ BundleTask.prototype.defineLicenseTask = function()
this.enhance([licenseProductPath]);
}
/*
BundleTask.prototype.compact = function(path, *patterns)
{
puts 'Compacting ' + path
info_plist_path = File.join(path, 'Info.plist')
existing_info_plist = Plist::parse_xml(info_plist_path)
absolute_path = File.expand_path(path) + '/'
patterns = patterns.map { |pattern| "#{path}/#{pattern}" }
bundle_name = existing_info_plist['CPBundleName']
replaced_files = []
FileList.new(File.join(path, '**', '*.platform')).each do |platform|
FileList.new(File.join(platform, '*.j')) do |list|
list.include(*patterns)
executable_path = File.join(platform, bundle_name) + '.sj'
platform_absolute_path = File.expand_path(platform) + '/'
File.open(executable_path, 'w+') do |executable|
executable.write '@STATIC;1.0;'
list.each do |fileName|
fileName = File.expand_path(fileName)
File.open(fileName) do |file|
if fileName.index(platform_absolute_path) == 0
fileName = File.expand_path(fileName)[platform_absolute_path.length..-1]
else
fileName = File.expand_path(fileName)[absolute_path.length..-1]
end
executable.write "p;#{fileName.length};#{fileName}#{file.read}"
replaced_files << fileName
end
end
end
end
end
existing_info_plist['CPBundleReplacedFiles'] = replaced_files.uniq
existing_info_plist['CPBundleExecutable'] = bundle_name + '.sj'
File.open(info_plist_path, 'w') do |file|
file.puts existing_info_plist.to_plist
end
end
}
*/
BundleTask.prototype.resourcesPath = function()
{
return FILE.join(this.buildProductPath(), "Resources");
return FILE.join(this.buildProductPath(), "Resources", "");
}
var IMAGE_EXTENSIONS = [ ".png", ".jpg", ".jpeg", ".gif", ".tif", ".tiff"];
var MIME_TYPES = {
".png" : "image/png",
".jpg" : "image/jpeg",
".jpeg" : "image/jpeg",
".gif" : "image/gif",
".tif" : "image/tiff",
".tiff" : "image/tiff"
};
BundleTask.prototype.defineResourceTask = function(aResourcePath, aDestinationPath)
{
var extname = FILE.extension(aResourcePath);
var extension = FILE.extension(aResourcePath).toLowerCase(),
extensionless = aResourcePath.substr(0, aResourcePath.length - extension.length);
if (IMAGE_EXTENSIONS.indexOf(extension) !== -1)
{
aDestinationPath = FILE.join(this.buildIntermediatesProductPath(), "Browser" + ".platform", "Resources", FILE.relative(this.resourcesPath(), aDestinationPath));
filedir (aDestinationPath, function()
{
var dataURI = "data:" + MIME_TYPES[extension] + ";base64," + base64.encode(FILE.read(aResourcePath, { mode : 'b'}));
FILE.write(aDestinationPath, dataURI.length + ";" + dataURI, { charset:"UTF-8" });
});
filedir (this.buildProductStaticPathForPlatform("Browser"), [aDestinationPath]);
return;
}
// NOT:
// (extname === ".cib" && (FILE.exists(extensionless + '.xib') || FILE.exists(extensionless + '.nib')) ||
// (extname === ".xib" || extname === ".nib") && !this.shouldIncludeNibsAndXibs())
if ((extname !== ".cib" || !FILE.exists(extensionsless + ".xib") && FILE.exists(extensionless + ".nib")) &&
((extname !== ".xib" && extname !== ".nib") || this.shouldIncludeNibsAndXibs()))
if ((extension !== ".cib" || !FILE.exists(extensionless + ".xib") && FILE.exists(extensionless + ".nib")) &&
((extension !== ".xib" && extension !== ".nib") || this.includesNibsAndXibs()))
{
filedir (aDestinationPath, [aResourcePath], function()
{
cp_r(aResourcePath, aDestinationPath);
cp(aResourcePath, aDestinationPath);
});
this.enhance([aDestinationPath]);
}
if (extname === ".xib" || extname === ".nib")
if (extension === ".xib" || extension === ".nib")
{
aDestinationPath = FILE.join(FILE.dirname(aDestinationPath), FILE.basename(aDestinationPath, extname)) + ".cib";
var cibDestinationPath = FILE.join(FILE.dirname(aDestinationPath), FILE.basename(aDestinationPath, extension)) + ".cib";
filedir (aDestinationPath, [aResourcePath], function()
filedir (cibDestinationPath, [aResourcePath], function()
{
OS.system("nib2cib " + aResourcePath + " " + aCopiedResource + " " + (this._nib2cibFlags || ""));
OS.system("echo $PATH");
OS.system("nib2cib " + aResourcePath + " " + cibDestinationPath + " " + (this._nib2cibFlags || ""));
});
this.enhance([aDestinationPath]);
this.enhance([cibDestinationPath]);
}
}
@@ -467,7 +393,9 @@ BundleTask.prototype.defineResourceTasks = function()
{
FILE.glob(aResourcePath + "/**").forEach(function(aSubresourcePath)
{
this.defineResourceTask(aSubresourcePath, FILE.join(resourcesPath, aSubresourcePath.substring(aResourcePath.length - baselength)));
// Is this the right way to go? Or should we include empty directories as well?
if (!FILE.isDirectory(aSubresourcePath))
this.defineResourceTask(aSubresourcePath, FILE.join(resourcesPath, aSubresourcePath.substring(aResourcePath.length - baselength)));
}, this);
}
else
@@ -481,7 +409,8 @@ BundleTask.prototype.defineStaticTask = function()
{
this.platforms().forEach(function(/*String*/ aPlatform)
{
var sourcesPath = FILE.join(this.buildIntermediatesProductPath(), aPlatform + ".platform", ""),
var sourcesPath = FILE.join(this.buildIntermediatesProductPath(), aPlatform + ".platform", "Sources", ""),
resourcesPath = FILE.join(this.buildIntermediatesProductPath(), aPlatform + ".platform", "Resources", ""),
staticPath = this.buildProductStaticPathForPlatform(aPlatform),
flattensSources = this.flattensSources();
@@ -496,14 +425,27 @@ BundleTask.prototype.defineStaticTask = function()
aTask.prerequisites().forEach(function(aFilename)
{
// Our prerequisites will contain directories due to filedir.
if (FILE.isFile(aFilename))
if (!FILE.isFile(aFilename))
return;
var dirname = FILE.dirname(aFilename);
if (aFilename.indexOf(sourcesPath) === 0)
{
var relativePath = flattensSources ? FILE.basename(aFilename) : FILE.relative(sourcesPath, aFilename);
// FIXME: We need to do this for now due to file.read adding newlines. Revert when fixed.
fileStream.write("p;" + relativePath.length + ";" + relativePath);
fileStream.write(FILE.read(aFilename, { mode:"b" }).decodeToString("UTF-8"));
}
else if (aFilename.indexOf(resourcesPath) === 0)
{
var resourcePath = "Resources/" + FILE.relative(resourcesPath, aFilename);
fileStream.write("u;" + resourcePath.length + ";" + resourcePath);
}
// FIXME: We need to do this for now due to file.read adding newlines. Revert when fixed.
fileStream.write(FILE.read(aFilename, { mode:"b" }).decodeToString("UTF-8"));
}, this);
fileStream.close();
@@ -532,7 +474,7 @@ BundleTask.prototype.defineSourceTasks = function()
this.platforms().forEach(function(/*String*/ aPlatform)
{
var platformSources = sources,
sourcesPath = FILE.join(this.buildIntermediatesProductPath(), aPlatform + ".platform", ""),
sourcesPath = FILE.join(this.buildIntermediatesProductPath(), aPlatform + ".platform", "Sources", ""),
staticPath = this.buildProductStaticPathForPlatform(aPlatform),
flags = BundleTask.PLATFORM_DEFAULT_FLAGS[aPlatform].join(" ");
@@ -562,30 +504,12 @@ BundleTask.prototype.defineSourceTasks = function()
this._replacedFiles.setValue(aPlatform, replacedFiles);
}, this);
/*
list.each do |fileName|
fileName = File.expand_path(fileName)
File.open(fileName) do |file|
if fileName.index(platform_absolute_path) == 0
fileName = File.expand_path(fileName)[platform_absolute_path.length..-1]
else
fileName = File.expand_path(fileName)[absolute_path.length..-1]
end
executable.write "p;#{fileName.length};#{fileName}#{file.read}"
replaced_files << fileName
end
end
existing_info_plist['CPBundleReplacedFiles'] = replaced_files.uniq
existing_info_plist['CPBundleExecutable'] = bundle_name + '.sj'
});
});*/
}
exports.BundleTask = BundleTask;
exports.bundle = function(aName, aFunction)
{
// No .apply necessary because the parameters aren't variable.
return BundleTask.defineTask(aName, aFunction);
}
@@ -2,7 +2,7 @@
BundleTask = require("objective-j/jake/bundletask").BundleTask;
function FrameworkTask(aName)
{print(aName + " so far so good");
{
BundleTask.apply(this, arguments);
}
+5 -1
View File
@@ -11,7 +11,7 @@ $COMMONJS_PRODUCT = FILE.join($PRODUCT_DIR, "CommonJS", "objective-j")
$COMMONJS_FRAMEWORK_PRODUCT = FILE.join($COMMONJS_PRODUCT, "lib", "Frameworks", "Objective-J");
$LICENSE_PRODUCT = FILE.join($PRODUCT, 'LICENSE')
$LICENSE_FILE = FILE.join($HOME_DIR, 'Tools', 'Rake', 'lib', 'licenses', 'LGPL-v2.1')
$LICENSE_FILE = FILE.join("CommonJS", "objective-j", "lib-js", "objective-j", "jake", "LICENSES", "LGPL-v2.1");
$BROWSER_FILE = FILE.join($PRODUCT, 'Objective-J.js')
$RHINO_FILE = FILE.join($PRODUCT, 'CommonJS.platform', 'Objective-J.js')
@@ -46,6 +46,10 @@ filedir ($COMMONJS_PRODUCT, FILE.glob("CommonJS/objective-j/**/*"), function()
{
rm_rf($COMMONJS_PRODUCT);
cp_r(FILE.join("CommonJS", "objective-j"), $COMMONJS_PRODUCT);
FILE.chmod(FILE.join($COMMONJS_PRODUCT, "bin", "objj"), 0755);
FILE.chmod(FILE.join($COMMONJS_PRODUCT, "bin", "objjc"), 0755);
FILE.chmod(FILE.join($COMMONJS_PRODUCT, "bin", "cplutil"), 0755);
});
filedir ($COMMONJS_FRAMEWORK_PRODUCT, function()
+4 -6
View File
@@ -1,6 +1,4 @@
#!/usr/bin/env ruby
var FILE = require("file");
#!/usr/bin/env narwhal
require ("../../common.jake");
@@ -10,12 +8,12 @@ app ("capp", function(cappTask)
cappTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "capp.build", $CONFIGURATION))
cappTask.setBuildPath($COMMONJS_PRODUCT_LIB);
cappTask.setAuthor("280 North, Inc.");
cappTask.setEmail("feedback @nospam@ 280north.com");
cappTask.setSummary("Setup up Cappuccino projects");
cappTask.setIdentifier("com.280n.capp");
cappTask.setLicense(BundleTask.License.LGPL_v2_1);
cappTask.setVersion("0.7.1");
// t.author = '280 North, Inc.'
// t.email = 'feedback @nospam@ 280north.com'
// t.summary = 'Setup up Cappuccino projects'
cappTask.setSources(FILE.glob("*.j"));
cappTask.setResources(["Templates"]);
cappTask.setIncludesNibsAndXibs(true);
+21 -12
View File
@@ -1,10 +1,10 @@
var ENV = require("system").env,
ARGV = require("system").args,
FILE = require("file"),
OS = require("os"),
Jake = require("jake");
var Jake = require("jake");
global.ENV = require("system").env;
global.ARGV = require("system").args
global.FILE = require("file");
global.OS = require("os");
global.task = Jake.task;
global.directory = Jake.directory;
@@ -32,11 +32,12 @@ ENV["BUILD_PATH"] = FILE.absolute(ENV["BUILD_PATH"]);
if (!ENV["CONFIG"])
ENV["CONFIG"] = "Release";
global.$CONFIGURATION = ENV['CONFIG'];
global.$BUILD_DIR = ENV['BUILD_PATH'];
global.$COMMONJS_PRODUCT = FILE.join($BUILD_DIR, $CONFIGURATION, "CommonJS", "objective-j");
global.$COMMONJS_PRODUCT_BIN = FILE.join($COMMONJS_PRODUCT, "bin");
global.$COMMONJS_PRODUCT_LIB = FILE.join($COMMONJS_PRODUCT, "lib");
global.$CONFIGURATION = ENV['CONFIG'];
global.$BUILD_DIR = ENV['BUILD_PATH'];
global.$COMMONJS_PRODUCT = FILE.join($BUILD_DIR, $CONFIGURATION, "CommonJS", "objective-j");
global.$COMMONJS_PRODUCT_BIN = FILE.join($COMMONJS_PRODUCT, "bin");
global.$COMMONJS_PRODUCT_LIB = FILE.join($COMMONJS_PRODUCT, "lib");
global.$COMMONJS_PRODUCT_FRAMEWORKS = FILE.join($COMMONJS_PRODUCT_LIB, "Frameworks");
global.$PRODUCT_DIR = FILE.join($BUILD_DIR, $CONFIGURATION);
@@ -70,7 +71,15 @@ if(!global.COMMON_DO_ONCE)
}
if (FILE.exists(objectiveJBin))
OS.system("PATH=$PATH:" + objectiveJBin);
{
var system = OS.system;
// FIXME: is there a better way to do this???
OS.system = function(aCommand)
{
system("PATH=$PATH:" + OS.enquote(objectiveJBin) + " " + aCommand)
}
}
}
global.rm_rf = function(/*String*/ aFilename)