mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
some restructuring of the repo, trying to fix problems when building with node
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
||||
|
||||
require("../common.jake");
|
||||
|
||||
var framework = require("../Foundation/objective-j/jake").framework,
|
||||
BundleTask = require("../Foundation/objective-j/jake").BundleTask;
|
||||
var framework = require("../Jake/frameworktask.js").framework,
|
||||
BundleTask = require("../Jake/bundletask.js").BundleTask;
|
||||
|
||||
const path = require("path");
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ var screenNeedsInitialization = NO,
|
||||
screenNeedsInitialization = [CPPlatform isBrowser];
|
||||
|
||||
// We do this here because doing it later breaks IE.
|
||||
if (document.documentElement)
|
||||
if (typeof document !== 'undefined' && document.documentElement)
|
||||
document.documentElement.style.overflow = "hidden";
|
||||
|
||||
if ([CPPlatform isBrowser])
|
||||
|
||||
@@ -1,16 +1,61 @@
|
||||
|
||||
require("../../../common.jake");
|
||||
|
||||
var blend = require("cappuccino/jake").blend;
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const ObjectiveJ = require("objj-runtime");
|
||||
|
||||
blend ("Aristo.blend", function(aristoTask)
|
||||
{
|
||||
aristoTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "Aristo.build", $CONFIGURATION))
|
||||
aristoTask.setBuildPath(FILE.join($BUILD_DIR, $CONFIGURATION));
|
||||
$BUILD_CJS_BLENDTASK = path.join($BUILD_CJS_CAPPUCCINO, "lib", "cappuccino", "jake", "blendtask.j");
|
||||
|
||||
aristoTask.setThemeDescriptors(new FileList("ThemeDescriptors.j"));
|
||||
aristoTask.setIdentifier("com.280n.blend.Aristo");
|
||||
aristoTask.setResources(new FileList("Resources/*"));
|
||||
var callback;
|
||||
|
||||
var promise = new Promise((resolve, reject) => {
|
||||
callback = function(BLEND_TASK) {
|
||||
exports.BlendTask = BLEND_TASK.BlendTask;
|
||||
exports.blend = BLEND_TASK.blend;
|
||||
defineBlendTask();
|
||||
resolve();
|
||||
delete exports.jakePromise;
|
||||
}
|
||||
});
|
||||
|
||||
task ("build", ["Aristo.blend"]);
|
||||
var blendTask = buildBlendTask({});
|
||||
|
||||
function buildBlendTask(localExports) {
|
||||
|
||||
function exposeExports(path) {
|
||||
var object = require(path);
|
||||
|
||||
for (var name in object) {
|
||||
if (object.hasOwnProperty(name)) {
|
||||
localExports[name] = object[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exposeExports("jake");
|
||||
|
||||
// This check is only necessary because during the build process blendtask gets created much later.
|
||||
|
||||
if (fs.existsSync($BUILD_CJS_BLENDTASK)) {
|
||||
objj_importFile($BUILD_CJS_BLENDTASK, true, callback);
|
||||
//var BLEND_TASK = require("cappuccino/jake/blendtask");
|
||||
}
|
||||
return localExports;
|
||||
}
|
||||
|
||||
function defineBlendTask() {
|
||||
blendTask.blend ("Aristo.blend", function(aristoTask)
|
||||
{
|
||||
aristoTask.setBuildIntermediatesPath(path.join($BUILD_DIR, "Aristo.build", $CONFIGURATION))
|
||||
aristoTask.setBuildPath(path.join($BUILD_DIR, $CONFIGURATION));
|
||||
|
||||
aristoTask.setThemeDescriptors(new FileList("ThemeDescriptors.j"));
|
||||
aristoTask.setIdentifier("com.280n.blend.Aristo");
|
||||
aristoTask.setResources(new FileList("Resources/*"));
|
||||
});
|
||||
|
||||
task ("build", ["Aristo.blend"]);
|
||||
}
|
||||
|
||||
exports.jakePromise = promise;
|
||||
@@ -1,21 +1,24 @@
|
||||
|
||||
require("../../../common.jake");
|
||||
|
||||
var framework = require("objective-j/jake").framework;
|
||||
var BundleTask = require("objective-j/jake").BundleTask;
|
||||
const path = require("path");
|
||||
const glob = require("glob"); // FIXME: probably unnecessary to use an external library for this, maybe built into FileList?
|
||||
|
||||
var framework = require("../../../Jake/frameworktask.js").framework;
|
||||
var BundleTask = require("../../../Jake/bundletask.js").BundleTask;
|
||||
|
||||
blendKitTask = framework ("BlendKit", function(blendKitTask)
|
||||
{
|
||||
blendKitTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "BlendKit.build", $CONFIGURATION))
|
||||
blendKitTask.setBuildPath(FILE.join($BUILD_DIR, $CONFIGURATION));
|
||||
blendKitTask.setBuildIntermediatesPath(path.join($BUILD_DIR, "BlendKit.build", $CONFIGURATION))
|
||||
blendKitTask.setBuildPath(path.join($BUILD_DIR, $CONFIGURATION));
|
||||
|
||||
blendKitTask.setIdentifier("com.280n.BlendKit");
|
||||
blendKitTask.setVersion(getCappuccinoVersion());
|
||||
blendKitTask.setAuthor("280 North, Inc.");
|
||||
blendKitTask.setEmail("feedback @nospam@ 280north.com");
|
||||
blendKitTask.setSummary("BlendKit classes for Cappuccino");
|
||||
blendKitTask.setSources(FILE.glob("*.j"));
|
||||
blendKitTask.setResources(FILE.glob("Resources/*"));
|
||||
blendKitTask.setSources(glob.sync("*.j"));
|
||||
blendKitTask.setResources(glob.sync("Resources/*"));
|
||||
blendKitTask.setLicense(BundleTask.License.LGPL_v2_1);
|
||||
blendKitTask.setFlattensSources(true); // FIXME: how do we non flatten?
|
||||
|
||||
@@ -25,7 +28,7 @@ blendKitTask = framework ("BlendKit", function(blendKitTask)
|
||||
blendKitTask.setCompilerFlags("-DDEBUG -g -Wno-unused-but-set-variable");
|
||||
});
|
||||
|
||||
$BUILD_CJS_PRODUCT_BLENDKIT = FILE.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "BlendKit");
|
||||
$BUILD_CJS_PRODUCT_BLENDKIT = path.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "BlendKit");
|
||||
|
||||
filedir ($BUILD_CJS_PRODUCT_BLENDKIT, ["BlendKit"], function()
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
require("../../../common.jake");
|
||||
|
||||
var FILE = require("file");
|
||||
var path = require("path");
|
||||
|
||||
$BLENDTASK = "blendtask.j";
|
||||
$BUILD_CJS_BLENDTASK = FILE.join($BUILD_CJS_CAPPUCCINO, "lib", "cappuccino", "jake", "blendtask.j");
|
||||
$BUILD_CJS_BLENDTASK = path.join($BUILD_CJS_CAPPUCCINO, "lib", "cappuccino", "jake", "blendtask.j");
|
||||
|
||||
filedir($BUILD_CJS_BLENDTASK, [$BLENDTASK], function()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
require("../../common.jake");
|
||||
|
||||
subtasks(["BlendKit", "CommonJS", "Aristo", "Aristo2"], ["build", "clean", "clobber"]);
|
||||
|
||||
@@ -12,7 +12,6 @@ tmp_list.exclude("Jakefile");
|
||||
|
||||
tmp_list.forEach(function(aFilename)
|
||||
{
|
||||
|
||||
if (!fs.lstatSync(aFilename).isFile())
|
||||
return;
|
||||
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
diff -rupN a/engines/rhino/bin/narwhal-rhino b/engines/rhino/bin/narwhal-rhino
|
||||
--- a/engines/rhino/bin/narwhal-rhino 2011-11-16 11:01:40.000000000 +0000
|
||||
+++ b/engines/rhino/bin/narwhal-rhino 2012-04-23 18:35:45.000000000 +0100
|
||||
@@ -22,7 +22,7 @@ fi
|
||||
CLASSPATH=$NARWHAL_ENGINE_HOME/jars/jna.jar
|
||||
BOOTCLASSPATH=$NARWHAL_ENGINE_HOME/jars/js.jar
|
||||
|
||||
-JAVA_OPTS="-Dnarwhal.http_proxy=$http_proxy"
|
||||
+JAVA_OPTS="-Dnarwhal.http_proxy=$http_proxy $JAVA_OPTS"
|
||||
|
||||
if [ -n "$NARWHAL_CLASSPATH" ]; then
|
||||
CLASSPATH=$NARWHAL_CLASSPATH:$CLASSPATH
|
||||
+3
-4
@@ -22,8 +22,8 @@
|
||||
|
||||
require("../common.jake");
|
||||
|
||||
var framework = require("./objective-j/jake").framework;
|
||||
var BundleTask = require("./objective-j/jake").BundleTask;
|
||||
var framework = require("../Jake/frameworktask.js").framework;
|
||||
var BundleTask = require("../Jake/bundletask.js").BundleTask;
|
||||
|
||||
const path = require("path");
|
||||
|
||||
@@ -43,7 +43,7 @@ foundationTask = framework ("Foundation", function(foundationTask)
|
||||
foundationTask.setResources(new FileList("Resources/**/*"));
|
||||
foundationTask.setFlattensSources(true);
|
||||
foundationTask.setInfoPlistPath("Info.plist");
|
||||
foundationTask.setEnvironments(require("./objective-j/jake/environment").ObjJ);
|
||||
foundationTask.setEnvironments(require("../Jake/environment.js").ObjJ);
|
||||
|
||||
// Grab all the .h's and just include them in each file.
|
||||
var INCLUDES_LIST = new FileList();
|
||||
@@ -65,7 +65,6 @@ $BUILD_CJS_FOUNDATION = path.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "Foundation"
|
||||
|
||||
filedir ($BUILD_CJS_FOUNDATION, ["Foundation"], function()
|
||||
{
|
||||
console.log("in task $BUILD_CJS_FOUNDATION");
|
||||
cp_r(foundationTask.buildProductPath(), $BUILD_CJS_FOUNDATION);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* Objective-J.js
|
||||
* Objective-J
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* Copyright 2008-2010, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
var FILE = require("file");
|
||||
var MD5 = require("md5");
|
||||
var FileList = (require("jake")).FileList;
|
||||
var BundleTask = (require("objective-j/jake/bundletask")).BundleTask;
|
||||
exports.generateManifest = function(productPath, options)
|
||||
{
|
||||
options = options || {};
|
||||
indexFilePath = options.index || FILE.join(productPath, "index.html");
|
||||
if (!FILE.isFile(indexFilePath))
|
||||
{
|
||||
print("Warning: Skipping cache manifest generation, no index file at " + indexFilePath);
|
||||
return;
|
||||
} var index = FILE.read(indexFilePath, {charset: "UTF-8"});
|
||||
var manifestName = "app.manifest";
|
||||
var manifestPath = FILE.join(productPath, manifestName);
|
||||
var manifestAttribute = 'manifest="' + manifestName + '"';
|
||||
print("Generating cache manifest: " + manifestPath);
|
||||
var manifestOut = FILE.open(manifestPath, "w", {charset: "UTF-8"});
|
||||
manifestOut.print("CACHE MANIFEST");
|
||||
manifestOut.print("");
|
||||
manifestOut.print("CACHE:");
|
||||
var list = new FileList(FILE.join(productPath, "**", "*"));
|
||||
list.exclude(manifestPath);
|
||||
list.exclude("**/.DS_Store", "**/.htaccess");
|
||||
list.exclude("**/LICENSE");
|
||||
list.exclude("**/MHTML*");
|
||||
list.exclude("**/CommonJS.environment/*");
|
||||
list.exclude("**/*.cur");
|
||||
if (index.indexOf('"Frameworks/Debug"') < 0)
|
||||
list.exclude("**/Frameworks/Debug/*");
|
||||
if (options.exclude)
|
||||
options.exclude.forEach(list.exclude.bind(list));
|
||||
list.forEach( function(path)
|
||||
{
|
||||
if (FILE.isFile(path))
|
||||
{
|
||||
var relative = FILE.relative(productPath, path);
|
||||
if (BundleTask.isSpritable(path) && index.indexOf(relative) < 0)
|
||||
return;
|
||||
var hash = (MD5.hash(FILE.read(path, "b"))).decodeToString("base16");
|
||||
manifestOut.print("# " + hash);
|
||||
manifestOut.print(relative);
|
||||
} });
|
||||
manifestOut.print("");
|
||||
manifestOut.print("NETWORK:");
|
||||
manifestOut.print("*");
|
||||
manifestOut.close();
|
||||
var matchTag = index.match(/<html[^>]*>/i);
|
||||
if (matchTag)
|
||||
{
|
||||
var htmlTag = matchTag[0];
|
||||
var newHTMLTag = null;
|
||||
var matchAttr = htmlTag.match(/manifest\s*=\s*"([^"]*)"/i);
|
||||
if (matchAttr)
|
||||
{
|
||||
if (matchAttr[1] !== manifestName)
|
||||
{
|
||||
newHTMLTag = htmlTag.replace(matchAttr[0], manifestAttribute);
|
||||
} } else
|
||||
{
|
||||
newHTMLTag = htmlTag.replace(/>$/, " " + manifestAttribute + ">");
|
||||
} if (newHTMLTag)
|
||||
{
|
||||
print("Replacing html tag: \n " + htmlTag + "\nwith:\n " + newHTMLTag);
|
||||
var newIndex = index.replace(htmlTag, newHTMLTag);
|
||||
if (newIndex === index)
|
||||
{
|
||||
print("Warning: No change!");
|
||||
} else
|
||||
{
|
||||
FILE.write(indexFilePath, newIndex, {charset: "UTF-8"});
|
||||
} } } else
|
||||
{
|
||||
print("Warning: Couldn't find <html> tag in " + indexFilePath);
|
||||
} var htaccessPath = FILE.join(productPath, ".htaccess");
|
||||
var htaccess = FILE.isFile(htaccessPath) ? FILE.read(htaccessPath, {charset: "UTF-8"}) : "";
|
||||
var htaccessOut = FILE.open(htaccessPath, "w", {charset: "UTF-8"});
|
||||
htaccessOut.print(htaccess);
|
||||
var openTag = "<Files " + manifestName + ">";
|
||||
if (htaccess.indexOf(openTag) < 0)
|
||||
{
|
||||
htaccessOut.print("");
|
||||
htaccessOut.print(openTag);
|
||||
htaccessOut.print("\tHeader set Content-Type text/cache-manifest");
|
||||
htaccessOut.print("</Files>");
|
||||
} htaccessOut.close();
|
||||
};
|
||||
@@ -1,267 +0,0 @@
|
||||
/*
|
||||
* Objective-J.js
|
||||
* Objective-J
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* Copyright 2008-2010, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
var FILE = require("file"),
|
||||
OS = require("os"),
|
||||
ObjectiveJ = require("objective-j"),
|
||||
JAKE = require("jake");
|
||||
require("objective-j/rhino/regexp-rhino-patch");
|
||||
var compressors = {ss: {id: "minify/shrinksafe"}};
|
||||
var compressorStats = {};
|
||||
function compressor(code)
|
||||
{
|
||||
var winner,
|
||||
winnerName;
|
||||
compressorStats['original'] = (compressorStats['original'] || 0) + code.length;
|
||||
for (var name in compressors)
|
||||
{
|
||||
var aCompressor = require(compressors[name].id),
|
||||
result = aCompressor.compress(code, {charset: "UTF-8", useServer: true});
|
||||
compressorStats[name] = (compressorStats[name] || 0) + result.length;
|
||||
if (!winner || result < winner.length)
|
||||
{
|
||||
winner = result;
|
||||
winnerName = name;
|
||||
}
|
||||
}
|
||||
return winner;
|
||||
}
|
||||
function compileWithResolvedFlags(aFilePath, objjcFlags, gccFlags, asPlainJavascript)
|
||||
{
|
||||
var shouldObjjPreprocess = true,
|
||||
shouldCompress = objjcFlags.compress,
|
||||
fileContents = "",
|
||||
executable,
|
||||
code;
|
||||
if (!shouldObjjPreprocess)
|
||||
{
|
||||
try {
|
||||
var p = OS.popen("which gcc");
|
||||
if ((p.stdout.read()).length === 0)
|
||||
{
|
||||
fileContents = FILE.read(aFilePath, {charset: "UTF-8"});
|
||||
}
|
||||
else
|
||||
{
|
||||
try {
|
||||
var gcc = OS.popen("gcc -E -x c -P " + (gccFlags ? gccFlags.join(" ") : "") + " " + OS.enquote(aFilePath), {charset: "UTF-8"}),
|
||||
chunk = "";
|
||||
while (chunk = gcc.stdout.read())
|
||||
fileContents += chunk;
|
||||
}
|
||||
finally {
|
||||
gcc.stdin.close();
|
||||
gcc.stdout.close();
|
||||
gcc.stderr.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
p.stdin.close();
|
||||
p.stdout.close();
|
||||
p.stderr.close();
|
||||
}
|
||||
return fileContents;
|
||||
}
|
||||
try {
|
||||
var sources = new JAKE.FileList("**/*.j"),
|
||||
translateFilenameToPath = {},
|
||||
otherwayTranslateFilenameToPath = {};
|
||||
sources.forEach( function(aFilename)
|
||||
{
|
||||
translateFilenameToPath[FILE.basename(aFilename)] = aFilename;
|
||||
otherwayTranslateFilenameToPath[aFilename] = FILE.basename(aFilename);
|
||||
}, this);
|
||||
var translatedFilename = translateFilenameToPath[aFilePath] ? translateFilenameToPath[aFilePath] : aFilePath,
|
||||
otherwayTranslatedFilename = otherwayTranslateFilenameToPath[aFilePath] ? otherwayTranslateFilenameToPath[aFilePath] : aFilePath,
|
||||
theTranslatedFilename = otherwayTranslatedFilename ? otherwayTranslatedFilename : translatedFilename,
|
||||
absolutePath = FILE.absolute(theTranslatedFilename),
|
||||
basePath = absolutePath.substring(0, absolutePath.length - theTranslatedFilename.length);
|
||||
var rhinoUglyFix = false;
|
||||
if (system.engine === "rhino")
|
||||
{
|
||||
if (typeof document == "undefined")
|
||||
{
|
||||
document = {createElement: function(x)
|
||||
{
|
||||
return {innerText: "", style: {}};
|
||||
}};
|
||||
rhinoUglyFix = true;
|
||||
}
|
||||
if (typeof navigator == "undefined")
|
||||
{
|
||||
navigator = {"userAgent": "fakenavigator"};
|
||||
rhinoUglyFix = true;
|
||||
}
|
||||
}
|
||||
ObjectiveJ.FileExecutable.setCurrentCompilerFlags(objjcFlags);
|
||||
ObjectiveJ.make_narwhal_factory(absolutePath, basePath, translateFilenameToPath)(require, {}, module, system, print);
|
||||
executable = new ObjectiveJ.FileExecutable(FILE.basename(aFilePath));
|
||||
if (rhinoUglyFix)
|
||||
delete document;
|
||||
}
|
||||
catch(anException) {
|
||||
print(anException);
|
||||
return;
|
||||
}
|
||||
if (shouldCompress)
|
||||
{
|
||||
code = executable.code();
|
||||
code = compressor("function(){" + code + "}");
|
||||
code = code.replace(/^\s*function\s*\(\s*\)\s*{|}\s*;?\s*$/g, "");
|
||||
executable.setCode(code);
|
||||
}
|
||||
return asPlainJavascript ? executable.code() : executable.toMarkedString();
|
||||
}
|
||||
function resolveFlags(args)
|
||||
{
|
||||
var filePaths = [],
|
||||
outputFilePaths = [],
|
||||
index = 0,
|
||||
count = args.length,
|
||||
gccFlags = [],
|
||||
objjcFlags = {};
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var argument = args[index];
|
||||
if (argument === "-o")
|
||||
{
|
||||
if (++index < count)
|
||||
outputFilePaths.push(args[index]);
|
||||
}
|
||||
else if (argument.indexOf("-D") === 0)
|
||||
gccFlags.push(argument);
|
||||
else if (argument.indexOf("-U") === 0)
|
||||
gccFlags.push(argument);
|
||||
else if (argument === "--include")
|
||||
{
|
||||
if (++index < count)
|
||||
{
|
||||
gccFlags.push(argument);
|
||||
gccFlags.push(args[index]);
|
||||
}
|
||||
}
|
||||
else if (argument.indexOf("-T") === 0)
|
||||
{
|
||||
objjcFlags.includeIvarTypeSignatures = false;
|
||||
objjcFlags.includeMethodArgumentTypeSignatures = false;
|
||||
}
|
||||
else if (argument.indexOf("-g") === 0)
|
||||
objjcFlags.includeMethodFunctionNames = true;
|
||||
else if (argument.indexOf("-O") === 0)
|
||||
{
|
||||
objjcFlags.compress = true;
|
||||
if (argument.length > 2)
|
||||
objjcFlags.inlineMsgSendFunctions = true;
|
||||
}
|
||||
else if (argument.indexOf("-G") === 0)
|
||||
objjcFlags.generate = true;
|
||||
else if (argument.indexOf("--inline-msg-send") === 0)
|
||||
{
|
||||
objjcFlags.inlineMsgSendFunctions = true;
|
||||
}
|
||||
else
|
||||
filePaths.push(argument);
|
||||
}
|
||||
return {filePaths: filePaths, outputFilePaths: outputFilePaths, objjcFlags: objjcFlags, gccFlags: gccFlags};
|
||||
}
|
||||
exports.compile = function(aFilePath, flags)
|
||||
{
|
||||
if (flags.split)
|
||||
flags = flags.split(/\s+/);
|
||||
var resolvedFlags = resolveFlags(flags);
|
||||
return compileWithResolvedFlags(aFilePath, resolvedFlags.objjcFlags, resolvedFlags.gccFlags);
|
||||
};
|
||||
exports.main = function(args)
|
||||
{
|
||||
var shouldPrintOutput = false,
|
||||
asPlainJavascript = false,
|
||||
objjcFlags = {};
|
||||
var argv = args.slice(1);
|
||||
while (argv.length)
|
||||
{
|
||||
if (argv[0] === '--')
|
||||
{
|
||||
argv.shift();
|
||||
break;
|
||||
} if (argv[0] === "-p" || argv[0] === "--print")
|
||||
{
|
||||
shouldPrintOutput = YES;
|
||||
argv.shift();
|
||||
continue;
|
||||
} if (argv[0] === "--unmarked")
|
||||
{
|
||||
asPlainJavascript = true;
|
||||
argv.shift();
|
||||
continue;
|
||||
} if (argv[0] === "-T" || argv[0] === "--includeTypeSignatures")
|
||||
{
|
||||
objjcFlags.includeIvarTypeSignatures = true;
|
||||
objjcFlags.includeMethodArgumentTypeSignatures = true;
|
||||
argv.shift();
|
||||
continue;
|
||||
} if (argv[0] === "--help" || argv[0].substr(0, 1) == '-')
|
||||
{
|
||||
print("Usage (objjc 2.0): " + args[0] + " [options] [--] file...");
|
||||
print(" -p, --print print the output directly to stdout");
|
||||
print(" --unmarked don't tag the output with @STATIC header");
|
||||
print("");
|
||||
print(" -T, --dont-include-type-signatures include type signatures in the compiled output");
|
||||
print(" -g, --include-debug-symbols include debug symbols in the compiled output");
|
||||
print(" -T, --include-type-signatures include type signatures in the compiled output");
|
||||
print(" -O, --compress compress the compiled output");
|
||||
print(" -O2, --inline-msg-send inline objj_msgSend function in the compiled output");
|
||||
print(" -Wno-unused-but-set-variable turn off warning when a local variable is never read");
|
||||
print(" -Wno-shadow-ivar turn off warning when a local variable is shadowing an instance variable for the class");
|
||||
print(" -Wno-create-global-inside-function-or-method turn off warning when creating a global variable inside a function or method");
|
||||
print(" -Wno-unknown-class-or-global. turn off warning when a class or global variable is not known");
|
||||
print(" -Wno-unknown-ivar-type turn off warning when the type for an instance variable is not known");
|
||||
print(" To turn on a warning flag remove the 'no-' prefix. Example: -Wunused-but-set-variable");
|
||||
print("");
|
||||
print(" --help print this help");
|
||||
return;
|
||||
} break;
|
||||
} var resolved = resolveFlags(argv),
|
||||
outputFilePaths = resolved.outputFilePaths,
|
||||
gccFlags = resolved.gccFlags,
|
||||
resolvedObjjcFlags = resolved.objjcFlags;
|
||||
for (var key in resolvedObjjcFlags)
|
||||
{
|
||||
if (resolvedObjjcFlags.hasOwnProperty(key))
|
||||
{
|
||||
if (resolvedObjjcFlags[key])
|
||||
objjcFlags[key] = resolvedObjjcFlags[key];
|
||||
} } resolved.filePaths.forEach( function(filePath, index)
|
||||
{
|
||||
if (!shouldPrintOutput)
|
||||
print("Statically Compiling " + filePath);
|
||||
var output = compileWithResolvedFlags(filePath, objjcFlags, gccFlags, asPlainJavascript);
|
||||
if (output !== undefined)
|
||||
{
|
||||
if (shouldPrintOutput)
|
||||
print(output);
|
||||
else
|
||||
FILE.write(outputFilePaths[index], output, {charset: "UTF-8"});
|
||||
} });
|
||||
};
|
||||
if (require.main == module.id)
|
||||
exports.main(system.args);
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Objective-J.js
|
||||
* Objective-J
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* Copyright 2008-2010, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
var BUNDLE_TASK = require("./jake/bundletask");
|
||||
exports.BundleTask = BUNDLE_TASK.BundleTask;
|
||||
exports.bundle = BUNDLE_TASK.bundle;
|
||||
var FRAMEWORK_TASK = require("./jake/frameworktask");
|
||||
exports.FrameworkTask = FRAMEWORK_TASK.FrameworkTask;
|
||||
exports.framework = FRAMEWORK_TASK.framework;
|
||||
var APPLICATION_TASK = require("./jake/applicationtask");
|
||||
exports.ApplicationTask = APPLICATION_TASK.ApplicationTask;
|
||||
exports.app = APPLICATION_TASK.app;
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Objective-J.js
|
||||
* Objective-J
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* Copyright 2008-2010, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
function ObjectiveJLoader()
|
||||
{
|
||||
var loader = {};
|
||||
var factories = {};
|
||||
loader.reload = function(topId, path)
|
||||
{
|
||||
if (!global.ObjectiveJ)
|
||||
global.ObjectiveJ = require("objective-j");
|
||||
factories[topId] = ObjectiveJ.make_narwhal_factory(path);
|
||||
factories[topId].path = path;
|
||||
};
|
||||
loader.load = function(topId, path)
|
||||
{
|
||||
if (!factories.hasOwnProperty(topId))
|
||||
loader.reload(topId, path);
|
||||
return factories[topId];
|
||||
};
|
||||
return loader;
|
||||
}
|
||||
require.loader.loaders.unshift([".j", ObjectiveJLoader()]);
|
||||
@@ -20,40 +20,49 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
var /* FILE = require("file"),
|
||||
OS = require("os"),
|
||||
UTIL = require("narwhal/util"),
|
||||
TERM = require("narwhal/term"),
|
||||
base64 = require("base64"),
|
||||
Jake = require("jake"),*/
|
||||
//CLEAN = require("../../../common.jake").CLEAN,
|
||||
//CLOBBER = require("../../../common.jake").CLOBBER,
|
||||
ObjectiveJ = require("objj-runtime"),
|
||||
environment = require("./environment");
|
||||
// Core modules
|
||||
const child_process = require("child_process");
|
||||
const path = require("path");
|
||||
|
||||
/* task = Jake.task;
|
||||
var Task = Jake.Task,
|
||||
filedir = Jake.filedir; */
|
||||
// NPM modules
|
||||
const fs = require("fs-extra");
|
||||
const glob = require("glob");
|
||||
const ObjectiveJ = require("objj-runtime");
|
||||
const term = require("objj-runtime").term;
|
||||
|
||||
// for testing
|
||||
var Jake = require("../../../../jake/lib/jake.js");
|
||||
var fs = require("fs-extra");
|
||||
var glob = require("glob");
|
||||
// Internal modules
|
||||
const environment = require("./environment");
|
||||
const Jake = require("jake"); // TODO
|
||||
|
||||
/* Old imports
|
||||
FILE = require("file")
|
||||
OS = require("os")
|
||||
UTIL = require("narwhal/util")
|
||||
TERM = require("narwhal/term")
|
||||
base64 = require("base64")
|
||||
Jake = require("jake")
|
||||
*/
|
||||
|
||||
var task = Jake.task;
|
||||
var Task = Jake.Task;
|
||||
var filedir = Jake.filedir;
|
||||
|
||||
var path = require("path");
|
||||
var child_process = require("child_process");
|
||||
|
||||
function isImage(aFilename)
|
||||
{
|
||||
return [".png", ".jpg", ".jpeg", ".gif", ".tif", ".tiff"].includes(path.extname(aFilename).toLowerCase());
|
||||
}
|
||||
function mimeType(aFilename)
|
||||
{
|
||||
return {".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".tif": "image/tiff", ".tiff": "image/tiff"}[(path.extname(aFilename)).toLowerCase()];
|
||||
var mimeTypeDict = {
|
||||
".png": "image/png",
|
||||
".jpg": "image/jpeg",
|
||||
".jpeg": "image/jpeg",
|
||||
".gif": "image/gif",
|
||||
".tif": "image/tiff",
|
||||
".tiff": "image/tiff"
|
||||
};
|
||||
var lowerCaseExt = path.extname(aFilename).toLowerCase();
|
||||
return mimeTypeDict[lowerCaseExt];
|
||||
}
|
||||
function BundleTask(aName, anApplication)
|
||||
{
|
||||
@@ -310,7 +319,6 @@ BundleTask.prototype.defineTasks = function()
|
||||
this.defineSpritedImagesTask();
|
||||
CLEAN.include(this.buildIntermediatesProductPath());
|
||||
CLOBBER.include(this.buildProductPath());
|
||||
console.log("at the end of defineTasks");
|
||||
};
|
||||
BundleTask.prototype.packageType = function()
|
||||
{
|
||||
@@ -338,7 +346,7 @@ BundleTask.prototype.infoPlist = function()
|
||||
var environmentsWithImageSprites = ((this.environments()).filter( function(anEnvironment)
|
||||
{
|
||||
return anEnvironment.spritesImages() && (((task(this.buildProductDataURLPathForEnvironment(anEnvironment))).prerequisites()).filter(isImage)).length > 0;
|
||||
}, this)).map( function(anEnvironment)
|
||||
}, this)).map(function(anEnvironment)
|
||||
{
|
||||
return anEnvironment.name();
|
||||
});
|
||||
@@ -463,7 +471,6 @@ function directoryInCommon(filenames)
|
||||
}
|
||||
BundleTask.prototype.defineResourceTasks = function()
|
||||
{
|
||||
console.log("defineResourceTasks");
|
||||
if (!this._resources)
|
||||
return;
|
||||
var resources = [],
|
||||
@@ -476,7 +483,6 @@ BundleTask.prototype.defineResourceTasks = function()
|
||||
} else
|
||||
resources.push(aResourcePath);
|
||||
});
|
||||
console.log(resources);
|
||||
// TODO: too lazy to look this up, assuming it returns the array without duplicates
|
||||
// resources = UTIL.unique(resources);
|
||||
resources = [... new Set(resources)];
|
||||
@@ -489,7 +495,7 @@ BundleTask.prototype.defineResourceTasks = function()
|
||||
this.defineResourceTask(aResourcePath, path.join(resourcesPath, aResourcePath.substring(basePathLength)));
|
||||
}, this);
|
||||
};
|
||||
var RESOURCES_PATH = path.join(path.resolve(path.dirname(module.path)), "RESOURCES"),
|
||||
var RESOURCES_PATH = path.join(path.resolve(path.dirname(module.path)), "Jake/RESOURCES"),
|
||||
MHTMLTestPath = path.join(RESOURCES_PATH, "MHTMLTest.txt");
|
||||
BundleTask.prototype.defineSpritedImagesTask = function()
|
||||
{
|
||||
@@ -508,9 +514,8 @@ BundleTask.prototype.defineSpritedImagesTask = function()
|
||||
if (fs.existsSync(dataURLPath))
|
||||
fs.removeSync(dataURLPath);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Creating data URLs file... \0green(" + dataURLPath + "\0)");
|
||||
}
|
||||
term.stream.print("Creating data URLs file... \0green(" + dataURLPath + "\0)");
|
||||
var dataURLStream = fs.openSync(dataURLPath, "w+");
|
||||
fs.writeSync(dataURLStream, "@STATIC;1.0;");
|
||||
|
||||
@@ -536,8 +541,7 @@ BundleTask.prototype.defineSpritedImagesTask = function()
|
||||
fs.rmSync(MHTMLPath);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Creating MHTML paths file... \0green(" + MHTMLPath + "\0)");
|
||||
term.stream.write("Creating MHTML paths file... \0green(" + MHTMLPath + "\0)");
|
||||
var MHTMLStream = fs.openSync(MHTMLPath, "w+");
|
||||
fs.writeSync(MHTMLStream, "@STATIC;1.0;");
|
||||
|
||||
@@ -545,11 +549,11 @@ BundleTask.prototype.defineSpritedImagesTask = function()
|
||||
{
|
||||
var resourcePath = "Resources/" + path.relative(resourcesPath, aFilename),
|
||||
MHTMLResourcePath = "mhtml:" + path.join(folder, "MHTMLData.txt!") + resourcePath;
|
||||
MHTMLStream.write("u;" + resourcePath.length + ";" + resourcePath);
|
||||
MHTMLStream.write(MHTMLResourcePath.length + ";" + MHTMLResourcePath);
|
||||
|
||||
fs.writeSync(MHTMLStream, "u;" + resourcePath.length + ";" + resourcePath);
|
||||
fs.writeSync(MHTMLStream, MHTMLResourcePath.length + ";" + MHTMLResourcePath);
|
||||
});
|
||||
fs.closeSync(MHTMLStream);
|
||||
MHTMLStream.close();
|
||||
});
|
||||
this.enhance([MHTMLPath]);
|
||||
var MHTMLDataPath = this.buildProductMHTMLDataPathForEnvironment(anEnvironment);
|
||||
@@ -562,26 +566,29 @@ BundleTask.prototype.defineSpritedImagesTask = function()
|
||||
fs.rmSync(MHTMLDataPath);
|
||||
return;
|
||||
}
|
||||
console.log("Creating MHTML images file... \0green(" + MHTMLDataPath + "\0)");
|
||||
//var MHTMLDataStream = FILE.open(MHTMLDataPath, "w+", {charset: "UTF-8"});
|
||||
term.stream.print("Creating MHTML images file... \0green(" + MHTMLDataPath + "\0)");
|
||||
var MHTMLDataStream = fs.openSync(MHTMLDataPath, "w+");
|
||||
MHTMLDataStream.write("/*\r\nContent-Type: multipart/related; boundary=\"_ANY_STRING_WILL_DO_AS_A_SEPARATOR\"\r\n\r\n");
|
||||
fs.writeSync(MHTMLDataStream, "/*\r\nContent-Type: multipart/related; boundary=\"_ANY_STRING_WILL_DO_AS_A_SEPARATOR\"\r\n\r\n");
|
||||
prerequisites.forEach( function(aFilename)
|
||||
{
|
||||
var resourcePath = "Resources/" + path.relative(resourcesPath, aFilename);
|
||||
MHTMLDataStream.write("--_ANY_STRING_WILL_DO_AS_A_SEPARATOR\r\n");
|
||||
fs.writeSync(MHTMLDataStream, "--_ANY_STRING_WILL_DO_AS_A_SEPARATOR\r\n");
|
||||
fs.writeSync(MHTMLDataStream, "Content-Location:" + resourcePath + "\r\nContent-Transfer-Encoding:base64\r\n\r\n");
|
||||
fs.writeSync(MHTMLDataStream, fs.readFileSync(aFilename).toString("utf8"));
|
||||
fs.writeSync(MHTMLDataStream, "\r\n");
|
||||
/* MHTMLDataStream.write("--_ANY_STRING_WILL_DO_AS_A_SEPARATOR\r\n");
|
||||
MHTMLDataStream.write("Content-Location:" + resourcePath + "\r\nContent-Transfer-Encoding:base64\r\n\r\n");
|
||||
MHTMLDataStream.write(fs.readFileSync(aFilename).toString("utf8"));
|
||||
MHTMLDataStream.write("\r\n");
|
||||
MHTMLDataStream.write("\r\n"); */
|
||||
});
|
||||
MHTMLDataStream.write("*/");
|
||||
MHTMLDataStream.close();
|
||||
fs.writeSync(MHTMLDataStream, "*/");
|
||||
fs.closeSync(MHTMLDataStream);
|
||||
});
|
||||
this.enhance([MHTMLDataPath]);
|
||||
var MHTMLTestDestinationPath = this.buildProductMHTMLTestPathForEnvironment(anEnvironment);
|
||||
filedir(MHTMLTestDestinationPath, function(aTask)
|
||||
{
|
||||
console.log("Copying MHTML test file... \0green(" + MHTMLTestDestinationPath + "\0)");
|
||||
term.stream.print("Copying MHTML test file... \0green(" + MHTMLTestDestinationPath + "\0)");
|
||||
fs.copyFileSync(MHTMLTestPath, MHTMLTestDestinationPath);
|
||||
});
|
||||
this.enhance([MHTMLTestDestinationPath]);
|
||||
@@ -597,12 +604,11 @@ BundleTask.prototype.defineStaticTask = function()
|
||||
staticPath = this.buildProductStaticPathForEnvironment(anEnvironment),
|
||||
flattensSources = this.flattensSources(),
|
||||
productName = this.productName();
|
||||
filedir(staticPath, function(aTask)
|
||||
filedir(staticPath, function(aTask)
|
||||
{
|
||||
console.log("Creating static file... \0green(" + staticPath + "\0)");
|
||||
//TERM.stream.print("Creating static file... \0green(" + staticPath + "\0)");
|
||||
term.stream.print("Creating static file... \0green(" + staticPath + "\0)");
|
||||
var fileStream = fs.openSync(staticPath, "w+");
|
||||
fileStream.write("@STATIC;1.0;");
|
||||
fs.writeSync(fileStream, "@STATIC;1.0;");
|
||||
(aTask.prerequisites()).forEach( function(aFilename)
|
||||
{
|
||||
if (!fs.lstatSync(aFilename).isFile())
|
||||
@@ -611,18 +617,22 @@ BundleTask.prototype.defineStaticTask = function()
|
||||
if (aFilename.indexOf(sourcesPath) === 0)
|
||||
{
|
||||
var relativePath = flattensSources ? path.basename(aFilename) : path.relative(sourcesPath, aFilename);
|
||||
fileStream.write("p;" + relativePath.length + ";" + relativePath);
|
||||
fs.writeSync(fileStream, "p;" + relativePath.length + ";" + relativePath);
|
||||
var fileContents = fs.readFileSync(aFilename).toString("utf8");
|
||||
fileStream.write("t;" + fileContents.length + ";" + fileContents);
|
||||
} else if (aFilename.indexOf(resourcesPath) === 0 && !isImage(aFilename))
|
||||
fs.writeSync(fileStream, "t;" + fileContents.length + ";" + fileContents);
|
||||
}
|
||||
else if (aFilename.indexOf(resourcesPath) === 0 && !isImage(aFilename))
|
||||
{
|
||||
var resourcePath = "Resources/" + path.relative(resourcesPath, aFilename);
|
||||
fileStream.write("p;");
|
||||
contents = fs.readFileSync(aFilename).toString("utf8");
|
||||
fileStream.write(resourcePath.length + ";" + resourcePath + contents);
|
||||
} }, this);
|
||||
fileStream.write("e;");
|
||||
fileStream.close();
|
||||
}
|
||||
}, this);
|
||||
fs.writeFileSync(fileStream, "e;");
|
||||
fs.closeSync(fileStream);
|
||||
//fileStream.write("e;");
|
||||
//fileStream.close();
|
||||
ObjectiveJ.Executable.resetCachedFileExecutableSearchers();
|
||||
ObjectiveJ.StaticResource.resetRootResources();
|
||||
ObjectiveJ.FileExecutable.resetFileExecutables();
|
||||
@@ -644,8 +654,6 @@ BundleTask.prototype.defineSourceTasks = function()
|
||||
compilerFlags = "";
|
||||
else if (compilerFlags.join)
|
||||
compilerFlags = compilerFlags.join(" ");
|
||||
console.log("environments");
|
||||
console.log(this.environments());
|
||||
(this.environments()).forEach( function(anEnvironment)
|
||||
{
|
||||
var environmentSources = sources,
|
||||
@@ -681,65 +689,44 @@ BundleTask.prototype.defineSourceTasks = function()
|
||||
var relativePath = aFilename.substring(basePathLength ? basePathLength + 1 : basePathLength),
|
||||
compiledEnvironmentSource = path.join(sourcesPath, relativePath);
|
||||
|
||||
filedir(compiledEnvironmentSource, [aFilename], async function()
|
||||
{
|
||||
console.log("ran compiledEnvironmentSource");
|
||||
var rhinoUglyFix = false;
|
||||
if (false/* system.engine === "rhino" */)
|
||||
{
|
||||
if (typeof document == "undefined")
|
||||
{
|
||||
document = {createElement: function(x)
|
||||
{
|
||||
return {innerText: "", style: {}};
|
||||
}};
|
||||
rhinoUglyFix = true;
|
||||
} if (typeof navigator == "undefined")
|
||||
{
|
||||
navigator = {"userAgent": "fakenavigator"};
|
||||
rhinoUglyFix = true;
|
||||
} }
|
||||
|
||||
|
||||
var compile;
|
||||
filedir(compiledEnvironmentSource, [aFilename], async function()
|
||||
{
|
||||
if ((path.extname(aFilename)).toLowerCase() !== ".j")
|
||||
{
|
||||
console.log("Including [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)");
|
||||
//(TERM.stream.write("Including [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)")).flush();
|
||||
(term.stream.write("Including [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)")).flush();
|
||||
var compiled = fs.readFileSync(aFilename, { encoding: "utf8"}).toString();
|
||||
console.log((Array(Math.round(compiled.length / 1024) + 3)).join("."));
|
||||
return await fs.promises.writeFile(compiledEnvironmentSource, compiled, { encoding: "utf8"});
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
var translatedFilename = translateFilenameToPath[aFilename] ? translateFilenameToPath[aFilename] : aFilename,
|
||||
otherwayTranslatedFilename = otherwayTranslateFilenameToPath[aFilename] ? otherwayTranslateFilenameToPath[aFilename] : aFilename,
|
||||
theTranslatedFilename = otherwayTranslatedFilename ? otherwayTranslatedFilename : translatedFilename,
|
||||
absolutePath = path.resolve(theTranslatedFilename),
|
||||
basePath = absolutePath.substring(0, absolutePath.length - theTranslatedFilename.length);
|
||||
ObjectiveJ.FileExecutable.setCurrentGccCompilerFlags(environmentCompilerFlags);
|
||||
ObjectiveJ.StaticResource.setCurrentGccCompilerFlags(environmentCompilerFlags);
|
||||
CFBundle.environments = function()
|
||||
{
|
||||
return [anEnvironment.name(), "ObjJ"];
|
||||
};
|
||||
console.log("before make_narwhal_factory");
|
||||
console.log("basePath: " + basePath);
|
||||
//absolutePath = "/" + absolutePath;
|
||||
//basePath = "/" + basePath;
|
||||
console.log("absolutePath: " + absolutePath);
|
||||
return new Promise((resolve, reject) => {
|
||||
var callback = function() {
|
||||
console.log("callback called");
|
||||
var otherwayTranslatedFilename = otherwayTranslateFilenameToPath[aFilename] ? otherwayTranslateFilenameToPath[aFilename] : aFilename,
|
||||
translatedFilename = translateFilenameToPath[aFilename] ? translateFilenameToPath[aFilename] : aFilename,
|
||||
executer = new ObjectiveJ.FileExecutable(otherwayTranslatedFilename);
|
||||
var compiled = executer.toMarkedString();
|
||||
console.log((Array(Math.round(compiled.length / 1024) + 3)).join("."));
|
||||
//var msg = "Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)";
|
||||
var dots = (Array(Math.round(compiled.length / 1024) + 3)).join(".");
|
||||
term.stream.print(dots);
|
||||
fs.writeFileSync(compiledEnvironmentSource, compiled, { encoding: "utf8"});
|
||||
resolve();
|
||||
}
|
||||
console.log("mnf");
|
||||
debugger;
|
||||
var msg = "Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)";
|
||||
term.stream.print(msg);
|
||||
ObjectiveJ.make_narwhal_factory(absolutePath, basePath, translateFilenameToPath, callback)(require, e, module, {}, console.log);
|
||||
console.log("Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)");
|
||||
//(TERM.stream.write("Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)")).flush();
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -12,6 +12,8 @@ require("./common.jake");
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
const term = require("objj-runtime").term;
|
||||
|
||||
|
||||
var subprojects = ["Objective-J", "CommonJS", "Foundation", "AppKit", "Tools"];
|
||||
|
||||
@@ -410,9 +412,9 @@ function pushPackage(path, remote, branch)
|
||||
|
||||
var pkg = JSON.parse(packagePath.join("package.json").read({ charset : "UTF-8" }));
|
||||
|
||||
stream.print(" Version: " + colorize(pkg.version, "purple"));
|
||||
stream.print(" Revision: " + colorize(pkg["cappuccino-revision"], "purple"));
|
||||
stream.print(" Timestamp: " + colorize(pkg["cappuccino-timestamp"], "purple"));
|
||||
term.stream.print(" Version: " + colorize(pkg.version, "purple"));
|
||||
term.stream.print(" Revision: " + colorize(pkg["cappuccino-revision"], "purple"));
|
||||
term.stream.print(" Timestamp: " + colorize(pkg["cappuccino-timestamp"], "purple"));
|
||||
|
||||
var cmd = [
|
||||
["cd", packagePath],
|
||||
|
||||
@@ -41,6 +41,8 @@ acorn = {walk: walk};
|
||||
acorn = require("./acorn").acorn;
|
||||
var compiler = require("./ObjJAcornCompiler").ObjJCompiler;
|
||||
|
||||
const term = require("objj-runtime").term;
|
||||
|
||||
//$BUILD_CONFIGURATION_DIR = "../Build"
|
||||
$BROWSER_FILE = path.join("Browser", "Objective-J.js");
|
||||
|
||||
@@ -82,7 +84,8 @@ new FileList("CommonJS/**/*").forEach(function(aFilename)
|
||||
{
|
||||
if (path.extname(aFilename) !== ".js")
|
||||
{
|
||||
console.log("Copying... \0green(" + aFilename +"\0)");
|
||||
term.stream.print("Copying... \0green(" + aFilename +"\0)");
|
||||
//console.log("Copying... \0green(" + aFilename +"\0)");
|
||||
cp(aFilename, buildFilename);
|
||||
}
|
||||
else
|
||||
@@ -132,7 +135,8 @@ function compressor(srcCode) {
|
||||
var headerText = fs.readFileSync("header.txt", { encoding: "utf8"});
|
||||
function gcc(inputFilePath, outputFilePath, flags, compress)
|
||||
{
|
||||
console.log("Building... \0green(" + outputFilePath +"\0)");
|
||||
term.stream.print("Building... \0green(" + outputFilePath +"\0)");
|
||||
//console.log("Building... \0green(" + outputFilePath +"\0)");
|
||||
var source = fs.readFileSync(inputFilePath, { charset : "utf8" }).toString();
|
||||
//console.log(source.charCodeAt);
|
||||
var compilerOptions = compiler.parseGccCompilerFlags(flags.join(" "));
|
||||
|
||||
+3
-5
@@ -31,7 +31,7 @@ var child_process = require('child_process');
|
||||
var path = require('path');
|
||||
|
||||
// for testing
|
||||
var JAKE = require("../jake/lib/jake.js");
|
||||
var JAKE = require("jake");
|
||||
|
||||
requiresSudo = false;
|
||||
|
||||
@@ -249,7 +249,7 @@ function setupEnvironment()
|
||||
{
|
||||
try
|
||||
{
|
||||
//require("objective-j").OBJJ_INCLUDE_PATHS.push(path.join($BUILD_CONFIGURATION_DIR, "CommonJS", "cappuccino", "Frameworks"));
|
||||
require("objj-runtime").OBJJ_INCLUDE_PATHS.push(path.join($BUILD_CONFIGURATION_DIR, "CommonJS", "cappuccino", "Frameworks"));
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
@@ -318,10 +318,8 @@ function systemSync(command)
|
||||
{
|
||||
console.log("i systemSync");
|
||||
console.log("command: " + command)
|
||||
|
||||
try {
|
||||
child_process.execSync(command, {stdio: 'inherit'});
|
||||
console.log("exited gracefully")
|
||||
return 0;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -503,7 +501,7 @@ global.spawnJake = function(/*String*/ aTaskName)
|
||||
{
|
||||
console.log("i spawnJake");
|
||||
// for testing
|
||||
if (systemSync(serializedENV() + " " + "/Users/alfred/Developer/jake/bin/jake" + " " + aTaskName))
|
||||
if (systemSync(serializedENV() +/* " " + "node --inspect-brk" + */" /Users/alfred/Developer/jake/bin/jake" + " " + aTaskName))
|
||||
console.log("exited in spawnJake with code 1");
|
||||
process.exit(1); //rake abort if ($? != 0)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user