Fixed: Introduce ’jake install-inline’ task to generate the cappuccino framework with objj_msgSend function inlined. Also introduced options in ’index-debug.html’ templates to allow inline of objj_msgSend function when compiling in browser.

This commit is contained in:
Martin Carlberg
2015-10-06 13:34:28 +02:00
parent 101261ca63
commit e45e31d223
16 changed files with 51 additions and 15 deletions
+3 -2
View File
@@ -33,8 +33,9 @@ appKitTask = framework ("AppKit", function(appKitTask)
return "--include \"" + aFilename + "\"";
}).join(" ");
if ($CONFIGURATION === "Release")
appKitTask.setCompilerFlags("-O " + INCLUDES);
if ($CONFIGURATION === "Release") {
appKitTask.setCompilerFlags(($INLINE_MSG_SEND ? "-O2 " : "-O ") + INCLUDES);
}
else
appKitTask.setCompilerFlags("-DDEBUG -g " + INCLUDES);
});
+1 -1
View File
@@ -20,7 +20,7 @@ blendKitTask = framework ("BlendKit", function(blendKitTask)
blendKitTask.setFlattensSources(true); // FIXME: how do we non flatten?
if ($CONFIGURATION === "Release")
blendKitTask.setCompilerFlags("-O");
blendKitTask.setCompilerFlags($INLINE_MSG_SEND ? "-O2" : "-O");
else
blendKitTask.setCompilerFlags("-DDEBUG -g");
});
+1 -1
View File
@@ -51,7 +51,7 @@ foundationTask = framework ("Foundation", function(foundationTask)
INCLUDES = "--include \"../AppKit/Platform/Platform.h\" " + INCLUDES;
if ($CONFIGURATION === "Release")
foundationTask.setCompilerFlags("-O " + INCLUDES);
foundationTask.setCompilerFlags(($INLINE_MSG_SEND ? "-O2 " : "-O ") + INCLUDES);
else
foundationTask.setCompilerFlags("-DDEBUG -g " + INCLUDES);
});
+11 -3
View File
@@ -21,7 +21,7 @@ var subprojects = ["Objective-J", "CommonJS", "Foundation", "AppKit", "Tools"];
$BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS = FILE.join($BUILD_CJS_OBJECTIVE_J, "Frameworks", "Debug");
filedir ($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, ["debug", "release"], function()
filedir ($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, [], function()
{
FILE.mkdirs($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS);
@@ -30,7 +30,7 @@ filedir ($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, ["debug", "release"], function
$BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS = FILE.join($BUILD_CJS_CAPPUCCINO, "Frameworks", "Debug");
filedir ($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, ["debug", "release"], function()
filedir ($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, [], function()
{
FILE.mkdirs($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS);
@@ -39,7 +39,9 @@ filedir ($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, ["debug", "release"], function(
cp_r(FILE.join($BUILD_DIR, "Debug", "BlendKit"), FILE.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "BlendKit"));
});
task ("CommonJS", [$BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "debug", "release"]);
task ("CommonJS", ["debug", "release", $BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "debug", "release"]);
task ("CommonJS-inline", ["debug", "release-inline", $BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "debug", "release-inline"]);
task ("install", ["CommonJS"], function()
{
@@ -47,6 +49,12 @@ task ("install", ["CommonJS"], function()
installCopy($BUILD_CJS_CAPPUCCINO, false);
});
task ("install-inline", ["CommonJS-inline"], function()
{
installCopy($BUILD_CJS_OBJECTIVE_J, false);
installCopy($BUILD_CJS_CAPPUCCINO, false);
});
task ("sudo-install", ["CommonJS"], function()
{
installCopy($BUILD_CJS_OBJECTIVE_J, true);
+1 -1
View File
@@ -351,7 +351,7 @@ function FileRequest(/*CFURL*/ aURL, onsuccess, onfailure, onprogress)
{
var aFilePath = aURL.toString().substring(5),
OS = require("os"),
gccFlags = require("objective-j").currentCompilerFlags(),
gccFlags = require("objective-j").currentGccCompilerFlags(),
chunk,
fileContents = "";
@@ -192,8 +192,12 @@ function resolveFlags(args)
else if (argument.indexOf("-g") === 0)
objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.IncludeDebugSymbols;
else if (argument.indexOf("-O") === 0)
else if (argument.indexOf("-O") === 0) {
objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.Compress;
// FIXME: currently we are sending in '-O2' when we want InlineMsgSend. Here we only check if we it is '-O...'
if (argument.length > 2)
objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.InlineMsgSend;
}
else if (argument.indexOf("-G") === 0)
objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.Generate;
@@ -907,7 +907,7 @@ BundleTask.prototype.defineSourceTasks = function()
basePath = absolutePath.substring(0, absolutePath.length - theTranslatedFilename.length);
// Here we set the current compiler flags so the load system will know what compiler flags to use
ObjectiveJ.setCurrentCompilerFlags(environmentCompilerFlags);
ObjectiveJ.setCurrentGccCompilerFlags(environmentCompilerFlags);
// Here we tell the CFBundle to load frameworks for the current build enviroment and not the enviroment that is running
CFBundle.environments = function() {return [anEnvironment.name(), "ObjJ"]};
ObjectiveJ.make_narwhal_factory(absolutePath, basePath, translateFilenameToPath)(require, e, module, system, print);
+1 -1
View File
@@ -41,7 +41,7 @@ function FileExecutable(/*CFURL|String*/ aURL, /*Dictionary*/ aFilenameTranslate
if (fileContents.match(/^@STATIC;/))
executable = decompile(fileContents, aURL);
else if ((extension === "j" || !extension) && !fileContents.match(/^{/))
executable = exports.ObjJAcornCompiler.compileFileDependencies(fileContents, aURL, ObjJAcornCompiler.Flags.IncludeDebugSymbols);
executable = exports.ObjJAcornCompiler.compileFileDependencies(fileContents, aURL, exports.currentCompilerFlags());
else
executable = new Executable(fileContents, [], aURL);
@@ -49,7 +49,7 @@ var FILENAMES = [
correct = FILE.read(FILE.join(FILE.dirname(module.path), filename + ".js"));
[self assertNoThrow:function() {
preprocessed = ObjectiveJ.ObjJAcornCompiler.compileToExecutable(unpreprocessed).code();
preprocessed = ObjectiveJ.ObjJAcornCompiler.compileToExecutable(unpreprocessed, nil, ObjectiveJ.ObjJAcornCompiler.Flags.IncludeDebugSymbols/* | ObjectiveJ.ObjJAcornCompiler.Flags.IncludeTypeSignatures*/).code();
preprocessed = compressor.compress(preprocessed, { charset : "UTF-8", useServer : true });
correct = compressor.compress(correct, { charset : "UTF-8", useServer : true });
}];
@@ -40,7 +40,7 @@ app (projectName, function(task)
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
task.setCompilerFlags("-O2");
});
task ("default", [projectName], function()
@@ -61,6 +61,11 @@
<script type="text/javascript">
objj_msgSend_reset();
// COMPILER OPTIONS:
// Uncomment to generate debug symbols, type signatures and/or inline objj_msgSend functions
// ObjectiveJ.setCurrentCompilerFlags(ObjectiveJ.ObjJAcornCompiler.Flags.IncludeDebugSymbols | ObjectiveJ.ObjJAcornCompiler.Flags.IncludeTypeSignatures | ObjectiveJ.ObjJAcornCompiler.Flags.InlineMsgSend);
// DEBUG OPTIONS:
// Uncomment to enable printing of backtraces on exceptions:
@@ -112,7 +112,7 @@ var frameworkTask = framework (productName, function(frameworkTask)
if (configuration === "Debug")
frameworkTask.setCompilerFlags("-DDEBUG -g");
else
frameworkTask.setCompilerFlags("-O");
frameworkTask.setCompilerFlags("-O2");
});
task ("debug", function()
@@ -40,7 +40,7 @@ app (projectName, function(task)
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
task.setCompilerFlags("-O2");
});
task ("default", [projectName], function()
@@ -61,6 +61,11 @@
<script type="text/javascript">
objj_msgSend_reset();
// COMPILER OPTIONS:
// Uncomment to generate debug symbols, type signatures and/or inline objj_msgSend functions
// ObjectiveJ.setCurrentCompilerFlags(ObjectiveJ.ObjJAcornCompiler.Flags.IncludeDebugSymbols | ObjectiveJ.ObjJAcornCompiler.Flags.IncludeTypeSignatures | ObjectiveJ.ObjJAcornCompiler.Flags.InlineMsgSend);
// DEBUG OPTIONS:
// Uncomment to enable printing of backtraces on exceptions:
@@ -61,6 +61,11 @@
<script type="text/javascript">
objj_msgSend_reset();
// COMPILER OPTIONS:
// Uncomment to generate debug symbols, type signatures and/or inline objj_msgSend functions
// ObjectiveJ.setCurrentCompilerFlags(ObjectiveJ.ObjJAcornCompiler.Flags.IncludeDebugSymbols | ObjectiveJ.ObjJAcornCompiler.Flags.IncludeTypeSignatures | ObjectiveJ.ObjJAcornCompiler.Flags.InlineMsgSend);
// DEBUG OPTIONS:
// Uncomment to enable printing of backtraces on exceptions:
+8
View File
@@ -148,6 +148,7 @@ global.filedir = JAKE.filedir;
global.FileList = JAKE.FileList;
global.$CONFIGURATION = SYSTEM.env['CONFIG'];
global.$INLINE_MSG_SEND = SYSTEM.env['INLINE_MSG_SEND'];
global.$BUILD_DIR = SYSTEM.env['BUILD_PATH'];
global.$BUILD_CONFIGURATION_DIR = FILE.join($BUILD_DIR, $CONFIGURATION);
@@ -597,6 +598,13 @@ task ("release", function()
spawnJake("build");
});
task ("release-inline", function()
{
SYSTEM.env["CONFIG"] = "Release";
SYSTEM.env['INLINE_MSG_SEND'] = true;
spawnJake("build");
});
task ("debug", function()
{
SYSTEM.env["CONFIG"] = "Debug";