lots of Node fixes

This commit is contained in:
Alfred Wärnsäter
2021-08-19 10:56:13 +02:00
parent ddeaad74d0
commit 2ecea40fdc
52 changed files with 807 additions and 4548 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ var cachedBlackColor,
CPImage _patternImage; CPImage _patternImage;
CPString _cssString; CPString _cssString;
} }
@global document
#pragma mark - #pragma mark -
#pragma mark Theming #pragma mark Theming
+2
View File
@@ -37,6 +37,8 @@
CPString _expires; CPString _expires;
} }
@global document
/*! /*!
Initializes a cookie with a given name \c aName. Initializes a cookie with a given name \c aName.
@param the name for the cookie @param the name for the cookie
+2
View File
@@ -41,6 +41,8 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
#endif #endif
} }
@global document
- (id)initWithFrame:(CGRect)aFrame - (id)initWithFrame:(CGRect)aFrame
{ {
+2
View File
@@ -29,6 +29,8 @@
@global CPApp @global CPApp
@class CPFontPanel @class CPFontPanel
@global document
CPItalicFontMask = 1 << 0; CPItalicFontMask = 1 << 0;
CPBoldFontMask = 1 << 1; CPBoldFontMask = 1 << 1;
CPUnboldFontMask = 1 << 2; CPUnboldFontMask = 1 << 2;
+1
View File
@@ -33,6 +33,7 @@
@import "CPCompatibility.j" @import "CPCompatibility.j"
@class CPColor @class CPColor
@global document
@protocol CPImageDelegate <CPObject> @protocol CPImageDelegate <CPObject>
+2
View File
@@ -29,6 +29,8 @@
@global CPImagesPboardType @global CPImagesPboardType
@global appkit_tag_dom_elements @global appkit_tag_dom_elements
@global document
@typedef CPImageAlignment @typedef CPImageAlignment
CPImageAlignCenter = 0; CPImageAlignCenter = 0;
CPImageAlignTop = 1; CPImageAlignTop = 1;
+2
View File
@@ -31,6 +31,8 @@
@global CPMenuDidChangeItemNotification @global CPMenuDidChangeItemNotification
@global CPMenuDidRemoveItemNotification @global CPMenuDidRemoveItemNotification
@global document
@implementation _CPMenuBarWindow : CPPanel @implementation _CPMenuBarWindow : CPPanel
{ {
CPView _highlightView; CPView _highlightView;
+1
View File
@@ -32,6 +32,7 @@
@end @end
@global document
var CPSoundDelegate_sound_didFinishPlaying_ = 1 << 1; var CPSoundDelegate_sound_didFinishPlaying_ = 1 << 1;
+2
View File
@@ -34,6 +34,8 @@
@global CPStringPboardType @global CPStringPboardType
@global CPCursor @global CPCursor
@global document
@protocol CPTextFieldDelegate <CPControlTextEditingDelegate> @protocol CPTextFieldDelegate <CPControlTextEditingDelegate>
@end @end
+2
View File
@@ -32,6 +32,8 @@
@global _MakeRangeFromAbs @global _MakeRangeFromAbs
@global document
@class CPTextContainer @class CPTextContainer
@class CPTextView @class CPTextView
+2
View File
@@ -55,6 +55,8 @@
@end @end
@global document
_MakeRangeFromAbs = function(a1, a2) _MakeRangeFromAbs = function(a1, a2)
{ {
return (a1 < a2) ? CPMakeRange(a1, a2 - a1) : CPMakeRange(a2, a1 - a2); return (a1 < a2) ? CPMakeRange(a1, a2 - a1) : CPMakeRange(a2, a1 - a2);
+1
View File
@@ -40,6 +40,7 @@
@global CPTextFieldDidFocusNotification @global CPTextFieldDidFocusNotification
@global CPTextFieldDidBlurNotification @global CPTextFieldDidBlurNotification
@global document
// TODO: should be conform to protocol CPTextFieldDelegate // TODO: should be conform to protocol CPTextFieldDelegate
@protocol CPTokenFieldDelegate <CPObject> @protocol CPTokenFieldDelegate <CPObject>
+2
View File
@@ -39,6 +39,8 @@ CPWebViewProgressEstimateChangedNotification = "CPWebViewProgressEstimateChan
CPWebViewProgressStartedNotification = "CPWebViewProgressStartedNotification"; CPWebViewProgressStartedNotification = "CPWebViewProgressStartedNotification";
CPWebViewProgressFinishedNotification = "CPWebViewProgressFinishedNotification"; CPWebViewProgressFinishedNotification = "CPWebViewProgressFinishedNotification";
@global document
/*! /*!
Automatically choose between AppKit (Cappuccino style) scrollbars and Automatically choose between AppKit (Cappuccino style) scrollbars and
native scrollbars. In this mode AppKit scrollbars are always used except native scrollbars. In this mode AppKit scrollbars are always used except
+2
View File
@@ -268,6 +268,8 @@ var CPWindowActionMessageKeys = [
BOOL _inhibitUpdateTrackingAreas; // Used by the CPView when updating tracking areas BOOL _inhibitUpdateTrackingAreas; // Used by the CPView when updating tracking areas
} }
@global document
+ (Class)_binderClassForBinding:(CPString)aBinding + (Class)_binderClassForBinding:(CPString)aBinding
{ {
if ([aBinding hasPrefix:CPDisplayPatternTitleBinding]) if ([aBinding hasPrefix:CPDisplayPatternTitleBinding])
+2
View File
@@ -120,6 +120,8 @@ var CALayerRegisteredRunLoopUpdates = nil;
CGAffineTransform _transformFromLayer; CGAffineTransform _transformFromLayer;
} }
@global document
/*! /*!
Returns a new animation layer. Returns a new animation layer.
*/ */
+4
View File
@@ -291,7 +291,11 @@ var frameToCSSTranslationTransformMatrix = function(start, current)
- (Object)_DOMElement - (Object)_DOMElement
{ {
#if PLATFORM(DOM)
return _DOMElement; return _DOMElement;
#else
return nil;
#endif
} }
- (CPString)debug_description - (CPString)debug_description
+1
View File
@@ -53,6 +53,7 @@ subtasks (["Themes"], ["clean", "clobber"]);
task ("Theme", [$BUILD_CJS_CAPPUCCINO_APPKIT], function() task ("Theme", [$BUILD_CJS_CAPPUCCINO_APPKIT], function()
{ {
console.log("in task Theme in appkit");
subjake(["Themes"], "build"); subjake(["Themes"], "build");
cp_r(path.join($BUILD_DIR, $CONFIGURATION, 'Aristo.blend'), path.join($BUILD_PATH, 'Resources', 'Aristo.blend')); cp_r(path.join($BUILD_DIR, $CONFIGURATION, 'Aristo.blend'), path.join($BUILD_PATH, 'Resources', 'Aristo.blend'));
+2
View File
@@ -25,6 +25,8 @@
@import "CGGeometry.j" @import "CGGeometry.j"
@global document
@implementation CPDOMWindowLayer : CPObject @implementation CPDOMWindowLayer : CPObject
{ {
int _level; int _level;
@@ -133,6 +133,8 @@
@global _CPRunModalLoop @global _CPRunModalLoop
@global document
// List of all open native windows // List of all open native windows
var PlatformWindows = [CPSet set]; var PlatformWindows = [CPSet set];
+11 -8
View File
@@ -517,15 +517,17 @@ var themedButtonValues = nil,
width: 9.0, width: 9.0,
height: 4.0, height: 4.0,
orientation: PatternIsVertical orientation: PatternIsVertical
}), });
// removed as variable is never read
knobColorLegacy = PatternColor( /* knobColorLegacy = PatternColor(
"scroller-legacy-vertical-knob{position}.png", "scroller-legacy-vertical-knob{position}.png",
{ {
width: 14.0, width: 14.0,
height: 3.0, height: 3.0,
orientation: PatternIsVertical orientation: PatternIsVertical
}); }) */
themedVerticalScrollerValues = themedVerticalScrollerValues =
[ [
@@ -593,15 +595,16 @@ var themedButtonValues = nil,
width: 4.0, width: 4.0,
height: 9.0, height: 9.0,
orientation: PatternIsHorizontal orientation: PatternIsHorizontal
}), });
knobColorLegacy = PatternColor( // removed as variable is never read
/* knobColorLegacy = PatternColor(
"scroller-legacy-horizontal-knob{position}.png", "scroller-legacy-horizontal-knob{position}.png",
{ {
width: 3.0, width: 3.0,
height: 14.0, height: 14.0,
orientation: PatternIsHorizontal orientation: PatternIsHorizontal
}); }) */
themedHorizontalScrollerValues = themedHorizontalScrollerValues =
[ [
@@ -2792,7 +2795,7 @@ var themedButtonValues = nil,
closeButtonImageInactive = PatternImage(@"window-standard-close-button-inactive.png", 16, 16), closeButtonImageInactive = PatternImage(@"window-standard-close-button-inactive.png", 16, 16),
closeButtonImageHighlighted = PatternImage(@"window-standard-button-highlighted.png", 16, 16), closeButtonImageHighlighted = PatternImage(@"window-standard-button-highlighted.png", 16, 16),
unsavedButtonImage = PatternImage(@"window-standard-button-unsaved.png", 16, 16), unsavedButtonImage = PatternImage(@"window-standard-button-unsaved.png", 16, 16),
unsavedButtonImageInactive = PatternImage(@"window-standard-button-unsaved-inactive.png", 16, 16), //unsavedButtonImageInactive = PatternImage(@"window-standard-button-unsaved-inactive.png", 16, 16), removed as it is unused
unsavedButtonImageHighlighted = PatternImage(@"window-standard-close-button-unsaved-highlighted.png", 16, 16), unsavedButtonImageHighlighted = PatternImage(@"window-standard-close-button-unsaved-highlighted.png", 16, 16),
minimizeButtonImage = PatternImage(@"window-standard-minimize-button.png", 16, 16), minimizeButtonImage = PatternImage(@"window-standard-minimize-button.png", 16, 16),
minimizeButtonImageHighlighted = PatternImage(@"window-standard-minimize-button-highlighted.png", 16, 16), minimizeButtonImageHighlighted = PatternImage(@"window-standard-minimize-button-highlighted.png", 16, 16),
+4 -4
View File
@@ -28,10 +28,10 @@
@import <BlendKit/BlendKit.j> @import <BlendKit/BlendKit.j>
var /* FILE = require("file"), */ var /* FILE = require("file"), */
TERM = require("objj-runtime").term, TERM = ObjectiveJ.term,
task = require("objj-jake").task, task = JAKE.task,
filedir = require("objj-jake").filedir, filedir = JAKE.filedir,
BundleTask = require("../../../Jake/bundletask.js").BundleTask; BundleTask = CAPPUCCINO.Jake.BundleTask.BundleTask;
var fs = require("fs"); var fs = require("fs");
var path = require("path"); var path = require("path");
+2
View File
@@ -77,6 +77,8 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
#endif #endif
} }
@global document
- (id)initWithFrame:(CGRect)aFrame control:(CPControl)aControl - (id)initWithFrame:(CGRect)aFrame control:(CPControl)aControl
{ {
self = [super initWithFrame:aFrame]; self = [super initWithFrame:aFrame];
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env node
JAKE = require("@objj/jake");
ObjectiveJ = require("@objj/runtime");
CAPPUCCINO = require("@objj/cappuccino");
JAKE.application().run({ args : process.argv });
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env node
require("@objj/runtime").run(process.argv);
+12 -4
View File
@@ -1,7 +1,7 @@
var path = require("path"); var path = require("path");
var fs = require("fs"); var fs = require("fs");
function exposeExports(path) /* function exposeExports(path)
{ {
var object = require(path); var object = require(path);
@@ -10,7 +10,15 @@ function exposeExports(path)
exports[name] = object[name]; exports[name] = object[name];
} }
exposeExports("objj-jake"); exposeExports("@objj/jake"); */
var object = JAKE;
for (var name in object) {
if (object.hasOwnProperty(name)) {
exports[name] = object[name];
}
}
exports.initilize = function(callback) { exports.initilize = function(callback) {
// This check is only necessary because during the build process blendtask gets created much later. // This check is only necessary because during the build process blendtask gets created much later.
@@ -26,7 +34,7 @@ exports.initilize = function(callback) {
callback(anExports); callback(anExports);
} }
process.env["CONFIG"] = "Debug"; process.env["CONFIG"] = "Debug";
require("objj-runtime").OBJJ_INCLUDE_PATHS.push(path.join(path.join($BUILD_DIR, "Debug"), "CommonJS", "cappuccino", "Frameworks")); ObjectiveJ.OBJJ_INCLUDE_PATHS.push(path.join(path.join($BUILD_DIR, "Debug"), "CommonJS", "cappuccino", "Frameworks"));
require("objj-runtime").make_narwhal_factory(blendTaskPath, null, null, localCallback)(require, anExports, module, typeof system !== "undefined" && system, console.log); ObjectiveJ.make_narwhal_factory(blendTaskPath, null, null, localCallback)(require, anExports, module, typeof system !== "undefined" && system, console.log);
} }
} }
+2
View File
@@ -50,6 +50,8 @@ CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}";
DOMElement _scriptTag; DOMElement _scriptTag;
} }
@global document
/*! @deprecated */ /*! @deprecated */
+ (CPJSONPConnection)sendRequest:(CPURLRequest)aRequest callback:(CPString)callbackParameter delegate:(id)aDelegate + (CPJSONPConnection)sendRequest:(CPURLRequest)aRequest callback:(CPString)callbackParameter delegate:(id)aDelegate
{ {
+15 -1
View File
@@ -22,12 +22,26 @@
var /* FILE = require("file"), */ var /* FILE = require("file"), */
OS = require("os"), OS = require("os"),
Jake = require("objj-jake"), Jake = JAKE,
BundleTask = (require("./bundletask")).BundleTask; BundleTask = (require("./bundletask")).BundleTask;
var fs = require("fs"); var fs = require("fs");
var path = require("path"); var path = require("path");
var copyRecursiveSync = function (src, dest) {
var exists = fs.existsSync(src);
var stats = exists && fs.statSync(src);
var isDirectory = exists && stats.isDirectory();
if (isDirectory) {
fs.mkdirSync(dest, { recursive: true });
fs.readdirSync(src).forEach(function(childItemName) {
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
});
} else {
fs.copyFileSync(src, dest);
}
};
function ApplicationTask(aName) function ApplicationTask(aName)
{ {
BundleTask.apply(this, arguments); BundleTask.apply(this, arguments);
+31 -16
View File
@@ -26,28 +26,42 @@ const path = require("path");
// NPM modules // NPM modules
const fs = require("fs"); const fs = require("fs");
const ObjectiveJ = require("objj-runtime"); //const ObjectiveJ = require("@objj/runtime");
const term = require("objj-runtime").term; const term = ObjectiveJ.term;
// Internal modules // Internal modules
const environment = require("./environment"); const environment = require("./environment");
const Jake = require("objj-jake"); //const JAKE = require("@objj/jake");
/* Old imports /* Old imports
FILE = require("file") FILE = require("file")
OS = require("os") OS = require("os")
UTIL = require("narwhal/util") UTIL = require("narwhal/util")
TERM = require("narwhal/term") TERM = require("narwhal/term")
base64 = require("base64") base64 = require("base64")
Jake = require("jake") JAKE = require("jake")
*/ */
var task = Jake.task; var copyRecursiveSync = function (src, dest) {
var Task = Jake.Task; var exists = fs.existsSync(src);
var filedir = Jake.filedir; var stats = exists && fs.statSync(src);
var FileList = Jake.FileList; var isDirectory = exists && stats.isDirectory();
CLEAN = require("objj-jake/lib/jake/clean.js").CLEAN; if (isDirectory) {
CLOBBER = require("objj-jake/lib/jake/clean.js").CLOBBER; fs.mkdirSync(dest, { recursive: true });
fs.readdirSync(src).forEach(function(childItemName) {
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
});
} else {
fs.copyFileSync(src, dest);
}
};
var task = JAKE.task;
var Task = JAKE.Task;
var filedir = JAKE.filedir;
var FileList = JAKE.FileList;
CLEAN = JAKE.CLEAN_AND_CLOBBER.CLEAN;
CLOBBER = JAKE.CLEAN_AND_CLOBBER.CLOBBER;
function isImage(aFilename) function isImage(aFilename)
@@ -494,7 +508,7 @@ BundleTask.prototype.defineResourceTasks = function()
basePath = null; basePath = null;
this._resources.forEach( function(aResourcePath) this._resources.forEach( function(aResourcePath)
{ {
if (fs.lstatSync(aResourcePath).isDirectory()) if (fs.existsSync(aResourcePath) && fs.lstatSync(aResourcePath).isDirectory())
{ {
resources = resources.concat(aResourcePath, (new FileList(aResourcePath + "/**")).toArray()); resources = resources.concat(aResourcePath, (new FileList(aResourcePath + "/**")).toArray());
} else } else
@@ -558,7 +572,7 @@ BundleTask.prototype.defineSpritedImagesTask = function()
fs.rmSync(MHTMLPath); fs.rmSync(MHTMLPath);
return; return;
} }
term.stream.write("Creating MHTML paths file... \0green(" + MHTMLPath + "\0)"); term.stream.print("Creating MHTML paths file... \0green(" + MHTMLPath + "\0)");
var MHTMLStream = fs.openSync(MHTMLPath, "w+"); var MHTMLStream = fs.openSync(MHTMLPath, "w+");
fs.writeSync(MHTMLStream, "@STATIC;1.0;"); fs.writeSync(MHTMLStream, "@STATIC;1.0;");
@@ -712,11 +726,12 @@ BundleTask.prototype.defineSourceTasks = function()
{ {
if ((path.extname(aFilename)).toLowerCase() !== ".j") if ((path.extname(aFilename)).toLowerCase() !== ".j")
{ {
(term.stream.write("Including [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)")).flush(); (term.stream.write("Including [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)"));
var compiled = fs.readFileSync(aFilename, { encoding: "utf8"}).toString(); var compiled = fs.readFileSync(aFilename, { encoding: "utf8"}).toString();
var dots = (Array(Math.round(compiled.length / 1024 / 4) + 3)).join("."); var dots = (Array(Math.round(compiled.length / 1024 / 4) + 3)).join(".");
var p = await fs.promises.writeFile(compiledEnvironmentSource, compiled, { encoding: "utf8"});
term.stream.print(dots); term.stream.print(dots);
return await fs.promises.writeFile(compiledEnvironmentSource, compiled, { encoding: "utf8"}); return p;
} }
else else
{ {
@@ -738,8 +753,8 @@ BundleTask.prototype.defineSourceTasks = function()
var compiled = executer.toMarkedString(); var compiled = executer.toMarkedString();
//var msg = "Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)"; //var msg = "Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)";
var dots = (Array(Math.round(compiled.length / 1024 / 4) + 3)).join("."); var dots = (Array(Math.round(compiled.length / 1024 / 4) + 3)).join(".");
term.stream.print(dots);
fs.writeFileSync(compiledEnvironmentSource, compiled, { encoding: "utf8"}); fs.writeFileSync(compiledEnvironmentSource, compiled, { encoding: "utf8"});
term.stream.print(dots);
resolve(); resolve();
} }
var msg = "Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)"; var msg = "Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)";
+13 -5
View File
@@ -2,10 +2,17 @@ require("./common.jake");
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
const term = require("objj-runtime").term; var child_process = require("child_process");
debugger;
const term = ObjectiveJ.term;
var subprojects = ["Objective-J", "CommonJS", "Foundation", "AppKit", "Tools"]; var subprojects = ["Objective-J", "CommonJS", "Foundation", "AppKit", "Tools"];
task ("build", function() {
child_process.execSync("mkdir -p $CAPP_BUILD");
child_process.execSync("ln -sf $PWD/node_modules $CAPP_BUILD/node_modules");
});
["build", "clean", "clobber"].forEach(function(aTaskName) ["build", "clean", "clobber"].forEach(function(aTaskName)
{ {
task (aTaskName, function() task (aTaskName, function()
@@ -18,7 +25,7 @@ $BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS = path.join($BUILD_CJS_OBJECTIVE_J, "Fra
filedir ($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, ["debug", "release"], function() filedir ($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, ["debug", "release"], function()
{ {
fs.mkdirSync($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS); fs.mkdirSync($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, { recursive: true });
cp_r(path.join($BUILD_DIR, "Debug", "Objective-J"), path.join($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, "Objective-J")); cp_r(path.join($BUILD_DIR, "Debug", "Objective-J"), path.join($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, "Objective-J"));
}); });
@@ -27,15 +34,16 @@ $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS = path.join($BUILD_CJS_CAPPUCCINO, "Frame
filedir ($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, ["debug", "release"], function() filedir ($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, ["debug", "release"], function()
{ {
console.log("in the task $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS"); fs.mkdirSync($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, { recursive: true });
fs.mkdirSync($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS);
cp_r(path.join($BUILD_DIR, "Debug", "Foundation"), path.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "Foundation")); cp_r(path.join($BUILD_DIR, "Debug", "Foundation"), path.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "Foundation"));
cp_r(path.join($BUILD_DIR, "Debug", "AppKit"), path.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "AppKit")); cp_r(path.join($BUILD_DIR, "Debug", "AppKit"), path.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "AppKit"));
cp_r(path.join($BUILD_DIR, "Debug", "BlendKit"), path.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "BlendKit")); cp_r(path.join($BUILD_DIR, "Debug", "BlendKit"), path.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "BlendKit"));
}); });
task ("CommonJS", [$BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "debug", "release"]); task ("CommonJS", [$BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "debug", "release"], function() {
console.log("in commonjs action");
});
task ("install", ["CommonJS"], function() task ("install", ["CommonJS"], function()
{ {
+1 -1
View File
@@ -286,7 +286,7 @@ DISPLAY_NAME(CFBundle.prototype.isLoaded);
CFBundle.prototype.load = function(/*BOOL*/ shouldExecute) CFBundle.prototype.load = function(/*BOOL*/ shouldExecute)
{ {
if (this._loadStatus !== CFBundleUnloaded) if (this._loadStatus !== CFBundleUnloaded)
return; return;
this._loadStatus = CFBundleLoading | CFBundleLoadingInfoPlist; this._loadStatus = CFBundleLoading | CFBundleLoadingInfoPlist;
+7 -5
View File
@@ -1,7 +1,9 @@
#!/usr/bin/env narwhal #!/usr/bin/env node
var execPath = require("file").path(module.path); const path = require("path");
var mainPath = execPath.dirname().dirname().join("lib", execPath.basename(), "main.j");
var args = ["objj", String(mainPath)].concat(system.args.slice(1)); var commandName = path.basename(process.argv[1]);
require("objective-j").run(args); var mainPath = path.resolve(__dirname, "..", "lib", commandName, "main.j");
var args = ["objj", mainPath].concat(process.argv.slice(2));
require("@objj/runtime").run(args);
+1 -1
View File
@@ -40,7 +40,7 @@ acorn = {walk: walk};
acorn = require("./acorn").acorn; acorn = require("./acorn").acorn;
var compiler = require("./ObjJAcornCompiler").ObjJCompiler; var compiler = require("./ObjJAcornCompiler").ObjJCompiler;
const term = require("objj-runtime").term; const term = ObjectiveJ.term;
//$BUILD_CONFIGURATION_DIR = "../Build" //$BUILD_CONFIGURATION_DIR = "../Build"
$BROWSER_FILE = path.join("Browser", "Objective-J.js"); $BROWSER_FILE = path.join("Browser", "Objective-J.js");
-2
View File
@@ -44,7 +44,6 @@ var DefaultDictionary = nil,
+ (id)defaultConfiguration + (id)defaultConfiguration
{ {
debugger;
if (!DefaultConfiguration) if (!DefaultConfiguration)
DefaultConfiguration = [[self alloc] initWithPath:nil]; DefaultConfiguration = [[self alloc] initWithPath:nil];
@@ -53,7 +52,6 @@ var DefaultDictionary = nil,
+ (id)userConfiguration + (id)userConfiguration
{ {
debugger;
if (!UserConfiguration) if (!UserConfiguration)
UserConfiguration = [[self alloc] initWithPath:PATH.join(process.env["HOME"], ".cappconfig")]; UserConfiguration = [[self alloc] initWithPath:PATH.join(process.env["HOME"], ".cappconfig")];
+49 -84
View File
@@ -25,16 +25,15 @@
/* var OS = require("os"), /* var OS = require("os"),
SYSTEM = require("system"), SYSTEM = require("system"),
FILE = require("file"); */ FILE = require("file"); */
var OBJJ = require("objj-runtime"),
stream = require("objj-runtime").term.stream;
parser = new (require("objj-runtime").parser.Parser)(); var stream = ObjectiveJ.term.stream;
parser = new (ObjectiveJ.parser.Parser)();
// FIXME: lots of chaining using narwhals path wrapper, this file might still be broken // FIXME: lots of chaining using narwhals path wrapper, this file might still be broken
var fs = require("fs"); var fs = require("fs");
var node_path = require("path"); var node_path = require("path");
var child_process = require("child_process"); var child_process = require("child_process");
var jake = require("objj-jake");
// FIXME: removing command line options for now // FIXME: removing command line options for now
parser.usage("DESTINATION_DIRECTORY"); parser.usage("DESTINATION_DIRECTORY");
@@ -98,37 +97,32 @@ parser.helpful();
/* var CAPP_HOME = require("narwhal/packages").catalog["cappuccino"].directory, /* var CAPP_HOME = require("narwhal/packages").catalog["cappuccino"].directory,
templatesDirectory = node_path.join(CAPP_HOME, "lib", "capp", "Resources", "Templates"); */ templatesDirectory = node_path.join(CAPP_HOME, "lib", "capp", "Resources", "Templates"); */
var templatesDirectory = "/Users/alfred/Developer/cappuccino/Tools/capp/Resources/Templates"; var templatesDirectory;
function gen(/*va_args*/) function gen(/*va_args*/)
{ {
console.log("in gen: " + arguments); var mainBundlePath = arguments[0];
var args = ["capp gen"].concat(Array.prototype.slice.call(arguments)); templatesDirectory = node_path.join(mainBundlePath, "..", "Resources", "Templates");
debugger; var args = ["capp gen"].concat(Array.prototype.slice.call(arguments, 1));
var options = parser.parse(args, null, null, true); var options = parser.parse(args, null, null, true);
console.log(options);
if (options.args.length > 1) if (options.args.length > 1)
{ {
parser.printUsage(options); parser.printUsage(options);
process.exit(1); process.exit(1);
} }
console.log("a");
if (options.listTemplates) if (options.listTemplates)
{ {
listTemplates(); listTemplates();
return; return;
} }
console.log("b");
if (options.listFrameworks) if (options.listFrameworks)
{ {
listFrameworks(); listFrameworks();
return; return;
} }
console.log("c");
var destination = options.args[0]; var destination = options.args[0];
@@ -150,33 +144,29 @@ function gen(/*va_args*/)
else else
sourceTemplate = node_path.join(templatesDirectory, options.template); sourceTemplate = node_path.join(templatesDirectory, options.template);
console.log(sourceTemplate);
if (!fs.lstatSync(sourceTemplate).isDirectory()) if (!fs.lstatSync(sourceTemplate).isDirectory())
{ {
stream.print(colorize("Error: ", "red") + "The template " + logPath(sourceTemplate) + " cannot be found. Available templates are:"); stream.print(colorize("Error: ", "red") + "The template " + logPath(sourceTemplate) + " cannot be found. Available templates are:");
listTemplates(); listTemplates();
process.exit(1); process.exit(1);
} }
console.log("d");
var configFile = node_path.join(sourceTemplate, "template.config"), var configFile = node_path.join(sourceTemplate, "template.config"),
config = {}; config = {};
console.log(configFile);
if (fs.existsSync(configFile)) if (fs.existsSync(configFile))
config = JSON.parse(fs.readFileSync(configFile, { encoding: "utf8" })); config = JSON.parse(fs.readFileSync(configFile, { encoding: "utf8" }));
//config = JSON.parse(FILE.read(configFile, { charset:"UTF-8" })); //config = JSON.parse(FILE.read(configFile, { charset:"UTF-8" }));
console.log("e");
debugger;
var destinationProject = destination, var destinationProject = destination,
configuration = options.noconfig ? [Configuration defaultConfiguration] : [Configuration userConfiguration], configuration = options.noconfig ? [Configuration defaultConfiguration] : [Configuration userConfiguration],
frameworks = options.frameworks, frameworks = options.frameworks,
themes = options.themes; themes = options.themes;
console.log("f");
if (!options.noFrameworks) if (!options.noFrameworks)
frameworks.push("Objective-J", "Foundation", "AppKit"); frameworks.push("Objective-J", "Foundation", "AppKit");
console.log("before if");
if (options.justFrameworks) if (options.justFrameworks)
{ {
@@ -199,11 +189,10 @@ function gen(/*va_args*/)
} }
}; };
console.log("before copy: " + sourceTemplate + " " + destinationProject);
// FIXME??? // FIXME???
copyRecursiveSync(sourceTemplate, destinationProject); copyRecursiveSync(sourceTemplate, destinationProject);
var files = (new jake.FileList(node_path.join(destinationProject, "**", "*"))).toArray(), var files = (new ObjectiveJ.utils.filelist.FileList(node_path.join(destinationProject, "**", "*"))).toArray(),
count = files.length, count = files.length,
name = node_path.basename(destinationProject), name = node_path.basename(destinationProject),
orgIdentifier = [configuration valueForKey:@"organization.identifier"] || ""; orgIdentifier = [configuration valueForKey:@"organization.identifier"] || "";
@@ -272,18 +261,20 @@ function gen(/*va_args*/)
function createFrameworksInFile(/*Array*/ frameworks, /*String*/ aFile, /*Boolean*/ symlink, /*Boolean*/ build, /*Boolean*/ force) function createFrameworksInFile(/*Array*/ frameworks, /*String*/ aFile, /*Boolean*/ symlink, /*Boolean*/ build, /*Boolean*/ force)
{ {
var destination = node_path.path(node_path.resolve(aFile)); var destination = node_path.resolve(aFile);
if (!destination.isDirectory()) if (!fs.lstatSync(destination).isDirectory())
fail("Cannot create Frameworks. The directory does not exist: " + destination); fail("Cannot create Frameworks. The directory does not exist: " + destination);
var destinationFrameworks = destination.join("Frameworks"), var destinationFrameworks = node_path.join(destination, "Frameworks"),
destinationDebugFrameworks = destination.join("Frameworks", "Debug"); destinationDebugFrameworks = node_path.join(destination, "Frameworks", "Debug");
stream.print("Creating Frameworks directory in " + logPath(destinationFrameworks) + "..."); stream.print("Creating Frameworks directory in " + logPath(destinationFrameworks) + "...");
//destinationFrameworks.mkdirs(); // redundant //destinationFrameworks.mkdirs(); // redundant
destinationDebugFrameworks.mkdirs(); //destinationDebugFrameworks.mkdirs();
fs.mkdirSync(destinationDebugFrameworks, { recursive: true });
if (build) if (build)
{ {
@@ -303,84 +294,59 @@ function createFrameworksInFile(/*Array*/ frameworks, /*String*/ aFile, /*Boolea
else else
{ {
// Frameworks. Search frameworks paths // Frameworks. Search frameworks paths
frameworks.forEach(function(framework) frameworks.forEach(function(framework) {
{ var objjHome = ObjectiveJ.OBJJ_HOME;
// Need a special case for Objective-J // Need a special case for Objective-J
if (framework === "Objective-J") if (framework === "Objective-J"){
{
// Objective-J. Take from OBJJ_HOME. // Objective-J. Take from OBJJ_HOME.
var objjHome = OBJJ.OBJJ_HOME, var objjPath = node_path.join(objjHome, "..", "objective-j", "Frameworks", "Objective-J");
objjPath = node_path.join(objjHome, "Frameworks", "Objective-J"), var objjDebugPath = node_path.join(objjHome, "..", "objective-j", "Frameworks", "Debug", "Objective-J");
objjDebugPath = node_path.join(objjHome, "Frameworks", "Debug", "Objective-J");
installFramework(objjPath, destinationFrameworks.join("Objective-J"), force, symlink); installFramework(objjPath, node_path.join(destinationFrameworks, "Objective-J"), force, symlink);
installFramework(objjDebugPath, destinationDebugFrameworks.join("Objective-J"), force, symlink); installFramework(objjDebugPath, node_path.join(destinationDebugFrameworks, "Objective-J"), force, symlink);
return; return;
} }
var frameworkPath = node_path.join(objjHome, "Frameworks", framework);
installFramework(frameworkPath, node_path.join(destinationFrameworks, framework), force, symlink);
var found = false; var frameworkDebugPath = node_path.join(objjHome, "Frameworks", "Debug", framework);
installFramework(frameworkDebugPath, node_path.join(destinationDebugFrameworks, framework), force, symlink);
for (var i = 0; i < OBJJ.objj_frameworks.length; i++) /* if (!found)
{
var sourceFramework = node_path.join(OBJJ.objj_frameworks[i], framework);
if (fs.lstatSync(sourceFramework).isDirectory())
{
installFramework(sourceFramework, destinationFrameworks.join(framework), force, symlink);
found = true;
break;
}
}
if (!found)
warn("Couldn't find the framework: " + logPath(framework)); warn("Couldn't find the framework: " + logPath(framework));
for (var i = 0, found = false; i < OBJJ.objj_debug_frameworks.length; i++)
{
var sourceDebugFramework = node_path.join(OBJJ.objj_debug_frameworks[i], framework);
if (fs.lstatSync(sourceDebugFramework).isDirectory())
{
installFramework(sourceDebugFramework, destinationDebugFrameworks.join(framework), force, symlink);
found = true;
break;
}
}
if (!found) if (!found)
warn("Couldn't find the debug framework: " + logPath(framework)); warn("Couldn't find the debug framework: " + logPath(framework)); */
}); });
} }
} }
function installFramework(source, dest, force, symlink) function installFramework(source, dest, force, symlink)
{ {
if (dest.exists()) if (fs.existsSync(dest)){
{ if (force) {
if (force) fs.rmSync(dest, { recursive: true });
dest.rmtree(); } else {
else
{
warn(logPath(dest) + " already exists. Use --force to overwrite."); warn(logPath(dest) + " already exists. Use --force to overwrite.");
return; return;
} }
} }
if (source.exists()) if (fs.existsSync(source)) {
{
stream.print((symlink ? "Symlinking " : "Copying ") + logPath(source) + " ==> " + logPath(dest)); stream.print((symlink ? "Symlinking " : "Copying ") + logPath(source) + " ==> " + logPath(dest));
if (symlink) {
if (symlink)
fs.symlinkSync(source, dest); fs.symlinkSync(source, dest);
else } else {
copyRecursiveSync(source, dest); copyRecursiveSync(source, dest);
} }
else } else {
warn("Cannot find: " + logPath(source)); warn("Cannot find: " + logPath(source));
}
} }
function createThemesInFile(/*Array*/ themes, /*String*/ aFile, /*Boolean*/ symlink, /*Boolean*/ force) function createThemesInFile(/*Array*/ themes, /*String*/ aFile, /*Boolean*/ symlink, /*Boolean*/ force)
{ {
var destination = node_path.resolve(aFile); var destination = node_path.resolve(aFile);
@@ -397,12 +363,12 @@ function createThemesInFile(/*Array*/ themes, /*String*/ aFile, /*Boolean*/ syml
var themesBuild = node_path.join(process.env["CAPP_BUILD"], "Release"), var themesBuild = node_path.join(process.env["CAPP_BUILD"], "Release"),
sources = []; sources = [];
themes.forEach(function(theme) themes.forEach(function(theme)
{ {
var themeFolder = theme + ".blend", var themeFolder = theme + ".blend",
path = node_path.join(themesBuild, themeFolder); path = node_path.join(themesBuild, themeFolder);
console.log("createThemesInFile: " + path);
if (!fs.lstatSync(path).isDirectory()) if (!fs.lstatSync(path).isDirectory())
fail("Cannot find theme " + themeFolder + " in " + themesBuild); fail("Cannot find theme " + themeFolder + " in " + themesBuild);
@@ -417,7 +383,7 @@ function createThemesInFile(/*Array*/ themes, /*String*/ aFile, /*Boolean*/ syml
function installTheme(source, dest, force, symlink) function installTheme(source, dest, force, symlink)
{ {
if (dest.exists()) if (dest.exists())
{ {
if (force) if (force)
dest.rmtree(); dest.rmtree();
@@ -482,7 +448,7 @@ function listFrameworks()
{ {
stream.print("Frameworks:"); stream.print("Frameworks:");
OBJJ.objj_frameworks.forEach(function(frameworksDirectory) ObjectiveJ.objj_frameworks.forEach(function(frameworksDirectory)
{ {
stream.print(" " + frameworksDirectory); stream.print(" " + frameworksDirectory);
@@ -494,7 +460,7 @@ function listFrameworks()
stream.print("Frameworks (Debug):"); stream.print("Frameworks (Debug):");
OBJJ.objj_debug_frameworks.forEach(function(frameworksDirectory) ObjectiveJ.objj_debug_frameworks.forEach(function(frameworksDirectory)
{ {
stream.print(" " + frameworksDirectory); stream.print(" " + frameworksDirectory);
@@ -512,8 +478,7 @@ function executePostInstallScript(/*String*/ destinationProject)
if (fs.existsSync(path)) if (fs.existsSync(path))
{ {
stream.print(colorize("Executing postinstall script...", "cyan")); stream.print(colorize("Executing postinstall script...", "cyan"));
child_process.execSync("/bin/sh" + " " + path + " " + destinationProject); child_process.execSync("/bin/sh" + " " + path + " " + destinationProject); // Use sh in case it isn't marked executable
//OS.system(["/bin/sh", path, destinationProject]); // Use sh in case it isn't marked executable
fs.rmSync(path); fs.rmSync(path);
} }
} }
@@ -11,10 +11,9 @@ const fs = require("fs");
var ENV = process.env, var ENV = process.env,
//FILE = require("file"), //FILE = require("file"),
JAKE = require("objj-jake"),
task = JAKE.task, task = JAKE.task,
FileList = JAKE.FileList, FileList = JAKE.FileList,
app = require("/Users/alfred/Developer/cappuccino/Jake/applicationtask.js").app, app = CAPPUCCINO.Jake.applicationtask.app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug", configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os"), OS = require("os"),
projectName = "__project.nameasidentifier__"; projectName = "__project.nameasidentifier__";
@@ -36,7 +36,7 @@
// This will affect only Objective-J code that is compiled when loading the application. It will not affect precompiled // This will affect only Objective-J code that is compiled when loading the application. It will not affect precompiled
// code like the Cappuccino frameworks. // code like the Cappuccino frameworks.
// Uncomment or comment on the line below to change the flags // Uncomment or comment on the line below to change the flags
OBJJ_COMPILER_FLAGS = [/*"IncludeDebugSymbols"*/, "IncludeTypeSignatures"/*, "SourceMap"*/, "InlineMsgSend"]; OBJJ_COMPILER_FLAGS = [/*"IncludeDebugSymbols",*/ "IncludeTypeSignatures"/*, "SourceMap"*/, "InlineMsgSend"];
var progressBar = null; var progressBar = null;
@@ -69,20 +69,18 @@ var sourceDirs = [
const path = require("path"); const path = require("path");
const fs = require("fs"); const fs = require("fs");
const stream = require("objj-runtime/lib/term").stream; const stream = ObjectiveJ.term.stream;
const jake = require("objj-jake"); const jake = JAKE;
const CLEAN = require("objj-jake/lib/jake/clean").CLEAN; const CLEAN = JAKE.CLEAN_AND_CLOBBER.CLEAN;
const CLOBBER = require("objj-jake/lib/jake/clean").CLOBBER; const CLOBBER = JAKE.CLEAN_AND_CLOBBER.CLOBBER;
const FileList = jake.FileList; const FileList = jake.FileList;
const filedir = jake.filedir; const filedir = jake.filedir;
const task = jake.task; const task = jake.task;
const JAKE_EXTRAS_PATH = "/Users/alfred/Developer/cappuccino/Jake/"; const framework = CAPPUCCINO.Jake.frameworktask.framework;
//const browserEnvironment = require("@objj/cappuccino/Jake/environment.js");
const framework = require(path.join(JAKE_EXTRAS_PATH, "frameworktask.js")).framework;
const browserEnvironment = require(path.join(JAKE_EXTRAS_PATH, "environment.js"));
const configuration = env["CONFIG"] || env["CONFIGURATION"] || env["c"] || "Debug"; const configuration = env["CONFIG"] || env["CONFIGURATION"] || env["c"] || "Debug";
const productName = "__project.nameasidentifier__"; const productName = "__project.nameasidentifier__";
@@ -6,12 +6,13 @@
* Copyright __project.year__, __organization.name__ All rights reserved. * Copyright __project.year__, __organization.name__ All rights reserved.
*/ */
var ENV = require("system").env, const path = require("path");
FILE = require("file"), const fs = require("fs");
JAKE = require("jake"),
var ENV = process.env,
task = JAKE.task, task = JAKE.task,
FileList = JAKE.FileList, FileList = JAKE.FileList,
app = require("cappuccino/jake").app, app = CAPPUCCINO.Jake.applicationtask.app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug", configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os"), OS = require("os"),
projectName = "__project.nameasidentifier__"; projectName = "__project.nameasidentifier__";
@@ -21,10 +22,10 @@ app (projectName, function(task)
ENV["OBJJ_INCLUDE_PATHS"] = "Frameworks"; ENV["OBJJ_INCLUDE_PATHS"] = "Frameworks";
if (configuration === "Debug") if (configuration === "Debug")
ENV["OBJJ_INCLUDE_PATHS"] = FILE.join(ENV["OBJJ_INCLUDE_PATHS"], configuration); ENV["OBJJ_INCLUDE_PATHS"] = path.join(ENV["OBJJ_INCLUDE_PATHS"], configuration);
task.setBuildIntermediatesPath(FILE.join("Build", "__project.nameasidentifier__.build", configuration)); task.setBuildIntermediatesPath(path.join("Build", "__project.nameasidentifier__.build", configuration));
task.setBuildPath(FILE.join("Build", configuration)); task.setBuildPath(path.join("Build", configuration));
task.setProductName("__project.name__"); task.setProductName("__project.name__");
task.setIdentifier("__project.identifier__"); task.setIdentifier("__project.identifier__");
@@ -32,7 +33,7 @@ app (projectName, function(task)
task.setAuthor("__organization.name__"); task.setAuthor("__organization.name__");
task.setEmail("__organization.email__"); task.setEmail("__organization.email__");
task.setSummary("__project.name__"); task.setSummary("__project.name__");
task.setSources(new FileList("**/*.j").exclude(FILE.join("Build", "**")).exclude(FILE.join("Frameworks", "Source", "**"))); task.setSources(new FileList("**/*.j").exclude(path.join("Build", "**")).exclude(path.join("Frameworks", "Source", "**")));
task.setResources(new FileList("Resources/**")); task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html"); task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist"); task.setInfoPlistPath("Info.plist");
@@ -67,33 +68,33 @@ task ("release", function()
task ("run", ["debug"], function() task ("run", ["debug"], function()
{ {
OS.system(["open", FILE.join("Build", "Debug", projectName, "index.html")]); OS.system(["open", path.join("Build", "Debug", projectName, "index.html")]);
}); });
task ("run-release", ["release"], function() task ("run-release", ["release"], function()
{ {
OS.system(["open", FILE.join("Build", "Release", projectName, "index.html")]); OS.system(["open", path.join("Build", "Release", projectName, "index.html")]);
}); });
task ("deploy", ["release"], function() task ("deploy", ["release"], function()
{ {
FILE.mkdirs(FILE.join("Build", "Deployment", projectName)); FILE.mkdirs(path.join("Build", "Deployment", projectName));
OS.system(["press", "-f", FILE.join("Build", "Release", projectName), FILE.join("Build", "Deployment", projectName)]); OS.system(["press", "-f", path.join("Build", "Release", projectName), path.join("Build", "Deployment", projectName)]);
printResults("Deployment") printResults("Deployment")
}); });
function printResults(configuration) function printResults(configuration)
{ {
print("----------------------------"); console.log("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, projectName)); console.log(configuration+" app built at path: " + path.join("Build", configuration, projectName));
print("----------------------------"); console.log("----------------------------");
} }
function updateApplicationSize() function updateApplicationSize()
{ {
print("Calculating application file sizes..."); console.log("Calculating application file sizes...");
var contents = FILE.read(FILE.join("Build", configuration, projectName, "Info.plist"), { charset:"UTF-8" }), var contents = fs.readFileSync(path.join("Build", configuration, projectName, "Info.plist"), { encoding: "utf8" }),
format = CFPropertyList.sniffedFormatOfString(contents), format = CFPropertyList.sniffedFormatOfString(contents),
plist = CFPropertyList.propertyListFromString(contents), plist = CFPropertyList.propertyListFromString(contents),
totalBytes = {executable:0, data:0, mhtml:0}; totalBytes = {executable:0, data:0, mhtml:0};
@@ -102,14 +103,19 @@ function updateApplicationSize()
var frameworksDir = "Frameworks"; var frameworksDir = "Frameworks";
if (configuration === "Debug") if (configuration === "Debug")
frameworksDir = FILE.join(frameworksDir, "Debug"); frameworksDir = path.join(frameworksDir, "Debug");
var frameworks = FILE.list(frameworksDir); var frameworks = [];
if (fs.existsSync(frameworksDir)) {
frameworks = fs.readdirSync(frameworksDir);
}
//var frameworks = FILE.list(frameworksDir);
frameworks.forEach(function(framework) frameworks.forEach(function(framework)
{ {
if (framework !== "Source") if (framework !== "Source")
addBundleFileSizes(FILE.join(frameworksDir, framework), totalBytes); addBundleFileSizes(path.join(frameworksDir, framework), totalBytes);
}); });
// Read in the default theme name, and attempt to get its size // Read in the default theme name, and attempt to get its size
@@ -117,17 +123,17 @@ function updateApplicationSize()
themePath = nil; themePath = nil;
if (themeName === "Aristo" || themeName === "Aristo2") if (themeName === "Aristo" || themeName === "Aristo2")
themePath = FILE.join(frameworksDir, "AppKit", "Resources", themeName + ".blend"); themePath = path.join(frameworksDir, "AppKit", "Resources", themeName + ".blend");
else else
themePath = FILE.join("Frameworks", "Resources", themeName + ".blend"); themePath = path.join("Frameworks", "Resources", themeName + ".blend");
if (FILE.isDirectory(themePath)) if (fs.existsSync(themePath) && fs.lstatSync(themePath).isDirectory())
addBundleFileSizes(themePath, totalBytes); addBundleFileSizes(themePath, totalBytes);
// Add sizes for the app // Add sizes for the app
addBundleFileSizes(FILE.join("Build", configuration, projectName), totalBytes); addBundleFileSizes(path.join("Build", configuration, projectName), totalBytes);
print("Executables: " + totalBytes.executable + ", sprite data: " + totalBytes.data + ", total: " + (totalBytes.executable + totalBytes.data)); console.log("Executables: " + totalBytes.executable + ", sprite data: " + totalBytes.data + ", total: " + (totalBytes.executable + totalBytes.data));
var dict = new CFMutableDictionary(); var dict = new CFMutableDictionary();
@@ -136,37 +142,38 @@ function updateApplicationSize()
dict.setValueForKey("mhtml", totalBytes.mhtml); dict.setValueForKey("mhtml", totalBytes.mhtml);
plist.setValueForKey("CPApplicationSize", dict); plist.setValueForKey("CPApplicationSize", dict);
fs.writeFileSync(path.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { encoding: "utf8" });
FILE.write(FILE.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" }); //FILE.write(path.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
} }
function addBundleFileSizes(bundlePath, totalBytes) function addBundleFileSizes(bundlePath, totalBytes)
{ {
var bundleName = FILE.basename(bundlePath), var bundleName = path.basename(bundlePath),
environment = bundleName === "Foundation" ? "Objj" : "Browser", environment = bundleName === "Foundation" ? "Objj" : "Browser",
bundlePath = FILE.join(bundlePath, environment + ".environment"); bundlePath = path.join(bundlePath, environment + ".environment");
if (FILE.isDirectory(bundlePath)) if (fs.existsSync(bundlePath) && fs.lstatSync(bundlePath).isDirectory())
{ {
var filename = bundleName + ".sj", var filename = bundleName + ".sj",
filePath = new FILE.Path(FILE.join(bundlePath, filename)); filePath = path.join(bundlePath, filename);
if (fs.existsSync(filePath)) {
totalBytes.executable += fs.lstatSync(filePath).size;
}
if (filePath.exists()) filePath = path.join(bundlePath, "dataURLs.txt");
totalBytes.executable += filePath.size();
if (fs.existsSync(filePath))
totalBytes.data += fs.lstatSync(filePath).size;
filePath = new FILE.Path(FILE.join(bundlePath, "dataURLs.txt")); filePath = path.join(bundlePath, "MHTMLData.txt");
if (filePath.exists()) if (fs.existsSync(filePath))
totalBytes.data += filePath.size(); totalBytes.mhtml += fs.lstatSync(filePath).size;
filePath = new FILE.Path(FILE.join(bundlePath, "MHTMLData.txt")); filePath = path.join(bundlePath, "MHTMLPaths.txt");
if (filePath.exists()) if (fs.existsSync(filePath))
totalBytes.mhtml += filePath.size(); totalBytes.mhtml += fs.lstatSync(filePath).size;
filePath = new FILE.Path(FILE.join(bundlePath, "MHTMLPaths.txt"));
if (filePath.exists())
totalBytes.mhtml += filePath.size();
} }
} }
@@ -36,7 +36,7 @@
// This will affect only Objective-J code that is compiled when loading the application. It will not affect precompiled // This will affect only Objective-J code that is compiled when loading the application. It will not affect precompiled
// code like the Cappuccino frameworks. // code like the Cappuccino frameworks.
// Uncomment or comment on the line below to change the flags // Uncomment or comment on the line below to change the flags
OBJJ_COMPILER_FLAGS = [/*"IncludeDebugSymbols"*/, "IncludeTypeSignatures"/*, "SourceMap"*/, "InlineMsgSend"]; OBJJ_COMPILER_FLAGS = [/*"IncludeDebugSymbols",*/ "IncludeTypeSignatures"/*, "SourceMap"*/, "InlineMsgSend"];
var progressBar = null; var progressBar = null;
@@ -24,11 +24,7 @@
// DO NOT REMOVE // DO NOT REMOVE
//=========================================================== //===========================================================
var SYS = require("system"), var ENV = process.env;
ENV = SYS.env,
FILE = require("file"),
OS = require("os");
//=========================================================== //===========================================================
// USER CONFIGURABLE VARIABLES // USER CONFIGURABLE VARIABLES
@@ -43,6 +39,9 @@ var SYS = require("system"),
*/ */
var buildDir = "Build"; var buildDir = "Build";
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
//=========================================================== //===========================================================
// AUTOMATICALLY GENERATED // AUTOMATICALLY GENERATED
@@ -50,29 +49,74 @@ var buildDir = "Build";
// Do not edit! (unless you know what you are doing) // Do not edit! (unless you know what you are doing)
//=========================================================== //===========================================================
var stream = require("narwhal/term").stream, const path = require("path");
JAKE = require("jake"), const fs = require("fs");
var stream = ObjectiveJ.term.stream,
task = JAKE.task, task = JAKE.task,
FileList = JAKE.FileList, FileList = JAKE.FileList,
CLEAN = require("jake/clean").CLEAN, CLEAN = JAKE.CLEAN_AND_CLOBBER.CLEAN,
CLOBBER = require("jake/clean").CLOBBER, CLOBBER = JAKE.CLEAN_AND_CLOBBER.CLOBBER,
blend = require("cappuccino/jake").blend, //blend = require("cappuccino/jake").blend,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug", configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
productName = "__project.nameasidentifier__", productName = "__project.nameasidentifier__",
debugBlendKitPath = FILE.join("Frameworks", "Debug", "BlendKit"), debugBlendKitPath = path.join("Frameworks", "Debug", "BlendKit"),
releaseBlendKitPath = FILE.join("Frameworks", "BlendKit"), releaseBlendKitPath = path.join("Frameworks", "BlendKit"),
buildPath = FILE.canonical(FILE.join(buildDir, productName + ".build")); buildPath = path.resolve(path.join(buildDir, productName + ".build"));
blend (productName + ".blend", function(themeBlendTask) debugger;
{
themeBlendTask.setBuildIntermediatesPath(FILE.join(buildPath, configuration))
themeBlendTask.setBuildPath(FILE.join(buildDir, configuration));
themeBlendTask.setThemeDescriptors(new FileList("ThemeDescriptors.j")); var callback;
themeBlendTask.setIdentifier("__project.identifier__");
themeBlendTask.setResources(new FileList("Resources/*")); function callbackFunction(blendtask) {
callback(blendtask);
}
var initilize = function(callback) {
// This check is only necessary because during the build process blendtask gets created much later.
var blendTaskPath = path.resolve(fs.realpathSync(process.argv[1]), "..", "..", "lib", "cappuccino", "jake", "blendtask.j");
if (fs.existsSync(blendTaskPath))
{
var anExports = {};
function localCallback() {
callback(anExports);
}
process.env["CONFIG"] = "Debug";
ObjectiveJ.OBJJ_INCLUDE_PATHS.push(path.resolve(fs.realpathSync(process.argv[1]), "..", "..", "Frameworks"));
//ObjectiveJ.OBJJ_INCLUDE_PATHS.push(path.join(path.join($BUILD_DIR, "Debug"), "CommonJS", "cappuccino", "Frameworks"));
ObjectiveJ.make_narwhal_factory(blendTaskPath, null, null, localCallback)(require, anExports, module, typeof system !== "undefined" && system, console.log);
}
}
initilize(callbackFunction);
var promise = new Promise((resolve, reject) => {
callback = function(BLEND_TASK) {
exports.BlendTask = BLEND_TASK.BlendTask;
exports.blend = BLEND_TASK.blend;
defineBlendTask().then(() => {
resolve();
delete exports.jakePromise;
});
}
}); });
async function defineBlendTask() {
await exports.blend (productName + ".blend", function(themeBlendTask)
{
themeBlendTask.setBuildIntermediatesPath(path.join(buildPath, configuration))
themeBlendTask.setBuildPath(path.join(buildDir, configuration));
themeBlendTask.setThemeDescriptors(new FileList("ThemeDescriptors.j"));
themeBlendTask.setIdentifier("__project.identifier__");
themeBlendTask.setResources(new FileList("Resources/*"));
});
task ("build", [productName + ".blend"]);
}
exports.jakePromise = promise;
task ("debug", function() task ("debug", function()
{ {
ENV["CONFIGURATION"] = "Debug"; ENV["CONFIGURATION"] = "Debug";
@@ -36,7 +36,7 @@
// This will affect only Objective-J code that is compiled when loading the application. It will not affect precompiled // This will affect only Objective-J code that is compiled when loading the application. It will not affect precompiled
// code like the Cappuccino frameworks. // code like the Cappuccino frameworks.
// Uncomment or comment on the line below to change the flags // Uncomment or comment on the line below to change the flags
OBJJ_COMPILER_FLAGS = [/*"IncludeDebugSymbols"*/, "IncludeTypeSignatures", "InlineMsgSend"]; OBJJ_COMPILER_FLAGS = [/*"IncludeDebugSymbols",*/ "IncludeTypeSignatures", "InlineMsgSend"];
var progressBar = null; var progressBar = null;
+2 -4
View File
@@ -7,9 +7,7 @@ var path = require("path");
var fs = require("fs"); var fs = require("fs");
function main(args) { function main(args) {
debugger; var mainBundlePath = args.shift();
console.log(args);
args.shift();
if (args.length < 1) { if (args.length < 1) {
return printUsage(); return printUsage();
@@ -29,7 +27,7 @@ function main(args) {
case "config": return config.apply(this, args.slice(index + 1)); case "config": return config.apply(this, args.slice(index + 1));
case "gen": return gen.apply(this, args.slice(index + 1)); case "gen": return gen.apply(this, [mainBundlePath].concat(args.slice(index + 1)));
default: print("unknown command " + argument); default: print("unknown command " + argument);
} }
+3 -4
View File
@@ -1,7 +1,7 @@
require("../../common.jake"); require("../../common.jake");
var /* OS = require("os"), */ var /* OS = require("os"), */
task = require("objj-jake").task; task = JAKE.task;
//SYSTEM = require("system"); //SYSTEM = require("system");
const child_process = require("child_process"); const child_process = require("child_process");
@@ -19,16 +19,15 @@ task ("build", function()
args = "-sdk macosx " + args; args = "-sdk macosx " + args;
var xcodebuild = process.env.CAPP_BUILD ? "xcodebuild " : "CAPP_BUILD=../../Build xcodebuild "; var xcodebuild = process.env.CAPP_BUILD ? "xcodebuild " : "CAPP_BUILD=../../Build xcodebuild ";
try { try {
console.log(child_process.execSync(xcodebuild + args).toString()); child_process.execSync(xcodebuild + args).toString();
} catch (error) { } catch (error) {
process.exit(1); process.exit(1);
} }
} }
else else
{ {
print("Building fontinfo requires Xcode."); console.log("Building fontinfo requires Xcode.");
} }
}); });
+1 -1
View File
@@ -3,7 +3,7 @@ require("../../common.jake");
const child_process = require("child_process"); const child_process = require("child_process");
var /* OS = require("os"), */ var /* OS = require("os"), */
task = require("objj-jake").task; task = JAKE.task;
task ("build", function() task ("build", function()
{ {
+3 -5
View File
@@ -200,11 +200,9 @@ ConverterConversionException = @"ConverterConversionException";
// Minor NS keyed archive to CP keyed archive conversion. // Minor NS keyed archive to CP keyed archive conversion.
// Use Java directly because rhino's string.replace is *so slow*. 4 seconds vs. 1 millisecond. // Use Java directly because rhino's string.replace is *so slow*. 4 seconds vs. 1 millisecond.
// plistContents = plistContents.replace(/\<key\>\s*CF\$UID\s*\<\/key\>/g, "<key>CP$UID</key>"); // plistContents = plistContents.replace(/\<key\>\s*CF\$UID\s*\<\/key\>/g, "<key>CP$UID</key>");
if (system.engine === "rhino")
plistContents = String(java.lang.String(plistContents).replaceAll("\\<key\\>\\s*CF\\$UID\\s*\\<\/key\\>", "<key>CP\\$UID</key>")); plistContents = plistContents.replace(new RegExp("\\<key\\>\\s*CF\\$UID\\s*\\<\\/key\\>", "g"), "<key>CP$UID</key>");
else
plistContents = plistContents.replace(new RegExp("\\<key\\>\\s*CF\\$UID\\s*\\<\\/key\\>", "g"), "<key>CP$UID</key>");
plistContents = plistContents.replace(new RegExp("<string>[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F]<\\/string>", "g"), function(c) plistContents = plistContents.replace(new RegExp("<string>[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F]<\\/string>", "g"), function(c)
{ {
CPLog.warn("Warning: converting character 0x" + c.charCodeAt(8).toString(16) + " to base64 representation"); CPLog.warn("Warning: converting character 0x" + c.charCodeAt(8).toString(16) + " to base64 representation");
+12 -2
View File
@@ -31,7 +31,17 @@
var fs = require("fs"); var fs = require("fs");
var path = require("path"); var path = require("path");
var imageSize = require("objj-imagesize"); var child_process = require("child_process");
function imagesize() {
var result;
try {
result = child_process.execSync("imagesize -n " + p);
} catch(err) {
console.error("imagesize failed:" + err);
}
return result ? JSON.parse(result) : null;
}
/* /*
var FILE = require("file"), var FILE = require("file"),
@@ -93,7 +103,7 @@ var supportedTemplateImages = {
CPLog.warn("Resource \"" + _resourceName + "\" not found in the Resources directories"); CPLog.warn("Resource \"" + _resourceName + "\" not found in the Resources directories");
else else
{ {
size = imageSize(fs.realpathSync(resourceInfo.path)) || CGSizeMakeZero(); size = imagesize(fs.realpathSync(resourceInfo.path)) || CGSizeMakeZero();
framework = resourceInfo.framework; framework = resourceInfo.framework;
} }
+14 -2
View File
@@ -26,8 +26,20 @@ IBDefaultFontFace = @".AppleSystemUIFont";
IBDefaultFontFaceLegacy = @"Lucida Grande"; IBDefaultFontFaceLegacy = @"Lucida Grande";
IBDefaultFontSize = 13.0; IBDefaultFontSize = 13.0;
var OS = require("os"), var OS = require("os");
fontinfo = require("objj-fontinfo").fontinfo;
var child_process = require("child_process");
function fontinfo(name, size)
{
var result;
try {
result = child_process.execSync("fontinfo -n " + name + " " + (size || 12))
} catch(err) {
console.error("fontinfo fail");
}
return result ? JSON.parse(result) : null;
};
@implementation CPFont (NSCoding) @implementation CPFont (NSCoding)
+38 -36
View File
@@ -40,9 +40,9 @@ var child_process = require("child_process");
var /* FILE = require("file"), */ var /* FILE = require("file"), */
/* OS = require("os"), */ /* OS = require("os"), */
//SYS = require("system"), //SYS = require("system"),
FileList = require("objj-jake").FileList, FileList = ObjectiveJ.utils.filelist.FileList,
stream = require("objj-runtime").term.stream, stream = ObjectiveJ.term.stream,
StaticResource = require("objj-runtime").StaticResource, StaticResource = ObjectiveJ.StaticResource,
DefaultTheme = "Aristo2", DefaultTheme = "Aristo2",
BuildTypes = ["Debug", "Release"], BuildTypes = ["Debug", "Release"],
@@ -88,7 +88,7 @@ var /* FILE = require("file"), */
SharedNib2Cib = self; SharedNib2Cib = self;
commandLineArgs = theArgs; commandLineArgs = theArgs;
parser = new (require("objj-runtime").parser.Parser)(); parser = new (ObjectiveJ.parser.Parser)();
nibInfo = {}; nibInfo = {};
appDirectory = @""; appDirectory = @"";
frameworks = [CPDictionary dictionary]; frameworks = [CPDictionary dictionary];
@@ -127,16 +127,18 @@ var /* FILE = require("file"), */
[self logError:[self exceptionReason:anException]]; [self logError:[self exceptionReason:anException]];
process.exit(1); process.exit(1);
} }
//while(true) {};
} }
- (void)checkPrerequisites - (void)checkPrerequisites
{ {
var fontinfo = require("objj-fontinfo").fontinfo, /* var fontinfo = require("objj-fontinfo").fontinfo,
info = fontinfo("LucidaGrande", 13); info = fontinfo("LucidaGrande", 13);
*/
if (!info) try {
child_process.execSync("which fontinfo");
} catch(error) {
[self failWithMessage:@"fontinfo does not appear to be installed"]; [self failWithMessage:@"fontinfo does not appear to be installed"];
}
} }
- (void)enumerateFrameworks - (void)enumerateFrameworks
@@ -320,18 +322,8 @@ var /* FILE = require("file"), */
// Let the converter log however the user configured it // Let the converter log however the user configured it
[self setLogLevel:verbosity]; [self setLogLevel:verbosity];
// Stripping the --watch flag from the command line arguments and running nib2cib in a child_process [self convertWithOptions:options inputPath:nib completionHandler:function(success) { }];
// FIXME: this will fail if we have more advanced command line args
// FIXME: how to get this to work without resorting to child_process?
var a = process.argv.slice();
var idx = a.indexOf("--watch");
if (idx > -1) {
a.splice(idx, 1);
}
a.push(nib);
child_process.execSync(a.join(" "), {stdio: 'inherit'});
} }
}); });
} }
@@ -454,7 +446,7 @@ var /* FILE = require("file"), */
matches = line.match(ArgsRe) || []; */ matches = line.match(ArgsRe) || []; */
file.close(); file.close();
CPLog.debug("Reading stored options: " + p); CPLog.debug("Reading stored options: " + path);
if (matches) if (matches)
{ {
@@ -485,7 +477,7 @@ var /* FILE = require("file"), */
var show = value.length !== undefined ? value.length > 0 : !!value; var show = value.length !== undefined ? value.length > 0 : !!value;
if (show) if (show)
print(option + ": " + value); console.log(option + ": " + value);
} }
} }
} }
@@ -690,7 +682,7 @@ var /* FILE = require("file"), */
[self setLogLevel:verbosity]; [self setLogLevel:verbosity];
} }
require("browser/timeout").serviceTimeouts(); //require("browser/timeout").serviceTimeouts();
}); });
} }
@@ -754,7 +746,7 @@ var /* FILE = require("file"), */
cappBuild = PATH.normalize(cappBuild); cappBuild = PATH.normalize(cappBuild);
if (fs.lstatSync(cappBuild).isDirectory()) if (fs.existsSync(cappBuild) && fs.lstatSync(cappBuild).isDirectory())
{ {
var result = null; var result = null;
@@ -776,7 +768,7 @@ var /* FILE = require("file"), */
{ {
// NOTE: It's safe to use '/' directly in the path, we're guaranteed to be on a Mac // NOTE: It's safe to use '/' directly in the path, we're guaranteed to be on a Mac
// FIXME: temporary fix, narwhal will not be used in the future // FIXME: temporary fix, narwhal will not be used in the future
return [self findInFrameworks:PATH.normalize(PATH.join("/Users/alfred/Developer/narwhal", "packages/cappuccino/Frameworks")) return [self findInFrameworks:PATH.normalize(PATH.resolve(fs.realpathSync(process.argv[1]), "..", "..", "Frameworks"))
path:path path:path
isDirectory:isDirectory isDirectory:isDirectory
callback:callback]; callback:callback];
@@ -878,7 +870,7 @@ var /* FILE = require("file"), */
{ {
var path = PATH.normalize(blendName); var path = PATH.normalize(blendName);
if (fs.lstatSync(path).isDirectory()) if (fs.existsSync(path) && fs.lstatSync(path).isDirectory())
themePath = path; themePath = path;
} }
} }
@@ -897,7 +889,7 @@ var /* FILE = require("file"), */
// but we want the Browser environment. So we override mostEligibleEnvironment(). // but we want the Browser environment. So we override mostEligibleEnvironment().
themeBundle.mostEligibleEnvironment = function() { return "Browser"; }; themeBundle.mostEligibleEnvironment = function() { return "Browser"; };
themeBundle.addEventListener("load", function() var loadFunction = function()
{ {
var keyedThemes = themeBundle.valueForInfoDictionaryKey("CPKeyedThemes"); var keyedThemes = themeBundle.valueForInfoDictionaryKey("CPKeyedThemes");
@@ -922,14 +914,20 @@ var /* FILE = require("file"), */
CPLog.debug("Loaded theme: " + path); CPLog.debug("Loaded theme: " + path);
completionBlock(theme); completionBlock(theme);
}); };
themeBundle.addEventListener("error", function() if (themeBundle.isLoaded()) {
{ loadFunction();
CPLog.error("Could not find bundle: " + self); } else {
}); themeBundle.addEventListener("load", loadFunction);
themeBundle.load();
themeBundle._loadStatus themeBundle.addEventListener("error", function()
{
CPLog.error("Could not find bundle: " + self);
});
themeBundle.load();
}
} }
- (JSObject)readConfigFile:(CPString)configFile inputPath:(CPString)inputPath - (JSObject)readConfigFile:(CPString)configFile inputPath:(CPString)inputPath
@@ -1041,13 +1039,13 @@ var /* FILE = require("file"), */
*/ */
var path = PATH.dirname(PATH.dirname(PATH.normalize(process.argv[0]))), var path = PATH.dirname(PATH.dirname(PATH.normalize(process.argv[0]))),
version = null; version = null;
if (PATH.basename(path) === "narwhal") if (PATH.basename(path) === "narwhal")
path = PATH.join(path, "packages", "cappuccino"); path = PATH.join(path, "packages", "cappuccino");
path = PATH.join(path, "lib", "nib2cib", "Info.plist"); path = PATH.join(path, "lib", "nib2cib", "Info.plist");
console.log(path); //TODO: path =
try { try {
fs.accessSync(path, fs.constants.R_OK); fs.accessSync(path, fs.constants.R_OK);
@@ -1099,6 +1097,10 @@ var /* FILE = require("file"), */
stream.printError(message); stream.printError(message);
} }
- (void)bundleDidFinishLoading:(CPBundle)aBundle
{
}
@end @end
function logFormatter(aString, aLevel, aTitle) function logFormatter(aString, aLevel, aTitle)
+33 -16
View File
@@ -22,8 +22,7 @@
const fs = require('fs'); const fs = require('fs');
const child_process = require('child_process'); const child_process = require('child_process');
const path = require('path'); const path = require('path');
const jake = require("objj-jake"); const { stream } = ObjectiveJ.term;
const { stream } = require('objj-runtime/lib/term');
requiresSudo = false; requiresSudo = false;
@@ -52,11 +51,11 @@ if (!process.env["CONFIG"])
global.ENV = process.env; global.ENV = process.env;
global.task = jake.task; global.task = JAKE.task;
global.directory = jake.directory; global.directory = JAKE.directory;
global.file = jake.file; global.file = JAKE.file;
global.filedir = jake.filedir; global.filedir = JAKE.filedir;
global.FileList = jake.FileList; global.FileList = JAKE.FileList;
global.$CONFIGURATION = process.env['CONFIG']; global.$CONFIGURATION = process.env['CONFIG'];
global.$INLINE_MSG_SEND = process.env['INLINE_MSG_SEND']; global.$INLINE_MSG_SEND = process.env['INLINE_MSG_SEND'];
@@ -70,8 +69,10 @@ global.$BUILD_CJS_CAPPUCCINO_BIN = path.join($BUILD_CJS_CAPPUCCINO, "bin"
global.$BUILD_CJS_CAPPUCCINO_LIB = path.join($BUILD_CJS_CAPPUCCINO, "lib"); global.$BUILD_CJS_CAPPUCCINO_LIB = path.join($BUILD_CJS_CAPPUCCINO, "lib");
global.$BUILD_CJS_CAPPUCCINO_FRAMEWORKS = path.join($BUILD_CJS_CAPPUCCINO, "Frameworks"); global.$BUILD_CJS_CAPPUCCINO_FRAMEWORKS = path.join($BUILD_CJS_CAPPUCCINO, "Frameworks");
global.CLEAN = require("objj-jake/lib/jake/clean.js").CLEAN; global.OBJJ_INCLUDE_PATHS.push(global.$BUILD_CJS_CAPPUCCINO_FRAMEWORKS);
global.CLOBBER = require("objj-jake/lib/jake/clean.js").CLOBBER;
global.CLEAN = JAKE.CLEAN_AND_CLOBBER.CLEAN;
global.CLOBBER = JAKE.CLEAN_AND_CLOBBER.CLOBBER;
global.CLEAN.include(path.join(global.$BUILD_DIR, "*.build")); global.CLEAN.include(path.join(global.$BUILD_DIR, "*.build"));
global.CLOBBER.include(global.$BUILD_DIR); global.CLOBBER.include(global.$BUILD_DIR);
@@ -198,8 +199,7 @@ function setupEnvironment()
{ {
try try
{ {
debugger; ObjectiveJ.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) catch (e)
{ {
@@ -285,11 +285,12 @@ global.subjake = function(/*Array<String>*/ directories, /*String*/ aTaskName)
{ {
if (fs.lstatSync(aDirectory).isDirectory() && fs.lstatSync(path.join(aDirectory, "Jakefile")).isFile()) if (fs.lstatSync(aDirectory).isDirectory() && fs.lstatSync(path.join(aDirectory, "Jakefile")).isFile())
{ {
var cmd = "cd " + enquote(aDirectory) + " && " + serializedENV() + " " + "npx objj-jake" + " " + enquote(aTaskName); var cmd = "cd " + enquote(aDirectory) + " && " + serializedENV() + " " + "jake" + " " + enquote(aTaskName);
var returnCode = systemSync(cmd); var returnCode = systemSync(cmd);
if (returnCode) if (returnCode) {
process.exit(returnCode); process.exit(returnCode);
}
} }
else else
print("warning: subjake missing: " + aDirectory + " (this is not necessarily an error, " + aDirectory + " may be optional)"); print("warning: subjake missing: " + aDirectory + " (this is not necessarily an error, " + aDirectory + " may be optional)");
@@ -410,11 +411,16 @@ global.installSymlink = function(sourcePath)
global.installCopy = function(sourcePath, useSudo) global.installCopy = function(sourcePath, useSudo)
{ {
if (!fs.lstatSync(sourcePath).isDirectory()) if (!fs.existsSync(sourcePath))
return; return;
var packageName = path.basename(sourcePath), var packageName = path.basename(sourcePath),
targetPath = path.join(SYSTEM.prefix, "packages", packageName); targetPath = path.join(__dirname, "dist", packageName);
// create the dist directory if it does not exist
if (!fs.existsSync(targetPath)) {
fs.mkdirSync(targetPath, { recursive: true });
}
if (fs.lstatSync(targetPath).isDirectory()) if (fs.lstatSync(targetPath).isDirectory())
fs.rmSync(targetPath, {recursive: true, force: true}); fs.rmSync(targetPath, {recursive: true, force: true});
@@ -431,23 +437,34 @@ global.installCopy = function(sourcePath, useSudo)
var binPath = path.resolve(path.join(targetPath, "bin")) var binPath = path.resolve(path.join(targetPath, "bin"))
// create the bin directory if it does not exist
if (!fs.existsSync(binPath)) {
fs.mkdirSync(targetPath)
}
if (fs.lstatSync(binPath).isDirectory()) if (fs.lstatSync(binPath).isDirectory())
{ {
fs.readdirSync(binPath).forEach(function (name) fs.readdirSync(binPath).forEach(function (name)
{ {
var binary = path.join(binPath, name); var binary = path.join(binPath, name);
fs.chmodSync(binary, 0o755); fs.chmodSync(binary, 0o755);
}); });
} }
fs.readdirSync(binPath).forEach(function (name)
{
child_process.execSync("sudo ln -sf " + path.join(binPath, name) + " /usr/local/bin/" + name);
});
}; };
global.spawnJake = function(/*String*/ aTaskName) global.spawnJake = function(/*String*/ aTaskName)
{ {
//if (systemSync(serializedENV() + " " + "npx --node-options='--inspect-brk' objj-jake" + " " + aTaskName)) //if (systemSync(serializedENV() + " " + "npx --node-options='--inspect-brk' objj-jake" + " " + aTaskName))
if (systemSync(serializedENV() + " " + "npx objj-jake" + " " + aTaskName)) if (systemSync(serializedENV() + " " + "jake" + " " + aTaskName)) {
console.log("exited in spawnJake with error"); console.log("exited in spawnJake with error");
process.exit(1); //rake abort if ($? != 0) process.exit(1); //rake abort if ($? != 0)
}
}; };
var normalizeCommand = function(/*Array or String*/ command) var normalizeCommand = function(/*Array or String*/ command)
+4
View File
@@ -0,0 +1,4 @@
exports.Jake = { };
exports.Jake.BundleTask = require("./Jake/bundletask.js");
exports.Jake.applicationtask = require("./Jake/applicationtask.js");
exports.Jake.frameworktask = require("./Jake/frameworktask.js");
+355 -4259
View File
File diff suppressed because it is too large Load Diff
+23 -9
View File
@@ -1,15 +1,29 @@
{ {
"name": "cappuccino", "name": "@objj/cappuccino",
"version": "1.0.0", "version": "1.0.1-16",
"devDependencies": { "devDependencies": {
"grunt": "^1.4.1", "terser": "^5.7.0",
"grunt-contrib-concat": "^1.0.1", "@objj/cappuccino": "file:."
"terser": "^5.7.0"
}, },
"dependencies": { "dependencies": {
"objj-fontinfo": "file:../objj-fontinfo", "@objj/jake": "latest",
"objj-imagesize": "file:../objj-imagesize", "@objj/runtime": "latest"
"objj-jake": "file:../jake", },
"objj-runtime": "file:../objj-runtime" "files": [
"dist",
"Jake"
],
"main": "index.js",
"bin": {
"capp": "dist/cappuccino/bin/capp",
"cib-dump": "dist/cappuccino/bin/cib-dump",
"flatten": "dist/cappuccino/bin/flatten",
"fontinfo": "dist/cappuccino/bin/fontinfo",
"imagesize": "dist/cappuccino/bin/imagesize",
"nib2cib": "dist/cappuccino/bin/nib2cib",
"ojdepcheck": "dist/cappuccino/bin/ojdepcheck",
"press": "dist/cappuccino/bin/press",
"objj": "dist/cappuccino/bin/objj",
"jake": "dist/cappuccino/bin/jake"
} }
} }