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;
CPString _cssString;
}
@global document
#pragma mark -
#pragma mark Theming
+2
View File
@@ -37,6 +37,8 @@
CPString _expires;
}
@global document
/*!
Initializes a cookie with a given name \c aName.
@param the name for the cookie
+2
View File
@@ -41,6 +41,8 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
#endif
}
@global document
- (id)initWithFrame:(CGRect)aFrame
{
+2
View File
@@ -29,6 +29,8 @@
@global CPApp
@class CPFontPanel
@global document
CPItalicFontMask = 1 << 0;
CPBoldFontMask = 1 << 1;
CPUnboldFontMask = 1 << 2;
+1
View File
@@ -33,6 +33,7 @@
@import "CPCompatibility.j"
@class CPColor
@global document
@protocol CPImageDelegate <CPObject>
+2
View File
@@ -29,6 +29,8 @@
@global CPImagesPboardType
@global appkit_tag_dom_elements
@global document
@typedef CPImageAlignment
CPImageAlignCenter = 0;
CPImageAlignTop = 1;
+2
View File
@@ -31,6 +31,8 @@
@global CPMenuDidChangeItemNotification
@global CPMenuDidRemoveItemNotification
@global document
@implementation _CPMenuBarWindow : CPPanel
{
CPView _highlightView;
+1
View File
@@ -32,6 +32,7 @@
@end
@global document
var CPSoundDelegate_sound_didFinishPlaying_ = 1 << 1;
+2
View File
@@ -34,6 +34,8 @@
@global CPStringPboardType
@global CPCursor
@global document
@protocol CPTextFieldDelegate <CPControlTextEditingDelegate>
@end
+2
View File
@@ -32,6 +32,8 @@
@global _MakeRangeFromAbs
@global document
@class CPTextContainer
@class CPTextView
+2
View File
@@ -55,6 +55,8 @@
@end
@global document
_MakeRangeFromAbs = function(a1, a2)
{
return (a1 < a2) ? CPMakeRange(a1, a2 - a1) : CPMakeRange(a2, a1 - a2);
+1
View File
@@ -40,6 +40,7 @@
@global CPTextFieldDidFocusNotification
@global CPTextFieldDidBlurNotification
@global document
// TODO: should be conform to protocol CPTextFieldDelegate
@protocol CPTokenFieldDelegate <CPObject>
+2
View File
@@ -39,6 +39,8 @@ CPWebViewProgressEstimateChangedNotification = "CPWebViewProgressEstimateChan
CPWebViewProgressStartedNotification = "CPWebViewProgressStartedNotification";
CPWebViewProgressFinishedNotification = "CPWebViewProgressFinishedNotification";
@global document
/*!
Automatically choose between AppKit (Cappuccino style) scrollbars and
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
}
@global document
+ (Class)_binderClassForBinding:(CPString)aBinding
{
if ([aBinding hasPrefix:CPDisplayPatternTitleBinding])
+2
View File
@@ -120,6 +120,8 @@ var CALayerRegisteredRunLoopUpdates = nil;
CGAffineTransform _transformFromLayer;
}
@global document
/*!
Returns a new animation layer.
*/
+4
View File
@@ -291,7 +291,11 @@ var frameToCSSTranslationTransformMatrix = function(start, current)
- (Object)_DOMElement
{
#if PLATFORM(DOM)
return _DOMElement;
#else
return nil;
#endif
}
- (CPString)debug_description
+1
View File
@@ -53,6 +53,7 @@ subtasks (["Themes"], ["clean", "clobber"]);
task ("Theme", [$BUILD_CJS_CAPPUCCINO_APPKIT], function()
{
console.log("in task Theme in appkit");
subjake(["Themes"], "build");
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"
@global document
@implementation CPDOMWindowLayer : CPObject
{
int _level;
@@ -133,6 +133,8 @@
@global _CPRunModalLoop
@global document
// List of all open native windows
var PlatformWindows = [CPSet set];
+11 -8
View File
@@ -517,15 +517,17 @@ var themedButtonValues = nil,
width: 9.0,
height: 4.0,
orientation: PatternIsVertical
}),
});
// removed as variable is never read
knobColorLegacy = PatternColor(
/* knobColorLegacy = PatternColor(
"scroller-legacy-vertical-knob{position}.png",
{
width: 14.0,
height: 3.0,
orientation: PatternIsVertical
});
}) */
themedVerticalScrollerValues =
[
@@ -593,15 +595,16 @@ var themedButtonValues = nil,
width: 4.0,
height: 9.0,
orientation: PatternIsHorizontal
}),
knobColorLegacy = PatternColor(
});
// removed as variable is never read
/* knobColorLegacy = PatternColor(
"scroller-legacy-horizontal-knob{position}.png",
{
width: 3.0,
height: 14.0,
orientation: PatternIsHorizontal
});
}) */
themedHorizontalScrollerValues =
[
@@ -2792,7 +2795,7 @@ var themedButtonValues = nil,
closeButtonImageInactive = PatternImage(@"window-standard-close-button-inactive.png", 16, 16),
closeButtonImageHighlighted = PatternImage(@"window-standard-button-highlighted.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),
minimizeButtonImage = PatternImage(@"window-standard-minimize-button.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>
var /* FILE = require("file"), */
TERM = require("objj-runtime").term,
task = require("objj-jake").task,
filedir = require("objj-jake").filedir,
BundleTask = require("../../../Jake/bundletask.js").BundleTask;
TERM = ObjectiveJ.term,
task = JAKE.task,
filedir = JAKE.filedir,
BundleTask = CAPPUCCINO.Jake.BundleTask.BundleTask;
var fs = require("fs");
var path = require("path");
+2
View File
@@ -77,6 +77,8 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
#endif
}
@global document
- (id)initWithFrame:(CGRect)aFrame control:(CPControl)aControl
{
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 fs = require("fs");
function exposeExports(path)
/* function exposeExports(path)
{
var object = require(path);
@@ -10,7 +10,15 @@ function exposeExports(path)
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) {
// 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);
}
process.env["CONFIG"] = "Debug";
require("objj-runtime").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.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);
}
}
+2
View File
@@ -50,6 +50,8 @@ CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}";
DOMElement _scriptTag;
}
@global document
/*! @deprecated */
+ (CPJSONPConnection)sendRequest:(CPURLRequest)aRequest callback:(CPString)callbackParameter delegate:(id)aDelegate
{
+15 -1
View File
@@ -22,12 +22,26 @@
var /* FILE = require("file"), */
OS = require("os"),
Jake = require("objj-jake"),
Jake = JAKE,
BundleTask = (require("./bundletask")).BundleTask;
var fs = require("fs");
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)
{
BundleTask.apply(this, arguments);
+31 -16
View File
@@ -26,28 +26,42 @@ const path = require("path");
// NPM modules
const fs = require("fs");
const ObjectiveJ = require("objj-runtime");
const term = require("objj-runtime").term;
//const ObjectiveJ = require("@objj/runtime");
const term = ObjectiveJ.term;
// Internal modules
const environment = require("./environment");
const Jake = require("objj-jake");
//const JAKE = require("@objj/jake");
/* Old imports
FILE = require("file")
OS = require("os")
UTIL = require("narwhal/util")
TERM = require("narwhal/term")
base64 = require("base64")
Jake = require("jake")
JAKE = require("jake")
*/
var task = Jake.task;
var Task = Jake.Task;
var filedir = Jake.filedir;
var FileList = Jake.FileList;
CLEAN = require("objj-jake/lib/jake/clean.js").CLEAN;
CLOBBER = require("objj-jake/lib/jake/clean.js").CLOBBER;
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);
}
};
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)
@@ -494,7 +508,7 @@ BundleTask.prototype.defineResourceTasks = function()
basePath = null;
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());
} else
@@ -558,7 +572,7 @@ BundleTask.prototype.defineSpritedImagesTask = function()
fs.rmSync(MHTMLPath);
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+");
fs.writeSync(MHTMLStream, "@STATIC;1.0;");
@@ -712,11 +726,12 @@ BundleTask.prototype.defineSourceTasks = function()
{
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 dots = (Array(Math.round(compiled.length / 1024 / 4) + 3)).join(".");
var p = await fs.promises.writeFile(compiledEnvironmentSource, compiled, { encoding: "utf8"});
term.stream.print(dots);
return await fs.promises.writeFile(compiledEnvironmentSource, compiled, { encoding: "utf8"});
return p;
}
else
{
@@ -738,8 +753,8 @@ BundleTask.prototype.defineSourceTasks = function()
var compiled = executer.toMarkedString();
//var msg = "Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)";
var dots = (Array(Math.round(compiled.length / 1024 / 4) + 3)).join(".");
term.stream.print(dots);
fs.writeFileSync(compiledEnvironmentSource, compiled, { encoding: "utf8"});
term.stream.print(dots);
resolve();
}
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 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"];
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)
{
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()
{
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"));
});
@@ -27,15 +34,16 @@ $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS = path.join($BUILD_CJS_CAPPUCCINO, "Frame
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);
fs.mkdirSync($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, { recursive: true });
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", "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()
{
+1 -1
View File
@@ -286,7 +286,7 @@ DISPLAY_NAME(CFBundle.prototype.isLoaded);
CFBundle.prototype.load = function(/*BOOL*/ shouldExecute)
{
if (this._loadStatus !== CFBundleUnloaded)
if (this._loadStatus !== CFBundleUnloaded)
return;
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);
var mainPath = execPath.dirname().dirname().join("lib", execPath.basename(), "main.j");
const path = require("path");
var args = ["objj", String(mainPath)].concat(system.args.slice(1));
require("objective-j").run(args);
var commandName = path.basename(process.argv[1]);
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;
var compiler = require("./ObjJAcornCompiler").ObjJCompiler;
const term = require("objj-runtime").term;
const term = ObjectiveJ.term;
//$BUILD_CONFIGURATION_DIR = "../Build"
$BROWSER_FILE = path.join("Browser", "Objective-J.js");
-2
View File
@@ -44,7 +44,6 @@ var DefaultDictionary = nil,
+ (id)defaultConfiguration
{
debugger;
if (!DefaultConfiguration)
DefaultConfiguration = [[self alloc] initWithPath:nil];
@@ -53,7 +52,6 @@ var DefaultDictionary = nil,
+ (id)userConfiguration
{
debugger;
if (!UserConfiguration)
UserConfiguration = [[self alloc] initWithPath:PATH.join(process.env["HOME"], ".cappconfig")];
+49 -84
View File
@@ -25,16 +25,15 @@
/* var OS = require("os"),
SYSTEM = require("system"),
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
var fs = require("fs");
var node_path = require("path");
var child_process = require("child_process");
var jake = require("objj-jake");
// FIXME: removing command line options for now
parser.usage("DESTINATION_DIRECTORY");
@@ -98,37 +97,32 @@ parser.helpful();
/* var CAPP_HOME = require("narwhal/packages").catalog["cappuccino"].directory,
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*/)
{
console.log("in gen: " + arguments);
var args = ["capp gen"].concat(Array.prototype.slice.call(arguments));
debugger;
var mainBundlePath = arguments[0];
templatesDirectory = node_path.join(mainBundlePath, "..", "Resources", "Templates");
var args = ["capp gen"].concat(Array.prototype.slice.call(arguments, 1));
var options = parser.parse(args, null, null, true);
console.log(options);
if (options.args.length > 1)
{
parser.printUsage(options);
process.exit(1);
}
console.log("a");
if (options.listTemplates)
{
listTemplates();
return;
}
console.log("b");
if (options.listFrameworks)
{
listFrameworks();
return;
}
console.log("c");
var destination = options.args[0];
@@ -150,33 +144,29 @@ function gen(/*va_args*/)
else
sourceTemplate = node_path.join(templatesDirectory, options.template);
console.log(sourceTemplate);
if (!fs.lstatSync(sourceTemplate).isDirectory())
{
stream.print(colorize("Error: ", "red") + "The template " + logPath(sourceTemplate) + " cannot be found. Available templates are:");
listTemplates();
process.exit(1);
}
console.log("d");
var configFile = node_path.join(sourceTemplate, "template.config"),
config = {};
console.log(configFile);
if (fs.existsSync(configFile))
config = JSON.parse(fs.readFileSync(configFile, { encoding: "utf8" }));
//config = JSON.parse(FILE.read(configFile, { charset:"UTF-8" }));
console.log("e");
debugger;
var destinationProject = destination,
configuration = options.noconfig ? [Configuration defaultConfiguration] : [Configuration userConfiguration],
frameworks = options.frameworks,
themes = options.themes;
console.log("f");
if (!options.noFrameworks)
frameworks.push("Objective-J", "Foundation", "AppKit");
console.log("before if");
if (options.justFrameworks)
{
@@ -199,11 +189,10 @@ function gen(/*va_args*/)
}
};
console.log("before copy: " + sourceTemplate + " " + destinationProject);
// FIXME???
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,
name = node_path.basename(destinationProject),
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)
{
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);
var destinationFrameworks = destination.join("Frameworks"),
destinationDebugFrameworks = destination.join("Frameworks", "Debug");
var destinationFrameworks = node_path.join(destination, "Frameworks"),
destinationDebugFrameworks = node_path.join(destination, "Frameworks", "Debug");
stream.print("Creating Frameworks directory in " + logPath(destinationFrameworks) + "...");
//destinationFrameworks.mkdirs(); // redundant
destinationDebugFrameworks.mkdirs();
//destinationDebugFrameworks.mkdirs();
fs.mkdirSync(destinationDebugFrameworks, { recursive: true });
if (build)
{
@@ -303,84 +294,59 @@ function createFrameworksInFile(/*Array*/ frameworks, /*String*/ aFile, /*Boolea
else
{
// Frameworks. Search frameworks paths
frameworks.forEach(function(framework)
{
frameworks.forEach(function(framework) {
var objjHome = ObjectiveJ.OBJJ_HOME;
// Need a special case for Objective-J
if (framework === "Objective-J")
{
if (framework === "Objective-J"){
// Objective-J. Take from OBJJ_HOME.
var objjHome = OBJJ.OBJJ_HOME,
objjPath = node_path.join(objjHome, "Frameworks", "Objective-J"),
objjDebugPath = node_path.join(objjHome, "Frameworks", "Debug", "Objective-J");
var objjPath = node_path.join(objjHome, "..", "objective-j", "Frameworks", "Objective-J");
var objjDebugPath = node_path.join(objjHome, "..", "objective-j", "Frameworks", "Debug", "Objective-J");
installFramework(objjPath, destinationFrameworks.join("Objective-J"), force, symlink);
installFramework(objjDebugPath, destinationDebugFrameworks.join("Objective-J"), force, symlink);
installFramework(objjPath, node_path.join(destinationFrameworks, "Objective-J"), force, symlink);
installFramework(objjDebugPath, node_path.join(destinationDebugFrameworks, "Objective-J"), force, symlink);
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++)
{
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)
/* if (!found)
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)
warn("Couldn't find the debug framework: " + logPath(framework));
warn("Couldn't find the debug framework: " + logPath(framework)); */
});
}
}
function installFramework(source, dest, force, symlink)
{
if (dest.exists())
{
if (force)
dest.rmtree();
else
{
if (fs.existsSync(dest)){
if (force) {
fs.rmSync(dest, { recursive: true });
} else {
warn(logPath(dest) + " already exists. Use --force to overwrite.");
return;
}
}
if (source.exists())
{
if (fs.existsSync(source)) {
stream.print((symlink ? "Symlinking " : "Copying ") + logPath(source) + " ==> " + logPath(dest));
if (symlink)
if (symlink) {
fs.symlinkSync(source, dest);
else
} else {
copyRecursiveSync(source, dest);
}
else
}
} else {
warn("Cannot find: " + logPath(source));
}
}
function createThemesInFile(/*Array*/ themes, /*String*/ aFile, /*Boolean*/ symlink, /*Boolean*/ force)
{
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"),
sources = [];
themes.forEach(function(theme)
{
var themeFolder = theme + ".blend",
path = node_path.join(themesBuild, themeFolder);
console.log("createThemesInFile: " + path);
if (!fs.lstatSync(path).isDirectory())
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)
{
if (dest.exists())
if (dest.exists())
{
if (force)
dest.rmtree();
@@ -482,7 +448,7 @@ function listFrameworks()
{
stream.print("Frameworks:");
OBJJ.objj_frameworks.forEach(function(frameworksDirectory)
ObjectiveJ.objj_frameworks.forEach(function(frameworksDirectory)
{
stream.print(" " + frameworksDirectory);
@@ -494,7 +460,7 @@ function listFrameworks()
stream.print("Frameworks (Debug):");
OBJJ.objj_debug_frameworks.forEach(function(frameworksDirectory)
ObjectiveJ.objj_debug_frameworks.forEach(function(frameworksDirectory)
{
stream.print(" " + frameworksDirectory);
@@ -512,8 +478,7 @@ function executePostInstallScript(/*String*/ destinationProject)
if (fs.existsSync(path))
{
stream.print(colorize("Executing postinstall script...", "cyan"));
child_process.execSync("/bin/sh" + " " + path + " " + destinationProject);
//OS.system(["/bin/sh", path, destinationProject]); // Use sh in case it isn't marked executable
child_process.execSync("/bin/sh" + " " + path + " " + destinationProject); // Use sh in case it isn't marked executable
fs.rmSync(path);
}
}
@@ -11,10 +11,9 @@ const fs = require("fs");
var ENV = process.env,
//FILE = require("file"),
JAKE = require("objj-jake"),
task = JAKE.task,
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",
OS = require("os"),
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
// code like the Cappuccino frameworks.
// 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;
@@ -69,20 +69,18 @@ var sourceDirs = [
const path = require("path");
const fs = require("fs");
const stream = require("objj-runtime/lib/term").stream;
const jake = require("objj-jake");
const stream = ObjectiveJ.term.stream;
const jake = JAKE;
const CLEAN = require("objj-jake/lib/jake/clean").CLEAN;
const CLOBBER = require("objj-jake/lib/jake/clean").CLOBBER;
const CLEAN = JAKE.CLEAN_AND_CLOBBER.CLEAN;
const CLOBBER = JAKE.CLEAN_AND_CLOBBER.CLOBBER;
const FileList = jake.FileList;
const filedir = jake.filedir;
const task = jake.task;
const JAKE_EXTRAS_PATH = "/Users/alfred/Developer/cappuccino/Jake/";
const framework = require(path.join(JAKE_EXTRAS_PATH, "frameworktask.js")).framework;
const browserEnvironment = require(path.join(JAKE_EXTRAS_PATH, "environment.js"));
const framework = CAPPUCCINO.Jake.frameworktask.framework;
//const browserEnvironment = require("@objj/cappuccino/Jake/environment.js");
const configuration = env["CONFIG"] || env["CONFIGURATION"] || env["c"] || "Debug";
const productName = "__project.nameasidentifier__";
@@ -6,12 +6,13 @@
* Copyright __project.year__, __organization.name__ All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),
JAKE = require("jake"),
const path = require("path");
const fs = require("fs");
var ENV = process.env,
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
app = CAPPUCCINO.Jake.applicationtask.app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os"),
projectName = "__project.nameasidentifier__";
@@ -21,10 +22,10 @@ app (projectName, function(task)
ENV["OBJJ_INCLUDE_PATHS"] = "Frameworks";
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.setBuildPath(FILE.join("Build", configuration));
task.setBuildIntermediatesPath(path.join("Build", "__project.nameasidentifier__.build", configuration));
task.setBuildPath(path.join("Build", configuration));
task.setProductName("__project.name__");
task.setIdentifier("__project.identifier__");
@@ -32,7 +33,7 @@ app (projectName, function(task)
task.setAuthor("__organization.name__");
task.setEmail("__organization.email__");
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.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
@@ -67,33 +68,33 @@ task ("release", 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()
{
OS.system(["open", FILE.join("Build", "Release", projectName, "index.html")]);
OS.system(["open", path.join("Build", "Release", projectName, "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", projectName));
OS.system(["press", "-f", FILE.join("Build", "Release", projectName), FILE.join("Build", "Deployment", projectName)]);
FILE.mkdirs(path.join("Build", "Deployment", projectName));
OS.system(["press", "-f", path.join("Build", "Release", projectName), path.join("Build", "Deployment", projectName)]);
printResults("Deployment")
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, projectName));
print("----------------------------");
console.log("----------------------------");
console.log(configuration+" app built at path: " + path.join("Build", configuration, projectName));
console.log("----------------------------");
}
function updateApplicationSize()
{
print("Calculating application file sizes...");
var contents = FILE.read(FILE.join("Build", configuration, projectName, "Info.plist"), { charset:"UTF-8" }),
console.log("Calculating application file sizes...");
var contents = fs.readFileSync(path.join("Build", configuration, projectName, "Info.plist"), { encoding: "utf8" }),
format = CFPropertyList.sniffedFormatOfString(contents),
plist = CFPropertyList.propertyListFromString(contents),
totalBytes = {executable:0, data:0, mhtml:0};
@@ -102,14 +103,19 @@ function updateApplicationSize()
var frameworksDir = "Frameworks";
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)
{
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
@@ -117,17 +123,17 @@ function updateApplicationSize()
themePath = nil;
if (themeName === "Aristo" || themeName === "Aristo2")
themePath = FILE.join(frameworksDir, "AppKit", "Resources", themeName + ".blend");
themePath = path.join(frameworksDir, "AppKit", "Resources", themeName + ".blend");
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);
// 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();
@@ -136,37 +142,38 @@ function updateApplicationSize()
dict.setValueForKey("mhtml", totalBytes.mhtml);
plist.setValueForKey("CPApplicationSize", dict);
FILE.write(FILE.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
fs.writeFileSync(path.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { encoding: "utf8" });
//FILE.write(path.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
}
function addBundleFileSizes(bundlePath, totalBytes)
{
var bundleName = FILE.basename(bundlePath),
var bundleName = path.basename(bundlePath),
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",
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())
totalBytes.executable += filePath.size();
filePath = path.join(bundlePath, "dataURLs.txt");
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())
totalBytes.data += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
filePath = new FILE.Path(FILE.join(bundlePath, "MHTMLData.txt"));
filePath = path.join(bundlePath, "MHTMLPaths.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
filePath = new FILE.Path(FILE.join(bundlePath, "MHTMLPaths.txt"));
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(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
// code like the Cappuccino frameworks.
// 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;
@@ -24,11 +24,7 @@
// DO NOT REMOVE
//===========================================================
var SYS = require("system"),
ENV = SYS.env,
FILE = require("file"),
OS = require("os");
var ENV = process.env;
//===========================================================
// USER CONFIGURABLE VARIABLES
@@ -43,6 +39,9 @@ var SYS = require("system"),
*/
var buildDir = "Build";
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
//===========================================================
// AUTOMATICALLY GENERATED
@@ -50,29 +49,74 @@ var buildDir = "Build";
// Do not edit! (unless you know what you are doing)
//===========================================================
var stream = require("narwhal/term").stream,
JAKE = require("jake"),
const path = require("path");
const fs = require("fs");
var stream = ObjectiveJ.term.stream,
task = JAKE.task,
FileList = JAKE.FileList,
CLEAN = require("jake/clean").CLEAN,
CLOBBER = require("jake/clean").CLOBBER,
blend = require("cappuccino/jake").blend,
CLEAN = JAKE.CLEAN_AND_CLOBBER.CLEAN,
CLOBBER = JAKE.CLEAN_AND_CLOBBER.CLOBBER,
//blend = require("cappuccino/jake").blend,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
productName = "__project.nameasidentifier__",
debugBlendKitPath = FILE.join("Frameworks", "Debug", "BlendKit"),
releaseBlendKitPath = FILE.join("Frameworks", "BlendKit"),
buildPath = FILE.canonical(FILE.join(buildDir, productName + ".build"));
debugBlendKitPath = path.join("Frameworks", "Debug", "BlendKit"),
releaseBlendKitPath = path.join("Frameworks", "BlendKit"),
buildPath = path.resolve(path.join(buildDir, productName + ".build"));
blend (productName + ".blend", function(themeBlendTask)
{
themeBlendTask.setBuildIntermediatesPath(FILE.join(buildPath, configuration))
themeBlendTask.setBuildPath(FILE.join(buildDir, configuration));
debugger;
themeBlendTask.setThemeDescriptors(new FileList("ThemeDescriptors.j"));
themeBlendTask.setIdentifier("__project.identifier__");
themeBlendTask.setResources(new FileList("Resources/*"));
var callback;
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()
{
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
// code like the Cappuccino frameworks.
// 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;
+2 -4
View File
@@ -7,9 +7,7 @@ var path = require("path");
var fs = require("fs");
function main(args) {
debugger;
console.log(args);
args.shift();
var mainBundlePath = args.shift();
if (args.length < 1) {
return printUsage();
@@ -29,7 +27,7 @@ function main(args) {
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);
}
+3 -4
View File
@@ -1,7 +1,7 @@
require("../../common.jake");
var /* OS = require("os"), */
task = require("objj-jake").task;
task = JAKE.task;
//SYSTEM = require("system");
const child_process = require("child_process");
@@ -19,16 +19,15 @@ task ("build", function()
args = "-sdk macosx " + args;
var xcodebuild = process.env.CAPP_BUILD ? "xcodebuild " : "CAPP_BUILD=../../Build xcodebuild ";
try {
console.log(child_process.execSync(xcodebuild + args).toString());
child_process.execSync(xcodebuild + args).toString();
} catch (error) {
process.exit(1);
}
}
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");
var /* OS = require("os"), */
task = require("objj-jake").task;
task = JAKE.task;
task ("build", function()
{
+3 -5
View File
@@ -200,11 +200,9 @@ ConverterConversionException = @"ConverterConversionException";
// 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.
// 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>"));
else
plistContents = plistContents.replace(new RegExp("\\<key\\>\\s*CF\\$UID\\s*\\<\\/key\\>", "g"), "<key>CP$UID</key>");
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)
{
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 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"),
@@ -93,7 +103,7 @@ var supportedTemplateImages = {
CPLog.warn("Resource \"" + _resourceName + "\" not found in the Resources directories");
else
{
size = imageSize(fs.realpathSync(resourceInfo.path)) || CGSizeMakeZero();
size = imagesize(fs.realpathSync(resourceInfo.path)) || CGSizeMakeZero();
framework = resourceInfo.framework;
}
+14 -2
View File
@@ -26,8 +26,20 @@ IBDefaultFontFace = @".AppleSystemUIFont";
IBDefaultFontFaceLegacy = @"Lucida Grande";
IBDefaultFontSize = 13.0;
var OS = require("os"),
fontinfo = require("objj-fontinfo").fontinfo;
var OS = require("os");
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)
+38 -36
View File
@@ -40,9 +40,9 @@ var child_process = require("child_process");
var /* FILE = require("file"), */
/* OS = require("os"), */
//SYS = require("system"),
FileList = require("objj-jake").FileList,
stream = require("objj-runtime").term.stream,
StaticResource = require("objj-runtime").StaticResource,
FileList = ObjectiveJ.utils.filelist.FileList,
stream = ObjectiveJ.term.stream,
StaticResource = ObjectiveJ.StaticResource,
DefaultTheme = "Aristo2",
BuildTypes = ["Debug", "Release"],
@@ -88,7 +88,7 @@ var /* FILE = require("file"), */
SharedNib2Cib = self;
commandLineArgs = theArgs;
parser = new (require("objj-runtime").parser.Parser)();
parser = new (ObjectiveJ.parser.Parser)();
nibInfo = {};
appDirectory = @"";
frameworks = [CPDictionary dictionary];
@@ -127,16 +127,18 @@ var /* FILE = require("file"), */
[self logError:[self exceptionReason:anException]];
process.exit(1);
}
//while(true) {};
}
- (void)checkPrerequisites
{
var fontinfo = require("objj-fontinfo").fontinfo,
/* var fontinfo = require("objj-fontinfo").fontinfo,
info = fontinfo("LucidaGrande", 13);
if (!info)
*/
try {
child_process.execSync("which fontinfo");
} catch(error) {
[self failWithMessage:@"fontinfo does not appear to be installed"];
}
}
- (void)enumerateFrameworks
@@ -320,18 +322,8 @@ var /* FILE = require("file"), */
// Let the converter log however the user configured it
[self setLogLevel:verbosity];
// Stripping the --watch flag from the command line arguments and running nib2cib in a child_process
// 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'});
[self convertWithOptions:options inputPath:nib completionHandler:function(success) { }];
}
});
}
@@ -454,7 +446,7 @@ var /* FILE = require("file"), */
matches = line.match(ArgsRe) || []; */
file.close();
CPLog.debug("Reading stored options: " + p);
CPLog.debug("Reading stored options: " + path);
if (matches)
{
@@ -485,7 +477,7 @@ var /* FILE = require("file"), */
var show = value.length !== undefined ? value.length > 0 : !!value;
if (show)
print(option + ": " + value);
console.log(option + ": " + value);
}
}
}
@@ -690,7 +682,7 @@ var /* FILE = require("file"), */
[self setLogLevel:verbosity];
}
require("browser/timeout").serviceTimeouts();
//require("browser/timeout").serviceTimeouts();
});
}
@@ -754,7 +746,7 @@ var /* FILE = require("file"), */
cappBuild = PATH.normalize(cappBuild);
if (fs.lstatSync(cappBuild).isDirectory())
if (fs.existsSync(cappBuild) && fs.lstatSync(cappBuild).isDirectory())
{
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
// 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
isDirectory:isDirectory
callback:callback];
@@ -878,7 +870,7 @@ var /* FILE = require("file"), */
{
var path = PATH.normalize(blendName);
if (fs.lstatSync(path).isDirectory())
if (fs.existsSync(path) && fs.lstatSync(path).isDirectory())
themePath = path;
}
}
@@ -897,7 +889,7 @@ var /* FILE = require("file"), */
// but we want the Browser environment. So we override mostEligibleEnvironment().
themeBundle.mostEligibleEnvironment = function() { return "Browser"; };
themeBundle.addEventListener("load", function()
var loadFunction = function()
{
var keyedThemes = themeBundle.valueForInfoDictionaryKey("CPKeyedThemes");
@@ -922,14 +914,20 @@ var /* FILE = require("file"), */
CPLog.debug("Loaded theme: " + path);
completionBlock(theme);
});
};
themeBundle.addEventListener("error", function()
{
CPLog.error("Could not find bundle: " + self);
});
themeBundle.load();
themeBundle._loadStatus
if (themeBundle.isLoaded()) {
loadFunction();
} else {
themeBundle.addEventListener("load", loadFunction);
themeBundle.addEventListener("error", function()
{
CPLog.error("Could not find bundle: " + self);
});
themeBundle.load();
}
}
- (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]))),
version = null;
if (PATH.basename(path) === "narwhal")
path = PATH.join(path, "packages", "cappuccino");
path = PATH.join(path, "lib", "nib2cib", "Info.plist");
console.log(path);
//TODO: path =
try {
fs.accessSync(path, fs.constants.R_OK);
@@ -1099,6 +1097,10 @@ var /* FILE = require("file"), */
stream.printError(message);
}
- (void)bundleDidFinishLoading:(CPBundle)aBundle
{
}
@end
function logFormatter(aString, aLevel, aTitle)
+33 -16
View File
@@ -22,8 +22,7 @@
const fs = require('fs');
const child_process = require('child_process');
const path = require('path');
const jake = require("objj-jake");
const { stream } = require('objj-runtime/lib/term');
const { stream } = ObjectiveJ.term;
requiresSudo = false;
@@ -52,11 +51,11 @@ if (!process.env["CONFIG"])
global.ENV = process.env;
global.task = jake.task;
global.directory = jake.directory;
global.file = jake.file;
global.filedir = jake.filedir;
global.FileList = jake.FileList;
global.task = JAKE.task;
global.directory = JAKE.directory;
global.file = JAKE.file;
global.filedir = JAKE.filedir;
global.FileList = JAKE.FileList;
global.$CONFIGURATION = process.env['CONFIG'];
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_FRAMEWORKS = path.join($BUILD_CJS_CAPPUCCINO, "Frameworks");
global.CLEAN = require("objj-jake/lib/jake/clean.js").CLEAN;
global.CLOBBER = require("objj-jake/lib/jake/clean.js").CLOBBER;
global.OBJJ_INCLUDE_PATHS.push(global.$BUILD_CJS_CAPPUCCINO_FRAMEWORKS);
global.CLEAN = JAKE.CLEAN_AND_CLOBBER.CLEAN;
global.CLOBBER = JAKE.CLEAN_AND_CLOBBER.CLOBBER;
global.CLEAN.include(path.join(global.$BUILD_DIR, "*.build"));
global.CLOBBER.include(global.$BUILD_DIR);
@@ -198,8 +199,7 @@ function setupEnvironment()
{
try
{
debugger;
require("objj-runtime").OBJJ_INCLUDE_PATHS.push(path.join($BUILD_CONFIGURATION_DIR, "CommonJS", "cappuccino", "Frameworks"));
ObjectiveJ.OBJJ_INCLUDE_PATHS.push(path.join($BUILD_CONFIGURATION_DIR, "CommonJS", "cappuccino", "Frameworks"));
}
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())
{
var cmd = "cd " + enquote(aDirectory) + " && " + serializedENV() + " " + "npx objj-jake" + " " + enquote(aTaskName);
var cmd = "cd " + enquote(aDirectory) + " && " + serializedENV() + " " + "jake" + " " + enquote(aTaskName);
var returnCode = systemSync(cmd);
if (returnCode)
if (returnCode) {
process.exit(returnCode);
}
}
else
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)
{
if (!fs.lstatSync(sourcePath).isDirectory())
if (!fs.existsSync(sourcePath))
return;
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())
fs.rmSync(targetPath, {recursive: true, force: true});
@@ -431,23 +437,34 @@ global.installCopy = function(sourcePath, useSudo)
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())
{
fs.readdirSync(binPath).forEach(function (name)
{
var binary = path.join(binPath, name);
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)
{
//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");
process.exit(1); //rake abort if ($? != 0)
}
};
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",
"version": "1.0.0",
"name": "@objj/cappuccino",
"version": "1.0.1-16",
"devDependencies": {
"grunt": "^1.4.1",
"grunt-contrib-concat": "^1.0.1",
"terser": "^5.7.0"
"terser": "^5.7.0",
"@objj/cappuccino": "file:."
},
"dependencies": {
"objj-fontinfo": "file:../objj-fontinfo",
"objj-imagesize": "file:../objj-imagesize",
"objj-jake": "file:../jake",
"objj-runtime": "file:../objj-runtime"
"@objj/jake": "latest",
"@objj/runtime": "latest"
},
"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"
}
}