mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-09 12:17:13 +00:00
Compare commits
161
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c59687b6e2 | ||
|
|
c2bd9f26a7 | ||
|
|
f33ba954f5 | ||
|
|
150e44dcd5 | ||
|
|
511ce4b07d | ||
|
|
aea3fb5f07 | ||
|
|
5932a07eb2 | ||
|
|
2b07c4b662 | ||
|
|
bc689b91dc | ||
|
|
c6a42781e7 | ||
|
|
c92aedf433 | ||
|
|
7857f92f19 | ||
|
|
9361e5d401 | ||
|
|
ad1862a253 | ||
|
|
4af137894a | ||
|
|
55aca1fde9 | ||
|
|
53e1e936d9 | ||
|
|
ff1448fb54 | ||
|
|
95fb19f311 | ||
|
|
46d869a62f | ||
|
|
03140dbf64 | ||
|
|
052c96e05a | ||
|
|
9a88f9c324 | ||
|
|
747ea627c9 | ||
|
|
89c0ab405a | ||
|
|
04c2b98ae4 | ||
|
|
24b36cdd95 | ||
|
|
5c91a08eaf | ||
|
|
edfba15d6f | ||
|
|
044b0bb0d2 | ||
|
|
472b59ef80 | ||
|
|
6b559ce283 | ||
|
|
c17b806fd5 | ||
|
|
1dcea8fe4c | ||
|
|
d72a52b9ce | ||
|
|
61e01b08e5 | ||
|
|
b631032857 | ||
|
|
e221156c11 | ||
|
|
8e346acdce | ||
|
|
7c36fa3f56 | ||
|
|
642e254522 | ||
|
|
72aa1b8416 | ||
|
|
edb1ef7f98 | ||
|
|
92beaba1d6 | ||
|
|
3b61b1c85d | ||
|
|
a529e752b3 | ||
|
|
d9791673df | ||
|
|
d0923efa1a | ||
|
|
eab8fe2d64 | ||
|
|
c9e8b2970b | ||
|
|
1440c156b2 | ||
|
|
ddfa4445ae | ||
|
|
1f501e6429 | ||
|
|
7969f118de | ||
|
|
706166dc5c | ||
|
|
4a8667e0f3 | ||
|
|
094fbcc67c | ||
|
|
d34c47c167 | ||
|
|
7226330514 | ||
|
|
852b2bd5d9 | ||
|
|
3d8ecfad47 | ||
|
|
9e6f1e0dc3 | ||
|
|
4deb7a3f51 | ||
|
|
5b0b030435 | ||
|
|
4edec2df2e | ||
|
|
e0596bdf75 | ||
|
|
6430463b5d | ||
|
|
d9e27e549f | ||
|
|
9f14dac5d2 | ||
|
|
d70199ca58 | ||
|
|
6b1cdbd19c | ||
|
|
5b99757a0d | ||
|
|
6c49116c68 | ||
|
|
68f0cf27df | ||
|
|
89757e35e6 | ||
|
|
24bf09b70c | ||
|
|
0ed2709124 | ||
|
|
a835202db1 | ||
|
|
830fbbab26 | ||
|
|
119e11cfe2 | ||
|
|
511e18b44f | ||
|
|
2f00d93b22 | ||
|
|
973fa1b978 | ||
|
|
79f40d24ae | ||
|
|
fdff92e5c8 | ||
|
|
653dd07162 | ||
|
|
b7968ca4a7 | ||
|
|
2a0a6449e5 | ||
|
|
b7c04d7d16 | ||
|
|
ab4c87e69f | ||
|
|
8257632706 | ||
|
|
3f8821b43b | ||
|
|
f6b8bc0c45 | ||
|
|
0618fa9bb2 | ||
|
|
2e5a483dce | ||
|
|
e608e0dbf3 | ||
|
|
a88e316a94 | ||
|
|
51ffa256ca | ||
|
|
52bd654850 | ||
|
|
0518d479d3 | ||
|
|
a893f3f5c1 | ||
|
|
9c2f37b43f | ||
|
|
0289ba17f1 | ||
|
|
5db94e1e52 | ||
|
|
a4bc08c29e | ||
|
|
b638d8e904 | ||
|
|
251ce7fdad | ||
|
|
a2337a2969 | ||
|
|
0c803e26ca | ||
|
|
ab25fadb1e | ||
|
|
e697f4eca7 | ||
|
|
80158a8982 | ||
|
|
55bcfacf3b | ||
|
|
52b7a82b4d | ||
|
|
471e605871 | ||
|
|
5c635f17a7 | ||
|
|
c27d604780 | ||
|
|
ddaf575719 | ||
|
|
0757f2ea80 | ||
|
|
3f8dfb6516 | ||
|
|
45ee25adc2 | ||
|
|
fcfb3d4083 | ||
|
|
357f8bd684 | ||
|
|
173cd8b4ad | ||
|
|
d2ca5994c8 | ||
|
|
fe04d177af | ||
|
|
2a6b18bc1b | ||
|
|
152cd272f6 | ||
|
|
abbdc139e8 | ||
|
|
7226019b6a | ||
|
|
78ea29bd48 | ||
|
|
5c90d1f769 | ||
|
|
2ecea40fdc | ||
|
|
ddeaad74d0 | ||
|
|
a82472f509 | ||
|
|
4a43e376ed | ||
|
|
9ab82e1e5e | ||
|
|
1924cd1822 | ||
|
|
730b2dd874 | ||
|
|
1c2b383838 | ||
|
|
0b99f83d6f | ||
|
|
dc5b3f48e8 | ||
|
|
d17671c99e | ||
|
|
b69259e83b | ||
|
|
f2c80dc815 | ||
|
|
cbc281b173 | ||
|
|
472f859bd8 | ||
|
|
e71f650650 | ||
|
|
e64c9d9cd4 | ||
|
|
87a1c6621c | ||
|
|
3605e99914 | ||
|
|
5e9d479cef | ||
|
|
f5db73342f | ||
|
|
9b2dc23197 | ||
|
|
067052e1a8 | ||
|
|
441e5fbc05 | ||
|
|
0a2aae3bc2 | ||
|
|
a76c798500 | ||
|
|
c238ebeef4 | ||
|
|
206eddbdbd | ||
|
|
45549cdbcf |
@@ -0,0 +1,34 @@
|
||||
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Node build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ node ]
|
||||
pull_request:
|
||||
branches: [ node ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [17.x, 18.x, 19.x, 20.x, 21.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
- run: echo "${PWD}/dist/cappuccino/bin" >> $GITHUB_PATH
|
||||
- run: echo "${PWD}/dist/objective-j/bin" >> $GITHUB_PATH
|
||||
- run: npm install
|
||||
- run: npm update
|
||||
- run: jake dist
|
||||
- run: jake test-only
|
||||
+9
-1
@@ -17,4 +17,12 @@ Tests/Manual/**/*.xcodeproj
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
*.tm_properties
|
||||
*.idea
|
||||
*.idea
|
||||
node_modules
|
||||
*.vscode
|
||||
/dist/objective-j/objj-executable
|
||||
/dist/objective-j/package.json
|
||||
/dist/objective-j/lib
|
||||
/dist/cappuccino/package.json
|
||||
/dist/cappuccino/lib
|
||||
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
.DS_Store
|
||||
Frameworks
|
||||
!/dist/objective-j/Frameworks
|
||||
!/dist/cappuccino-j/Frameworks
|
||||
Build
|
||||
Demos
|
||||
./Aristo
|
||||
WebSite
|
||||
.push-package
|
||||
*.xcodeproj*
|
||||
*.xcodeproj/*.pbxuser
|
||||
*.xcodeproj/*.perspectivev3
|
||||
xcuserdata/
|
||||
!*.xcodeproj/project.pbxproj
|
||||
*.xCodeSupport/
|
||||
*.XcodeSupport/
|
||||
*XcodeSupport/
|
||||
Tests/Manual/**/*.xcodeproj
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
*.tm_properties
|
||||
*.idea
|
||||
node_modules
|
||||
*.vscode
|
||||
/dist/objective-j/objj-executable
|
||||
/dist/objective-j/package.json
|
||||
/dist/cappuccino/package.json
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ var cachedBlackColor,
|
||||
CPImage _patternImage;
|
||||
CPString _cssString;
|
||||
}
|
||||
|
||||
@global document
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Theming
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
CPString _expires;
|
||||
}
|
||||
|
||||
@global document
|
||||
|
||||
/*!
|
||||
Initializes a cookie with a given name \c aName.
|
||||
@param the name for the cookie
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
@global CPApp
|
||||
@class CPFontPanel
|
||||
|
||||
@global document
|
||||
|
||||
CPItalicFontMask = 1 << 0;
|
||||
CPBoldFontMask = 1 << 1;
|
||||
CPUnboldFontMask = 1 << 2;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
@import "CPCompatibility.j"
|
||||
|
||||
@class CPColor
|
||||
@global document
|
||||
|
||||
@protocol CPImageDelegate <CPObject>
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
@global CPImagesPboardType
|
||||
@global appkit_tag_dom_elements
|
||||
|
||||
@global document
|
||||
|
||||
@typedef CPImageAlignment
|
||||
CPImageAlignCenter = 0;
|
||||
CPImageAlignTop = 1;
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
@global CPMenuDidChangeItemNotification
|
||||
@global CPMenuDidRemoveItemNotification
|
||||
|
||||
@global document
|
||||
|
||||
@implementation _CPMenuBarWindow : CPPanel
|
||||
{
|
||||
CPView _highlightView;
|
||||
|
||||
@@ -1881,7 +1881,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPOutlineViewTableViewDataSource : CPObject
|
||||
@implementation _CPOutlineViewTableViewDataSource : CPObject <CPTableViewDataSource>
|
||||
{
|
||||
CPObject _outlineView;
|
||||
}
|
||||
@@ -2011,7 +2011,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPOutlineViewTableViewDelegate : CPObject
|
||||
@implementation _CPOutlineViewTableViewDelegate : CPObject <CPTableViewDelegate>
|
||||
{
|
||||
CPOutlineView _outlineView;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
@end
|
||||
|
||||
@global document
|
||||
|
||||
var CPSoundDelegate_sound_didFinishPlaying_ = 1 << 1;
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
@global CPStringPboardType
|
||||
@global CPCursor
|
||||
|
||||
@global document
|
||||
|
||||
@protocol CPTextFieldDelegate <CPControlTextEditingDelegate>
|
||||
|
||||
@end
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
@global _MakeRangeFromAbs
|
||||
|
||||
@global document
|
||||
|
||||
@class CPTextContainer
|
||||
@class CPTextView
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@
|
||||
|
||||
@end
|
||||
|
||||
@global document
|
||||
|
||||
_MakeRangeFromAbs = function(a1, a2)
|
||||
{
|
||||
return (a1 < a2) ? CPMakeRange(a1, a2 - a1) : CPMakeRange(a2, a1 - a2);
|
||||
@@ -1051,7 +1053,7 @@ Sets the selection to a range of characters in response to user action.
|
||||
|
||||
[[_window platformWindow] _propagateCurrentDOMEvent:YES]; // for the _CPNativeInputManager (necessary at least on FF and chrome)
|
||||
|
||||
if (![_CPNativeInputManager isNativeInputFieldActive] && [event charactersIgnoringModifiers].charCodeAt(0) != 229) // filter out 229 because this would be inserted in chrome on each deadkey
|
||||
if (![_CPNativeInputManager isNativeInputFieldActive] && ![_CPNativeInputManager isDeadKey:event])
|
||||
[self interpretKeyEvents:[event]];
|
||||
|
||||
[_caret setPermanentlyVisible:YES];
|
||||
@@ -2636,7 +2638,14 @@ var _CPCopyPlaceholder = '-';
|
||||
{
|
||||
return _CPNativeInputFieldActive;
|
||||
}
|
||||
+ (void)isDeadKey:(CPEvent)event
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
return event._DOMEvent && (event._DOMEvent.key == 'Dead' || event._DOMEvent.key == 'Process');
|
||||
#endif
|
||||
|
||||
return NO;
|
||||
}
|
||||
+ (void)cancelCurrentNativeInputSession
|
||||
{
|
||||
|
||||
@@ -2711,14 +2720,6 @@ var _CPCopyPlaceholder = '-';
|
||||
|
||||
var charCode = _CPNativeInputField.innerHTML.charCodeAt(0);
|
||||
|
||||
// å and Å need to be filtered out in keyDown: due to chrome inserting 229 on a deadkey
|
||||
if (charCode == 229 || charCode == 197)
|
||||
{
|
||||
[currentFirstResponder insertText:_CPNativeInputField.innerHTML];
|
||||
_CPNativeInputField.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// chrome-trigger: keypressed is omitted for deadkeys
|
||||
if (!_CPNativeInputFieldActive && _CPNativeInputFieldKeyPressedCalled == NO && _CPNativeInputField.innerHTML.length && _CPNativeInputField.innerHTML != _CPCopyPlaceholder && _CPNativeInputField.innerHTML.length < 3)
|
||||
{
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
@global CPTextFieldDidFocusNotification
|
||||
@global CPTextFieldDidBlurNotification
|
||||
|
||||
@global document
|
||||
|
||||
// TODO: should be conform to protocol CPTextFieldDelegate
|
||||
@protocol CPTokenFieldDelegate <CPObject>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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])
|
||||
|
||||
@@ -61,9 +61,10 @@ var _CPCibClassSwapperClassNameKey = @"_CPCibClassSwapperClassNameKey",
|
||||
|
||||
if (!object)
|
||||
{
|
||||
CPLog.error("Unable to find class " + theClassName + " referenced in cib file.");
|
||||
var originalClassName = [aCoder decodeObjectForKey:_CPCibClassSwapperOriginalClassNameKey];
|
||||
CPLog.warn(@"Unable to find class " + theClassName + @" referenced in cib file. Will try to use original class " + originalClassName + @".");
|
||||
|
||||
object = [self allocObjectWithCoder:aCoder className:[aCoder decodeObjectForKey:_CPCibClassSwapperOriginalClassNameKey]];
|
||||
object = [self allocObjectWithCoder:aCoder className:originalClassName];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,6 +120,8 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
CGAffineTransform _transformFromLayer;
|
||||
}
|
||||
|
||||
@global document
|
||||
|
||||
/*!
|
||||
Returns a new animation layer.
|
||||
*/
|
||||
|
||||
@@ -291,7 +291,11 @@ var frameToCSSTranslationTransformMatrix = function(start, current)
|
||||
|
||||
- (Object)_DOMElement
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
return _DOMElement;
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (CPString)debug_description
|
||||
|
||||
+15
-12
@@ -1,19 +1,22 @@
|
||||
|
||||
require("../common.jake");
|
||||
|
||||
var framework = require("objective-j/jake").framework,
|
||||
BundleTask = require("objective-j/jake").BundleTask;
|
||||
var framework = require("../Jake/frameworktask.js").framework,
|
||||
BundleTask = require("../Jake/bundletask.js").BundleTask;
|
||||
|
||||
$BUILD_PATH = FILE.join($BUILD_DIR, $CONFIGURATION, 'AppKit');
|
||||
const path = require("path");
|
||||
const utilsFile = ObjectiveJ.utils.file;
|
||||
|
||||
$BUILD_PATH = path.join($BUILD_DIR, $CONFIGURATION, 'AppKit');
|
||||
|
||||
AppKitFiles = new FileList("**/*.j").exclude('CoreGraphics/CGContextCanvas.j', 'CoreGraphics/CGContextVML.j', 'Themes/**/*', 'Tools/**/*', "Platform/DOM/CPPlatform.j", "Platform/DOM/CPPlatformString.j");
|
||||
|
||||
FIXME_fileDependency (FILE.join("Platform", "CPPlatform.j"), FILE.join("Platform", "DOM", "CPPlatform.j"));
|
||||
FIXME_fileDependency (FILE.join("Platform", "CPPlatformString.j"), FILE.join("Platform", "DOM", "CPPlatformString.j"));
|
||||
FIXME_fileDependency (path.join("Platform", "CPPlatform.j"), path.join("Platform", "DOM", "CPPlatform.j"));
|
||||
FIXME_fileDependency (path.join("Platform", "CPPlatformString.j"), path.join("Platform", "DOM", "CPPlatformString.j"));
|
||||
|
||||
appKitTask = framework ("AppKit", function(appKitTask)
|
||||
{
|
||||
appKitTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "AppKit.build", $CONFIGURATION))
|
||||
appKitTask.setBuildIntermediatesPath(path.join($BUILD_DIR, "AppKit.build", $CONFIGURATION))
|
||||
appKitTask.setBuildPath($BUILD_CONFIGURATION_DIR);
|
||||
|
||||
appKitTask.setAuthor("280 North, Inc.");
|
||||
@@ -40,11 +43,11 @@ appKitTask = framework ("AppKit", function(appKitTask)
|
||||
appKitTask.setCompilerFlags("-DDEBUG -g -S --inline-msg-send -Wno-unused-but-set-variable " + INCLUDES);
|
||||
});
|
||||
|
||||
$BUILD_CJS_CAPPUCCINO_APPKIT = FILE.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "AppKit");
|
||||
$BUILD_CJS_CAPPUCCINO_APPKIT = path.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "AppKit");
|
||||
|
||||
filedir ($BUILD_CJS_CAPPUCCINO_APPKIT, ["AppKit"], function()
|
||||
{
|
||||
cp_r(appKitTask.buildProductPath(), $BUILD_CJS_CAPPUCCINO_APPKIT);
|
||||
utilsFile.cp_r(appKitTask.buildProductPath(), $BUILD_CJS_CAPPUCCINO_APPKIT);
|
||||
});
|
||||
|
||||
subtasks (["Themes"], ["clean", "clobber"]);
|
||||
@@ -53,11 +56,11 @@ task ("Theme", [$BUILD_CJS_CAPPUCCINO_APPKIT], function()
|
||||
{
|
||||
subjake(["Themes"], "build");
|
||||
|
||||
cp_r(FILE.join($BUILD_DIR, $CONFIGURATION, 'Aristo.blend'), FILE.join($BUILD_PATH, 'Resources', 'Aristo.blend'));
|
||||
cp_r(FILE.join($BUILD_DIR, $CONFIGURATION, 'Aristo.blend'), FILE.join($BUILD_CJS_CAPPUCCINO_APPKIT, "Resources", "Aristo.blend"));
|
||||
utilsFile.cp_r(path.join($BUILD_DIR, $CONFIGURATION, 'Aristo.blend'), path.join($BUILD_PATH, 'Resources', 'Aristo.blend'));
|
||||
utilsFile.cp_r(path.join($BUILD_DIR, $CONFIGURATION, 'Aristo.blend'), path.join($BUILD_CJS_CAPPUCCINO_APPKIT, "Resources", "Aristo.blend"));
|
||||
|
||||
cp_r(FILE.join($BUILD_DIR, $CONFIGURATION, 'Aristo2.blend'), FILE.join($BUILD_PATH, 'Resources', 'Aristo2.blend'));
|
||||
cp_r(FILE.join($BUILD_DIR, $CONFIGURATION, 'Aristo2.blend'), FILE.join($BUILD_CJS_CAPPUCCINO_APPKIT, "Resources", "Aristo2.blend"));
|
||||
utilsFile.cp_r(path.join($BUILD_DIR, $CONFIGURATION, 'Aristo2.blend'), path.join($BUILD_PATH, 'Resources', 'Aristo2.blend'));
|
||||
utilsFile.cp_r(path.join($BUILD_DIR, $CONFIGURATION, 'Aristo2.blend'), path.join($BUILD_CJS_CAPPUCCINO_APPKIT, "Resources", "Aristo2.blend"));
|
||||
});
|
||||
|
||||
task ("build", ["AppKit", $BUILD_CJS_CAPPUCCINO_APPKIT, "Theme"]);
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
@import "CGGeometry.j"
|
||||
|
||||
@global document
|
||||
|
||||
@implementation CPDOMWindowLayer : CPObject
|
||||
{
|
||||
int _level;
|
||||
|
||||
@@ -44,7 +44,7 @@ var screenNeedsInitialization = NO,
|
||||
screenNeedsInitialization = [CPPlatform isBrowser];
|
||||
|
||||
// We do this here because doing it later breaks IE.
|
||||
if (document.documentElement)
|
||||
if (typeof document !== 'undefined' && document.documentElement)
|
||||
document.documentElement.style.overflow = "hidden";
|
||||
|
||||
if ([CPPlatform isBrowser])
|
||||
|
||||
@@ -133,6 +133,8 @@
|
||||
|
||||
@global _CPRunModalLoop
|
||||
|
||||
@global document
|
||||
|
||||
// List of all open native windows
|
||||
var PlatformWindows = [CPSet set];
|
||||
|
||||
|
||||
@@ -1,16 +1,39 @@
|
||||
|
||||
require("../../../common.jake");
|
||||
|
||||
var blend = require("cappuccino/jake").blend;
|
||||
const path = require("path");
|
||||
|
||||
blend ("Aristo.blend", function(aristoTask)
|
||||
{
|
||||
aristoTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "Aristo.build", $CONFIGURATION))
|
||||
aristoTask.setBuildPath(FILE.join($BUILD_DIR, $CONFIGURATION));
|
||||
var callback;
|
||||
|
||||
aristoTask.setThemeDescriptors(new FileList("ThemeDescriptors.j"));
|
||||
aristoTask.setIdentifier("com.280n.blend.Aristo");
|
||||
aristoTask.setResources(new FileList("Resources/*"));
|
||||
function callbackFunction(blendtask) {
|
||||
callback(blendtask);
|
||||
}
|
||||
|
||||
$BUILD_CJS_BLENDTASK = path.join($BUILD_CJS_CAPPUCCINO, "lib", "cappuccino", "jake", "blendtask.j");
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
task ("build", ["Aristo.blend"]);
|
||||
require("../../../CommonJS/lib/cappuccino/jake.js").initilize(callbackFunction);
|
||||
|
||||
async function defineBlendTask() {
|
||||
await exports.blend ("Aristo.blend", function(aristoTask)
|
||||
{
|
||||
aristoTask.setBuildIntermediatesPath(path.join($BUILD_DIR, "Aristo.build", $CONFIGURATION))
|
||||
aristoTask.setBuildPath(path.join($BUILD_DIR, $CONFIGURATION));
|
||||
|
||||
aristoTask.setThemeDescriptors(new FileList("ThemeDescriptors.j"));
|
||||
aristoTask.setIdentifier("com.280n.blend.Aristo");
|
||||
aristoTask.setResources(new FileList("Resources/*"));
|
||||
});
|
||||
task ("build", ["Aristo.blend"]);
|
||||
}
|
||||
|
||||
exports.jakePromise = promise;
|
||||
|
||||
@@ -1,16 +1,39 @@
|
||||
|
||||
require("../../../common.jake");
|
||||
|
||||
var blend = require("cappuccino/jake").blend;
|
||||
const path = require("path");
|
||||
|
||||
blend ("Aristo2.blend", function(aristo2Task)
|
||||
{
|
||||
aristo2Task.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "Aristo2.build", $CONFIGURATION))
|
||||
aristo2Task.setBuildPath(FILE.join($BUILD_DIR, $CONFIGURATION));
|
||||
var callback;
|
||||
|
||||
aristo2Task.setThemeDescriptors(new FileList("ThemeDescriptors.j"));
|
||||
aristo2Task.setIdentifier("com.280n.blend.Aristo2");
|
||||
aristo2Task.setResources(new FileList("Resources/*"));
|
||||
function callbackFunction(blendtask) {
|
||||
callback(blendtask);
|
||||
}
|
||||
|
||||
$BUILD_CJS_BLENDTASK = path.join($BUILD_CJS_CAPPUCCINO, "lib", "cappuccino", "jake", "blendtask.j");
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
task ("build", ["Aristo2.blend"]);
|
||||
require("../../../CommonJS/lib/cappuccino/jake.js").initilize(callbackFunction);
|
||||
|
||||
async function defineBlendTask() {
|
||||
await exports.blend ("Aristo2.blend", function(aristoTask)
|
||||
{
|
||||
aristoTask.setBuildIntermediatesPath(path.join($BUILD_DIR, "Aristo2.build", $CONFIGURATION))
|
||||
aristoTask.setBuildPath(path.join($BUILD_DIR, $CONFIGURATION));
|
||||
|
||||
aristoTask.setThemeDescriptors(new FileList("ThemeDescriptors.j"));
|
||||
aristoTask.setIdentifier("com.280n.blend.Aristo2");
|
||||
aristoTask.setResources(new FileList("Resources/*"));
|
||||
});
|
||||
task ("build", ["Aristo2.blend"]);
|
||||
}
|
||||
|
||||
exports.jakePromise = promise;
|
||||
|
||||
@@ -519,15 +519,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 =
|
||||
[
|
||||
@@ -595,15 +597,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 =
|
||||
[
|
||||
@@ -2794,7 +2797,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),
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
|
||||
require("../../../common.jake");
|
||||
|
||||
var framework = require("objective-j/jake").framework;
|
||||
var BundleTask = require("objective-j/jake").BundleTask;
|
||||
const path = require("path");
|
||||
const utilsFile = ObjectiveJ.utils.file;
|
||||
|
||||
var framework = require("../../../Jake/frameworktask.js").framework;
|
||||
var BundleTask = require("../../../Jake/bundletask.js").BundleTask;
|
||||
|
||||
blendKitTask = framework ("BlendKit", function(blendKitTask)
|
||||
{
|
||||
blendKitTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "BlendKit.build", $CONFIGURATION))
|
||||
blendKitTask.setBuildPath(FILE.join($BUILD_DIR, $CONFIGURATION));
|
||||
blendKitTask.setBuildIntermediatesPath(path.join($BUILD_DIR, "BlendKit.build", $CONFIGURATION))
|
||||
blendKitTask.setBuildPath(path.join($BUILD_DIR, $CONFIGURATION));
|
||||
|
||||
blendKitTask.setIdentifier("com.280n.BlendKit");
|
||||
blendKitTask.setVersion(getCappuccinoVersion());
|
||||
blendKitTask.setAuthor("280 North, Inc.");
|
||||
blendKitTask.setEmail("feedback @nospam@ 280north.com");
|
||||
blendKitTask.setSummary("BlendKit classes for Cappuccino");
|
||||
blendKitTask.setSources(FILE.glob("*.j"));
|
||||
blendKitTask.setResources(FILE.glob("Resources/*"));
|
||||
blendKitTask.setSources(new FileList("*.j"));
|
||||
blendKitTask.setResources(new FileList("Resources/*"));
|
||||
blendKitTask.setLicense(BundleTask.License.LGPL_v2_1);
|
||||
blendKitTask.setFlattensSources(true); // FIXME: how do we non flatten?
|
||||
|
||||
@@ -25,11 +28,11 @@ blendKitTask = framework ("BlendKit", function(blendKitTask)
|
||||
blendKitTask.setCompilerFlags("-DDEBUG -g -Wno-unused-but-set-variable");
|
||||
});
|
||||
|
||||
$BUILD_CJS_PRODUCT_BLENDKIT = FILE.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "BlendKit");
|
||||
$BUILD_CJS_PRODUCT_BLENDKIT = path.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "BlendKit");
|
||||
|
||||
filedir ($BUILD_CJS_PRODUCT_BLENDKIT, ["BlendKit"], function()
|
||||
{
|
||||
cp_r(blendKitTask.buildProductPath(), $BUILD_CJS_PRODUCT_BLENDKIT);
|
||||
utilsFile.cp_r(blendKitTask.buildProductPath(), $BUILD_CJS_PRODUCT_BLENDKIT);
|
||||
});
|
||||
|
||||
task ("build", ["BlendKit", $BUILD_CJS_PRODUCT_BLENDKIT]);
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
|
||||
require("../../../common.jake");
|
||||
|
||||
var FILE = require("file");
|
||||
var path = require("path");
|
||||
const utilsFile = ObjectiveJ.utils.file;
|
||||
|
||||
$BLENDTASK = "blendtask.j";
|
||||
$BUILD_CJS_BLENDTASK = FILE.join($BUILD_CJS_CAPPUCCINO, "lib", "cappuccino", "jake", "blendtask.j");
|
||||
$BUILD_CJS_BLENDTASK = path.join($BUILD_CJS_CAPPUCCINO, "lib", "cappuccino", "jake", "blendtask.j");
|
||||
|
||||
filedir($BUILD_CJS_BLENDTASK, [$BLENDTASK], function()
|
||||
{
|
||||
cp_r($BLENDTASK, $BUILD_CJS_BLENDTASK);
|
||||
utilsFile.cp_r($BLENDTASK, $BUILD_CJS_BLENDTASK);
|
||||
});
|
||||
|
||||
task("build", [$BUILD_CJS_BLENDTASK]);
|
||||
|
||||
@@ -27,13 +27,14 @@
|
||||
@import <AppKit/_CPCibObjectData.j>
|
||||
@import <BlendKit/BlendKit.j>
|
||||
|
||||
var /* FILE = require("file"), */
|
||||
TERM = ObjectiveJ.term,
|
||||
task = JAKE.task,
|
||||
filedir = JAKE.filedir,
|
||||
BundleTask = CAPPUCCINO.Jake.BundleTask.BundleTask;
|
||||
|
||||
var FILE = require("file"),
|
||||
TERM = require("narwhal/term"),
|
||||
task = require("jake").task,
|
||||
filedir = require("jake").filedir,
|
||||
BundleTask = require("objective-j/jake/bundletask").BundleTask;
|
||||
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
|
||||
function BlendTask(aName)
|
||||
{
|
||||
@@ -53,9 +54,17 @@ BlendTask.prototype.packageType = function()
|
||||
|
||||
BlendTask.prototype.infoPlist = function()
|
||||
{
|
||||
|
||||
var infoPlist = BundleTask.prototype.infoPlist.apply(this, arguments);
|
||||
|
||||
infoPlist.setValueForKey("CPKeyedThemes", require("narwhal/util").unique(this._keyedThemes));
|
||||
function onlyUnique(value, index, self) {
|
||||
return self.indexOf(value) === index;
|
||||
}
|
||||
|
||||
this._keyedThemes.filter(onlyUnique)
|
||||
|
||||
infoPlist.setValueForKey("CPKeyedThemes", this._keyedThemes.filter(onlyUnique));
|
||||
//infoPlist.setValueForKey("CPKeyedThemes", require("narwhal/util").unique(this._keyedThemes));
|
||||
|
||||
return infoPlist;
|
||||
};
|
||||
@@ -72,9 +81,10 @@ BlendTask.prototype.setThemeDescriptors = function(/*Array | FileList*/ themeDes
|
||||
|
||||
BlendTask.prototype.defineTasks = function()
|
||||
{
|
||||
this.defineThemeDescriptorTasks();
|
||||
|
||||
BundleTask.prototype.defineTasks.apply(this, arguments);
|
||||
var self = this;
|
||||
return self.defineThemeDescriptorTasks().then(function() {
|
||||
BundleTask.prototype.defineTasks.apply(self, arguments);
|
||||
});
|
||||
};
|
||||
|
||||
BlendTask.prototype.defineSourceTasks = function()
|
||||
@@ -83,52 +93,68 @@ BlendTask.prototype.defineSourceTasks = function()
|
||||
|
||||
BlendTask.prototype.defineThemeDescriptorTasks = function()
|
||||
{
|
||||
this.environments().forEach(function(anEnvironment)
|
||||
{
|
||||
var folder = anEnvironment.name() + ".environment",
|
||||
themeDescriptors = this.themeDescriptors(),
|
||||
resourcesPath = this.resourcesPath(),
|
||||
intermediatesPath = FILE.join(this.buildIntermediatesProductPath(), folder, "Resources"),
|
||||
staticPath = this.buildProductStaticPathForEnvironment(anEnvironment),
|
||||
keyedThemes = this._keyedThemes,
|
||||
themesTaskName = this.name() + ":themes";
|
||||
|
||||
this.enhance(themesTaskName);
|
||||
|
||||
themeDescriptors.forEach(function(/*CPString*/ themeDescriptorPath)
|
||||
var self = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
var envsLeft = self.environments().length;
|
||||
self.environments().forEach(function(anEnvironment)
|
||||
{
|
||||
objj_importFile(FILE.absolute(themeDescriptorPath), YES);
|
||||
});
|
||||
var folder = anEnvironment.name() + ".environment",
|
||||
themeDescriptors = this.themeDescriptors(),
|
||||
resourcesPath = this.resourcesPath(),
|
||||
intermediatesPath = path.join(this.buildIntermediatesProductPath(), folder, "Resources"),
|
||||
staticPath = this.buildProductStaticPathForEnvironment(anEnvironment),
|
||||
keyedThemes = this._keyedThemes,
|
||||
themesTaskName = this.name() + ":themes";
|
||||
var tdLeft = themeDescriptors.length;
|
||||
|
||||
[BKThemeDescriptor allThemeDescriptorClasses].forEach(function(aClass)
|
||||
{
|
||||
var keyedThemePath = FILE.join(intermediatesPath, [aClass themeName] + ".keyedtheme");
|
||||
this.enhance(themesTaskName);
|
||||
|
||||
filedir (keyedThemePath, themesTaskName);
|
||||
filedir (staticPath, [keyedThemePath]);
|
||||
|
||||
keyedThemes.push([aClass themeName] + ".keyedtheme");
|
||||
});
|
||||
|
||||
task (themesTaskName, function()
|
||||
{
|
||||
[BKThemeDescriptor allThemeDescriptorClasses].forEach(function(aClass)
|
||||
themeDescriptors.forEach(function(/*CPString*/ themeDescriptorPath)
|
||||
{
|
||||
var themeTemplate = [[BKThemeTemplate alloc] init];
|
||||
var localIntermediatesPath = intermediatesPath;
|
||||
var localStaticPath = staticPath;
|
||||
var localKeyedThemes = keyedThemes;
|
||||
var localThemesTaskName = themesTaskName;
|
||||
|
||||
objj_importFile(path.resolve(themeDescriptorPath), YES, function() {
|
||||
if (--tdLeft === 0) {
|
||||
[BKThemeDescriptor allThemeDescriptorClasses].forEach(function(aClass)
|
||||
{
|
||||
var keyedThemePath = path.join(localIntermediatesPath, [aClass themeName] + ".keyedtheme");
|
||||
|
||||
[themeTemplate setValue:[aClass themeName] forKey:@"name"];
|
||||
filedir (keyedThemePath, themesTaskName);
|
||||
filedir (localStaticPath, [keyedThemePath]);
|
||||
|
||||
var objectTemplates = [aClass themedObjectTemplates],
|
||||
data = cibDataFromTopLevelObjects(objectTemplates.concat([themeTemplate])),
|
||||
fileContents = themeFromCibData(data);
|
||||
localKeyedThemes.push([aClass themeName] + ".keyedtheme");
|
||||
});
|
||||
task (localThemesTaskName, function()
|
||||
{
|
||||
[BKThemeDescriptor allThemeDescriptorClasses].forEach(function(aClass)
|
||||
{
|
||||
var themeTemplate = [[BKThemeTemplate alloc] init];
|
||||
|
||||
// No filedir in this case, so we have to make it ourselves.
|
||||
FILE.mkdirs(intermediatesPath);
|
||||
// FIXME: MARKER_TEXT isn't global, so we use "t;".
|
||||
FILE.write(FILE.join(intermediatesPath, [aClass themeName] + ".keyedtheme"), "t;" + fileContents.length + ";" + fileContents, { charset:"UTF-8" });
|
||||
[themeTemplate setValue:[aClass themeName] forKey:@"name"];
|
||||
|
||||
var objectTemplates = [aClass themedObjectTemplates],
|
||||
data = cibDataFromTopLevelObjects(objectTemplates.concat([themeTemplate])),
|
||||
fileContents = themeFromCibData(data);
|
||||
|
||||
// No filedir in this case, so we have to make it ourselves.
|
||||
fs.mkdirSync(localIntermediatesPath, { recursive: true });
|
||||
//FILE.mkdirs(intermediatesPath);
|
||||
// FIXME: MARKER_TEXT isn't global, so we use "t;".
|
||||
fs.writeFileSync(path.join(localIntermediatesPath, [aClass themeName] + ".keyedtheme"), "t;" + fileContents.length + ";" + fileContents, { encoding: "utf8" });
|
||||
//FILE.write(FILE.join(intermediatesPath, [aClass themeName] + ".keyedtheme"), "t;" + fileContents.length + ";" + fileContents, { charset:"UTF-8" });
|
||||
});
|
||||
});
|
||||
if (--envsLeft === 0) {
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}, this);
|
||||
}, self);
|
||||
});
|
||||
};
|
||||
|
||||
function cibDataFromTopLevelObjects(objects)
|
||||
@@ -254,5 +280,7 @@ exports.BlendTask = BlendTask;
|
||||
exports.blend = function(aName, aFunction)
|
||||
{
|
||||
// No .apply necessary because the parameters aren't variable.
|
||||
return BlendTask.defineTask(aName, aFunction);
|
||||
};
|
||||
return BlendTask.defineTask(aName, aFunction).then(function(task) {
|
||||
return task;
|
||||
});
|
||||
};
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
require("../../common.jake");
|
||||
|
||||
subtasks(["BlendKit", "CommonJS", "Aristo", "Aristo2"], ["build", "clean", "clobber"]);
|
||||
|
||||
@@ -78,6 +78,8 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
|
||||
#endif
|
||||
}
|
||||
|
||||
@global document
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame control:(CPControl)aControl
|
||||
{
|
||||
self = [super initWithFrame:aFrame];
|
||||
|
||||
+14
-9
@@ -1,26 +1,31 @@
|
||||
|
||||
require("../common.jake");
|
||||
|
||||
var FILE = require("file");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const utilsFile = ObjectiveJ.utils.file;
|
||||
|
||||
new FileList("**/*").exclude("Jakefile").forEach(function(aFilename)
|
||||
var tmp_list = new FileList();
|
||||
tmp_list.include("**/*");
|
||||
tmp_list.exclude("Jakefile");
|
||||
|
||||
tmp_list.forEach(function(aFilename)
|
||||
{
|
||||
if (!FILE.isFile(aFilename))
|
||||
if (!fs.lstatSync(aFilename).isFile())
|
||||
return;
|
||||
|
||||
var buildFilename = FILE.join($BUILD_CJS_CAPPUCCINO, aFilename);
|
||||
var buildFilename = path.join($BUILD_CJS_CAPPUCCINO, aFilename);
|
||||
|
||||
filedir (buildFilename, [aFilename], function ()
|
||||
{
|
||||
cp(aFilename, buildFilename);
|
||||
utilsFile.cp(aFilename, buildFilename);
|
||||
});
|
||||
|
||||
// HACK: narwhal should copy permissions
|
||||
if (FILE.dirname(aFilename) === FILE.join("bin"))
|
||||
if (path.dirname(aFilename) === path.join("bin"))
|
||||
{
|
||||
filedir (buildFilename, function ()
|
||||
{
|
||||
FILE.chmod(buildFilename, 0755);
|
||||
fs.chmodSync(buildFilename, 0o755);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,5 +34,5 @@ new FileList("**/*").exclude("Jakefile").forEach(function(aFilename)
|
||||
});
|
||||
|
||||
task ("build", function() {
|
||||
setPackageMetadata(FILE.join($BUILD_CJS_CAPPUCCINO, "package.json"));
|
||||
setPackageMetadata(path.join($BUILD_CJS_CAPPUCCINO, "package.json"));
|
||||
});
|
||||
|
||||
Executable
+7
@@ -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 });
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
ObjectiveJ = require("@objj/runtime");
|
||||
//CAPPUCCINO = require("@objj/cappuccino");
|
||||
|
||||
var ojtest = require("@objj/ojtest");
|
||||
|
||||
// Inject path to the OJTest main Objective-J file into the arguments so it is the file to be executed.
|
||||
var args = process.argv.slice(); // Copy
|
||||
args.splice(1, 1, ojtest.pathToOJTest);
|
||||
|
||||
// Compile, load and run it
|
||||
ObjectiveJ.run(args, {inlineMsgSendFunctions: true, sourceMap: true, sourceMapIncludeSource: true });
|
||||
@@ -1,8 +1,7 @@
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
|
||||
|
||||
var FILE = require("file");
|
||||
|
||||
function exposeExports(path)
|
||||
/* function exposeExports(path)
|
||||
{
|
||||
var object = require(path);
|
||||
|
||||
@@ -11,13 +10,31 @@ function exposeExports(path)
|
||||
exports[name] = object[name];
|
||||
}
|
||||
|
||||
exposeExports("objective-j/jake");
|
||||
exposeExports("@objj/jake"); */
|
||||
|
||||
// This check is only necessary because during the build process blendtask gets created much later.
|
||||
if (FILE.exists(FILE.join(FILE.dirname(module.path), "jake", "blendtask.j")))
|
||||
{
|
||||
var BLEND_TASK = require("cappuccino/jake/blendtask");
|
||||
var object = JAKE;
|
||||
|
||||
exports.BlendTask = BLEND_TASK.BlendTask;
|
||||
exports.blend = BLEND_TASK.blend;
|
||||
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.
|
||||
var blendTaskPath = path.join(process.cwd(), "..", "CommonJS", "blendtask.j");
|
||||
|
||||
// var blendTaskPath = path.join(path.dirname(module.path), "jake", "blendtask.j");
|
||||
// Should be "{something}/AppKit/Themes/CommonJS/blendtask.j"
|
||||
|
||||
if (fs.existsSync(blendTaskPath))
|
||||
{
|
||||
var anExports = {};
|
||||
function localCallback() {
|
||||
callback(anExports);
|
||||
}
|
||||
process.env["CONFIG"] = "Debug";
|
||||
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);
|
||||
}
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
diff -rupN a/engines/rhino/bin/narwhal-rhino b/engines/rhino/bin/narwhal-rhino
|
||||
--- a/engines/rhino/bin/narwhal-rhino 2011-11-16 11:01:40.000000000 +0000
|
||||
+++ b/engines/rhino/bin/narwhal-rhino 2012-04-23 18:35:45.000000000 +0100
|
||||
@@ -22,7 +22,7 @@ fi
|
||||
CLASSPATH=$NARWHAL_ENGINE_HOME/jars/jna.jar
|
||||
BOOTCLASSPATH=$NARWHAL_ENGINE_HOME/jars/js.jar
|
||||
|
||||
-JAVA_OPTS="-Dnarwhal.http_proxy=$http_proxy"
|
||||
+JAVA_OPTS="-Dnarwhal.http_proxy=$http_proxy $JAVA_OPTS"
|
||||
|
||||
if [ -n "$NARWHAL_CLASSPATH" ]; then
|
||||
CLASSPATH=$NARWHAL_CLASSPATH:$CLASSPATH
|
||||
@@ -207,7 +207,10 @@ var CPBundlesForURLStrings = { };
|
||||
CPLog.error("Could not find bundle: " + self);
|
||||
});
|
||||
|
||||
_bundle.load(YES);
|
||||
// Return the answer so it is possible to do 'await' on this 'loadWithDelegate:' method as the
|
||||
// load function will return a Promise. It is still possible to not do 'await' on this method
|
||||
// and that gives us the old behaviour.
|
||||
return _bundle.load(YES);
|
||||
}
|
||||
|
||||
- (CPArray)staticResourceURLs
|
||||
|
||||
@@ -50,6 +50,8 @@ CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}";
|
||||
DOMElement _scriptTag;
|
||||
}
|
||||
|
||||
@global document
|
||||
|
||||
/*! @deprecated */
|
||||
+ (CPJSONPConnection)sendRequest:(CPURLRequest)aRequest callback:(CPString)callbackParameter delegate:(id)aDelegate
|
||||
{
|
||||
|
||||
@@ -320,8 +320,8 @@
|
||||
lhs = lhs.stripDiacritics();
|
||||
rhs = rhs.stripDiacritics();
|
||||
}
|
||||
var commut = (_options & CPCaseInsensitivePredicateOption) ? "gi":"g",
|
||||
reg = new RegExp(rhs.escapeForRegExp(),commut);
|
||||
var commut = (_options & CPCaseInsensitivePredicateOption) ? "i":"",
|
||||
reg = new RegExp("^" + rhs.escapeForRegExp() + "$",commut);
|
||||
return reg.test(lhs);
|
||||
|
||||
case CPBeginsWithPredicateOperatorType: var range = CPMakeRange(0, MIN([lhs length], [rhs length]));
|
||||
|
||||
+17
-6
@@ -44,6 +44,16 @@ var abbreviationDictionary,
|
||||
timeZoneDataVersion,
|
||||
localizedName;
|
||||
|
||||
function abbreviationForDate(date)
|
||||
{
|
||||
// Sometimes the browsers will give unmatched timezones in other languages so try one more thing
|
||||
// Take the locale string for english in the US. It has the following format (9/21/2021, 2:40:44 PM Central European Summer Time)
|
||||
// Remove the date and time with this regex and take first letter in each word in the time zone name.
|
||||
// This is not 100% but is better than nothing as JAvascript has no good support for this.
|
||||
var abbreviation = date.toLocaleString('en-US', {timeZoneName : 'long'}).replace(/^([0]?\d|[1][0-2])\/((?:[0]?|[1-2])\d|[3][0-1])\/([2][01]|[1][6-9])\d{2}(,?\s*([0]?\d|[1][0-2])(\:[0-5]\d){1,2})*\s*([aApP][mM]{0,2})?\s*/, "").split(" ").map(function(l) { return l[0]}).join("");
|
||||
|
||||
return abbreviation;
|
||||
}
|
||||
/*!
|
||||
@class CPTimeZone
|
||||
@ingroup foundation
|
||||
@@ -132,6 +142,7 @@ var abbreviationDictionary,
|
||||
@"CLST" : @"America/Santiago",
|
||||
@"CLT" : @"America/Santiago",
|
||||
@"COT" : @"America/Bogota",
|
||||
@"CUT" : @"UTC",
|
||||
@"CST" : @"America/Chicago",
|
||||
@"EAT" : @"Africa/Addis_Ababa",
|
||||
@"EDT" : @"America/New_York",
|
||||
@@ -269,11 +280,11 @@ var abbreviationDictionary,
|
||||
};
|
||||
|
||||
var date = [CPDate date],
|
||||
abbreviation = String(String(date).split("(")[1]).split(")")[0];
|
||||
abbreviation = abbreviationForDate(date);
|
||||
|
||||
localTimeZone = [self timeZoneWithAbbreviation:abbreviation];
|
||||
systemTimeZone = [self timeZoneWithAbbreviation:abbreviation];
|
||||
defaultTimeZone = [self timeZoneWithAbbreviation:abbreviation];
|
||||
systemTimeZone = localTimeZone;
|
||||
defaultTimeZone = localTimeZone;
|
||||
|
||||
localizedName = @{
|
||||
@"en" : englishLocalizedName,
|
||||
@@ -430,7 +441,7 @@ var abbreviationDictionary,
|
||||
+ (void)resetSystemTimeZone
|
||||
{
|
||||
var date = [CPDate date],
|
||||
abbreviation = String(String(date).split("(")[1]).split(")")[0];
|
||||
abbreviation = abbreviationForDate(date);
|
||||
|
||||
systemTimeZone = [self timeZoneWithAbbreviation:abbreviation];
|
||||
|
||||
@@ -560,7 +571,7 @@ var abbreviationDictionary,
|
||||
if (!date)
|
||||
return nil;
|
||||
|
||||
return String(String(date).split("(")[1]).split(")")[0];
|
||||
return abbreviationForDate(date);
|
||||
}
|
||||
|
||||
/*! Returns the number of seconds from GMT for the given date
|
||||
@@ -573,7 +584,7 @@ var abbreviationDictionary,
|
||||
if (!date)
|
||||
return nil;
|
||||
|
||||
var abbreviation = String(String(date).split("(")[1]).split(")")[0];
|
||||
var abbreviation = abbreviationForDate(date);
|
||||
|
||||
return [timeDifferenceFromUTC valueForKey:abbreviation] * 60;
|
||||
}
|
||||
|
||||
@@ -154,6 +154,31 @@ var CPURLConnectionDelegate = nil;
|
||||
return [[self alloc] _initWithRequest:aRequest queue:aQueue completionHandler:aHandler];
|
||||
}
|
||||
|
||||
/*
|
||||
Loads the data for a URL request and returns a Promise.
|
||||
@param aRequest contains the URL to obtain data from.
|
||||
@discussion If the request completes successfully, the data parameter of the function contains the resource data, and the error parameter is nil. If the request fails, the data parameter is nil and the error parameter contain information about the failure.
|
||||
|
||||
Typical use can be like this:
|
||||
|
||||
- (async @action)doAction:(id)sender {
|
||||
const { response, data, error } = await [CPURLConnection sendAsynchronousRequest:[CPURLRequest requestWithURL:@"http://cappuccino.dev"]];
|
||||
if (error == nil) {
|
||||
//do the stuff...
|
||||
} else {
|
||||
// Handle errors
|
||||
}
|
||||
}
|
||||
*/
|
||||
+ (async JSObject /* { response: CPURLResponse, data: CPData, error: CPError } */)sendAsynchronousRequest:(CPURLRequest)aRequest
|
||||
{
|
||||
return new Promise((resolve, reject) =>
|
||||
[[self alloc] _initWithRequest:aRequest
|
||||
queue:[CPOperationQueue mainQueue]
|
||||
completionHandler:(aResponse, aData, anError) => resolve( {response: aResponse, data: aData, error:anError })]
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
Creates a url connection with a delegate to monitor the request progress.
|
||||
@param aRequest contains the URL to obtain data from
|
||||
|
||||
+13
-7
@@ -22,12 +22,15 @@
|
||||
|
||||
require("../common.jake");
|
||||
|
||||
var framework = require("objective-j/jake").framework;
|
||||
var BundleTask = require("objective-j/jake").BundleTask;
|
||||
var framework = require("../Jake/frameworktask.js").framework;
|
||||
var BundleTask = require("../Jake/bundletask.js").BundleTask;
|
||||
|
||||
const path = require("path");
|
||||
const utilsFile = ObjectiveJ.utils.file;
|
||||
|
||||
foundationTask = framework ("Foundation", function(foundationTask)
|
||||
{
|
||||
foundationTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "Foundation.build", $CONFIGURATION))
|
||||
foundationTask.setBuildIntermediatesPath(path.join($BUILD_DIR, "Foundation.build", $CONFIGURATION))
|
||||
foundationTask.setBuildPath($BUILD_CONFIGURATION_DIR);
|
||||
|
||||
foundationTask.setAuthor("280 North, Inc.");
|
||||
@@ -40,10 +43,12 @@ foundationTask = framework ("Foundation", function(foundationTask)
|
||||
foundationTask.setResources(new FileList("Resources/**/*"));
|
||||
foundationTask.setFlattensSources(true);
|
||||
foundationTask.setInfoPlistPath("Info.plist");
|
||||
foundationTask.setEnvironments(require("objective-j/jake/environment").ObjJ);
|
||||
foundationTask.setEnvironments(require("../Jake/environment.js").ObjJ);
|
||||
|
||||
// Grab all the .h's and just include them in each file.
|
||||
var INCLUDES = new FileList("**/*.h").map(function(aFilename)
|
||||
var INCLUDES_LIST = new FileList();
|
||||
INCLUDES_LIST.include("**/*.h");
|
||||
var INCLUDES = INCLUDES_LIST.map(function(aFilename)
|
||||
{
|
||||
return "--include \"" + aFilename + "\"";
|
||||
}).join(" ");
|
||||
@@ -56,13 +61,14 @@ foundationTask = framework ("Foundation", function(foundationTask)
|
||||
foundationTask.setCompilerFlags("-DDEBUG -g -S --inline-msg-send -Wno-unused-but-set-variable " + INCLUDES);
|
||||
});
|
||||
|
||||
$BUILD_CJS_FOUNDATION = FILE.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "Foundation");
|
||||
$BUILD_CJS_FOUNDATION = path.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "Foundation");
|
||||
|
||||
filedir ($BUILD_CJS_FOUNDATION, ["Foundation"], function()
|
||||
{
|
||||
cp_r(foundationTask.buildProductPath(), $BUILD_CJS_FOUNDATION);
|
||||
utilsFile.cp_r(foundationTask.buildProductPath(), $BUILD_CJS_FOUNDATION);
|
||||
});
|
||||
|
||||
|
||||
task ("build", ["Foundation", $BUILD_CJS_FOUNDATION]);
|
||||
|
||||
CLOBBER.include($BUILD_CJS_FOUNDATION);
|
||||
|
||||
@@ -0,0 +1,503 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (C) 2012 by Marijn Haverbeke <marijnh@gmail.com>
|
||||
Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -16,8 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Please note that some subdirectories of the CodeMirror distribution
|
||||
include their own LICENSE files, and are released under different
|
||||
licences.
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
Content-Type: multipart/related; boundary="_SEPARATOR_"
|
||||
|
||||
--_SEPARATOR_
|
||||
Content-Location:test
|
||||
Content-Transfer-Encoding:base64
|
||||
|
||||
R0lGODlhAQABAIAAAMc9BQAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==
|
||||
*/
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Objective-J.js
|
||||
* Objective-J
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* Copyright 2008-2010, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
var /* FILE = require("file"), */
|
||||
OS = require("os"),
|
||||
Jake = JAKE,
|
||||
BundleTask = (require("./bundletask")).BundleTask;
|
||||
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
|
||||
const utilsFile = ObjectiveJ.utils.file;
|
||||
|
||||
function ApplicationTask(aName)
|
||||
{
|
||||
BundleTask.apply(this, arguments);
|
||||
|
||||
if (fs.existsSync("index.html"))
|
||||
this._indexFilePath = "index.html";
|
||||
else
|
||||
this._indexFilePath = null;
|
||||
if (fs.existsSync("Frameworks"))
|
||||
this._frameworksPath = "Frameworks";
|
||||
else
|
||||
this._frameworksPath = null;
|
||||
this._shouldGenerateCacheManifest = false;
|
||||
}
|
||||
ApplicationTask.__proto__ = BundleTask;
|
||||
ApplicationTask.prototype.__proto__ = BundleTask.prototype;
|
||||
ApplicationTask.prototype.packageType = function()
|
||||
{
|
||||
return "APPL";
|
||||
};
|
||||
ApplicationTask.prototype.defineTasks = function()
|
||||
{
|
||||
BundleTask.prototype.defineTasks.apply(this, arguments);
|
||||
this.defineFrameworksTask();
|
||||
this.defineIndexFileTask();
|
||||
this.defineCacheManifestTask();
|
||||
};
|
||||
ApplicationTask.prototype.setIndexFilePath = function(aFilePath)
|
||||
{
|
||||
this._indexFilePath = aFilePath;
|
||||
};
|
||||
ApplicationTask.prototype.indexFilePath = function()
|
||||
{
|
||||
return this._indexFilePath;
|
||||
};
|
||||
ApplicationTask.prototype.setFrameworksPath = function(aFrameworksPath)
|
||||
{
|
||||
this._frameworksPath = aFrameworksPath;
|
||||
};
|
||||
ApplicationTask.prototype.frameworksPath = function()
|
||||
{
|
||||
return this._frameworksPath;
|
||||
};
|
||||
ApplicationTask.prototype.setShouldGenerateCacheManifest = function(shouldGenerateCacheManifest)
|
||||
{
|
||||
this._shouldGenerateCacheManifest = shouldGenerateCacheManifest;
|
||||
};
|
||||
ApplicationTask.prototype.shouldGenerateCacheManifest = function()
|
||||
{
|
||||
return this._shouldGenerateCacheManifest;
|
||||
};
|
||||
ApplicationTask.prototype.defineFrameworksTask = function()
|
||||
{
|
||||
if (!this._frameworksPath && (this.environments()).indexOf((require("./environment.js")).Browser) === -1)
|
||||
return;
|
||||
var buildPath = this.buildProductPath(),
|
||||
newFrameworks = path.join(buildPath, "Frameworks"),
|
||||
thisTask = this;
|
||||
Jake.fileCreate(newFrameworks, function()
|
||||
{
|
||||
if (thisTask._frameworksPath === "capp")
|
||||
OS.system(["capp", "gen", "-f", "--force", buildPath]);
|
||||
else if (thisTask._frameworksPath)
|
||||
{
|
||||
if (fs.existsSync(newFrameworks))
|
||||
fs.rmSync(newFrameworks, { recursive: true });
|
||||
var sourcePath = path.join(thisTask._frameworksPath, "Source"),
|
||||
hasSource = fs.existsSync(sourcePath),
|
||||
tempPath = path.join(process.cwd(), ".__capp_Frameworks_Source__");
|
||||
if (hasSource)
|
||||
fs.moveSync(sourcePath, tempPath);
|
||||
utilsFile.copyRecursiveSync(thisTask._frameworksPath, newFrameworks);
|
||||
if (hasSource)
|
||||
fs.moveSync(tempPath, sourcePath);
|
||||
} });
|
||||
this.enhance([newFrameworks]);
|
||||
};
|
||||
ApplicationTask.prototype.buildIndexFilePath = function()
|
||||
{
|
||||
return path.join(this.buildProductPath(), path.basename(this.indexFilePath()));
|
||||
};
|
||||
ApplicationTask.prototype.defineIndexFileTask = function()
|
||||
{
|
||||
if (!this._indexFilePath)
|
||||
return;
|
||||
var indexFilePath = this.indexFilePath(),
|
||||
buildIndexFilePath = this.buildIndexFilePath();
|
||||
Jake.filedir(buildIndexFilePath, [indexFilePath], function()
|
||||
{
|
||||
fs.copyFileSync(indexFilePath, buildIndexFilePath);
|
||||
});
|
||||
this.enhance([buildIndexFilePath]);
|
||||
};
|
||||
ApplicationTask.prototype.defineCacheManifestTask = function()
|
||||
{
|
||||
if (!this.shouldGenerateCacheManifest())
|
||||
return;
|
||||
var productPath = path.join(this.buildProductPath(), "");
|
||||
var indexFilePath = this.buildIndexFilePath();
|
||||
var manifestPath = path.join(productPath, "app.manifest");
|
||||
Jake.task(manifestPath, function()
|
||||
{
|
||||
(require("../cache-manifest")).generateManifest(productPath, {index: indexFilePath});
|
||||
});
|
||||
this.enhance([manifestPath]);
|
||||
};
|
||||
exports.ApplicationTask = ApplicationTask;
|
||||
exports.app = function(aName, aFunction)
|
||||
{
|
||||
return ApplicationTask.defineTask(aName, aFunction);
|
||||
};
|
||||
@@ -0,0 +1,751 @@
|
||||
/*
|
||||
* Objective-J.js
|
||||
* Objective-J
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* Copyright 2008-2010, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Core modules
|
||||
const child_process = require("child_process");
|
||||
const path = require("path");
|
||||
|
||||
// NPM modules
|
||||
const fs = require("fs");
|
||||
const term = ObjectiveJ.term;
|
||||
const utilsFile = ObjectiveJ.utils.file;
|
||||
|
||||
// Internal modules
|
||||
const environment = require("./environment");
|
||||
|
||||
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)
|
||||
{
|
||||
return [".png", ".jpg", ".jpeg", ".gif", ".tif", ".tiff"].includes(path.extname(aFilename).toLowerCase());
|
||||
}
|
||||
function mimeType(aFilename)
|
||||
{
|
||||
var mimeTypeDict = {
|
||||
".png": "image/png",
|
||||
".jpg": "image/jpeg",
|
||||
".jpeg": "image/jpeg",
|
||||
".gif": "image/gif",
|
||||
".tif": "image/tiff",
|
||||
".tiff": "image/tiff"
|
||||
};
|
||||
var lowerCaseExt = path.extname(aFilename).toLowerCase();
|
||||
return mimeTypeDict[lowerCaseExt];
|
||||
}
|
||||
function BundleTask(aName, anApplication)
|
||||
{
|
||||
Task.apply(this, arguments);
|
||||
var ignoreCommonJS = process.env["CAPP_IGNORE_COMMONJS_ENV"];
|
||||
if (ignoreCommonJS && ignoreCommonJS.toLowerCase() == "no" || ignoreCommonJS == "1")
|
||||
this.setEnvironments([environment.Browser]);
|
||||
else
|
||||
this.setEnvironments([environment.Browser, environment.CommonJS]);
|
||||
this._author = null;
|
||||
this._email = null;
|
||||
this._summary = null;
|
||||
this._license = null;
|
||||
this._sources = null;
|
||||
this._resources = null;
|
||||
this._spritesResources = true;
|
||||
this._identifier = null;
|
||||
this._version = 0.1;
|
||||
this._compilerFlags = null;
|
||||
this._flattensSources = false;
|
||||
this._includesNibsAndXibs = false;
|
||||
this._preventsNib2Cib = false;
|
||||
this._productName = this.name();
|
||||
this._buildIntermediatesPath = null;
|
||||
this._buildPath = process.cwd();
|
||||
this._replacedFiles = {};
|
||||
this._nib2cibFlags = null;
|
||||
this._infoPlistPath = "Info.plist";
|
||||
this._principalClass = null;
|
||||
}
|
||||
BundleTask.__proto__ = Task;
|
||||
BundleTask.prototype.__proto__ = Task.prototype;
|
||||
BundleTask.defineTask = function(aName, aFunction)
|
||||
{
|
||||
var bundleTask = Task.defineTask.apply(this, [aName]);
|
||||
if (aFunction) {
|
||||
aFunction(bundleTask);
|
||||
}
|
||||
var p = bundleTask.defineTasks();
|
||||
if (p != null) {
|
||||
return p.then(() => {
|
||||
return bundleTask;
|
||||
});
|
||||
} else {
|
||||
return bundleTask;
|
||||
}
|
||||
};
|
||||
BundleTask.prototype.setEnvironments = function(environments)
|
||||
{
|
||||
if (arguments.length < 1)
|
||||
this._environments = [];
|
||||
else if (arguments.length > 1)
|
||||
this._environments = Array.prototype.slice.apply(environments);
|
||||
else if (typeof environments.slice === "function")
|
||||
this._environments = environments.slice();
|
||||
else
|
||||
this._environments = [environments];
|
||||
};
|
||||
BundleTask.prototype.environments = function()
|
||||
{
|
||||
return this._environments;
|
||||
};
|
||||
BundleTask.prototype.setAuthor = function(anAuthor)
|
||||
{
|
||||
this._author = anAuthor;
|
||||
};
|
||||
BundleTask.prototype.author = function()
|
||||
{
|
||||
return this._author;
|
||||
};
|
||||
BundleTask.prototype.setEmail = function(anEmail)
|
||||
{
|
||||
this._email = anEmail;
|
||||
};
|
||||
BundleTask.prototype.email = function()
|
||||
{
|
||||
return this._email;
|
||||
};
|
||||
BundleTask.prototype.setSummary = function(aSummary)
|
||||
{
|
||||
this._summary = aSummary;
|
||||
};
|
||||
BundleTask.prototype.summary = function()
|
||||
{
|
||||
return this._summary;
|
||||
};
|
||||
BundleTask.prototype.setIdentifier = function(anIdentifier)
|
||||
{
|
||||
this._identifier = anIdentifier;
|
||||
};
|
||||
BundleTask.prototype.identifier = function()
|
||||
{
|
||||
return this._identifier;
|
||||
};
|
||||
BundleTask.prototype.setVersion = function(aVersion)
|
||||
{
|
||||
this._version = aVersion;
|
||||
};
|
||||
BundleTask.prototype.version = function()
|
||||
{
|
||||
return this._version;
|
||||
};
|
||||
BundleTask.prototype.setSources = function(sources, environments)
|
||||
{
|
||||
if (!environments)
|
||||
this._sources = sources;
|
||||
else
|
||||
{
|
||||
if (!this._sources)
|
||||
this._sources = {};
|
||||
if (!Array.isArray(environments))
|
||||
environments = [environments];
|
||||
environments.forEach( function(anEnvironment)
|
||||
{
|
||||
this._sources[anEnvironment] = sources;
|
||||
}, this);
|
||||
}};
|
||||
BundleTask.prototype.sources = function()
|
||||
{
|
||||
return this._sources;
|
||||
};
|
||||
BundleTask.prototype.setResources = function(resources)
|
||||
{
|
||||
this._resources = resources;
|
||||
};
|
||||
BundleTask.prototype.resources = function(resources)
|
||||
{
|
||||
this._resources = resources;
|
||||
};
|
||||
BundleTask.prototype.setSpritesResources = function(shouldSpriteResources)
|
||||
{
|
||||
this._spritesResources = shouldSpriteResources;
|
||||
};
|
||||
BundleTask.prototype.spritesResources = function()
|
||||
{
|
||||
return this._spritesResources;
|
||||
};
|
||||
BundleTask.prototype.setIncludesNibsAndXibs = function(shouldIncludeNibsAndXibs)
|
||||
{
|
||||
this._includesNibsAndXibs = shouldIncludeNibsAndXibs;
|
||||
};
|
||||
BundleTask.prototype.includesNibsAndXibs = function()
|
||||
{
|
||||
return this._includesNibsAndXibs;
|
||||
};
|
||||
BundleTask.prototype.setPreventsNib2Cib = function(shouldPreventNib2Cib)
|
||||
{
|
||||
this._preventsNib2Cib = shouldPreventNib2Cib;
|
||||
};
|
||||
BundleTask.prototype.preventsNib2Cib = function()
|
||||
{
|
||||
return this._preventsNib2Cib;
|
||||
};
|
||||
BundleTask.prototype.setProductName = function(aProductName)
|
||||
{
|
||||
this._productName = aProductName;
|
||||
};
|
||||
BundleTask.prototype.productName = function()
|
||||
{
|
||||
return this._productName;
|
||||
};
|
||||
BundleTask.prototype.setInfoPlistPath = function(anInfoPlistPath)
|
||||
{
|
||||
this._infoPlistPath = anInfoPlistPath;
|
||||
};
|
||||
BundleTask.prototype.infoPlistPath = function()
|
||||
{
|
||||
return this._infoPlistPath;
|
||||
};
|
||||
BundleTask.prototype.setPrincipalClass = function(aPrincipalClass)
|
||||
{
|
||||
this._principalClass = aPrincipalClass;
|
||||
};
|
||||
BundleTask.prototype.principalClass = function()
|
||||
{
|
||||
return this._principalClass;
|
||||
};
|
||||
BundleTask.prototype.setCompilerFlags = function(flags)
|
||||
{
|
||||
this._compilerFlags = flags;
|
||||
};
|
||||
BundleTask.prototype.compilerFlags = function()
|
||||
{
|
||||
return this._compilerFlags;
|
||||
};
|
||||
BundleTask.prototype.setNib2cibFlags = function(flags)
|
||||
{
|
||||
this._nib2cibFlags = flags;
|
||||
};
|
||||
BundleTask.prototype.setNib2CibFlags = BundleTask.prototype.setNib2cibFlags;
|
||||
BundleTask.prototype.nib2cibFlags = function()
|
||||
{
|
||||
return this._nib2cibFlags;
|
||||
};
|
||||
BundleTask.prototype.flattensSources = function()
|
||||
{
|
||||
return this._flattensSources;
|
||||
};
|
||||
BundleTask.prototype.setFlattensSources = function(shouldFlattenSources)
|
||||
{
|
||||
this._flattensSources = shouldFlattenSources;
|
||||
};
|
||||
BundleTask.prototype.setLicense = function(aLicense)
|
||||
{
|
||||
this._license = aLicense;
|
||||
};
|
||||
BundleTask.prototype.license = function()
|
||||
{
|
||||
return this._license;
|
||||
};
|
||||
(BundleTask.prototype.setBuildPath = function(aBuildPath)
|
||||
{
|
||||
this._buildPath = aBuildPath;
|
||||
}, BundleTask.prototype.buildPath = function()
|
||||
{
|
||||
return this._buildPath;
|
||||
});
|
||||
BundleTask.prototype.setBuildIntermediatesPath = function(aBuildPath)
|
||||
{
|
||||
this._buildIntermediatesPath = aBuildPath;
|
||||
};
|
||||
BundleTask.prototype.buildIntermediatesPath = function()
|
||||
{
|
||||
return this._buildIntermediatesPath || this.buildPath();
|
||||
};
|
||||
BundleTask.prototype.buildProductPath = function()
|
||||
{
|
||||
return path.join(this.buildPath(), this.productName());
|
||||
};
|
||||
BundleTask.prototype.buildIntermediatesProductPath = function()
|
||||
{
|
||||
return this.buildIntermediatesPath() || path.join(this.buildPath(), this.productName() + ".build");
|
||||
};
|
||||
BundleTask.prototype.buildProductStaticPathForEnvironment = function(anEnvironment)
|
||||
{
|
||||
return path.join(this.buildProductPath(), anEnvironment.name() + ".environment", this.productName() + ".sj");
|
||||
};
|
||||
BundleTask.prototype.buildProductMHTMLPathForEnvironment = function(anEnvironment)
|
||||
{
|
||||
return path.join(this.buildProductPath(), anEnvironment.name() + ".environment", "MHTMLPaths.txt");
|
||||
};
|
||||
BundleTask.prototype.buildProductMHTMLDataPathForEnvironment = function(anEnvironment)
|
||||
{
|
||||
return path.join(this.buildProductPath(), anEnvironment.name() + ".environment", "MHTMLData.txt");
|
||||
};
|
||||
BundleTask.prototype.buildProductMHTMLTestPathForEnvironment = function(anEnvironment)
|
||||
{
|
||||
return path.join(this.buildProductPath(), anEnvironment.name() + ".environment", "MHTMLTest.txt");
|
||||
};
|
||||
BundleTask.prototype.buildProductDataURLPathForEnvironment = function(anEnvironment)
|
||||
{
|
||||
return path.join(this.buildProductPath(), anEnvironment.name() + ".environment", "dataURLs.txt");
|
||||
};
|
||||
BundleTask.prototype.defineTasks = function()
|
||||
{
|
||||
this.defineResourceTasks();
|
||||
this.defineSourceTasks();
|
||||
this.defineInfoPlistTask();
|
||||
this.defineLicenseTask();
|
||||
this.defineStaticTask();
|
||||
this.defineSpritedImagesTask();
|
||||
CLEAN.include(this.buildIntermediatesProductPath());
|
||||
CLOBBER.include(this.buildProductPath());
|
||||
};
|
||||
BundleTask.prototype.packageType = function()
|
||||
{
|
||||
return 1;
|
||||
};
|
||||
BundleTask.prototype.infoPlist = function()
|
||||
{
|
||||
var infoPlistPath = this.infoPlistPath(),
|
||||
infoPlist;
|
||||
|
||||
if (infoPlistPath && fs.existsSync(infoPlistPath))
|
||||
infoPlist = CFPropertyList.propertyListFromString(fs.readFileSync(infoPlistPath, {encoding: "utf8"}));
|
||||
else
|
||||
infoPlist = new CFMutableDictionary();
|
||||
infoPlist.setValueForKey("CPBundleInfoDictionaryVersion", 6.0);
|
||||
infoPlist.setValueForKey("CPBundleName", this.productName());
|
||||
infoPlist.setValueForKey("CPBundleIdentifier", this.identifier());
|
||||
infoPlist.setValueForKey("CPBundleVersion", this.version());
|
||||
infoPlist.setValueForKey("CPBundlePackageType", this.packageType());
|
||||
infoPlist.setValueForKey("CPBundleEnvironments", (this.environments()).map( function(anEnvironment)
|
||||
{
|
||||
return anEnvironment.name();
|
||||
}));
|
||||
infoPlist.setValueForKey("CPBundleExecutable", this.productName() + ".sj");
|
||||
var environmentsWithImageSprites = ((this.environments()).filter( function(anEnvironment)
|
||||
{
|
||||
return anEnvironment.spritesImages() && (((task(this.buildProductDataURLPathForEnvironment(anEnvironment))).prerequisites()).filter(isImage)).length > 0;
|
||||
}, this)).map(function(anEnvironment)
|
||||
{
|
||||
return anEnvironment.name();
|
||||
});
|
||||
infoPlist.setValueForKey("CPBundleEnvironmentsWithImageSprites", environmentsWithImageSprites);
|
||||
var principalClass = this.principalClass();
|
||||
if (principalClass)
|
||||
infoPlist.setValueForKey("CPPrincipalClass", principalClass);
|
||||
return infoPlist;
|
||||
};
|
||||
BundleTask.prototype.defineInfoPlistTask = function()
|
||||
{
|
||||
var infoPlistProductPath = path.join(this.buildProductPath(), "Info.plist"),
|
||||
bundleTask = this;
|
||||
filedir(infoPlistProductPath, function()
|
||||
{
|
||||
fs.writeFileSync(infoPlistProductPath, CFPropertyList.stringFromPropertyList(bundleTask.infoPlist(), CFPropertyList.Format280North_v1_0), { encoding: "utf8"});
|
||||
});
|
||||
var infoPlistPath = this.infoPlistPath();
|
||||
if (infoPlistPath && fs.existsSync(infoPlistPath))
|
||||
filedir(infoPlistProductPath, [infoPlistPath]);
|
||||
(this.environments()).forEach( function(anEnvironment)
|
||||
{
|
||||
if (!anEnvironment.spritesImages())
|
||||
return;
|
||||
filedir(infoPlistProductPath, this.buildProductStaticPathForEnvironment(anEnvironment));
|
||||
}, this);
|
||||
this.enhance([infoPlistProductPath]);
|
||||
};
|
||||
BundleTask.License = {LGPL_v2_1: "LGPL_v2_1", MIT: "MIT"};
|
||||
|
||||
var LICENSES_PATH = path.join(path.resolve(module.path), "LICENSES"),
|
||||
LICENSE_PATHS = {"LGPL_v2_1": path.join(LICENSES_PATH, "LGPL-v2.1"), "MIT": path.join(LICENSES_PATH, "MIT")};
|
||||
BundleTask.prototype.defineLicenseTask = function()
|
||||
{
|
||||
var license = this.license();
|
||||
if (!license)
|
||||
return;
|
||||
var licensePath = LICENSE_PATHS[license];
|
||||
licenseProductPath = path.join(this.buildProductPath(), "LICENSE");
|
||||
filedir(licenseProductPath, [licensePath], function()
|
||||
{
|
||||
fs.copyFileSync(licensePath, licenseProductPath);
|
||||
});
|
||||
this.enhance([licenseProductPath]);
|
||||
};
|
||||
BundleTask.prototype.resourcesPath = function()
|
||||
{
|
||||
return path.join(this.buildProductPath(), "Resources", "");
|
||||
};
|
||||
BundleTask.isSpritable = function(aResourcePath) {
|
||||
return isImage(aResourcePath) && fs.lstatSync(aResourcePath).size < 32768 && ("data:" + mimeType(aResourcePath) + ";base64," + Buffer.from(fs.readFileSync(aResourcePath)).toString("base64")).length < 32768;
|
||||
};
|
||||
BundleTask.prototype.defineResourceTask = function(aResourcePath, aDestinationPath)
|
||||
{
|
||||
if (this.spritesResources() && BundleTask.isSpritable(aResourcePath))
|
||||
{
|
||||
(this.environments()).forEach( function(anEnvironment)
|
||||
{
|
||||
if (!anEnvironment.spritesImages())
|
||||
return;
|
||||
var folder = anEnvironment.name() + ".environment",
|
||||
spritedDestinationPath = path.join(this.buildIntermediatesProductPath(), folder, "Resources", path.relative(this.resourcesPath(), aDestinationPath));
|
||||
filedir(spritedDestinationPath, function()
|
||||
{
|
||||
fs.writeFileSync(spritedDestinationPath, Buffer.from(fs.readFileSync(aResourcePath)).toString("base64"), { encoding: "utf8" });
|
||||
});
|
||||
filedir(this.buildProductDataURLPathForEnvironment(anEnvironment), [spritedDestinationPath]);
|
||||
filedir(this.buildProductMHTMLPathForEnvironment(anEnvironment), [spritedDestinationPath]);
|
||||
filedir(this.buildProductMHTMLDataPathForEnvironment(anEnvironment), [spritedDestinationPath]);
|
||||
filedir(this.buildProductMHTMLTestPathForEnvironment(anEnvironment), [spritedDestinationPath]);
|
||||
}, this);
|
||||
} var extension = path.extname(aResourcePath),
|
||||
extensionless = aResourcePath.substr(0, aResourcePath.length - extension.length);
|
||||
if ((extension !== ".cib" || !fs.existsSync(extensionless + ".xib") && !fs.existsSync(extensionless + ".nib") || this._preventsNib2Cib) && (extension !== ".xib" && extension !== ".nib" || this.includesNibsAndXibs()))
|
||||
{
|
||||
filedir(aDestinationPath, [aResourcePath], function()
|
||||
{
|
||||
if (fs.existsSync(aDestinationPath))
|
||||
try {
|
||||
fs.rmSync(aDestinationPath, { recursive: true });
|
||||
}
|
||||
catch(anException) {
|
||||
}
|
||||
if (fs.lstatSync(aResourcePath).isDirectory())
|
||||
utilsFile.copyRecursiveSync(aResourcePath, aDestinationPath);
|
||||
else
|
||||
fs.copyFileSync(aResourcePath, aDestinationPath);
|
||||
});
|
||||
this.enhance([aDestinationPath]);
|
||||
} if ((extension === ".xib" || extension === ".nib") && !this._preventsNib2Cib)
|
||||
{
|
||||
var cibDestinationPath = path.join(path.dirname(aDestinationPath), path.basename(aDestinationPath, extension)) + ".cib";
|
||||
var nib2cibFlags = this.nib2cibFlags();
|
||||
if (!nib2cibFlags)
|
||||
nib2cibFlags = "";
|
||||
else if (nib2cibFlags.join)
|
||||
nib2cibFlags = nib2cibFlags.join(" ");
|
||||
filedir(cibDestinationPath, [aResourcePath], function()
|
||||
{
|
||||
try {
|
||||
child_process.execSync("nib2cib '" + aResourcePath + "' '" + cibDestinationPath + "' " + nib2cibFlags, {stdio: 'inherit'});
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
console.log(error.output.toString());
|
||||
}
|
||||
|
||||
});
|
||||
this.enhance([cibDestinationPath]);
|
||||
}};
|
||||
function directoryInCommon(filenames)
|
||||
{
|
||||
var aCommonDirectory = null;
|
||||
filenames.forEach( function(aFilename)
|
||||
{
|
||||
var directory = path.dirname(aFilename);
|
||||
if (directory === ".")
|
||||
directory = "";
|
||||
if (aCommonDirectory === null)
|
||||
aCommonDirectory = directory;
|
||||
else
|
||||
{
|
||||
var index = 0,
|
||||
count = Math.min(directory.length, aFilename.length);
|
||||
for (; index < count && aCommonDirectory.charAt(index) === directory.charAt(index); ++index);
|
||||
aCommonDirectory = directory.substr(0, index);
|
||||
} });
|
||||
return aCommonDirectory;
|
||||
}
|
||||
BundleTask.prototype.defineResourceTasks = function()
|
||||
{
|
||||
if (!this._resources)
|
||||
return;
|
||||
var resources = [],
|
||||
basePath = null;
|
||||
this._resources.forEach( function(aResourcePath)
|
||||
{
|
||||
if (fs.existsSync(aResourcePath) && fs.lstatSync(aResourcePath).isDirectory())
|
||||
{
|
||||
resources = resources.concat(aResourcePath, (new FileList(aResourcePath + "/**")).toArray());
|
||||
} else
|
||||
resources.push(aResourcePath);
|
||||
});
|
||||
// TODO: assuming it returns the array without duplicates
|
||||
// resources = UTIL.unique(resources);
|
||||
resources = [... new Set(resources)];
|
||||
if (resources.length <= 0)
|
||||
return;
|
||||
var basePathLength = (directoryInCommon(resources)).length,
|
||||
resourcesPath = this.resourcesPath();
|
||||
resources.forEach( function(aResourcePath)
|
||||
{
|
||||
this.defineResourceTask(aResourcePath, path.join(resourcesPath, aResourcePath.substring(basePathLength)));
|
||||
}, this);
|
||||
};
|
||||
var RESOURCES_PATH = path.join(path.resolve(path.dirname(module.path)), "Jake/RESOURCES"),
|
||||
MHTMLTestPath = path.join(RESOURCES_PATH, "MHTMLTest.txt");
|
||||
BundleTask.prototype.defineSpritedImagesTask = function()
|
||||
{
|
||||
(this.environments()).forEach( function(anEnvironment)
|
||||
{
|
||||
if (!anEnvironment.spritesImages())
|
||||
return;
|
||||
var folder = anEnvironment.name() + ".environment",
|
||||
resourcesPath = path.join(this.buildIntermediatesProductPath(), folder, "Resources", "");
|
||||
var productName = this.productName(),
|
||||
dataURLPath = this.buildProductDataURLPathForEnvironment(anEnvironment);
|
||||
filedir(dataURLPath, function(aTask){
|
||||
var prerequisites = (aTask.prerequisites()).filter(isImage);
|
||||
if (!prerequisites.length)
|
||||
{
|
||||
if (fs.existsSync(dataURLPath))
|
||||
fs.removeSync(dataURLPath);
|
||||
return;
|
||||
}
|
||||
term.stream.print("Creating data URLs file... \0green(" + dataURLPath + "\0)");
|
||||
var dataURLStream = fs.openSync(dataURLPath, "w+");
|
||||
fs.writeSync(dataURLStream, "@STATIC;1.0;");
|
||||
|
||||
prerequisites.forEach(function(aFilename)
|
||||
{
|
||||
var resourcePath = "Resources/" + path.relative(resourcesPath, aFilename);
|
||||
fs.writeFileSync(dataURLStream, "u;" + resourcePath.length + ";" + resourcePath, {encoding: "utf8"});
|
||||
var contents = "data:" + mimeType(aFilename) + ";base64," + fs.readFileSync(aFilename).toString("utf8");
|
||||
fs.writeFileSync(dataURLStream, contents.length + ";" + contents, { encoding: "utf8" });
|
||||
});
|
||||
|
||||
fs.writeFileSync(dataURLStream, "e;", { encoding: "utf8"});
|
||||
fs.closeSync(dataURLStream);
|
||||
});
|
||||
this.enhance([dataURLPath]);
|
||||
var MHTMLPath = this.buildProductMHTMLPathForEnvironment(anEnvironment);
|
||||
filedir(MHTMLPath, function(aTask)
|
||||
{
|
||||
var prerequisites = (aTask.prerequisites()).filter(isImage);
|
||||
if (!prerequisites.length)
|
||||
{
|
||||
if (fs.existsSync(MHTMLPath))
|
||||
fs.rmSync(MHTMLPath);
|
||||
return;
|
||||
}
|
||||
term.stream.print("Creating MHTML paths file... \0green(" + MHTMLPath + "\0)");
|
||||
var MHTMLStream = fs.openSync(MHTMLPath, "w+");
|
||||
fs.writeSync(MHTMLStream, "@STATIC;1.0;");
|
||||
|
||||
prerequisites.forEach( function(aFilename)
|
||||
{
|
||||
var resourcePath = "Resources/" + path.relative(resourcesPath, aFilename),
|
||||
MHTMLResourcePath = "mhtml:" + path.join(folder, "MHTMLData.txt!") + resourcePath;
|
||||
|
||||
fs.writeSync(MHTMLStream, "u;" + resourcePath.length + ";" + resourcePath);
|
||||
fs.writeSync(MHTMLStream, MHTMLResourcePath.length + ";" + MHTMLResourcePath);
|
||||
});
|
||||
fs.closeSync(MHTMLStream);
|
||||
});
|
||||
this.enhance([MHTMLPath]);
|
||||
var MHTMLDataPath = this.buildProductMHTMLDataPathForEnvironment(anEnvironment);
|
||||
filedir(MHTMLDataPath, function(aTask)
|
||||
{
|
||||
var prerequisites = (aTask.prerequisites()).filter(isImage);
|
||||
if (!prerequisites.length)
|
||||
{
|
||||
if (fs.existsSync(MHTMLDataPath))
|
||||
fs.rmSync(MHTMLDataPath);
|
||||
return;
|
||||
}
|
||||
term.stream.print("Creating MHTML images file... \0green(" + MHTMLDataPath + "\0)");
|
||||
var MHTMLDataStream = fs.openSync(MHTMLDataPath, "w+");
|
||||
fs.writeSync(MHTMLDataStream, "/*\r\nContent-Type: multipart/related; boundary=\"_ANY_STRING_WILL_DO_AS_A_SEPARATOR\"\r\n\r\n");
|
||||
prerequisites.forEach( function(aFilename)
|
||||
{
|
||||
var resourcePath = "Resources/" + path.relative(resourcesPath, aFilename);
|
||||
fs.writeSync(MHTMLDataStream, "--_ANY_STRING_WILL_DO_AS_A_SEPARATOR\r\n");
|
||||
fs.writeSync(MHTMLDataStream, "Content-Location:" + resourcePath + "\r\nContent-Transfer-Encoding:base64\r\n\r\n");
|
||||
fs.writeSync(MHTMLDataStream, fs.readFileSync(aFilename).toString("utf8"));
|
||||
fs.writeSync(MHTMLDataStream, "\r\n");
|
||||
/* MHTMLDataStream.write("--_ANY_STRING_WILL_DO_AS_A_SEPARATOR\r\n");
|
||||
MHTMLDataStream.write("Content-Location:" + resourcePath + "\r\nContent-Transfer-Encoding:base64\r\n\r\n");
|
||||
MHTMLDataStream.write(fs.readFileSync(aFilename).toString("utf8"));
|
||||
MHTMLDataStream.write("\r\n"); */
|
||||
});
|
||||
fs.writeSync(MHTMLDataStream, "*/");
|
||||
fs.closeSync(MHTMLDataStream);
|
||||
});
|
||||
this.enhance([MHTMLDataPath]);
|
||||
var MHTMLTestDestinationPath = this.buildProductMHTMLTestPathForEnvironment(anEnvironment);
|
||||
filedir(MHTMLTestDestinationPath, function(aTask)
|
||||
{
|
||||
term.stream.print("Copying MHTML test file... \0green(" + MHTMLTestDestinationPath + "\0)");
|
||||
fs.copyFileSync(MHTMLTestPath, MHTMLTestDestinationPath);
|
||||
});
|
||||
this.enhance([MHTMLTestDestinationPath]);
|
||||
}, this);
|
||||
};
|
||||
BundleTask.prototype.defineStaticTask = function()
|
||||
{
|
||||
(this.environments()).forEach( function(anEnvironment)
|
||||
{
|
||||
var folder = anEnvironment.name() + ".environment",
|
||||
sourcesPath = path.join(this.buildIntermediatesProductPath(), folder, "Sources", ""),
|
||||
resourcesPath = path.join(this.buildIntermediatesProductPath(), folder, "Resources", ""),
|
||||
staticPath = this.buildProductStaticPathForEnvironment(anEnvironment),
|
||||
flattensSources = this.flattensSources(),
|
||||
productName = this.productName();
|
||||
filedir(staticPath, function(aTask)
|
||||
{
|
||||
term.stream.print("Creating static file... \0green(" + staticPath + "\0)");
|
||||
var fileStream = fs.openSync(staticPath, "w+");
|
||||
fs.writeSync(fileStream, "@STATIC;1.0;");
|
||||
(aTask.prerequisites()).forEach( function(aFilename)
|
||||
{
|
||||
if (!fs.lstatSync(aFilename).isFile())
|
||||
return;
|
||||
var dirname = path.dirname(aFilename);
|
||||
if (aFilename.indexOf(sourcesPath) === 0)
|
||||
{
|
||||
var relativePath = flattensSources ? path.basename(aFilename) : path.relative(sourcesPath, aFilename);
|
||||
fs.writeSync(fileStream, "p;" + relativePath.length + ";" + relativePath);
|
||||
var fileContents = fs.readFileSync(aFilename).toString("utf8");
|
||||
fs.writeSync(fileStream, "t;" + fileContents.length + ";" + fileContents);
|
||||
}
|
||||
else if (aFilename.indexOf(resourcesPath) === 0 && !isImage(aFilename))
|
||||
{
|
||||
var resourcePath = "Resources/" + path.relative(resourcesPath, aFilename);
|
||||
fs.writeFileSync(fileStream, "p;");
|
||||
//fileStream.write("p;");
|
||||
contents = fs.readFileSync(aFilename).toString("utf8");
|
||||
fs.writeFileSync(fileStream, resourcePath.length + ";" + resourcePath + contents);
|
||||
//fileStream.write(resourcePath.length + ";" + resourcePath + contents);
|
||||
}
|
||||
}, this);
|
||||
fs.writeFileSync(fileStream, "e;");
|
||||
fs.closeSync(fileStream);
|
||||
//fileStream.write("e;");
|
||||
//fileStream.close();
|
||||
ObjectiveJ.Executable.resetCachedFileExecutableSearchers();
|
||||
ObjectiveJ.StaticResource.resetRootResources();
|
||||
ObjectiveJ.FileExecutable.resetFileExecutables();
|
||||
objj_resetRegisterClasses();
|
||||
});
|
||||
this.enhance([staticPath]);
|
||||
}, this);
|
||||
};
|
||||
BundleTask.prototype.defineSourceTasks = function()
|
||||
{
|
||||
var sources = this.sources();
|
||||
if (!sources) {
|
||||
return;
|
||||
}
|
||||
var compilerFlags = this.compilerFlags();
|
||||
var flattensSources = this.flattensSources();
|
||||
|
||||
if (!compilerFlags)
|
||||
compilerFlags = "";
|
||||
else if (compilerFlags.join)
|
||||
compilerFlags = compilerFlags.join(" ");
|
||||
(this.environments()).forEach( function(anEnvironment)
|
||||
{
|
||||
var environmentSources = sources,
|
||||
folder = anEnvironment.name() + ".environment",
|
||||
sourcesPath = path.join(this.buildIntermediatesProductPath(), folder, "Sources", ""),
|
||||
staticPath = this.buildProductStaticPathForEnvironment(anEnvironment);
|
||||
if (!Array.isArray(environmentSources) && environmentSources.constructor !== FileList)
|
||||
{
|
||||
environmentSources = environmentSources[anEnvironment];
|
||||
if (!environmentSources)
|
||||
return;
|
||||
} var replacedFiles = [],
|
||||
environmentCompilerFlags = (anEnvironment.compilerFlags()).join(" ") + " " + compilerFlags,
|
||||
flattensSources = this.flattensSources(),
|
||||
basePath = directoryInCommon(environmentSources),
|
||||
basePathLength = basePath.length,
|
||||
translateFilenameToPath = {},
|
||||
otherwayTranslateFilenameToPath = {};
|
||||
environmentSources.forEach( function(aFilename)
|
||||
{
|
||||
translateFilenameToPath[flattensSources ? path.basename(aFilename) : aFilename] = aFilename;
|
||||
otherwayTranslateFilenameToPath[aFilename] = flattensSources ? path.basename(aFilename) : aFilename;
|
||||
}, this);
|
||||
var e = {};
|
||||
environmentSources.forEach( function(aFilename)
|
||||
{
|
||||
ObjectiveJ.Executable.resetCachedFileExecutableSearchers();
|
||||
ObjectiveJ.StaticResource.resetRootResources();
|
||||
ObjectiveJ.FileExecutable.resetFileExecutables();
|
||||
objj_resetRegisterClasses();
|
||||
if (!fs.existsSync(aFilename))
|
||||
return;
|
||||
var relativePath = aFilename.substring(basePathLength ? basePathLength + 1 : basePathLength),
|
||||
compiledEnvironmentSource = path.join(sourcesPath, relativePath);
|
||||
|
||||
filedir(compiledEnvironmentSource, [aFilename], async function()
|
||||
{
|
||||
if ((path.extname(aFilename)).toLowerCase() !== ".j")
|
||||
{
|
||||
(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 p;
|
||||
}
|
||||
else
|
||||
{
|
||||
var translatedFilename = translateFilenameToPath[aFilename] ? translateFilenameToPath[aFilename] : aFilename,
|
||||
otherwayTranslatedFilename = otherwayTranslateFilenameToPath[aFilename] ? otherwayTranslateFilenameToPath[aFilename] : aFilename,
|
||||
theTranslatedFilename = otherwayTranslatedFilename ? otherwayTranslatedFilename : translatedFilename,
|
||||
absolutePath = path.resolve(theTranslatedFilename),
|
||||
basePath = absolutePath.substring(0, absolutePath.length - theTranslatedFilename.length);
|
||||
ObjectiveJ.StaticResource.setCurrentGccCompilerFlags(environmentCompilerFlags);
|
||||
CFBundle.environments = function()
|
||||
{
|
||||
return [anEnvironment.name(), "ObjJ"];
|
||||
};
|
||||
return new Promise((resolve, reject) => {
|
||||
var callback = function() {
|
||||
var otherwayTranslatedFilename = otherwayTranslateFilenameToPath[aFilename] ? otherwayTranslateFilenameToPath[aFilename] : aFilename,
|
||||
translatedFilename = translateFilenameToPath[aFilename] ? translateFilenameToPath[aFilename] : aFilename,
|
||||
executer = new ObjectiveJ.FileExecutable(otherwayTranslatedFilename);
|
||||
var compiled = executer.toMarkedString();
|
||||
//var msg = "Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)";
|
||||
var dots = (Array(Math.round(compiled.length / 1024 / 4) + 3)).join(".");
|
||||
fs.writeFileSync(compiledEnvironmentSource, compiled, { encoding: "utf8"});
|
||||
term.stream.print(dots);
|
||||
resolve();
|
||||
}
|
||||
var msg = "Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)";
|
||||
term.stream.write(msg);
|
||||
ObjectiveJ.make_narwhal_factory(absolutePath, basePath, translateFilenameToPath, callback)(require, e, module, {}, console.log);
|
||||
});
|
||||
}
|
||||
});
|
||||
filedir(staticPath, [compiledEnvironmentSource]);
|
||||
replacedFiles.push(flattensSources ? path.basename(aFilename) : relativePath);
|
||||
}, this);
|
||||
this._replacedFiles[anEnvironment] = replacedFiles;
|
||||
}, this);
|
||||
};
|
||||
exports.BundleTask = BundleTask;
|
||||
exports.bundle = function(aName, aFunction)
|
||||
{
|
||||
return BundleTask.defineTask(aName, aFunction);
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Objective-J.js
|
||||
* Objective-J
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* Copyright 2008-2010, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
var environments = {};
|
||||
function Environment(aName)
|
||||
{
|
||||
this._name = aName;
|
||||
this._compilerFlags = [];
|
||||
this._spritesImages = false;
|
||||
environments[aName] = this;
|
||||
}
|
||||
Environment.environmentWithName = function(aName)
|
||||
{
|
||||
return environments[aName];
|
||||
};
|
||||
Environment.prototype.name = function()
|
||||
{
|
||||
return this._name;
|
||||
};
|
||||
Environment.prototype.toString = function()
|
||||
{
|
||||
return this._name;
|
||||
};
|
||||
Environment.prototype.compilerFlags = function()
|
||||
{
|
||||
return this._compilerFlags;
|
||||
};
|
||||
Environment.prototype.setCompilerFlags = function(flags)
|
||||
{
|
||||
this._compilerFlags = flags;
|
||||
};
|
||||
Environment.prototype.setSpritesImages = function(shouldSpriteImages)
|
||||
{
|
||||
this._spritesImages = !!shouldSpriteImages;
|
||||
};
|
||||
Environment.prototype.spritesImages = function()
|
||||
{
|
||||
return this._spritesImages;
|
||||
};
|
||||
exports.Environment = Environment;
|
||||
exports.ObjJ = new Environment("ObjJ");
|
||||
var CommonJS = new Environment("CommonJS");
|
||||
CommonJS.setCompilerFlags(["-DPLATFORM_COMMONJS"]);
|
||||
exports.CommonJS = CommonJS;
|
||||
var Browser = new Environment("Browser");
|
||||
Browser.setCompilerFlags(["-DPLATFORM_BROWSER", "-DPLATFORM_DOM"]);
|
||||
Browser.setSpritesImages(true);
|
||||
exports.Browser = Browser;
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Objective-J.js
|
||||
* Objective-J
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* Copyright 2008-2010, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
BundleTask = (require("./bundletask")).BundleTask;
|
||||
function FrameworkTask(aName)
|
||||
{
|
||||
BundleTask.apply(this, arguments);
|
||||
}
|
||||
FrameworkTask.__proto__ = BundleTask;
|
||||
FrameworkTask.prototype.__proto__ = BundleTask.prototype;
|
||||
FrameworkTask.prototype.packageType = function()
|
||||
{
|
||||
return "FMWK";
|
||||
};
|
||||
exports.FrameworkTask = FrameworkTask;
|
||||
exports.framework = function(aName, aFunction)
|
||||
{
|
||||
return FrameworkTask.defineTask(aName, aFunction);
|
||||
};
|
||||
@@ -1,15 +1,19 @@
|
||||
|
||||
require("./common.jake");
|
||||
|
||||
var FILE = require("file"),
|
||||
SYSTEM = require("system"),
|
||||
OS = require("os"),
|
||||
UTIL = require("narwhal/util"),
|
||||
jake = require("jake"),
|
||||
stream = require("narwhal/term").stream;
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var childProcess = require("child_process");
|
||||
|
||||
const term = ObjectiveJ.term;
|
||||
const utilsFile = ObjectiveJ.utils.file;
|
||||
|
||||
var subprojects = ["Objective-J", "CommonJS", "Foundation", "AppKit", "Tools"];
|
||||
|
||||
task ("build", function() {
|
||||
childProcess.execSync(["mkdir", "-p", $BUILD_DIR].map(utilsFile.enquote).join(" "), {stdio: 'inherit'});
|
||||
childProcess.execSync(['ln', '-sf', '"$PWD"/node_modules', utilsFile.enquote($BUILD_DIR)].join(" "), {stdio: 'inherit'});
|
||||
});
|
||||
|
||||
["build", "clean", "clobber"].forEach(function(aTaskName)
|
||||
{
|
||||
task (aTaskName, function()
|
||||
@@ -18,41 +22,56 @@ var subprojects = ["Objective-J", "CommonJS", "Foundation", "AppKit", "Tools"];
|
||||
});
|
||||
});
|
||||
|
||||
$BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS = FILE.join($BUILD_CJS_OBJECTIVE_J, "Frameworks", "Debug");
|
||||
|
||||
$BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS = path.join($BUILD_CJS_OBJECTIVE_J, "Frameworks", "Debug");
|
||||
|
||||
filedir ($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, ["debug", "release"], function()
|
||||
{
|
||||
FILE.mkdirs($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS);
|
||||
fs.mkdirSync($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, { recursive: true });
|
||||
|
||||
cp_r(FILE.join($BUILD_DIR, "Debug", "Objective-J"), FILE.join($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, "Objective-J"));
|
||||
utilsFile.cp_r(path.join($BUILD_DIR, "Debug", "Objective-J"), path.join($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, "Objective-J"));
|
||||
});
|
||||
|
||||
$BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS = FILE.join($BUILD_CJS_CAPPUCCINO, "Frameworks", "Debug");
|
||||
$BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS = path.join($BUILD_CJS_CAPPUCCINO, "Frameworks", "Debug");
|
||||
|
||||
filedir ($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, ["debug", "release"], function()
|
||||
{
|
||||
FILE.mkdirs($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS);
|
||||
fs.mkdirSync($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, { recursive: true });
|
||||
|
||||
cp_r(FILE.join($BUILD_DIR, "Debug", "Foundation"), FILE.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "Foundation"));
|
||||
cp_r(FILE.join($BUILD_DIR, "Debug", "AppKit"), FILE.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "AppKit"));
|
||||
cp_r(FILE.join($BUILD_DIR, "Debug", "BlendKit"), FILE.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "BlendKit"));
|
||||
utilsFile.cp_r(path.join($BUILD_DIR, "Debug", "Foundation"), path.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "Foundation"));
|
||||
utilsFile.cp_r(path.join($BUILD_DIR, "Debug", "AppKit"), path.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "AppKit"));
|
||||
utilsFile.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() {
|
||||
});
|
||||
|
||||
task ("install", ["CommonJS"], function()
|
||||
// Install everything in the dist directory
|
||||
task ("dist", ["CommonJS"], function()
|
||||
{
|
||||
installCopy($BUILD_CJS_OBJECTIVE_J, false);
|
||||
installCopy($BUILD_CJS_CAPPUCCINO, false);
|
||||
});
|
||||
|
||||
task ("sudo-install", ["CommonJS"], function()
|
||||
task ("sudo-dist", ["CommonJS"], function()
|
||||
{
|
||||
installCopy($BUILD_CJS_OBJECTIVE_J, true);
|
||||
installCopy($BUILD_CJS_CAPPUCCINO, true);
|
||||
});
|
||||
|
||||
// Install everything in the dist directory (task dist) and
|
||||
// create symlinks to the 'dist' binaries in the global 'npm prefix' path
|
||||
task ("install", ["dist"], function()
|
||||
{
|
||||
installGlobal($BUILD_CJS_OBJECTIVE_J, false);
|
||||
installGlobal($BUILD_CJS_CAPPUCCINO, false);
|
||||
});
|
||||
|
||||
task ("sudo-install", ["sudo-dist"], function()
|
||||
{
|
||||
installGlobal($BUILD_CJS_OBJECTIVE_J, true);
|
||||
installGlobal($BUILD_CJS_CAPPUCCINO, true);
|
||||
});
|
||||
|
||||
task ("install-symlinks", function()
|
||||
{
|
||||
installSymlink($BUILD_CJS_OBJECTIVE_J);
|
||||
@@ -67,35 +86,35 @@ task ("install-debug-symlinks", function()
|
||||
|
||||
task ("clean-sprites", function()
|
||||
{
|
||||
var f = new FileList(FILE.join(SYSTEM.env.CAPP_BUILD, "**/dataURLs.txt")),
|
||||
var f = new FileList(path.join(SYSTEM.env.CAPP_BUILD, "**/dataURLs.txt")),
|
||||
paths = f.items();
|
||||
|
||||
f = new FileList(FILE.join(SYSTEM.env.CAPP_BUILD, "**/MHTML*.txt"));
|
||||
f = new FileList(path.join(SYSTEM.env.CAPP_BUILD, "**/MHTML*.txt"));
|
||||
paths = paths.concat(f.items());
|
||||
|
||||
paths.forEach(function(path)
|
||||
{
|
||||
FILE.remove(path);
|
||||
fs.rmSync(path);
|
||||
});
|
||||
});
|
||||
|
||||
task ("clobber-theme", function()
|
||||
{
|
||||
var f = new FileList(FILE.join(SYSTEM.env.CAPP_BUILD, "**/Aristo.blend"), FILE.join(SYSTEM.env.CAPP_BUILD, "**/Aristo2.blend")),
|
||||
var f = new FileList(path.join(SYSTEM.env.CAPP_BUILD, "**/Aristo.blend"), path.join(SYSTEM.env.CAPP_BUILD, "**/Aristo2.blend")),
|
||||
paths = f.items();
|
||||
|
||||
f = new FileList(FILE.join(SYSTEM.env.CAPP_BUILD, "Aristo.build"), FILE.join(SYSTEM.env.CAPP_BUILD, "Aristo2.build"));
|
||||
f = new FileList(path.join(SYSTEM.env.CAPP_BUILD, "Aristo.build"), path.join(SYSTEM.env.CAPP_BUILD, "Aristo2.build"));
|
||||
paths = paths.concat(f.items());
|
||||
|
||||
paths.forEach(function(path)
|
||||
{
|
||||
rm_rf(path);
|
||||
utilsFile.rm_rf(path);
|
||||
});
|
||||
});
|
||||
|
||||
// Documentation
|
||||
|
||||
$DOCUMENTATION_BUILD = FILE.join($BUILD_DIR, "Documentation");
|
||||
$DOCUMENTATION_BUILD = path.join($BUILD_DIR, "Documentation");
|
||||
|
||||
task ("docs", ["documentation"]);
|
||||
|
||||
@@ -114,12 +133,13 @@ task ("documentation-no-frame", function()
|
||||
task ("docset", function()
|
||||
{
|
||||
generateDocs(true);
|
||||
var documentationDir = FILE.canonical(FILE.join("Tools", "Documentation")),
|
||||
docsetShell = FILE.join(documentationDir, "support", "docset.sh");
|
||||
var documentationDir = path.resolve(path.join("Tools", "Documentation")),
|
||||
docsetShell = path.join(documentationDir, "support", "docset.sh");
|
||||
|
||||
|
||||
|
||||
OS.system([docsetShell, documentationDir]);
|
||||
});
|
||||
|
||||
function generateDocs(/* boolean */ noFrame)
|
||||
{
|
||||
// try to find a doxygen executable in the PATH;
|
||||
@@ -135,7 +155,7 @@ function generateDocs(/* boolean */ noFrame)
|
||||
{
|
||||
var doxygenApps = p.stdout.read().split("\n");
|
||||
if (doxygenApps[0])
|
||||
doxygen = FILE.join(doxygenApps[0], "Contents/Resources/doxygen");
|
||||
doxygen = path.join(doxygenApps[0], "Contents/Resources/doxygen");
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -155,8 +175,8 @@ function generateDocs(/* boolean */ noFrame)
|
||||
colorPrint("Using " + doxygen + " for doxygen binary.", "green");
|
||||
colorPrint("Pre-processing source files...", "green");
|
||||
|
||||
var documentationDir = FILE.canonical(FILE.join("Tools", "Documentation")),
|
||||
processors = FILE.glob(FILE.join(documentationDir, "preprocess/*"));
|
||||
var documentationDir = FILE.canonical(path.join("Tools", "Documentation")),
|
||||
processors = FILE.glob(path.join(documentationDir, "preprocess/*"));
|
||||
|
||||
for (var i = 0; i < processors.length; ++i)
|
||||
if (OS.system([processors[i], documentationDir]))
|
||||
@@ -165,26 +185,26 @@ function generateDocs(/* boolean */ noFrame)
|
||||
if (noFrame)
|
||||
{
|
||||
// Back up the default settings, turn off the treeview
|
||||
if (OS.system(["sed", "-i", ".bak", "s/GENERATE_TREEVIEW.*=.*YES/GENERATE_TREEVIEW = NO/", FILE.join(documentationDir, "Cappuccino.doxygen")]))
|
||||
if (OS.system(["sed", "-i", ".bak", "s/GENERATE_TREEVIEW.*=.*YES/GENERATE_TREEVIEW = NO/", path.join(documentationDir, "Cappuccino.doxygen")]))
|
||||
return;
|
||||
}
|
||||
else if (FILE.exists(FILE.join(documentationDir, "Cappuccino.doxygen.bak")))
|
||||
mv(FILE.join(documentationDir, "Cappuccino.doxygen.bak"), FILE.join(documentationDir, "Cappuccino.doxygen"));
|
||||
else if (FILE.exists(path.join(documentationDir, "Cappuccino.doxygen.bak")))
|
||||
utilsFile.mv(path.join(documentationDir, "Cappuccino.doxygen.bak"), path.join(documentationDir, "Cappuccino.doxygen"));
|
||||
|
||||
var doxygenDidSucceed = !OS.system([doxygen, FILE.join(documentationDir, "Cappuccino.doxygen")]);
|
||||
var doxygenDidSucceed = !OS.system([doxygen, path.join(documentationDir, "Cappuccino.doxygen")]);
|
||||
|
||||
// Restore the original doxygen settings
|
||||
if (FILE.exists(FILE.join(documentationDir, "Cappuccino.doxygen.bak")))
|
||||
mv(FILE.join(documentationDir, "Cappuccino.doxygen.bak"), FILE.join(documentationDir, "Cappuccino.doxygen"));
|
||||
if (FILE.exists(path.join(documentationDir, "Cappuccino.doxygen.bak")))
|
||||
utilsFile.mv(path.join(documentationDir, "Cappuccino.doxygen.bak"), path.join(documentationDir, "Cappuccino.doxygen"));
|
||||
|
||||
colorPrint("Post-processing generated documentation...", "green");
|
||||
|
||||
processors = FILE.glob(FILE.join(documentationDir, "postprocess/*"));
|
||||
processors = FILE.glob(path.join(documentationDir, "postprocess/*"));
|
||||
|
||||
for (var i = 0; i < processors.length; ++i)
|
||||
if (OS.system([processors[i], documentationDir, FILE.join("Documentation", "html")]))
|
||||
if (OS.system([processors[i], documentationDir, path.join("Documentation", "html")]))
|
||||
{
|
||||
rm_rf("Documentation");
|
||||
utilsFile.rm_rf("Documentation");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -193,13 +213,13 @@ function generateDocs(/* boolean */ noFrame)
|
||||
if (!FILE.isDirectory($BUILD_DIR))
|
||||
FILE.mkdirs($BUILD_DIR);
|
||||
|
||||
rm_rf($DOCUMENTATION_BUILD);
|
||||
mv("debug.txt", FILE.join("Documentation", "debug.txt"));
|
||||
mv("Documentation", $DOCUMENTATION_BUILD);
|
||||
utilsFile.rm_rf($DOCUMENTATION_BUILD);
|
||||
utilsFile.mv("debug.txt", path.join("Documentation", "debug.txt"));
|
||||
utilsFile.mv("Documentation", $DOCUMENTATION_BUILD);
|
||||
|
||||
// There is a bug in doxygen 1.7.x preventing loading correctly the custom CSS
|
||||
// So let's do it manually
|
||||
cp(FILE.join(documentationDir, "doxygen.css"), FILE.join($DOCUMENTATION_BUILD, "html", "doxygen.css"));
|
||||
utilsFile.cp(path.join(documentationDir, "doxygen.css"), path.join($DOCUMENTATION_BUILD, "html", "doxygen.css"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,25 +227,25 @@ function generateDocs(/* boolean */ noFrame)
|
||||
|
||||
task ("downloads", ["starter_download"]);
|
||||
|
||||
$STARTER_README = FILE.join('Tools', 'READMEs', 'STARTER-README');
|
||||
$STARTER_README = path.join('Tools', 'READMEs', 'STARTER-README');
|
||||
$STARTER_BOOTSTRAP = 'bootstrap.sh';
|
||||
$STARTER_DOWNLOAD = FILE.join($BUILD_DIR, 'Cappuccino', 'Starter');
|
||||
$STARTER_DOWNLOAD_APPLICATION = FILE.join($STARTER_DOWNLOAD, 'NewApplication');
|
||||
$STARTER_DOWNLOAD_README = FILE.join($STARTER_DOWNLOAD, 'README');
|
||||
$STARTER_DOWNLOAD_BOOTSTRAP = FILE.join($STARTER_DOWNLOAD, 'bootstrap.sh');
|
||||
$STARTER_DOWNLOAD = path.join($BUILD_DIR, 'Cappuccino', 'Starter');
|
||||
$STARTER_DOWNLOAD_APPLICATION = path.join($STARTER_DOWNLOAD, 'NewApplication');
|
||||
$STARTER_DOWNLOAD_README = path.join($STARTER_DOWNLOAD, 'README');
|
||||
$STARTER_DOWNLOAD_BOOTSTRAP = path.join($STARTER_DOWNLOAD, 'bootstrap.sh');
|
||||
|
||||
task ("starter_download", [$STARTER_DOWNLOAD_APPLICATION, $STARTER_DOWNLOAD_README, $STARTER_DOWNLOAD_BOOTSTRAP, "documentation"], function()
|
||||
{
|
||||
if (FILE.exists($DOCUMENTATION_BUILD))
|
||||
{
|
||||
rm_rf(FILE.join($STARTER_DOWNLOAD, 'Documentation'));
|
||||
cp_r(FILE.join($DOCUMENTATION_BUILD, 'html', '.'), FILE.join($STARTER_DOWNLOAD, 'Documentation'));
|
||||
utilsFile.rm_rf(path.join($STARTER_DOWNLOAD, 'Documentation'));
|
||||
utilsFile.cp_r(path.join($DOCUMENTATION_BUILD, 'html', '.'), path.join($STARTER_DOWNLOAD, 'Documentation'));
|
||||
}
|
||||
});
|
||||
|
||||
filedir ($STARTER_DOWNLOAD_APPLICATION, ["CommonJS"], function()
|
||||
{
|
||||
rm_rf($STARTER_DOWNLOAD_APPLICATION);
|
||||
utilsFile.rm_rf($STARTER_DOWNLOAD_APPLICATION);
|
||||
FILE.mkdirs($STARTER_DOWNLOAD);
|
||||
|
||||
if (OS.system(["capp", "gen", $STARTER_DOWNLOAD_APPLICATION, "-t", "Application", "--noconfig"]))
|
||||
@@ -238,7 +258,7 @@ filedir ($STARTER_DOWNLOAD_APPLICATION, ["CommonJS"], function()
|
||||
|
||||
filedir ($STARTER_DOWNLOAD_README, [$STARTER_README], function()
|
||||
{
|
||||
cp($STARTER_README, $STARTER_DOWNLOAD_README);
|
||||
utilsFile.cp($STARTER_README, $STARTER_DOWNLOAD_README);
|
||||
});
|
||||
|
||||
filedir ($STARTER_DOWNLOAD_BOOTSTRAP, [$STARTER_BOOTSTRAP], function()
|
||||
@@ -252,23 +272,23 @@ filedir ($STARTER_DOWNLOAD_BOOTSTRAP, [$STARTER_BOOTSTRAP], function()
|
||||
|
||||
task ("deploy", ["downloads", "demos"], function()
|
||||
{
|
||||
var cappuccino_output_path = FILE.join($BUILD_DIR, 'Cappuccino');
|
||||
var cappuccino_output_path = path.join($BUILD_DIR, 'Cappuccino');
|
||||
|
||||
// zip the starter pack
|
||||
var starter_zip_output = FILE.join($BUILD_DIR, 'Cappuccino', 'Starter.zip');
|
||||
rm_rf(starter_zip_output);
|
||||
var starter_zip_output = path.join($BUILD_DIR, 'Cappuccino', 'Starter.zip');
|
||||
utilsFile.rm_rf(starter_zip_output);
|
||||
|
||||
OS.system("cd " + OS.enquote(cappuccino_output_path) + " && zip -ry -8 Starter.zip Starter");
|
||||
});
|
||||
|
||||
task ("demos", function()
|
||||
{
|
||||
var demosDir = FILE.join($BUILD_DIR, "CappuccinoDemos"),
|
||||
zipDir = FILE.join(demosDir, "demos.zip"),
|
||||
var demosDir = path.join($BUILD_DIR, "CappuccinoDemos"),
|
||||
zipDir = path.join(demosDir, "demos.zip"),
|
||||
demosQuoted = OS.enquote(demosDir),
|
||||
zipQuoted = OS.enquote(zipDir);
|
||||
|
||||
rm_rf(demosDir);
|
||||
utilsFile.rm_rf(demosDir);
|
||||
FILE.mkdirs(demosDir);
|
||||
|
||||
OS.system("curl -L http://github.com/cappuccino/cappuccino-demos/zipball/master > " + zipQuoted);
|
||||
@@ -279,7 +299,7 @@ task ("demos", function()
|
||||
function Demo(aPath)
|
||||
{
|
||||
this._path = aPath;
|
||||
this._plist = CFPropertyList.readPropertyListFromFile(FILE.join(aPath, 'Info.plist'));
|
||||
this._plist = CFPropertyList.readPropertyListFromFile(path.join(aPath, 'Info.plist'));
|
||||
}
|
||||
|
||||
Demo.prototype.plist = function(key)
|
||||
@@ -309,21 +329,21 @@ task ("demos", function()
|
||||
return this.name();
|
||||
};
|
||||
|
||||
FILE.glob(FILE.join(demosDir, "demos", "**/Info.plist")).map(function(demoPath){
|
||||
FILE.glob(path.join(demosDir, "demos", "**/Info.plist")).map(function(demoPath){
|
||||
return new Demo(FILE.dirname(demoPath));
|
||||
}).filter(function(demo){
|
||||
return !demo.excluded();
|
||||
}).forEach(function(demo)
|
||||
{
|
||||
// copy frameworks into the demos
|
||||
cp_r(FILE.join($STARTER_DOWNLOAD_APPLICATION, "Frameworks"), FILE.join(demo.path(), "Frameworks"));
|
||||
rm_rf(FILE.join(demo.path(), "Frameworks", "Debug"));
|
||||
utilsFile.cp_r(path.join($STARTER_DOWNLOAD_APPLICATION, "Frameworks"), path.join(demo.path(), "Frameworks"));
|
||||
utilsFile.rm_rf(path.join(demo.path(), "Frameworks", "Debug"));
|
||||
|
||||
var outputPath = demo.name().replace(/\s/g, "-") + ".zip";
|
||||
OS.system("cd " + OS.enquote(FILE.dirname(demo.path()))+" && zip -ry -8 " + OS.enquote(outputPath) + " " + OS.enquote(FILE.basename(demo.path())));
|
||||
|
||||
// remove the frameworks
|
||||
rm_rf(FILE.join(demo.path(), "Frameworks"));
|
||||
utilsFile.rm_rf(path.join(demo.path(), "Frameworks"));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -333,12 +353,18 @@ task("test", ["CommonJS", "test-only"]);
|
||||
|
||||
task("test-only", function()
|
||||
{
|
||||
var tests = new FileList('Tests/**/*Test.j'),
|
||||
cmd = ["ojtest"].concat(tests.items()),
|
||||
code = OS.system(serializedENV() + " " + cmd.map(OS.enquote).join(" "));
|
||||
var tests = new FileList('Tests/**/*Test.j');
|
||||
var cmd = ["ojtest"].concat(tests.items());
|
||||
var cmdString = cmd.map(utilsFile.enquote).join(" ");
|
||||
|
||||
if (code !== 0)
|
||||
OS.exit(code);
|
||||
try
|
||||
{
|
||||
childProcess.execSync(serializedENV() + " " + cmdString, {stdio: 'inherit'});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
task("check-missing-imports", function()
|
||||
@@ -401,9 +427,9 @@ function pushPackage(path, remote, branch)
|
||||
|
||||
var pkg = JSON.parse(packagePath.join("package.json").read({ charset : "UTF-8" }));
|
||||
|
||||
stream.print(" Version: " + colorize(pkg.version, "purple"));
|
||||
stream.print(" Revision: " + colorize(pkg["cappuccino-revision"], "purple"));
|
||||
stream.print(" Timestamp: " + colorize(pkg["cappuccino-timestamp"], "purple"));
|
||||
term.stream.print(" Version: " + colorize(pkg.version, "purple"));
|
||||
term.stream.print(" Revision: " + colorize(pkg["cappuccino-revision"], "purple"));
|
||||
term.stream.print(" Timestamp: " + colorize(pkg["cappuccino-timestamp"], "purple"));
|
||||
|
||||
var cmd = [
|
||||
["cd", packagePath],
|
||||
|
||||
@@ -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;
|
||||
@@ -635,6 +635,7 @@ function CFBundleHasTestedSpriteSupport()
|
||||
|
||||
function CFBundleTestSpriteSupport(/*String*/ MHTMLPath, /*Function*/ aCallback)
|
||||
{
|
||||
|
||||
if (CFBundleHasTestedSpriteSupport())
|
||||
return;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
var OBJECT_COUNT = 0;
|
||||
|
||||
GLOBAL(objj_generateObjectUID) = function()
|
||||
@@ -82,9 +83,12 @@ CFPropertyList.stringFromPropertyList = function(/*CFPropertyList*/ aPropertyLis
|
||||
}
|
||||
|
||||
#ifdef COMMONJS
|
||||
var fs = require("fs");
|
||||
|
||||
CFPropertyList.readPropertyListFromFile = function(/*String*/ aFilePath)
|
||||
{
|
||||
return CFPropertyList.propertyListFromString(FILE.read(aFilePath, { charset:"UTF-8" }));
|
||||
return CFPropertyList.propertyListFromString(fs.readFileSync(aFilePath, { encoding: "utf8" }));
|
||||
//return CFPropertyList.propertyListFromString(FILE.read(aFilePath, { charset:"UTF-8" }));
|
||||
}
|
||||
|
||||
CFPropertyList.writePropertyListToFile = function(/*CFPropertyList*/ aPropertyList, /*String*/ aFilePath, /*Format*/ aFormat)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env narwhal
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("objective-j").run(system.args);
|
||||
require("@objj/runtime").run(process.argv.slice(1));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -24,10 +24,10 @@ var undefined;
|
||||
|
||||
if (typeof window !== "undefined")
|
||||
{
|
||||
window.setNativeTimeout = window.setTimeout;
|
||||
window.clearNativeTimeout = window.clearTimeout;
|
||||
window.setNativeInterval = window.setInterval;
|
||||
window.clearNativeInterval = window.clearInterval;
|
||||
window.setNativeTimeout = window.setTimeout || setTimeout;
|
||||
window.clearNativeTimeout = window.clearTimeout || clearTimeout;
|
||||
window.setNativeInterval = window.setInterval || setInterval;
|
||||
window.clearNativeInterval = window.clearInterval || clearInterval;
|
||||
}
|
||||
|
||||
// Objective-J Constants
|
||||
|
||||
@@ -66,7 +66,7 @@ FileExecutable.prototype = new Executable();
|
||||
|
||||
var compile = function(self, fileContents, aURL, compilerOptions, aFilenameTranslateDictionary)
|
||||
{
|
||||
var acornOptions = compilerOptions.acornOptions || (compilerOptions.acornOptions = {});
|
||||
var acornOptions = compilerOptions.acornOptions || (compilerOptions.acornOptions = {ecmaVersion: 2022});
|
||||
|
||||
acornOptions.preprocessGetIncludeFile = function(filePath, isQuoted) {
|
||||
var referenceURL = new CFURL(".", aURL), // Remove the filename from the url
|
||||
|
||||
@@ -47,9 +47,9 @@
|
||||
#include "StaticResource.js"
|
||||
#include "Preprocessor.js"
|
||||
#include "source-map.js"
|
||||
#include "acorn.js"
|
||||
#include "acornwalk.js"
|
||||
#include "ObjJAcornCompiler.js"
|
||||
#include "../node_modules/acorn-walk/dist/walk.js"
|
||||
#include "../node_modules/objj-parser/dist/objj-parser.js"
|
||||
#include "../node_modules/objj-transpiler/dist/objj-transpiler.cjs"
|
||||
#include "FileDependency.js"
|
||||
#include "Executable.js"
|
||||
#include "FileExecutable.js"
|
||||
|
||||
+43
-44
@@ -27,58 +27,64 @@ require("../common.jake");
|
||||
// as we are running in an already built Objective-J environment
|
||||
require("./OldBrowserCompatibility");
|
||||
|
||||
var FILE = require("file"),
|
||||
/* var FILE = require("file"),
|
||||
OS = require("os"),
|
||||
stream = require("narwhal/term").stream;
|
||||
stream = require("narwhal/term").stream; */
|
||||
|
||||
var walk = require("./acornwalk").acorn.walk;
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
var terser = require("terser");
|
||||
|
||||
var walk = require("acorn-walk");
|
||||
acorn = {walk: walk};
|
||||
acorn = require("./acorn").acorn;
|
||||
acorn = require("objj-parser");
|
||||
var compiler = require("objj-transpiler");
|
||||
|
||||
var compiler = require("./ObjJAcornCompiler").ObjJCompiler;
|
||||
const term = ObjectiveJ.term;
|
||||
const utilsFile = ObjectiveJ.utils.file;
|
||||
|
||||
//$BUILD_CONFIGURATION_DIR = "../Build"
|
||||
$BROWSER_FILE = FILE.join("Browser", "Objective-J.js");
|
||||
$BROWSER_FILE = path.join("Browser", "Objective-J.js");
|
||||
|
||||
$BUILD_OBJECTIVE_J = FILE.join($BUILD_CONFIGURATION_DIR, "Objective-J");
|
||||
$BUILD_BROWSER_FILE = FILE.join($BUILD_OBJECTIVE_J, "Objective-J.js");
|
||||
$BUILD_OBJECTIVE_J = path.join($BUILD_CONFIGURATION_DIR, "Objective-J");
|
||||
$BUILD_BROWSER_FILE = path.join($BUILD_OBJECTIVE_J, "Objective-J.js");
|
||||
|
||||
$INCLUDE_FLAGS = ["'-I" + FILE.cwd() + "'"];
|
||||
$INCLUDE_FLAGS = ["'-I" + process.cwd() + "'"];
|
||||
$DEBUG_FLAGS = $CONFIGURATION === "Debug" ? ["-DDEBUG=1"] : [""];
|
||||
$OBJECTIVEJ_FILES = new FileList("*.js");
|
||||
|
||||
$BROWSER_FILES = new FileList($BROWSER_FILE).include($OBJECTIVEJ_FILES);
|
||||
|
||||
filedir($BUILD_BROWSER_FILE, $BROWSER_FILES, function(aTask)
|
||||
|
||||
filedir($BUILD_BROWSER_FILE, $BROWSER_FILES, async function(aTask)
|
||||
{
|
||||
gcc($BROWSER_FILE,
|
||||
$BUILD_BROWSER_FILE,
|
||||
environmentFlags("Browser", "ObjJ").concat($INCLUDE_FLAGS, $DEBUG_FLAGS, ["-Wno-unused-but-set-variable"]), $CONFIGURATION !== "Debug");
|
||||
});
|
||||
|
||||
$LICENSE = FILE.join("CommonJS", "lib", "objective-j", "jake", "LICENSES", "LGPL-v2.1");
|
||||
$BUILD_LICENSE = FILE.join($BUILD_OBJECTIVE_J, "LICENSE");
|
||||
$LICENSE = path.join("CommonJS", "lib", "objective-j", "jake", "LICENSES", "LGPL-v2.1");
|
||||
$BUILD_LICENSE = path.join($BUILD_OBJECTIVE_J, "LICENSE");
|
||||
|
||||
filedir($BUILD_LICENSE, [$LICENSE], function()
|
||||
{
|
||||
FILE.copy($LICENSE, $BUILD_LICENSE);
|
||||
fs.copyFileSync($LICENSE, $BUILD_LICENSE);
|
||||
});
|
||||
|
||||
new FileList("CommonJS/**/*").forEach(function(aFilename)
|
||||
new FileList("CommonJS/**/*").forEach( async function(aFilename)
|
||||
{
|
||||
// . files should be left out of FileList...
|
||||
if (!FILE.isFile(aFilename) || FILE.basename(aFilename).charAt(0) === ".")
|
||||
if (!fs.lstatSync(aFilename).isFile() || path.basename(aFilename).charAt(0) === ".")
|
||||
return;
|
||||
|
||||
var buildFilename = FILE.join($BUILD_CJS_OBJECTIVE_J, FILE.relative("CommonJS/", aFilename));
|
||||
var buildFilename = path.join($BUILD_CJS_OBJECTIVE_J, path.relative("CommonJS/", aFilename));
|
||||
|
||||
filedir (buildFilename, new FileList(aFilename).include($OBJECTIVEJ_FILES), function ()
|
||||
{
|
||||
if (FILE.extension(aFilename) !== ".js")
|
||||
if (path.extname(aFilename) !== ".js")
|
||||
{
|
||||
stream.print("Copying... \0green(" + aFilename +"\0)");
|
||||
cp(aFilename, buildFilename);
|
||||
term.stream.print("Copying... \0green(" + aFilename +"\0)");
|
||||
utilsFile.cp(aFilename, buildFilename);
|
||||
}
|
||||
else
|
||||
gcc(aFilename,
|
||||
@@ -87,27 +93,26 @@ new FileList("CommonJS/**/*").forEach(function(aFilename)
|
||||
});
|
||||
|
||||
// HACK: narwhal should copy permissions
|
||||
if (FILE.dirname(aFilename) === FILE.join("CommonJS", "bin"))
|
||||
if (path.dirname(aFilename) === path.join("CommonJS", "bin"))
|
||||
{
|
||||
filedir (buildFilename, function ()
|
||||
{
|
||||
FILE.chmod(buildFilename, 0755);
|
||||
fs.chmodSync(buildFilename, 0o755);
|
||||
});
|
||||
}
|
||||
|
||||
task ("build", buildFilename);
|
||||
CLOBBER.include(buildFilename);
|
||||
});
|
||||
|
||||
task ("build", function() {
|
||||
setPackageMetadata(FILE.join($BUILD_CJS_OBJECTIVE_J, "package.json"));
|
||||
setPackageMetadata(path.join($BUILD_CJS_OBJECTIVE_J, "package.json"));
|
||||
});
|
||||
|
||||
$BUILD_CJS_OBJECTIVE_J_FRAMEWORK = FILE.join($BUILD_CJS_OBJECTIVE_J, "Frameworks", "Objective-J");
|
||||
$BUILD_CJS_OBJECTIVE_J_FRAMEWORK = path.join($BUILD_CJS_OBJECTIVE_J, "Frameworks", "Objective-J");
|
||||
|
||||
filedir($BUILD_CJS_OBJECTIVE_J_FRAMEWORK, function()
|
||||
{
|
||||
cp_r($BUILD_OBJECTIVE_J, $BUILD_CJS_OBJECTIVE_J_FRAMEWORK);
|
||||
utilsFile.cp_r($BUILD_OBJECTIVE_J, $BUILD_CJS_OBJECTIVE_J_FRAMEWORK);
|
||||
});
|
||||
|
||||
CLOBBER.include($BUILD_OBJECTIVE_J);
|
||||
@@ -121,24 +126,20 @@ function environmentFlags()
|
||||
}).concat("-DENVIRONMENTS=" + JSON.stringify(environments));
|
||||
}
|
||||
|
||||
var SHRINKSAFE = require("minify/shrinksafe");
|
||||
function compressor(code) {
|
||||
return SHRINKSAFE.compress(code, { charset : "UTF-8", useServer : true });
|
||||
async function compressor(srcCode) {
|
||||
return (await terser.minify(srcCode)).code;
|
||||
}
|
||||
|
||||
var headerText = FILE.read("header.txt", { charset : "UTF-8" });
|
||||
function gcc(inputFilePath, outputFilePath, flags, compress)
|
||||
var headerText = fs.readFileSync("header.txt", { encoding: "utf8" });
|
||||
async function gcc(inputFilePath, outputFilePath, flags, compress)
|
||||
{
|
||||
stream.print("Building... \0green(" + outputFilePath +"\0)");
|
||||
|
||||
var source = FILE.read(inputFilePath, { charset : "UTF-8" });
|
||||
term.stream.print("Building... \0green(" + outputFilePath +"\0)");
|
||||
var source = fs.readFileSync(inputFilePath, { charset : "utf8" }).toString();
|
||||
var compilerOptions = compiler.parseGccCompilerFlags(flags.join(" "));
|
||||
var acornOptions = compilerOptions.acornOptions || (compilerOptions.acornOptions = {});
|
||||
var acornOptions = compilerOptions.acornOptions || (compilerOptions.acornOptions = {ecmaVersion: 2022});
|
||||
|
||||
acornOptions.preprocessGetIncludeFile = function(filePath, isQuoted) {
|
||||
var includeContent = FILE.read(filePath, { charset : "UTF-8" });
|
||||
//print ("Include content for file '" + filePath + "': " + includeContent);
|
||||
//print ("Include file '" + filePath + "'");
|
||||
var includeContent = fs.readFileSync(filePath, { charset : "utf8" }).toString();
|
||||
return {include: includeContent, sourceFile: filePath};
|
||||
}
|
||||
|
||||
@@ -153,18 +154,16 @@ function gcc(inputFilePath, outputFilePath, flags, compress)
|
||||
|
||||
// Set anyErrors to 'true' if there are any errors in the list
|
||||
anyErrors = anyErrors || warning.messageType === "ERROR";
|
||||
print(message);
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
if (anyErrors) throw "Compilation Error";
|
||||
|
||||
var code = c.code();
|
||||
var contents = headerText + code;
|
||||
|
||||
if (FILE.extension(inputFilePath) === ".js" && compress)
|
||||
contents = compressor(contents);
|
||||
|
||||
FILE.write(outputFilePath, contents, { charset : "UTF-8" });
|
||||
if (path.extname(inputFilePath) === ".js" && compress) {
|
||||
contents = await compressor(contents);
|
||||
}
|
||||
fs.writeFileSync(outputFilePath, contents, { encoding : "utf8" });
|
||||
}
|
||||
|
||||
task("build", [$BUILD_BROWSER_FILE, $BUILD_LICENSE, $BUILD_CJS_OBJECTIVE_J_FRAMEWORK]);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -81,7 +81,7 @@ GLOBAL(objj_class) = function(displayName)
|
||||
#if DEBUG
|
||||
// Naming the allocator allows the WebKit heap snapshot tool to display object class names correctly
|
||||
// HACK: displayName property is not respected so we must eval a function to name it
|
||||
eval("this.allocator = function " + (displayName || "OBJJ_OBJECT").replace(/\W/g, "_") + "() { }");
|
||||
eval("this.allocator = function " + (displayName ? displayName.replace(/^0|\W/g, "_") : "OBJJ_OBJECT") + "() { }");
|
||||
#else
|
||||
this.allocator = function() { };
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,285 +0,0 @@
|
||||
// AST walker module for Mozilla Parser API compatible trees
|
||||
|
||||
if (!exports.acorn) {
|
||||
exports.acorn = {};
|
||||
exports.acorn.walk = {};
|
||||
}
|
||||
|
||||
(function(exports) {
|
||||
"use strict";
|
||||
|
||||
// A simple walk is one where you simply specify callbacks to be
|
||||
// called on specific nodes. The last two arguments are optional. A
|
||||
// simple use would be
|
||||
//
|
||||
// walk.simple(myTree, {
|
||||
// Expression: function(node) { ... }
|
||||
// });
|
||||
//
|
||||
// to do something with all expressions. All Parser API node types
|
||||
// can be used to identify node types, as well as Expression,
|
||||
// Statement, and ScopeBody, which denote categories of nodes.
|
||||
//
|
||||
// The base argument can be used to pass a custom (recursive)
|
||||
// walker, and state can be used to give this walked an initial
|
||||
// state.
|
||||
exports.simple = function(node, visitors, base, state) {
|
||||
if (!base) base = exports;
|
||||
function c(node, st, override) {
|
||||
var type = override || node.type, found = visitors[type];
|
||||
if (found) found(node, st);
|
||||
base[type](node, st, c);
|
||||
}
|
||||
c(node, state);
|
||||
};
|
||||
|
||||
// A recursive walk is one where your functions override the default
|
||||
// walkers. They can modify and replace the state parameter that's
|
||||
// threaded through the walk, and can opt how and whether to walk
|
||||
// their child nodes (by calling their third argument on these
|
||||
// nodes).
|
||||
exports.recursive = function(node, state, funcs, base) {
|
||||
var visitor = exports.make(funcs, base);
|
||||
function c(node, st, override) {
|
||||
return visitor[override || node.type](node, st, c);
|
||||
}
|
||||
return c(node, state);
|
||||
};
|
||||
|
||||
// Used to create a custom walker. Will fill in all missing node
|
||||
// type properties with the defaults.
|
||||
exports.make = function(funcs, base) {
|
||||
if (!base) base = exports;
|
||||
var visitor = {};
|
||||
for (var type in base) visitor[type] = base[type];
|
||||
for (var type in funcs) visitor[type] = funcs[type];
|
||||
return visitor;
|
||||
};
|
||||
|
||||
function skipThrough(node, st, c) { c(node, st); }
|
||||
function ignore(node, st, c) {}
|
||||
|
||||
// Node walkers.
|
||||
|
||||
exports.Program = exports.BlockStatement = function(node, st, c) {
|
||||
for (var i = 0; i < node.body.length; ++i) {
|
||||
c(node.body[i], st, "Statement");
|
||||
}
|
||||
};
|
||||
exports.Statement = skipThrough;
|
||||
exports.EmptyStatement = ignore;
|
||||
exports.ExpressionStatement = function(node, st, c) {
|
||||
c(node.expression, st, "Expression");
|
||||
};
|
||||
exports.IfStatement = function(node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Statement");
|
||||
if (node.alternate) c(node.alternate, st, "Statement");
|
||||
};
|
||||
exports.LabeledStatement = function(node, st, c) {
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
exports.BreakStatement = exports.ContinueStatement = ignore;
|
||||
exports.WithStatement = function(node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
exports.SwitchStatement = function(node, st, c) {
|
||||
c(node.discriminant, st, "Expression");
|
||||
for (var i = 0; i < node.cases.length; ++i) {
|
||||
var cs = node.cases[i];
|
||||
if (cs.test) c(cs.test, st, "Expression");
|
||||
for (var j = 0; j < cs.consequent.length; ++j)
|
||||
c(cs.consequent[j], st, "Statement");
|
||||
}
|
||||
};
|
||||
exports.ReturnStatement = function(node, st, c) {
|
||||
if (node.argument) c(node.argument, st, "Expression");
|
||||
};
|
||||
exports.ThrowStatement = function(node, st, c) {
|
||||
c(node.argument, st, "Expression");
|
||||
};
|
||||
exports.TryStatement = function(node, st, c) {
|
||||
c(node.block, st, "Statement");
|
||||
if (node.handler) c(node.handler.body, st, "ScopeBody");
|
||||
if (node.finalizer) c(node.finalizer, st, "Statement");
|
||||
};
|
||||
exports.WhileStatement = function(node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
exports.DoWhileStatement = function(node, st, c) {
|
||||
c(node.body, st, "Statement");
|
||||
c(node.test, st, "Expression");
|
||||
};
|
||||
exports.ForStatement = function(node, st, c) {
|
||||
if (node.init) c(node.init, st, "ForInit");
|
||||
if (node.test) c(node.test, st, "Expression");
|
||||
if (node.update) c(node.update, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
exports.ForInStatement = function(node, st, c) {
|
||||
c(node.left, st, "ForInit");
|
||||
c(node.right, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
exports.ForInit = function(node, st, c) {
|
||||
if (node.type == "VariableDeclaration") c(node, st);
|
||||
else c(node, st, "Expression");
|
||||
};
|
||||
exports.DebuggerStatement = ignore;
|
||||
|
||||
exports.FunctionDeclaration = function(node, st, c) {
|
||||
c(node, st, "Function");
|
||||
};
|
||||
exports.VariableDeclaration = function(node, st, c) {
|
||||
for (var i = 0; i < node.declarations.length; ++i) {
|
||||
var decl = node.declarations[i];
|
||||
if (decl.init) c(decl.init, st, "Expression");
|
||||
}
|
||||
};
|
||||
|
||||
exports.Function = function(node, st, c) {
|
||||
c(node.body, st, "ScopeBody");
|
||||
};
|
||||
exports.ScopeBody = function(node, st, c) {
|
||||
c(node, st, "Statement");
|
||||
};
|
||||
|
||||
exports.Expression = skipThrough;
|
||||
exports.ThisExpression = ignore;
|
||||
exports.ArrayExpression = exports.ArrayLiteral = function(node, st, c) {
|
||||
for (var i = 0; i < node.elements.length; ++i) {
|
||||
var elt = node.elements[i];
|
||||
if (elt) c(elt, st, "Expression");
|
||||
}
|
||||
};
|
||||
exports.DictionaryLiteral = function(node, st, c) {
|
||||
for (var i = 0; i < node.keys.length; i++) {
|
||||
var key = node.keys[i];
|
||||
c(key, st, "Expression");
|
||||
var value = node.values[i];
|
||||
c(value, st, "Expression");
|
||||
}
|
||||
};
|
||||
exports.ObjectExpression = function(node, st, c) {
|
||||
for (var i = 0; i < node.properties.length; ++i)
|
||||
c(node.properties[i].value, st, "Expression");
|
||||
};
|
||||
exports.FunctionExpression = exports.FunctionDeclaration;
|
||||
exports.SequenceExpression = function(node, st, c) {
|
||||
for (var i = 0; i < node.expressions.length; ++i)
|
||||
c(node.expressions[i], st, "Expression");
|
||||
};
|
||||
exports.UnaryExpression = exports.UpdateExpression = function(node, st, c) {
|
||||
c(node.argument, st, "Expression");
|
||||
};
|
||||
exports.BinaryExpression = exports.AssignmentExpression = exports.LogicalExpression = function(node, st, c) {
|
||||
c(node.left, st, "Expression");
|
||||
c(node.right, st, "Expression");
|
||||
};
|
||||
exports.ConditionalExpression = function(node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Expression");
|
||||
c(node.alternate, st, "Expression");
|
||||
};
|
||||
exports.NewExpression = exports.CallExpression = function(node, st, c) {
|
||||
c(node.callee, st, "Expression");
|
||||
if (node.arguments) for (var i = 0; i < node.arguments.length; ++i)
|
||||
c(node.arguments[i], st, "Expression");
|
||||
};
|
||||
exports.MemberExpression = function(node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
if (node.computed) c(node.property, st, "Expression");
|
||||
};
|
||||
exports.Identifier = exports.Literal = ignore;
|
||||
|
||||
exports.ClassDeclarationStatement = function(node, st, c) {
|
||||
if (node.ivardeclarations) for (var i = 0; i < node.ivardeclarations.length; ++i) {
|
||||
c(node.ivardeclarations[i], st, "IvarDeclaration");
|
||||
}
|
||||
for (var i = 0; i < node.body.length; ++i) {
|
||||
c(node.body[i], st, "Statement");
|
||||
}
|
||||
}
|
||||
|
||||
exports.ImportStatement = ignore;
|
||||
|
||||
exports.IvarDeclaration = ignore;
|
||||
|
||||
exports.PreprocessStatement = ignore;
|
||||
exports.ClassStatement = ignore;
|
||||
exports.GlobalStatement = ignore;
|
||||
|
||||
exports.ProtocolDeclarationStatement = function(node, st, c) {
|
||||
if (node.required) for (var i = 0; i < node.required.length; ++i) {
|
||||
c(node.required[i], st, "Statement");
|
||||
}
|
||||
if (node.optional) for (var i = 0; i < node.optional.length; ++i) {
|
||||
c(node.optional[i], st, "Statement");
|
||||
}
|
||||
}
|
||||
|
||||
exports.TypeDefStatement = ignore;
|
||||
|
||||
exports.MethodDeclarationStatement = function(node, st, c) {
|
||||
var body = node.body;
|
||||
if (body)
|
||||
c(body, st, "Statement");
|
||||
}
|
||||
|
||||
exports.MessageSendExpression = function(node, st, c) {
|
||||
if (!node.superObject) c(node.object, st, "Expression");
|
||||
if (node.arguments) for (var i = 0; i < node.arguments.length; ++i)
|
||||
c(node.arguments[i], st, "Expression");
|
||||
if (node.parameters) for (var i = 0; i < node.parameters.length; ++i)
|
||||
c(node.parameters[i], st, "Expression");
|
||||
}
|
||||
|
||||
exports.SelectorLiteralExpression = ignore;
|
||||
exports.ProtocolLiteralExpression = ignore;
|
||||
|
||||
exports.Reference = function(node, st, c) {
|
||||
c(node.element, st, "Identifier");
|
||||
}
|
||||
|
||||
exports.Dereference = function(node, st, c) {
|
||||
c(node.expr, st, "Expression");
|
||||
}
|
||||
|
||||
// A custom walker that keeps track of the scope chain and the
|
||||
// variables defined in it.
|
||||
function makeScope(prev) {
|
||||
return {vars: Object.create(null), prev: prev};
|
||||
}
|
||||
exports.scopeVisitor = exports.make({
|
||||
Function: function(node, scope, c) {
|
||||
var inner = makeScope(scope);
|
||||
for (var i = 0; i < node.params.length; ++i)
|
||||
inner.vars[node.params[i].name] = {type: "argument", node: node.params[i]};
|
||||
if (node.id) {
|
||||
var decl = node.type == "FunctionDeclaration";
|
||||
(decl ? scope : inner).vars[node.id.name] =
|
||||
{type: decl ? "function" : "function name", node: node.id};
|
||||
}
|
||||
c(node.body, inner, "ScopeBody");
|
||||
},
|
||||
TryStatement: function(node, scope, c) {
|
||||
c(node.block, scope, "Statement");
|
||||
if (node.handler) {
|
||||
var inner = makeScope(scope);
|
||||
inner.vars[node.handler.param.name] = {type: "catch clause", node: node.handler.param};
|
||||
c(node.handler.body, inner, "ScopeBody");
|
||||
}
|
||||
if (node.finalizer) c(node.finalizer, scope, "Statement");
|
||||
},
|
||||
VariableDeclaration: function(node, scope, c) {
|
||||
for (var i = 0; i < node.declarations.length; ++i) {
|
||||
var decl = node.declarations[i];
|
||||
scope.vars[decl.id.name] = {type: "var", node: decl.id};
|
||||
if (decl.init) c(decl.init, scope, "Expression");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(typeof exports == "undefined" ? acorn.walk = {} : exports.acorn.walk);
|
||||
+73
-5
@@ -1,6 +1,6 @@
|
||||
[](https://travis-ci.org/cappuccino/cappuccino)
|
||||
[](https://github.com/cappuccino/cappuccino/actions/workflows/BuildAndTest.yml)
|
||||
[](https://gitter.im/cappuccino/cappuccino?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://github.com/cappuccino/cappuccino/actions/workflows/BuildAndTest.yml)
|
||||
[](
|
||||
https://gitter.im/cappuccino/cappuccino?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
Welcome to Cappuccino!
|
||||
======================
|
||||
@@ -10,7 +10,8 @@ Introduction
|
||||
Cappuccino is an open source framework that makes it easy to build
|
||||
desktop-caliber applications that run in a web browser.
|
||||
|
||||
With Cappuccino, you don't concern yourself with HTML, CSS, or the DOM. You write applications with the APIs from Apple's Cocoa frameworks and the Objective-J language.
|
||||
With Cappuccino, you don't concern yourself with HTML, CSS, or the DOM. You write applications with the APIs from
|
||||
Apple's Cocoa frameworks and the Objective-J language.
|
||||
|
||||
Check out a [live demo of the widgets in Cappuccino](https://cappuccino-testbook.5apps.com/#ThemeKitchenSink)
|
||||
|
||||
@@ -36,13 +37,80 @@ You can develop Cappuccino applications with only a simple text editor on any pl
|
||||
|
||||
If you are on a Mac, our integration with Xcode leverages the world-class visual development tools from Apple to create complex applications with minimal coding.
|
||||
|
||||
Node.js version alpha
|
||||
------------------
|
||||
|
||||
There is currently an ongoing effort to switch JavaScript platform from [Narwhal](https://narwhaljs.org/) to Node.js.
|
||||
To try the Node.js version, do the following:
|
||||
|
||||
1. Install Node.js and npm from the [Node.js website](https://nodejs.org/en/).
|
||||
|
||||
2. Run `npm set prefix ~/.npm`. This will set the default install location for npm to `~/.npm`. The reasoning behind
|
||||
this is outlined in the section about permission issues below.
|
||||
|
||||
3. Add this line to your `.zshrc` or equivalent config file.
|
||||
```bash
|
||||
export PATH="~/.npm/bin:$PATH"
|
||||
```
|
||||
|
||||
4. Restart your shell.
|
||||
|
||||
5. Run `npm install -g @objj/cappuccino`.
|
||||
|
||||
6. Done! See below for basic usage.
|
||||
|
||||
### Permisson issues
|
||||
|
||||
By default npm uses `/usr/local/lib/node_modules` as the install location for globally installed packages. This causes
|
||||
problems since users typically lack write permissions there. It is therefore recommended to either use a version
|
||||
manager, or change npm's default install location manually (which is what we did above). For more details on how to do
|
||||
this, see [this article](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally).
|
||||
|
||||
### Basic usage
|
||||
|
||||
If the install succeeded you will be able to do the following to create a simple Cappuccino application:
|
||||
|
||||
1. `capp gen HelloWorld`
|
||||
2. `cd HelloWorld`
|
||||
3. `python3 -m http.server`
|
||||
4. Go to `localhost:8000` in your web browser.
|
||||
|
||||
### Building Cappuccino from source
|
||||
|
||||
If you want to build Cappuccino from source you should clone the GitHub repository at
|
||||
https://github.com/cappuccino/cappuccino/ and checkout the `node` branch. Then you can use the command
|
||||
`jake install` to install Cappuccino and its tools locally.
|
||||
|
||||
To build from source, do:
|
||||
|
||||
1. `git clone https://github.com/cappuccino/cappuccino.git`
|
||||
|
||||
2. `cd cappuccino`
|
||||
|
||||
3. `git checkout node`
|
||||
|
||||
4. `npm install`
|
||||
|
||||
5. Make any desired changes to the codebase.
|
||||
|
||||
6. Make sure the environment variable `CAPP_BUILD` is set. This is done by adding the line
|
||||
```bash
|
||||
export CAPP_BUILD="/path/to/cappuccino/build/directory"
|
||||
```
|
||||
to your `.zshrc` or equivalent config file and of course changing the path to where you want to build Cappuccino.
|
||||
7. Run `jake install` to build and install Cappuccino.
|
||||
|
||||
Beware that building and installing Cappuccino from source will overwrite the binaries installed from npm. To undo this,
|
||||
simply run `npm install -g @objj/cappuccino` again.
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
To write you first application, [download the starter package](http://cappuccino.dev/#download).
|
||||
|
||||
To try our new Node (alpha) version of the Cappuccino framework, [check the Node installation instructions](https://github.com/cappuccino/cappuccino/wiki/node)
|
||||
|
||||
To contribute to Cappuccino, please read here: [Getting and Building the Source](https://github.com/cappuccino/cappuccino/wiki/Getting-and-building-the-source).
|
||||
To contribute to Cappuccino, please read here: [Getting and Building the Source](
|
||||
https://github.com/cappuccino/cappuccino/wiki/Getting-and-building-the-source).
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
@@ -1 +1 @@
|
||||
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;0E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;4E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;0E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;1;7E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;1;9E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;11E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;13E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;15E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;18E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;19E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;12E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;20E;E;D;K;10;$classnameS;20;CPCibOutletConnectorK;8;$classesA;S;20;CPCibOutletConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;11E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;18E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;21E;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;22E;E;D;K;10;$classnameS;18;_CPCibClassSwapperK;8;$classesA;S;18;_CPCibClassSwapperS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;17E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;23E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;24E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;24E;K;22;CPViewAutoresizingMaskD;K;6;CP$UIDd;2;25E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;2;21E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;26E;K;14;CPViewScaleKeyD;K;6;CP$UIDd;2;27E;K;18;CPViewSizeScaleKeyD;K;6;CP$UIDd;2;27E;K;17;CPViewIsScaledKeyD;K;6;CP$UIDd;2;28E;K;19;CPViewAppearanceKeyD;K;6;CP$UIDd;1;0E;K;22;CPViewTrackingAreasKeyD;K;6;CP$UIDd;2;29E;K;30;_CPCibClassSwapperClassNameKeyD;K;6;CP$UIDd;2;30E;K;38;_CPCibClassSwapperOriginalClassNameKeyD;K;6;CP$UIDd;2;31E;E;S;16;CPViewControllerD;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;S;4;viewS;13;CPApplicationd;1;0S;20;{{0, 0}, {480, 272}}d;2;12S;6;normalS;6;{1, 1}F;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;S;6;NSViewS;6;CPViewE;K;9;$archiverS;15;CPKeyedArchiverK;8;$versionS;6;100000E;
|
||||
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;0E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;4E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;0E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;1;7E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;1;9E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;11E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;13E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;15E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;18E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;19E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;12E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;20E;E;D;K;10;$classnameS;20;CPCibOutletConnectorK;8;$classesA;S;20;CPCibOutletConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;11E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;18E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;21E;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;22E;E;D;K;10;$classnameS;18;_CPCibClassSwapperK;8;$classesA;S;18;_CPCibClassSwapperS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;17E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;23E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;24E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;24E;K;22;CPViewAutoresizingMaskD;K;6;CP$UIDd;2;25E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;2;21E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;26E;K;14;CPViewScaleKeyD;K;6;CP$UIDd;2;27E;K;18;CPViewSizeScaleKeyD;K;6;CP$UIDd;2;27E;K;17;CPViewIsScaledKeyD;K;6;CP$UIDd;2;28E;K;19;CPViewAppearanceKeyD;K;6;CP$UIDd;1;0E;K;22;CPViewTrackingAreasKeyD;K;6;CP$UIDd;2;29E;K;30;_CPCibClassSwapperClassNameKeyD;K;6;CP$UIDd;2;30E;K;38;_CPCibClassSwapperOriginalClassNameKeyD;K;6;CP$UIDd;2;30E;E;S;16;CPViewControllerD;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;S;4;viewS;13;CPApplicationd;1;0S;20;{{0, 0}, {480, 272}}d;2;12S;6;normalS;6;{1, 1}F;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;S;6;CPViewE;K;9;$archiverS;15;CPKeyedArchiverK;8;$versionS;6;100000E;
|
||||
@@ -32,8 +32,8 @@
|
||||
- (void)testColorCreate
|
||||
{
|
||||
var colorspace = CGColorSpaceCreateDeviceRGB(),
|
||||
components = [2,3,4,5],
|
||||
clruid = CFHashCode(colorspace) + components.join("");
|
||||
components = [2,3,4,5]/*,
|
||||
clruid = CFHashCode(colorspace) + components.join("")*/;
|
||||
|
||||
// Can't access the colormap cache, but it would be nice to
|
||||
// [self assert:NULL equals:_CGColorMap[clruid]];
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
{
|
||||
/*
|
||||
Ensure that we have no canvas nor vml support.
|
||||
Now when we are moving to Node we don't need to do this check anymore.
|
||||
Before Node we had to check what engine we where running on to test correctly
|
||||
*/
|
||||
if (system.engine !== "jsc")
|
||||
{
|
||||
//if (system.engine !== "jsc")
|
||||
//{
|
||||
[self assert:YES equals:!CPFeatureIsCompatible(CPHTMLCanvasFeature)];
|
||||
}
|
||||
//}
|
||||
[self assert:YES equals:!CPFeatureIsCompatible(CPVMLFeature)];
|
||||
}
|
||||
|
||||
|
||||
@@ -875,8 +875,9 @@
|
||||
|
||||
- (void)testObservationDuringSetSelectionIndexes
|
||||
{
|
||||
var arrayController = [self arrayController],
|
||||
newContent = [self setupObservationFixture];
|
||||
var arrayController = [self arrayController];
|
||||
|
||||
[self setupObservationFixture];
|
||||
|
||||
var newSelection = [CPIndexSet indexSetWithIndex:2];
|
||||
[arrayController setSelectionIndexes:newSelection];
|
||||
@@ -1142,6 +1143,7 @@
|
||||
[self setItemsArray:[]];
|
||||
var ddd = new Date();
|
||||
|
||||
console.log();
|
||||
CPLog.warn("\n" + [self className] + " Performance tests");
|
||||
CPLog.warn("EmptyArray -> BigArray (" + [bigArray count] + "): " + (dd - d) + "ms.");
|
||||
CPLog.warn("BigArray (" + [bigArray count] + ") -> EmptyArray: " + (ddd - dd) + "ms.");
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
@import <AppKit/CPButton.j>
|
||||
@import <AppKit/CPApplication.j>
|
||||
@import <AppKit/CPText.j>
|
||||
@import <AppKit/CPRadio.j>
|
||||
@import <AppKit/CPObjectController.j>
|
||||
|
||||
@implementation CPButtonTest : OJTestCase
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
var archived = [CPKeyedArchiver archivedDataWithRootObject:colorWell],
|
||||
unarchived = [CPKeyedUnarchiver unarchiveObjectWithData:archived];
|
||||
|
||||
[self assertNotNull:unarchived];
|
||||
[self assertFalse:[colorWell isBordered] message:"color well archived bordered state"];
|
||||
[self assert:[CPColor greenColor] equals:[colorWell color] message:"color well archived color"];
|
||||
}
|
||||
|
||||
@@ -109,6 +109,8 @@
|
||||
// this code should run with or without that connection.
|
||||
var cib = [CPBundle loadCibFile:[[CPBundle bundleForClass:CPKeyValueBindingSimpleBindingsTest] pathForResource:"SimpleBindingsAdoption_03.cib"] externalNameTable:@{ CPCibOwner: self }];
|
||||
|
||||
[self assertNotNull:cib];
|
||||
|
||||
// Test the interaction.
|
||||
[textField setStringValue:@"0.7"];
|
||||
// Simulate user interaction. By default bindings update on action only.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
@import <AppKit/CPApplication.j>
|
||||
@import <AppKit/CPKeyValueBinding.j>
|
||||
@import <AppKit/CPTextField.j>
|
||||
|
||||
@@ -13,6 +14,7 @@
|
||||
@import <AppKit/CPClipView.j>
|
||||
@import <AppKit/CPTableView.j>
|
||||
@import <AppKit/CPArrayController.j>
|
||||
@import <AppKit/CPSegmentedControl.j>
|
||||
|
||||
@implementation CPKeyValueBindingTest : OJTestCase
|
||||
{
|
||||
@@ -358,7 +360,11 @@
|
||||
[segmented bind:CPSelectedIndexBinding toObject:model withKeyPath:@"cheese" options:nil];
|
||||
|
||||
// Try to bind another binding (mutually exclusive) to the same value.
|
||||
// Turn off logging so we don't get the warning about this
|
||||
var saveCPLogDisable = CPLogDisable;
|
||||
CPLogDisable = YES;
|
||||
[segmented bind:CPSelectedTagBinding toObject:model withKeyPath:@"cheese" options:nil];
|
||||
CPLogDisable = saveCPLogDisable;
|
||||
|
||||
[self assertNotNull:[segmented infoForBinding:CPSelectedIndexBinding]];
|
||||
|
||||
|
||||
@@ -286,6 +286,8 @@
|
||||
outlineView = decoded;
|
||||
// Expansion state does not archive.
|
||||
[outlineView expandItem:nil expandChildren:YES];
|
||||
// Set the datasource or we will get warnings about this.
|
||||
[outlineView setDataSource:dataSource];
|
||||
// While not exhaustive, if this test works nothing is majorly broken with the unarchived outline view.
|
||||
[self testCollapse];
|
||||
}
|
||||
|
||||
@@ -229,7 +229,6 @@
|
||||
documentView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 1000, 1000)],
|
||||
textField1 = [CPTextField textFieldWithStringValue:@"Martin" placeholder:@"" width:10],
|
||||
textField2 = [CPTextField textFieldWithStringValue:@"Malte" placeholder:@"" width:10],
|
||||
textField1Size = CGSizeMakeCopy([textField1 bounds].size),
|
||||
textField2Size = CGSizeMakeCopy([textField2 bounds].size);
|
||||
|
||||
[scrollView setDocumentView:documentView];
|
||||
@@ -277,9 +276,7 @@
|
||||
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)],
|
||||
documentView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 1000, 1000)],
|
||||
view1 = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)],
|
||||
view2 = [[CPView alloc] initWithFrame:CGRectMake(500, 500, 200, 200)],
|
||||
view1Size = CGSizeMakeCopy([view1 bounds].size),
|
||||
view2Size = CGSizeMakeCopy([view2 bounds].size);
|
||||
view2 = [[CPView alloc] initWithFrame:CGRectMake(500, 500, 200, 200)];
|
||||
|
||||
[scrollView setDocumentView:documentView];
|
||||
|
||||
@@ -289,8 +286,7 @@
|
||||
[documentView addSubview:view1];
|
||||
[documentView addSubview:view2];
|
||||
|
||||
var visibleRect = [documentView visibleRect],
|
||||
originalVisibleSize = CGSizeMakeCopy(visibleRect.size);
|
||||
var visibleRect = [documentView visibleRect];
|
||||
|
||||
// Make sure we are at the top left corner
|
||||
[self assertPoint:CGPointMake(0, 0) equals:visibleRect.origin message:@"VisibleRect origin not at top left corner"];
|
||||
|
||||
@@ -194,7 +194,6 @@
|
||||
|
||||
for (var row = 0; row < 50; row++)
|
||||
{
|
||||
var column = row * 2;
|
||||
contentArray.push([CPDictionary dictionaryWithObjects:["R" + row + "C0", "R" + row + "C1"] forKeys:["c1", "c2"]]);
|
||||
}
|
||||
[arrayController setContent:contentArray];
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@import <AppKit/CPApplication.j>
|
||||
@import <AppKit/CPTextView.j>
|
||||
@import <OJMoq/OJMoq.j>
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ var methodsCalled;
|
||||
CPBundle bundle;
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
- (async void)setUp
|
||||
{
|
||||
bundle = [CPBundle bundleWithPath:@"Tests/AppKit/BundleTest"];
|
||||
[bundle loadWithDelegate:self];
|
||||
await [bundle loadWithDelegate:self];
|
||||
}
|
||||
|
||||
- (void)bundleDidFinishLoading:(CPBundle)aBundle
|
||||
|
||||
@@ -932,7 +932,7 @@ var updateTrackingAreasCalls,
|
||||
|
||||
[view1 setHidden:YES];
|
||||
[view2 addSubview:view3];
|
||||
CPLog.warn("will add view2");
|
||||
|
||||
[view1 addSubview:view2];
|
||||
|
||||
[self assertTrue: [view2 isHiddenOrHasHiddenAncestor] message:@"Expected " + [view2 identifier] + "isHiddenOrHasHiddenAncestor = YES"];
|
||||
|
||||
+3
-2
@@ -38,8 +38,9 @@
|
||||
|
||||
- (void)test
|
||||
{
|
||||
var theDocument = [MyDocument new],
|
||||
cib = [CPBundle loadCibFile:[[CPBundle bundleForClass:WithoutBindingsTest] pathForResource:"01_WithoutBindings.cib"] externalNameTable:[CPDictionary dictionaryWithObject:theDocument forKey:CPCibOwner]];
|
||||
var theDocument = [MyDocument new];
|
||||
|
||||
[CPBundle loadCibFile:[[CPBundle bundleForClass:WithoutBindingsTest] pathForResource:"01_WithoutBindings.cib"] externalNameTable:[CPDictionary dictionaryWithObject:theDocument forKey:CPCibOwner]];
|
||||
|
||||
[theDocument windowControllerDidLoadCib:self];
|
||||
|
||||
|
||||
@@ -40,8 +40,9 @@
|
||||
|
||||
- (void)test
|
||||
{
|
||||
var theDocument = [MyDocument2 new],
|
||||
cib = [CPBundle loadCibFile:[[CPBundle bundleForClass:WithBindingsTest] pathForResource:"02_WithBindings.cib"] externalNameTable:[CPDictionary dictionaryWithObject:theDocument forKey:CPCibOwner]];
|
||||
var theDocument = [MyDocument2 new];
|
||||
|
||||
[CPBundle loadCibFile:[[CPBundle bundleForClass:WithBindingsTest] pathForResource:"02_WithBindings.cib"] externalNameTable:[CPDictionary dictionaryWithObject:theDocument forKey:CPCibOwner]];
|
||||
|
||||
[theDocument windowControllerDidLoadCib:self];
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
var FILE = require("file");
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
|
||||
@import <Foundation/CPArray.j>
|
||||
@import <Foundation/CPString.j>
|
||||
@@ -33,6 +34,7 @@ var ELEMENTS = 100,
|
||||
|
||||
- (void)testAlmostSortedNumericUsingMergeSort
|
||||
{
|
||||
console.log();
|
||||
CPLog.warn("\nNUMERIC ALMOST SORTED");
|
||||
var a = [self makeUnsorted],
|
||||
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingDescriptors:) withObject:descriptors];
|
||||
@@ -48,6 +50,7 @@ var ELEMENTS = 100,
|
||||
|
||||
- (void)testRandomNumericUsingMergeSort
|
||||
{
|
||||
console.log();
|
||||
CPLog.warn("\nNUMERIC RANDOM");
|
||||
var a = [self makeRandomNumeric],
|
||||
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingDescriptors:) withObject:descriptors];
|
||||
@@ -63,6 +66,7 @@ var ELEMENTS = 100,
|
||||
|
||||
- (void)testRandomTextUsingMergeSort
|
||||
{
|
||||
console.log();
|
||||
CPLog.warn("\nTEXT RANDOM");
|
||||
var a = [self makeRandomText],
|
||||
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingDescriptors:) withObject:descriptors];
|
||||
@@ -78,6 +82,7 @@ var ELEMENTS = 100,
|
||||
|
||||
- (void)testAlmostSortedNumericUsingMergeSelectorSort
|
||||
{
|
||||
console.log();
|
||||
CPLog.warn("\nNUMERIC ALMOST SORTED (SELECTOR)");
|
||||
var a = [self makeUnsorted],
|
||||
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingSelector:) withObject:@selector(compareAAscendingThenBDescending:)];
|
||||
@@ -93,6 +98,7 @@ var ELEMENTS = 100,
|
||||
|
||||
- (void)testRandomNumericUsingMergeSelectorSort
|
||||
{
|
||||
console.log();
|
||||
CPLog.warn("\nNUMERIC RANDOM (SELECTOR)");
|
||||
var a = [self makeRandomNumeric],
|
||||
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingSelector:) withObject:@selector(compareAAscendingThenBDescending:)];
|
||||
@@ -108,6 +114,7 @@ var ELEMENTS = 100,
|
||||
|
||||
- (void)testRandomTextUsingMergeSelectorSort
|
||||
{
|
||||
console.log();
|
||||
CPLog.warn("\nTEXT RANDOM (SELECTOR)");
|
||||
var a = [self makeRandomText],
|
||||
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingSelector:) withObject:@selector(compareAAscendingThenBDescending:)];
|
||||
@@ -173,7 +180,7 @@ var ELEMENTS = 100,
|
||||
|
||||
- (CPArray)makeRandomText
|
||||
{
|
||||
var the_big_sort = FILE.read(FILE.join(FILE.dirname(module.path), "the_big_sort.txt"), { charset:"UTF-8" }),
|
||||
var the_big_sort = fs.readFileSync(path.join(path.dirname(__filename), "the_big_sort.txt"), {encoding: 'utf-8'}),
|
||||
words = the_big_sort.split(" ", ELEMENTS),
|
||||
wordcount = words.length,
|
||||
array = [];
|
||||
@@ -254,6 +261,7 @@ var ELEMENTS = 100,
|
||||
test2 = [array objectsAtIndexes:indexes];
|
||||
var ddd = new Date();
|
||||
|
||||
console.log();
|
||||
CPLog.warn("\n_CPJavaScriptArray -objectsAtIndexes:");
|
||||
CPLog.warn(" CPArray -objectsAtIndexes: " + (dd - d) + "ms.");
|
||||
CPLog.warn("_CPJavaScriptArray -objectsAtIndexes: " + (ddd - dd) + "ms.");
|
||||
@@ -298,6 +306,7 @@ var ELEMENTS = 100,
|
||||
}
|
||||
var ddd = new Date();
|
||||
|
||||
console.log();
|
||||
CPLog.warn("\n_CPJavaScriptArray -removeObjectIdenticalTo:");
|
||||
CPLog.warn(" CPArray -removeObjectIdenticalTo: " + (dd - d) + "ms.");
|
||||
CPLog.warn("_CPJavaScriptArray -removeObjectIdenticalTo: " + (ddd - dd) + "ms.");
|
||||
|
||||
@@ -27,22 +27,22 @@
|
||||
|
||||
- (void)testCreationMainBundle
|
||||
{
|
||||
var bundle = [CPBundle mainBundle];
|
||||
[CPBundle mainBundle];
|
||||
}
|
||||
|
||||
- (void)testLoadingBundle
|
||||
- (async void)testLoadingBundle
|
||||
{
|
||||
var bundle = [CPBundle bundleWithPath:@"Tests/Foundation/BundleTest"];
|
||||
[bundle loadWithDelegate:self];
|
||||
await [bundle loadWithDelegate:self];
|
||||
|
||||
[self assert:[bundle objectForInfoDictionaryKey:"CPBundleDefaultLanguage"] equals:"fr"];
|
||||
[self assert:[bundle objectForInfoDictionaryKey:"CPBundleLocalizableStrings"] equals:["Localizable.strings"]];
|
||||
}
|
||||
|
||||
- (void)testLocalization
|
||||
- (async void)testLocalization
|
||||
{
|
||||
var bundle = [CPBundle bundleWithPath:@"Tests/Foundation/BundleTest"];
|
||||
[bundle loadWithDelegate:self];
|
||||
await [bundle loadWithDelegate:self];
|
||||
|
||||
[self assert:[bundle localizedStringForKey:"Label from file" value:"" table:"Localizable"] equals:"Label traduit de fr.lproj du premier context"];
|
||||
[self assert:[bundle localizedStringForKey:"Wrong key" value:"Default value" table:"Localizable"] equals:"Default value"];
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
@import <Foundation/CPKeyedArchiver.j>
|
||||
@import <Foundation/CPNumber.j>
|
||||
|
||||
@global require;
|
||||
|
||||
@implementation CPDataTest : OJTestCase
|
||||
{
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
- (void)testInitWithString
|
||||
{
|
||||
var tests = [
|
||||
["1800-01-01 00:00:00 +0000", -5364662400],
|
||||
["1900-01-01 00:00:00 +0000", -2208988800],
|
||||
["1970-01-01 00:00:00 +0000", 0],
|
||||
["1970-01-01 00:01:00 +0000", 60],
|
||||
["1970-01-01 01:00:00 +0000", 60 * 60],
|
||||
|
||||
@@ -418,7 +418,6 @@
|
||||
// test addition of positives
|
||||
var d1 = CPDecimalMakeWithString(@"1"),
|
||||
d2 = CPDecimalMakeWithParts(1, 0),
|
||||
dcm = CPDecimalMakeZero(),
|
||||
i = 50;
|
||||
while (i--)
|
||||
[self assert:CPDecimalAdd(d1, d1, d2, CPRoundPlain) equals:CPCalculationNoError message:"CPDecimalAdd() Tap1: addition"];
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
|
||||
- (void)testDictionaryWithJSObjectNonRecursive
|
||||
{
|
||||
var non_recursive_dict = [CPDictionary dictionaryWithJSObject:json recursively:NO];
|
||||
[CPDictionary dictionaryWithJSObject:json recursively:NO];
|
||||
}
|
||||
|
||||
- (void)testCopy
|
||||
|
||||
@@ -307,7 +307,6 @@
|
||||
|
||||
- (void)testCPPointMakeZero
|
||||
{
|
||||
var point = CGPointMake(10, 20);
|
||||
[self assertTrue:CGPointEqualToPoint(CGPointMake(0, 0), CPPointMakeZero(0, 0))];
|
||||
}
|
||||
|
||||
|
||||
@@ -333,8 +333,7 @@ var COUNTER;
|
||||
|
||||
- (void)testKVCCountArrayOperators
|
||||
{
|
||||
var one = [1, 1, 1, 1, 1, 1, 1, 1],
|
||||
two = [1, 2, 3, 4, 8, 0];
|
||||
var one = [1, 1, 1, 1, 1, 1, 1, 1];
|
||||
|
||||
[self assert:[one valueForKey:"@count"] equals:8];
|
||||
|
||||
@@ -345,8 +344,7 @@ var COUNTER;
|
||||
|
||||
- (void)testKVCSumArrayOperators
|
||||
{
|
||||
var one = [1, 1, 1, 1, 1, 1, 1, 1],
|
||||
two = [1, 2, 3, 4, 8, 0];
|
||||
var one = [1, 1, 1, 1, 1, 1, 1, 1];
|
||||
|
||||
[self assert:[one valueForKeyPath:"@sum.intValue"] equals:8];
|
||||
|
||||
@@ -363,8 +361,7 @@ var COUNTER;
|
||||
|
||||
- (void)testKVCAvgArrayOperators
|
||||
{
|
||||
var one = [1, 1, 1, 1, 1, 1, 1, 1],
|
||||
two = [1, 2, 3, 4, 8, 0];
|
||||
var two = [1, 2, 3, 4, 8, 0];
|
||||
|
||||
[self assert:[two valueForKeyPath:"@avg.intValue"] equals:3];
|
||||
|
||||
@@ -377,8 +374,7 @@ var COUNTER;
|
||||
|
||||
- (void)testKVCMinArrayOperators
|
||||
{
|
||||
var one = [1, 1, 1, 1, 1, 1, 1, 1],
|
||||
two = [1, 2, 3, 4, 8, 0];
|
||||
var two = [1, 2, 3, 4, 8, 0];
|
||||
|
||||
[self assert:[two valueForKeyPath:"@min.intValue"] equals:0];
|
||||
|
||||
@@ -392,8 +388,7 @@ var COUNTER;
|
||||
|
||||
- (void)testKVCMaxArrayOperators
|
||||
{
|
||||
var one = [1, 1, 1, 1, 1, 1, 1, 1],
|
||||
two = [1, 2, 3, 4, 8, 0];
|
||||
var two = [1, 2, 3, 4, 8, 0];
|
||||
|
||||
[self assert:[two valueForKeyPath:"@max.intValue"] equals:8];
|
||||
|
||||
|
||||
@@ -284,8 +284,7 @@ var _getCheeseCounter;
|
||||
- (void)testOnlyInsertObject_AtKeyIndex_Implemented
|
||||
{
|
||||
var insertSelector = @selector(insertObject:inObjectsAtIndex:),
|
||||
object = [self objectWithMethods:insertSelector],
|
||||
methodTypes = class_getInstanceMethod(object.isa, insertSelector).method_types;
|
||||
object = [self objectWithMethods:insertSelector];
|
||||
|
||||
// Sanity check
|
||||
[self assert:class_getInstanceMethod(object.isa, insertSelector)
|
||||
|
||||
@@ -257,8 +257,7 @@
|
||||
|
||||
- (void)testKVCSumSetOperators
|
||||
{
|
||||
var one = [CPSet setWithArray:[@"one", @"two", @"three"]],
|
||||
two = [CPSet setWithArray:[1, 2, 3, 4, 8, 0]];
|
||||
var two = [CPSet setWithArray:[1, 2, 3, 4, 8, 0]];
|
||||
|
||||
[self assert:[two valueForKeyPath:"@sum.intValue"] equals:18];
|
||||
|
||||
@@ -271,8 +270,7 @@
|
||||
|
||||
- (void)testKVCAvgSetOperators
|
||||
{
|
||||
var one = [CPSet setWithArray:[@"one", @"two", @"three"]],
|
||||
two = [CPSet setWithArray:[1, 2, 3, 4, 8, 0]];
|
||||
var two = [CPSet setWithArray:[1, 2, 3, 4, 8, 0]];
|
||||
|
||||
[self assert:[two valueForKeyPath:"@avg.doubleValue"] equals:3.0];
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
var timeZone = [CPTimeZone timeZoneWithName:nil];
|
||||
[CPTimeZone timeZoneWithName:nil];
|
||||
[self fail:"Invalid value provided for tzName"];
|
||||
}
|
||||
catch (e)
|
||||
@@ -140,7 +140,7 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
var timeZone = [CPTimeZone timeZoneWithName:nil data:_data];
|
||||
[CPTimeZone timeZoneWithName:nil data:_data];
|
||||
[self fail:"Invalid value provided for tzName"];
|
||||
}
|
||||
catch (e)
|
||||
@@ -204,7 +204,7 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
var timeZone = [[CPTimeZone alloc] initWithName:nil];
|
||||
[[CPTimeZone alloc] initWithName:nil];
|
||||
[self fail:"Invalid value provided for tzName"];
|
||||
}
|
||||
catch (e)
|
||||
@@ -248,7 +248,7 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
var timeZone = [[CPTimeZone alloc] initWithName:nil data:_data];
|
||||
[[CPTimeZone alloc] initWithName:nil data:_data];
|
||||
[self fail:"Invalid value provided for tzName"];
|
||||
}
|
||||
catch (e)
|
||||
@@ -260,9 +260,10 @@
|
||||
- (void)testAbbreviationWithDate
|
||||
{
|
||||
var timeZone = [CPTimeZone localTimeZone],
|
||||
abbreviation = [timeZone abbreviationForDate:_date];
|
||||
abbreviation = [timeZone abbreviationForDate:_date],
|
||||
expected = _date.toLocaleString('en-US', {timeZoneName : 'long'}).replace(/^([0]?\d|[1][0-2])\/((?:[0]?|[1-2])\d|[3][0-1])\/([2][01]|[1][6-9])\d{2}(,?\s*([0]?\d|[1][0-2])(\:[0-5]\d){1,2})*\s*([aApP][mM]{0,2})?\s*/, "").split(" ").map(function(l) { return l[0]}).join("");
|
||||
|
||||
[self assert:abbreviation equals:String(String(_date).split("(")[1]).split(")")[0]];
|
||||
[self assert:abbreviation equals:expected];
|
||||
}
|
||||
|
||||
- (void)testAbbreviationWithNilDate
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
- (void)testSynchronousRequestSuccess
|
||||
{
|
||||
var req = [CPURLRequest requestWithURL:@"Tests/Foundation/CPURLConnectionTest.j"],
|
||||
var req = [CPURLRequest requestWithURL:@"file:Tests/Foundation/CPURLConnectionTest.j"],
|
||||
data = [CPURLConnection sendSynchronousRequest:req returningResponse:nil];
|
||||
|
||||
[self assert:CPData equals:[data class]];
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
- (void)testSynchronousRequestNotFound
|
||||
{
|
||||
var req = [CPURLRequest requestWithURL:@"NotFound"],
|
||||
var req = [CPURLRequest requestWithURL:@"file:NotFound"],
|
||||
data = [CPURLConnection sendSynchronousRequest:req returningResponse:nil];
|
||||
|
||||
[self assertNull:data];
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
- (void)testClassMethodConnectionWithCredentials
|
||||
{
|
||||
var req = [CPURLRequest requestWithURL:[CPURL URLWithString:@"Tests/Foundation/CPURLConnectionTest.j"]];
|
||||
var req = [CPURLRequest requestWithURL:[CPURL URLWithString:@"file:Tests/Foundation/CPURLConnectionTest.j"]];
|
||||
[req setWithCredentials:YES];
|
||||
var data = [CPURLConnection sendSynchronousRequest:req returningResponse:nil];
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
- (void)testInstanceMethodConnectionWithCredentials
|
||||
{
|
||||
var req = [CPURLRequest requestWithURL:[CPURL URLWithString:@"Tests/Foundation/CPURLConnectionTest.j"]];
|
||||
var req = [CPURLRequest requestWithURL:[CPURL URLWithString:@"file:Tests/Foundation/CPURLConnectionTest.j"]];
|
||||
[req setWithCredentials:YES];
|
||||
|
||||
var conn = [[CPURLConnection alloc] initWithRequest:req delegate:nil startImmediately:NO];
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
- (void)testRequestGetters
|
||||
{
|
||||
var req = [CPURLRequest requestWithURL:[CPURL URLWithString:@"Tests/Foundation/CPURLConnectionTest.j"]],
|
||||
var req = [CPURLRequest requestWithURL:[CPURL URLWithString:@"file:Tests/Foundation/CPURLConnectionTest.j"]],
|
||||
conn = [[CPURLConnection alloc] initWithRequest:req delegate:nil startImmediately:NO];
|
||||
|
||||
var originalRequest = [conn originalRequest],
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
@global module
|
||||
|
||||
var FILE = require("file"),
|
||||
FileList = require("jake").FileList;
|
||||
var fs = require("fs"),
|
||||
path = require("path"),
|
||||
FileList = ObjectiveJ.utils.filelist.FileList;
|
||||
|
||||
@implementation CFPropertyListTest : OJTestCase
|
||||
|
||||
- (void)testFormatSniffing
|
||||
{
|
||||
var XMLPropertyLists = new FileList(FILE.join(FILE.dirname(module.path), "PropertyLists", "XML-*.plist"));
|
||||
var XMLPropertyLists = new FileList(path.join(path.dirname(__filename), "PropertyLists", "XML-*.plist"));
|
||||
|
||||
XMLPropertyLists.forEach(function(/*String*/ aPath)
|
||||
{
|
||||
[self assert:CFPropertyList.FormatXML_v1_0 equals:CFPropertyList.sniffedFormatOfString(FILE.read(aPath))];
|
||||
[self assert:CFPropertyList.FormatXML_v1_0 equals:CFPropertyList.sniffedFormatOfString(fs.readFileSync(aPath).toString())];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)testDateDeserialization
|
||||
{
|
||||
var path = FILE.join(FILE.dirname(module.path), "PropertyLists/XMLDate.plist"),
|
||||
object = CFPropertyList.readPropertyListFromFile(path),
|
||||
var p = path.join(path.dirname(__filename), "PropertyLists/XMLDate.plist"),
|
||||
object = CFPropertyList.readPropertyListFromFile(p),
|
||||
date = [object objectForKey:@"date"];
|
||||
|
||||
[self assert:[CPDate class] equals:[date class]];
|
||||
@@ -26,26 +27,21 @@ var FILE = require("file"),
|
||||
}
|
||||
|
||||
- (void)testPropertyListFromXMLShouldHandleEmptyXMLGracefully {
|
||||
// rhino can't parse empty XML documents
|
||||
if (system.engine !== "rhino") {
|
||||
var XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">",
|
||||
object = CFPropertyList.propertyListFromXML(XML);
|
||||
|
||||
[self assert:object equals:null];
|
||||
}
|
||||
var XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">",
|
||||
object = CFPropertyList.propertyListFromXML(XML);
|
||||
|
||||
[self assert:object equals:null];
|
||||
}
|
||||
|
||||
- (void)testPropertyListFromXMLShouldHandleEmptierXMLGracefully {
|
||||
// rhino can't parse empty XML documents
|
||||
if (system.engine !== "rhino") {
|
||||
var XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
|
||||
object = CFPropertyList.propertyListFromXML(XML);
|
||||
|
||||
[self assert:object equals:null];
|
||||
}
|
||||
var XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
|
||||
object = CFPropertyList.propertyListFromXML(XML);
|
||||
|
||||
[self assert:object equals:null];
|
||||
}
|
||||
|
||||
- (void)testPropertyListFromXMLShouldHandleEmptiestXMLGracefully {
|
||||
// This is removed as the Node module xmldom/xmldom will print out an error (will not fail) when the xml string is empty
|
||||
/*- (void)testPropertyListFromXMLShouldHandleEmptiestXMLGracefully {
|
||||
// rhino can't parse empty XML documents
|
||||
if (system.engine !== "rhino") {
|
||||
var XML = "",
|
||||
@@ -53,7 +49,7 @@ var FILE = require("file"),
|
||||
|
||||
[self assert:object equals:null];
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
- (void)testPropertyListFromXMLShouldParseNiceAndCleanXML {
|
||||
var XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version=\"1.0\"><dict><key>Main cib file base name</key><string>MainMenu.cib</string><key>CPBundleName</key><string>CopyAndPaste</string><key>CPBundleVersion</key><string>1.0</string><key>CPHumanReadableCopyright</key><string>Copyright \u00a9 2013, SlevenBits, Ltd. All rights reserved.</string></dict></plist>",
|
||||
|
||||
@@ -45,17 +45,19 @@ objj_test_decorator = function(msgSend)
|
||||
{
|
||||
objj_msgSend_decorate(objj_test_decorator);
|
||||
var a = [TestClass0 new];
|
||||
[self assert:[a intify:3] equals:6];
|
||||
// The compiler might inline the 'message send' call so we do it manually here
|
||||
[self assert:a.isa.objj_msgSend1(a, "intify:", 3) /*[a intify:3]*/ equals:6];
|
||||
[self assert:SEEN_MESSAGES equals:[[a, @selector(intify:)]]];
|
||||
}
|
||||
|
||||
- (void)test_objj_msgSend_decorate_should_replace_fast_msgSend_for_initialised_class
|
||||
{
|
||||
var a = [TestClass1 new];
|
||||
[a intify:5];
|
||||
a.isa.objj_msgSend1(a, "intify:", 5) /*[a intify:5]*/;
|
||||
|
||||
objj_msgSend_decorate(objj_test_decorator);
|
||||
[self assert:[a intify:3] equals:6];
|
||||
// The compiler might inline the 'message send' call so we do it manually here
|
||||
[self assert:a.isa.objj_msgSend1(a, "intify:", 3) /*[a intify:3]*/ equals:6];
|
||||
[self assert:SEEN_MESSAGES equals:[[a, @selector(intify:)]]];
|
||||
}
|
||||
|
||||
@@ -63,9 +65,11 @@ objj_test_decorator = function(msgSend)
|
||||
{
|
||||
objj_msgSend_decorate(objj_test_decorator);
|
||||
var a = [TestClass1 new];
|
||||
[self assert:[a intify:3] equals:6];
|
||||
// The compiler might inline the 'message send' call so we do it manually here
|
||||
[self assert:a.isa.objj_msgSend1(a, "intify:", 3) /*[a intify:3]*/ equals:6];
|
||||
objj_msgSend_reset();
|
||||
[self assert:[a intify:3] equals:6];
|
||||
// The compiler might inline the 'message send' call so we do it manually here
|
||||
[self assert:a.isa.objj_msgSend1(a, "intify:", 3) /*[a intify:3]*/ equals:6];
|
||||
[self assert:SEEN_MESSAGES equals:[[a, @selector(intify:)]]];
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ class_addMethods(the_class,[new objj_method(sel_getUid("mySelector"),function $M
|
||||
(_1.isa.method_msgSend["init"]||_objj_forward)(_1,"init");
|
||||
_1=nil;
|
||||
(_1==null?_1:(_1.isa.method_msgSend["init"]||_objj_forward)(_1,"init"));
|
||||
},["id"]),new objj_method(sel_getUid("mySelector2"),function $MyClass__mySelector2(_3,_4){
|
||||
(_3.isa.method_msgSend["init"]||_objj_forward)(_3,"init");
|
||||
},["id"]),new objj_method(sel_getUid("mySelector2"),function $MyClass__mySelector2(self,_cmd){
|
||||
(self.isa.method_msgSend["init"]||_objj_forward)(self,"init");
|
||||
eval("self = null;");
|
||||
(_3==null?_3:(_3.isa.method_msgSend["init"]||_objj_forward)(_3,"init"));
|
||||
(self==null?self:(self.isa.method_msgSend["init"]||_objj_forward)(self,"init"));
|
||||
},["id"])]);
|
||||
@@ -4,8 +4,8 @@ class_addMethods(the_class,[new objj_method(sel_getUid("mySelector"),function $M
|
||||
_1.isa.objj_msgSend0(_1,"init");
|
||||
_1=nil;
|
||||
(_1==null?_1:_1.isa.objj_msgSend0(_1,"init"));
|
||||
},["id"]),new objj_method(sel_getUid("mySelector2"),function $MyClass__mySelector2(_3,_4){
|
||||
_3.isa.objj_msgSend0(_3,"init");
|
||||
},["id"]),new objj_method(sel_getUid("mySelector2"),function $MyClass__mySelector2(self,_cmd){
|
||||
self.isa.objj_msgSend0(self,"init");
|
||||
eval("self = null;");
|
||||
(_3==null?_3:_3.isa.objj_msgSend0(_3,"init"));
|
||||
(self==null?self:self.isa.objj_msgSend0(self,"init"));
|
||||
},["id"])]);
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
- (id)a
|
||||
{
|
||||
@ref(_control);
|
||||
var x = @ref(_control);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_control","id")]);objj_registerClassPair(the_class);
|
||||
class_addMethods(the_class, [new objj_method(sel_getUid("a"), function $TC__a(self, _cmd)
|
||||
{
|
||||
function(__input) { if (arguments.length) return self._control = __input; return self._control; };
|
||||
var x = function(__input) { if (arguments.length) return self._control = __input; return self._control; };
|
||||
}
|
||||
|
||||
,["id"])]);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
var FILE = require("file"),
|
||||
compressor = require("minify/shrinksafe");
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var terser = require("terser");
|
||||
|
||||
var FILENAMES = [
|
||||
"Class/root-class",
|
||||
@@ -30,6 +31,11 @@ var FILENAMES = [
|
||||
{
|
||||
}
|
||||
|
||||
async function compressor(srcCode) {
|
||||
var m = await terser.minify(srcCode, { keep_fnames: false, mangle: { properties: true }, toplevel: true });
|
||||
return m.code;
|
||||
}
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
var index = 0,
|
||||
@@ -42,26 +48,26 @@ var FILENAMES = [
|
||||
var filename = FILENAMES[index],
|
||||
testSelector = sel_getUid("test" + FILENAMES[index]);
|
||||
|
||||
class_addMethod(self, testSelector, function(self, _cmd)
|
||||
class_addMethod(self, testSelector, async function(self, _cmd)
|
||||
{
|
||||
var d = FILE.dirname(module.path),
|
||||
filePath = FILE.join(d, filename + ".j"),
|
||||
unpreprocessed = FILE.read(filePath, { charset:"UTF-8" }),
|
||||
var d = path.dirname(__filename),
|
||||
filePath = path.join(d, filename + ".j"),
|
||||
unpreprocessed = fs.readFileSync(filePath, {encoding: "utf8"}),
|
||||
preprocessed,
|
||||
preprocessedInlined,
|
||||
correct = FILE.read(FILE.join(d, filename + ".js")),
|
||||
p = FILE.join(d, filename + "-inlined.js"),
|
||||
correctInlined = FILE.exists(p) ? FILE.read(p) : correct; // Get inlined version if it exists. Otherwise use the regular one.
|
||||
correct = fs.readFileSync(path.join(d, filename + ".js"), {encoding: "utf8"}),
|
||||
p = path.join(d, filename + "-inlined.js"),
|
||||
correctInlined = fs.existsSync(p) ? fs.readFileSync(p, {encoding: "utf8"}) : correct; // Get inlined version if it exists. Otherwise use the regular one.
|
||||
|
||||
[self assertNoThrow:function() {
|
||||
preprocessed = ObjectiveJ.ObjJCompiler.compileToExecutable(unpreprocessed, nil, {includeMethodFunctionNames: true, includeMethodArgumentTypeSignatures: true, includeIvarTypeSignatures: true, inlineMsgSendFunctions: false, transformNamedFunctionDeclarationToAssignment: true}).code();
|
||||
preprocessed = compressor.compress(preprocessed, { charset : "UTF-8", useServer : true });
|
||||
correct = compressor.compress(correct, { charset : "UTF-8", useServer : true });
|
||||
await [self assertNoThrow: async function() {
|
||||
preprocessed = ObjectiveJ.ObjJCompiler.compile(unpreprocessed, nil, {includeMethodFunctionNames: true, includeMethodArgumentTypeSignatures: true, includeIvarTypeSignatures: true, inlineMsgSendFunctions: false, transformNamedFunctionDeclarationToAssignment: true, acornOptions: {ecmaVersion: 2022}}).jsBuffer.toString();
|
||||
preprocessed = await compressor(preprocessed);
|
||||
correct = await compressor(correct);
|
||||
|
||||
// Get an Inlined version
|
||||
preprocessedInlined = ObjectiveJ.ObjJCompiler.compileToExecutable(unpreprocessed, nil, {includeMethodFunctionNames: true, includeMethodArgumentTypeSignatures: true, includeIvarTypeSignatures: true, inlineMsgSendFunctions: true, transformNamedFunctionDeclarationToAssignment:true}).code();
|
||||
preprocessedInlined = compressor.compress(preprocessedInlined, { charset : "UTF-8", useServer : true });
|
||||
correctInlined = compressor.compress(correctInlined, { charset : "UTF-8", useServer : true });
|
||||
preprocessedInlined = ObjectiveJ.ObjJCompiler.compile(unpreprocessed, nil, {includeMethodFunctionNames: true, includeMethodArgumentTypeSignatures: true, includeIvarTypeSignatures: true, inlineMsgSendFunctions: true, transformNamedFunctionDeclarationToAssignment: true, acornOptions: {ecmaVersion: 2022}}).jsBuffer.toString();
|
||||
preprocessedInlined = await compressor(preprocessedInlined);
|
||||
correctInlined = await compressor(correctInlined);
|
||||
}];
|
||||
|
||||
[self assert:correct equals:preprocessed];
|
||||
|
||||
+44
-36
@@ -1,15 +1,17 @@
|
||||
var OS = require("os");
|
||||
var FILE = require("file");
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var childProcess = require("child_process");
|
||||
var utilsFile = ObjectiveJ.utils.file;
|
||||
|
||||
function cleanup() {
|
||||
["ToolsTestApp", "PressTestApp", "FlattenTestApp"].forEach(function(dir) {
|
||||
if (FILE.isDirectory(dir))
|
||||
FILE.rmtree(dir);
|
||||
if (fs.existsSync(dir) && fs.lstatSync(dir).isDirectory())
|
||||
utilsFile.rm_rf(dir);
|
||||
});
|
||||
|
||||
["objj2objcskeletonTestFile.h", "objj2objcskeletonTestFile.m", "objj2objcskeletonTestFile.j", "objjWarningTestFile.j", "objjErrorTestFile.j"].forEach(function(file) {
|
||||
if (FILE.isFile(file))
|
||||
FILE.remove(file);
|
||||
if (fs.existsSync(file) && fs.lstatSync(file).isFile())
|
||||
fs.rmSync(file);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,9 +22,9 @@ function cleanup() {
|
||||
- (void)setUp
|
||||
{
|
||||
cleanup();
|
||||
FILE.write("objj2objcskeletonTestFile.j", "@import <Foundation/CPObject.j>\n@import <AppKit/AppKit.j>\n\n\n@implementation AppController : CPObject\n{\n @outlet CPSplitView splitViewA;\n @outlet CPSplitView splitViewB;\n @outlet CPSplitView splitViewC;\n}\n\n@end");
|
||||
FILE.write("objjWarningTestFile.j", "@import <Foundation/Foundation.j>@implementation AppController : CPObject{CPWindow theWindow;}@end");
|
||||
FILE.write("objjErrorTestFile.j", "@implementation AppController : CPObject{}@end");
|
||||
fs.writeFileSync("objj2objcskeletonTestFile.j", "@import <Foundation/CPObject.j>\n@import <AppKit/AppKit.j>\n\n\n@implementation AppController : CPObject\n{\n @outlet CPSplitView splitViewA;\n @outlet CPSplitView splitViewB;\n @outlet CPSplitView splitViewC;\n}\n\n@end");
|
||||
fs.writeFileSync("objjWarningTestFile.j", "@import <Foundation/Foundation.j>@implementation AppController : CPObject{CPWindow theWindow;}@end");
|
||||
fs.writeFileSync("objjErrorTestFile.j", "@implementation AppController : CPObject{}@end");
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
@@ -33,52 +35,58 @@ function cleanup() {
|
||||
- (void)testTools
|
||||
{
|
||||
var status,
|
||||
rootDirectory = FILE.cwd();
|
||||
rootDirectory = process.cwd();
|
||||
|
||||
status = OS.system(["capp", "gen", "ToolsTestApp"].map(OS.enquote).join(" ") + " > /dev/null");
|
||||
[self assert:0 equals:status message:"capp gen failed"];
|
||||
[self assertNoThrow: function() {
|
||||
childProcess.execSync(["capp", "gen", "ToolsTestApp"].map(utilsFile.enquote).join(" ") + " > /dev/null", {stdio: 'inherit'});
|
||||
}];
|
||||
|
||||
status = OS.system(["press", "-f", "ToolsTestApp", "PressTestApp"].map(OS.enquote).join(" ") + " > /dev/null");
|
||||
[self assert:0 equals:status message:"press failed"];
|
||||
//status = childProcess.execSync(["press", "-f", "ToolsTestApp", "PressTestApp"].map(OS.enquote).join(" ") + " > /dev/null", {stdio: 'inherit'});
|
||||
//[self assert:0 equals:status message:"press failed"];
|
||||
|
||||
status = OS.system(["flatten", "-f", "ToolsTestApp", "FlattenTestApp"].map(OS.enquote).join(" ") + " > /dev/null");
|
||||
[self assert:0 equals:status message:"flatten failed"];
|
||||
//status = childProcess.execSync(["flatten", "-f", "ToolsTestApp", "FlattenTestApp"].map(OS.enquote).join(" ") + " > /dev/null", {stdio: 'inherit'});
|
||||
//[self assert:0 equals:status message:"flatten failed"];
|
||||
|
||||
status = OS.system(["objj", "ToolsTestApp/AppController.j"]);
|
||||
[self assert:0 equals:status message:"objj failed"];
|
||||
[self assertNoThrow: function() {
|
||||
childProcess.execSync(["objj", "ToolsTestApp/AppController.j"].map(utilsFile.enquote).join(" "), {stdio: 'ignore'});
|
||||
}];
|
||||
|
||||
status = OS.system(["objj", "-x", "ToolsTestApp/AppController.j"]);
|
||||
[self assert:0 equals:status message:"objj failed"];
|
||||
[self assertNoThrow: function() {
|
||||
childProcess.execSync(["objj", "-x", "ToolsTestApp/AppController.j"].map(utilsFile.enquote).join(" "), {stdio: 'ignore'});
|
||||
}];
|
||||
|
||||
var p = OS.popen(["objj", "--xml", "objjErrorTestFile.j"]);
|
||||
[self assert:1 equals:p.wait() message:"objj failed"];
|
||||
status = [self assertThrows: function() {
|
||||
return childProcess.execSync(["objj", "--xml", "objjErrorTestFile.j"].map(utilsFile.enquote).join(" "), {stdio: 'pipe'});
|
||||
}];
|
||||
[self assert:"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version = \"1.0\"><array><dict><key>line</key><integer>1</integer><key>sourcePath</key><string>" + rootDirectory + "/objjErrorTestFile.j</string><key>message</key><string>\
|
||||
\n@implementation AppController : CPObject{}@end\
|
||||
\n ^\
|
||||
\nERROR line 1 in file:" + rootDirectory + "/objjErrorTestFile.j:1: Can't find superclass CPObject</string></dict></array></plist>\n" equals:p.stdout.read() message:"objj failed"];
|
||||
|
||||
var p = OS.popen(["objj", "-x", "objjWarningTestFile.j"]);
|
||||
var pp = p.stdout.read();
|
||||
[self assert:0 equals:p.wait() message:"objj failed"];
|
||||
\nERROR line 1 in file:" + rootDirectory + "/objjErrorTestFile.j:1: Can't find superclass CPObject</string></dict></array></plist>\n" equals:status.stdout.toString() message:"objj failed"];
|
||||
status = [self assertNoThrow: function() {
|
||||
return childProcess.execSync(["objj", "-x", "objjWarningTestFile.j"].map(utilsFile.enquote).join(" "), {stdio: 'pipe'});
|
||||
}];
|
||||
[self assert:"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version = \"1.0\"><array><dict><key>line</key><integer>1</integer><key>sourcePath</key><string>" + rootDirectory + "/objjWarningTestFile.j</string><key>message</key><string>\n@import <Foundation/Foundation.j>@implementation AppController : CPObject{CPWindow theWindow;}@end\
|
||||
\n ^\
|
||||
\nWARNING line 1 in file:" + rootDirectory + "/objjWarningTestFile.j:1: Unknown type 'CPWindow' for ivar 'theWindow'</string></dict></array></plist>\n" equals:pp message:"objj failed"];
|
||||
\nWARNING line 1 in file:" + rootDirectory + "/objjWarningTestFile.j:1: Unknown type 'CPWindow' for ivar 'theWindow'</string></dict></array></plist>\n" equals:status.toString() message:"objj failed"];
|
||||
|
||||
status = OS.system(["objj", "-m", "ToolsTestApp/AppController.j", "ToolsTestApp/AppController.j"]);
|
||||
[self assert:0 equals:status message:"objj failed with several files"];
|
||||
[self assertNoThrow: function() {
|
||||
childProcess.execSync(["objj", "-m", "ToolsTestApp/AppController.j", "ToolsTestApp/AppController.j"].map(utilsFile.enquote).join(" "), {stdio: 'ignore'});
|
||||
}];
|
||||
|
||||
status = OS.system(["objj", "-I", "ToolsTestApp/Frameworks", "ToolsTestApp/AppController.j"]);
|
||||
[self assert:0 equals:status message:"objj failed with options -I"];
|
||||
[self assertNoThrow: function() {
|
||||
childProcess.execSync(["objj", "-IToolsTestApp/Frameworks", "ToolsTestApp/AppController.j"].map(utilsFile.enquote).join(" "), {stdio: 'ignore'});
|
||||
}];
|
||||
|
||||
status = OS.system(["objj2objcskeleton", "objj2objcskeletonTestFile.j", "."]);
|
||||
[self assert:0 equals:status message:"objj2objcskeleton failed"];
|
||||
[self assertNoThrow: function() {
|
||||
childProcess.execSync(["objj2objcskeleton", "objj2objcskeletonTestFile.j", "."].map(utilsFile.enquote).join(" "), {stdio: 'ignore'});
|
||||
}];
|
||||
|
||||
var contentHeader = FILE.read("objj2objcskeletonTestFile.h"),
|
||||
var contentHeader = fs.readFileSync("objj2objcskeletonTestFile.h").toString(),
|
||||
expectedHeaderResult = "#import <Cocoa/Cocoa.h>\n#import \"xcc_general_include.h\"\n\n@interface AppController : NSObject\n\n@property (assign) IBOutlet NSSplitView* splitViewA;\n@property (assign) IBOutlet NSSplitView* splitViewB;\n@property (assign) IBOutlet NSSplitView* splitViewC;\n\n@end\n";
|
||||
|
||||
[self assert:contentHeader equals:expectedHeaderResult message:@"Header generated by objj2objcskeleton is wrong"];
|
||||
|
||||
var contentMFile = FILE.read("objj2objcskeletonTestFile.m"),
|
||||
var contentMFile = fs.readFileSync("objj2objcskeletonTestFile.m").toString(),
|
||||
expectedMResult = "#import \"objj2objcskeletonTestFile.h\"\n\n@implementation AppController\n@end\n";
|
||||
|
||||
[self assert:contentMFile equals:expectedMResult message:@"File generated by objj2objcskeleton is wrong"];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user