diff --git a/AppKit/Tools/BlendKit/BKShowcaseController.j b/AppKit/Tools/BlendKit/BKShowcaseController.j new file mode 100644 index 000000000..885417f3e --- /dev/null +++ b/AppKit/Tools/BlendKit/BKShowcaseController.j @@ -0,0 +1,120 @@ + +@import +@import + +@import "BKUtilities.j" + + +@implementation BKShowcaseController : CPObject +{ +} + +- (void)applicationDidFinishLaunching:(CPNotification)aNotification +{ + var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], + contentView = [theWindow contentView], + bounds = [contentView bounds], + themeDescriptorClasses = BKThemeDescriptorClasses(); + + var tabView = [[CPTabView alloc] initWithFrame:bounds]; + + [tabView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; + + [contentView addSubview:tabView]; + + var count = [themeDescriptorClasses count]; + + while (count--) + { + var theClass = themeDescriptorClasses[count], + item = [[CPTabViewItem alloc] initWithIdentifier:[theClass themeName]], + templates = BKThemeObjectTemplatesForClass(theClass), + templatesCount = [templates count], + viewTemplates = [], + itemSize = CGSizeMake(0.0, 0.0); + + while (templatesCount--) + { + var template = templates[templatesCount], + object = [template valueForKey:@"themedObject"]; + + if ([object isKindOfClass:[CPView class]]) + { + var size = [object frame].size, + labelWidth = [[template valueForKey:@"label"] sizeWithFont:[CPFont boldSystemFontOfSize:12.0]].width + 20.0; + + if (size.width > itemSize.width) + itemSize.width = size.width; + + if (labelWidth > itemSize.width) + itemSize.width = labelWidth; + + if (size.height > itemSize.height) + itemSize.height = size.height; + + [viewTemplates addObject:template]; + } + } + + itemSize.height += 30; + + var collectionView = [[CPCollectionView alloc] initWithFrame:CGRectMakeZero()], + collectionViewItem = [[CPCollectionViewItem alloc] init]; + + [collectionViewItem setView:[[BKShowcaseCell alloc] init]]; + + [collectionView setItemPrototype:collectionViewItem]; + [collectionView setMinItemSize:itemSize]; + [collectionView setMaxItemSize:itemSize]; + [collectionView setVerticalMargin:5.0]; + [collectionView setContent:viewTemplates]; + + [item setLabel:[theClass themeName]]; + [item setView:collectionView]; + + [tabView addTabViewItem:item]; + } + + [theWindow orderFront:self]; +} + +@end + + +@implementation BKShowcaseCell : CPView +{ + CPView _view; + CPTextField _label; +} + +- (void)setRepresentedObject:(id)anObject +{ + if (!_label) + { + _label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; + + [_label setAlignment:CPCenterTextAlignment]; + [_label setAutoresizingMask:CPViewMinYMargin | CPViewWidthSizable]; + [_label setFont:[CPFont boldSystemFontOfSize:12.0]]; + + [self addSubview:_label]; + } + + [_label setStringValue:[anObject valueForKey:@"label"]]; + [_label sizeToFit]; + + [_label setFrame:CGRectMake(0.0, CGRectGetHeight([self bounds]) - CGRectGetHeight([_label frame]), + CGRectGetWidth([self bounds]), CGRectGetHeight([_label frame]))]; + + if (_view) + [_view removeFromSuperview]; + + _view = [anObject valueForKey:@"themedObject"]; + + [_view setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin]; + [_view setFrameOrigin:CGPointMake((CGRectGetWidth([self bounds]) - CGRectGetWidth([_view frame])) / 2.0, (CGRectGetMinY([_label frame]) - CGRectGetHeight([_view frame])) / 2.0)]; + + [self addSubview:_view]; +} + +@end diff --git a/AppKit/Tools/BlendKit/BKUtilities.j b/AppKit/Tools/BlendKit/BKUtilities.j new file mode 100644 index 000000000..bda6e696a --- /dev/null +++ b/AppKit/Tools/BlendKit/BKUtilities.j @@ -0,0 +1,145 @@ + +@implementation AKThemeTemplate : CPObject +{ + CPString _name; + CPString _description; +} + +- (id)initWithCoder:(CPCoder)aCoder +{ + self = [super init]; + + if (self) + { + _name = [aCoder decodeObjectForKey:@"AKThemeTemplateName"]; + _description = [aCoder decodeObjectForKey:@"AKThemeTemplateDescription"]; + } + + return self; +} + +- (void)encodeWithCoder:(CPCoder)aCoder +{ + [aCoder encodeObject:_name forKey:@"AKThemeTemplateName"]; + [aCoder encodeObject:_description forKey:@"AKThemeTemplateDescription"]; +} + +@end + +@implementation AKThemeObjectTemplate : CPView +{ + CPString _label; + id _themedObject; +} + +- (id)initWithCoder:(CPCoder)aCoder +{ + self = [super init]; + + if (self) + { + _label = [aCoder decodeObjectForKey:@"AKThemeObjectTemplateLabel"]; + _themedObject = [aCoder decodeObjectForKey:@"AKThemeObjectTemplateThemedObject"]; + } + + return self; +} + +- (void)encodeWithCoder:(CPCoder)aCoder +{ + [aCoder encodeObject:_label forKey:@"AKThemeObjectTemplateLabel"]; + [aCoder encodeObject:_themedObject forKey:@"AKThemeObjectTemplateThemedObject"]; +} + +@end + +function BKThemeDescriptorClasses() +{ + // Grab Theme Descriptor Classes. + var themeDescriptorClasses = []; + + for (candidate in window) + { + var theClass = objj_getClass(candidate), + theClassName = class_getName(theClass), + index = theClassName.indexOf("ThemeDescriptor"); + + if ((index >= 0) && (index === theClassName.length - "ThemeDescriptor".length)) + themeDescriptorClasses.push(theClass); + } + + return themeDescriptorClasses; +} + +function BKThemeObjectTemplatesForClass(aClass) +{ + var templates = [], + methods = class_copyMethodList(aClass.isa), + count = [methods count]; + + while (count--) + { + var method = methods[count], + selector = method_getName(method); + + if (selector.indexOf("themed") === 0) + { + var impl = method_getImplementation(method), + object = impl(aClass, selector); + + if (object) + { + var template = [[AKThemeObjectTemplate alloc] init]; + + [template setValue:object forKey:@"themedObject"]; + [template setValue:BKLabelFromIdentifier(selector) forKey:@"label"]; + + [templates addObject:template]; + } + } + } + + return templates; +} + +function BKLabelFromIdentifier(anIdentifier) +{ + var string = anIdentifier.substr("themed".length); + index = 0, + count = string.length, + label = "", + lastCapital = null, + isLeadingCapital = YES; + + for (; index < count; ++index) + { + var character = string.charAt(index), + isCapital = /^[A-Z]/.test(character); + + if (isCapital) + { + if (!isLeadingCapital) + { + if (lastCapital === null) + label += ' ' + character.toLowerCase(); + else + label += character; + } + + lastCapital = character; + } + else + { + if (isLeadingCapital && lastCapital !== null) + label += lastCapital; + + label += character; + + lastCapital = null; + isLeadingCapital = NO; + } + } + + return label; +} + diff --git a/AppKit/Tools/BlendKit/BlendKit.j b/AppKit/Tools/BlendKit/BlendKit.j new file mode 100644 index 000000000..09821ddd7 --- /dev/null +++ b/AppKit/Tools/BlendKit/BlendKit.j @@ -0,0 +1,3 @@ + +@import "BKShowcaseController.j" +@import "BKUtilities.j" diff --git a/AppKit/Tools/BlendKit/BlendKit.steam b/AppKit/Tools/BlendKit/BlendKit.steam new file mode 100644 index 000000000..75d93232e --- /dev/null +++ b/AppKit/Tools/BlendKit/BlendKit.steam @@ -0,0 +1,42 @@ + + + + + Name + BlendKit + Targets + + + Name + BlendKit + + + Configurations + + + Name + Debug + Flags + -DDEBUG -DPLATFORM_DOM -g + + + Name + Release + Flags + -DPLATFORM_DOM -O + + + Name + Debug-Rhino + Flags + -DDEBUG -g + + + Name + Release-Rhino + Flags + -O + + + + diff --git a/AppKit/Tools/BlendKit/Info.plist b/AppKit/Tools/BlendKit/Info.plist new file mode 100644 index 000000000..898e2e6c0 --- /dev/null +++ b/AppKit/Tools/BlendKit/Info.plist @@ -0,0 +1,14 @@ + + + + + CPBundleIdentifier + com.280n.BlendKit + CPBundleInfoDictionaryVersion + 6.0 + CPBundleName + BlendKit + CPBundlePackageType + FMWK + + diff --git a/AppKit/Tools/BlendKit/build.xml b/AppKit/Tools/BlendKit/build.xml new file mode 100644 index 000000000..67c5ff641 --- /dev/null +++ b/AppKit/Tools/BlendKit/build.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AppKit/Tools/BlendKit/rakefile b/AppKit/Tools/BlendKit/rakefile new file mode 100644 index 000000000..279095890 --- /dev/null +++ b/AppKit/Tools/BlendKit/rakefile @@ -0,0 +1,54 @@ +#!/usr/bin/env ruby + +require 'rake' +require '../../../common' +require 'objective-j' +require 'objective-j/bundle' + + +$PRODUCT = 'BlendKit' + $CONFIGURATION +$ENVIRONMENT_PRODUCT = File.join($ENVIRONMENT_FRAMEWORKS_DIR, 'BlendKit') + +task :build => [$PRODUCT, $ENVIRONMENT_PRODUCT] + +Specs = {} + +# Debug Framework +Specs[:BlendKitDebug] = ObjectiveJ::BundleSpecification.new do |s| + s.name = 'BlendKit' + s.identifier = 'com.280n.BlendKit' + s.version = '0.6.5' + s.author = '280 North, Inc.' + s.email = 'feedback @nospam@ 280north.com' + s.summary = 'BlendKit classes for Cappuccino' + s.sources = FileList['**/*.j'] + s.resources = FileList['Resources/*'] + s.license = ObjectiveJ::License::LGPL_v2_1 + s.build_path = File.join($BUILD_DIR, 'Debug', 'BlendKit') + s.intermediates_path = File.join($BUILD_DIR, 'BlendKit.build', 'Debug') + s.flag = 'DEBUG' +end + +bundle Specs[:BlendKitDebug], :BlendKitDebug + +# Release Framework +Specs[:BlendKitRelease] = ObjectiveJ::BundleSpecification.new do |s| + s.name = 'BlendKit' + s.identifier = 'com.280n.BlendKit' + s.version = '0.6.5' + s.author = '280 North, Inc.' + s.email = 'feedback @nospam@ 280north.com' + s.summary = 'BlendKit classes for Cappuccino' + s.sources = FileList['**/*.j'] + s.resources = FileList['Resources/*'] + s.license = ObjectiveJ::License::LGPL_v2_1 + s.build_path = File.join($BUILD_DIR, 'Release', 'BlendKit') + s.intermediates_path = File.join($BUILD_DIR, 'BlendKit.build', 'Release') +end + +bundle Specs[:BlendKitRelease], :BlendKitRelease + +#Framework in environment directory +file_d $ENVIRONMENT_PRODUCT => [$PRODUCT] do + cp_r(Specs[$PRODUCT.to_sym].build_path, $ENVIRONMENT_PRODUCT) +end diff --git a/AppKit/Tools/blend/blend b/AppKit/Tools/blend/blend new file mode 100755 index 000000000..7d3ae9cac --- /dev/null +++ b/AppKit/Tools/blend/blend @@ -0,0 +1,57 @@ +#!/bin/sh +# +# blend +# blend +# +# Created by Francisco Tolmasky. +# Copyright 2008, 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 +# + +# if OBJJ_HOME isn't set, try to determine it +if [ -z $OBJJ_HOME ]; then + # get path of the executable + SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0") + + # resolve symlinks + if [ -h $SELF_PATH ]; then + SELF_PATH=`readlink $SELF_PATH` + fi + + # get second ancestor directory + SELF_DIR=`dirname $SELF_PATH` + export OBJJ_HOME=`dirname $SELF_DIR` + + # check to ensure it exists, print message + if [ -d $OBJJ_HOME ]; then + echo "OBJJ_HOME not set, defaulting to $OBJJ_HOME" 1>&2 + else + echo "OBJJ_HOME not set, default at $OBJJ_HOME doesn't exist, exiting" 1>&2 + exit 2 + fi +fi + +OBJJ_LIB="$OBJJ_HOME/lib" + +BLEND="$OBJJ_LIB/blend/main.j" + +# convert paths for Cygwin +if [[ `uname` == CYGWIN* ]]; then + OBJJ_HOME=`cygpath -w "$OBJJ_HOME"` + BAKE=`cygpath -w "$BLEND"` +fi + +objj $BLEND $@ diff --git a/AppKit/Tools/blend/blend.steam b/AppKit/Tools/blend/blend.steam new file mode 100644 index 000000000..b4287d226 --- /dev/null +++ b/AppKit/Tools/blend/blend.steam @@ -0,0 +1,46 @@ + + + + + Name + blend + Targets + + + Name + blend + Excluded + + BlendKit + + + + Configurations + + + Name + Debug + Flags + -DDEBUG -DPLATFORM_DOM -g + + + Name + Release + Flags + -DPLATFORM_DOM -O + + + Name + Debug-Rhino + Flags + -DDEBUG -g + + + Name + Release-Rhino + Flags + -O + + + + diff --git a/AppKit/Tools/blend/build.xml b/AppKit/Tools/blend/build.xml new file mode 100644 index 000000000..a3773f38b --- /dev/null +++ b/AppKit/Tools/blend/build.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AppKit/Tools/blend/main.j b/AppKit/Tools/blend/main.j new file mode 100644 index 000000000..d441154e4 --- /dev/null +++ b/AppKit/Tools/blend/main.j @@ -0,0 +1,298 @@ + +@import +@import +@import +@import +@import + +importClass(java.io.File); +importClass(java.io.FileOutputStream); +importClass(java.io.BufferedWriter); +importClass(java.io.OutputStreamWriter); + + +function main() +{ + var index = 0, + count = arguments.length, + + outputFilePath = "", + descriptorFiles = [], + resourcesPath = nil, + cibFiles = []; + + for (; index < count; ++index) + { + var argument = arguments[index]; + + switch (argument) + { + case "-c": + case "--cib": cibFiles.push(arguments[++index]); + break; + + case "-d": + case "-descriptor": descriptorFiles.push(arguments[++index]); + break; + + case "-o": outputFilePath = arguments[++index]; + break; + + case "-R": resourcesPath = arguments[++index]; + break; + + default: jExtensionIndex = argument.indexOf(".j"); + + if ((jExtensionIndex > 0) && (jExtensionIndex === argument.length - ".j".length)) + descriptorFiles.push(argument); + else + cibFiles.push(argument); + } + } + + if (descriptorFiles.length === 0) + return buildBlendFromCibFiles(cibFiles); + + objj_import(descriptorFiles, YES, function() + { + var themeDescriptorClasses = BKThemeDescriptorClasses(), + count = [themeDescriptorClasses count]; + + while (count--) + { + var theClass = themeDescriptorClasses[count], + themeTemplate = [[AKThemeTemplate alloc] init]; + + [themeTemplate setValue:[theClass themeName] forKey:@"name"]; + + var objectTemplates = BKThemeObjectTemplatesForClass(theClass); + data = cibDataFromTopLevelObjects(objectTemplates.concat([themeTemplate])), + temporaryCibFile = File.createTempFile("temp", ".cib"), + temporaryCibFilePath = temporaryCibFile.getAbsolutePath(), + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(temporaryCibFilePath), "UTF-8")); + + writer.write([data string]); + writer.close(); + + cibFiles.push(temporaryCibFilePath); + } + + buildBlendFromCibFiles(cibFiles, outputFilePath, resourcesPath); + }); +} + +function cibDataFromTopLevelObjects(objects) +{ + var data = [CPData data], + archiver = [[CPKeyedArchiver alloc] initForWritingWithMutableData:data], + objectData = [[_CPCibObjectData alloc] init]; + + objectData._fileOwner = [_CPCibCustomObject new]; + objectData._fileOwner._className = @"CPObject"; + + var index = 0, + count = objects.length; + + for (; index < count; ++index) + { + objectData._objectsValues[index] = objectData._fileOwner; + objectData._objectsKeys[index] = objects[index]; + } + + [archiver encodeObject:objectData forKey:@"CPCibObjectDataKey"]; + + [archiver finishEncoding]; + + return data; +} + +function getDirectory(aPath) +{ + return (aPath).substr(0, (aPath).lastIndexOf('/') + 1) +} + +function buildBlendFromCibFiles(cibFiles, outputFilePath, resourcesPath) +{ + var resourcesFile = nil; + + if (resourcesPath) + resourcesFile = new File(resourcesPath); + + var count = cibFiles.length, + replacedFiles = [], + staticContent = @""; + + while (count--) + { + var theme = themeFromCibFile(new File(cibFiles[count])), + + // Archive our theme. + filePath = [theme name] + ".keyedtheme", + fileContents = [[CPKeyedArchiver archivedDataWithRootObject:theme] string]; + + replacedFiles.push(filePath); + + staticContent += MARKER_PATH + ';' + filePath.length + ';' + filePath + MARKER_TEXT + ';' + fileContents.length + ';' + fileContents; + } + + staticContent = "@STATIC;1.0;" + staticContent; + + var infoDictionary = [CPDictionary dictionary]; + staticContentName = "Aristo";//getFileNameWithoutExtension(project.activeTarget().name()); + + [infoDictionary setObject:@"Yikes." forKey:@"CPBundleName"]; + [infoDictionary setObject:@"Yikes." forKey:@"CPBundleIdentifier"]; + [infoDictionary setObject:replacedFiles forKey:@"CPBundleReplacedFiles"]; + [infoDictionary setObject:staticContentName forKey:@"CPBundleExecutable"]; + + var outputFile = new File(outputFilePath).getCanonicalFile(); + + outputFile.mkdirs(); + + var writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFilePath + "/Info.plist"), "UTF-8")); + + writer.write(CPPropertyListCreate280NorthData(infoDictionary).string); + + writer.close(); + + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFilePath + '/' + staticContentName), "UTF-8")); + + writer.write(staticContent); + + writer.close(); + + if (resourcesPath) + rsync(new File(resourcesPath), new File(outputFilePath)); +} + +function themeFromCibFile(aFile) +{ + var cib = [[CPCib alloc] initWithContentsOfURL:aFile.getCanonicalPath()], + topLevelObjects = []; + + [cib _setAwakenCustomResources:NO]; + [cib instantiateCibWithExternalNameTable:[CPDictionary dictionaryWithObject:topLevelObjects forKey:CPCibTopLevelObjects]]; + + var count = topLevelObjects.length, + theme = nil, + templates = []; + + while (count--) + { + var object = topLevelObjects[count]; + + templates = templates.concat([object blendThemeObjectTemplates]); + + if ([object isKindOfClass:[AKThemeTemplate class]]) + theme = [[CPTheme alloc] initWithName:[object valueForKey:@"name"]]; + } + + [templates makeObjectsPerformSelector:@selector(blendAddThemedObjectAttributesToTheme:) withObject:theme]; + + return theme; +} + +function rsync(srcFile, dstFile) +{ + var src, dst; + + if (String(java.lang.System.getenv("OS")).indexOf("Windows") < 0) + { + src = srcFile.getAbsolutePath(); + dst = dstFile.getAbsolutePath(); + } + else + { + src = exec(["cygpath", "-u", srcFile.getAbsolutePath() + '/']); + dst = exec(["cygpath", "-u", dstFile.getAbsolutePath() + "/Resources"]); + } + + if (srcFile.exists()) + exec(["rsync", "-avz", src, dst]); +} + +function exec(/*Array*/ command, /*Boolean*/ showOutput) +{ + var line = "", + output = "", + + process = Packages.java.lang.Runtime.getRuntime().exec(command),//jsArrayToJavaArray(command)); + reader = new Packages.java.io.BufferedReader(new Packages.java.io.InputStreamReader(process.getInputStream())); + + while (line = reader.readLine()) + { + if (showOutput) + System.out.println(line); + + output += line + '\n'; + } + + reader = new Packages.java.io.BufferedReader(new Packages.java.io.InputStreamReader(process.getErrorStream())); + + while (line = reader.readLine()) + System.out.println(line); + + try + { + if (process.waitFor() != 0) + System.err.println("exit value = " + process.exitValue()); + } + catch (anException) + { + System.err.println(anException); + } + + return output; +} + +@implementation CPObject (BlendAdditions) + +- (CPArray)blendThemeObjectTemplates +{ + var theClass = [self class]; + + if ([theClass isKindOfClass:[AKThemeObjectTemplate class]]) + return [self]; + + if ([theClass isKindOfClass:[CPView class]]) + { + var templates = [], + subviews = [self subviews], + count = [subviews count]; + + while (count--) + templates = templates.concat([subviews[count] blendThemeObjectTemplates]); + + return templates; + } + + return []; +} + +@end + +@implementation AKThemeObjectTemplate (BlendAdditions) + +- (void)blendAddThemedObjectAttributesToTheme:(CPTheme)aTheme +{ + var themedObject = [self valueForKey:@"themedObject"]; + + if (!themedObject) + { + var subviews = [self subviews]; + + if ([subviews count] > 0) + themedObject = subviews[0]; + } + + if (themedObject) + { + print(" Recording theme for " + [themedObject className] + "."); + + [aTheme takeThemeFromObject:themedObject]; + } +} + +@end + +main.apply(main, args); diff --git a/AppKit/Tools/blend/rakefile b/AppKit/Tools/blend/rakefile new file mode 100644 index 000000000..77f0428bb --- /dev/null +++ b/AppKit/Tools/blend/rakefile @@ -0,0 +1,59 @@ +#!/usr/bin/env ruby + +require 'rake' +require '../../../common' +require 'objective-j' +require 'objective-j/bundle' + + +$PRODUCT = 'blend' + $CONFIGURATION +$ENVIRONMENT_BIN_PRODUCT = File.join($ENVIRONMENT_BIN_DIR, 'blend') +$ENVIRONMENT_LIB_PRODUCT = File.join($ENVIRONMENT_LIB_DIR, 'blend') + +task :build => [$PRODUCT, $ENVIRONMENT_BIN_PRODUCT, $ENVIRONMENT_LIB_PRODUCT] + +Specs = {} + +# Debug Framework +Specs[:blendDebug] = ObjectiveJ::BundleSpecification.new do |s| + s.name = 'blend' + s.identifier = 'com.280n.blend' + s.version = '0.6.5' + s.author = '280 North, Inc.' + s.email = 'feedback @nospam@ 280north.com' + s.summary = 'blend classes for Cappuccino' + s.sources = FileList['**/*.j'] + s.resources = FileList['Resources/*'] + s.license = ObjectiveJ::License::LGPL_v2_1 + s.build_path = File.join($BUILD_DIR, 'Debug', 'blend') + s.intermediates_path = File.join($BUILD_DIR, 'blend.build', 'Debug') + s.flag = 'DEBUG' +end + +bundle Specs[:blendDebug], :blendDebug + +# Release Framework +Specs[:blendRelease] = ObjectiveJ::BundleSpecification.new do |s| + s.name = 'blend' + s.identifier = 'com.280n.blend' + s.version = '0.6.5' + s.author = '280 North, Inc.' + s.email = 'feedback @nospam@ 280north.com' + s.summary = 'blend classes for Cappuccino' + s.sources = FileList['**/*.j'] + s.resources = FileList['Resources/*'] + s.license = ObjectiveJ::License::LGPL_v2_1 + s.build_path = File.join($BUILD_DIR, 'Release', 'blend') + s.intermediates_path = File.join($BUILD_DIR, 'blend.build', 'Release') +end + +bundle Specs[:blendRelease], :blendRelease + +#executable in environment directory +file_d $ENVIRONMENT_BIN_PRODUCT do + make_objj_executable($ENVIRONMENT_BIN_PRODUCT) +end + +file_d $ENVIRONMENT_LIB_PRODUCT => [$PRODUCT] do + cp_r(Specs[$PRODUCT.to_sym].build_path, $ENVIRONMENT_LIB_PRODUCT) +end diff --git a/AppKit/Tools/rakefile b/AppKit/Tools/rakefile new file mode 100644 index 000000000..843707f53 --- /dev/null +++ b/AppKit/Tools/rakefile @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby + +require 'rake' +require '../../common' + + +subprojects = %w{BlendKit blend} + +%w(build clean).each do |task_name| + task task_name do + subrake(subprojects) + end +end diff --git a/AppKit/rakefile b/AppKit/rakefile index 13fe5b1c0..b34898877 100644 --- a/AppKit/rakefile +++ b/AppKit/rakefile @@ -9,11 +9,15 @@ require 'objective-j/bundle' $PRODUCT = 'AppKit' + $CONFIGURATION $ENVIRONMENT_PRODUCT = File.join($ENVIRONMENT_FRAMEWORKS_DIR, 'AppKit') +subprojects = %w{Tools} + +subrake(subprojects) + task :build => [$PRODUCT, $ENVIRONMENT_PRODUCT] Specs = {} -AppKitFiles = FileList['**/*.j'].exclude('CoreGraphics/CGContextCanvas.j', 'CoreGraphics/CGContextVML.j', 'Themes/**') +AppKitFiles = FileList['**/*.j'].exclude('CoreGraphics/CGContextCanvas.j', 'CoreGraphics/CGContextVML.j', 'Themes/**', 'Tools/**') # Debug Framework Specs[:AppKitDebug] = ObjectiveJ::BundleSpecification.new do |s| diff --git a/Objective-J/Runtime/file.js b/Objective-J/Runtime/file.js index d495a4deb..fefdf1aec 100644 --- a/Objective-J/Runtime/file.js +++ b/Objective-J/Runtime/file.js @@ -39,8 +39,8 @@ var objj_files = { }, var OBJJ_NO_FILE = {}; -if (!window.OBJJ_INCLUDE_PATHS) - var OBJJ_INCLUDE_PATHS = ["Frameworks", "SomethingElse"]; +if (typeof OBJJ_INCLUDE_PATHS === "undefined") + OBJJ_INCLUDE_PATHS = ["Frameworks", "SomethingElse"]; var OBJJ_BASE_URI = ""; @@ -127,7 +127,7 @@ objj_search.prototype.attemptNextSearchPath = function() { var searchPath = this.nextSearchPath(), file = objj_files[searchPath]; - + objj_alert("Will attempt to find " + this.filePath + " at " + searchPath); // If a file for this search path already exists, then it has already been downloaded. @@ -150,7 +150,7 @@ objj_search.prototype.attemptNextSearchPath = function() } var existingSearch = objj_searches[searchPath]; - + // If there is already an ongoing search for this search path, then we can let it find // the file for us. Make sure to assign it our callback, if we have one, since only // one search can have a callback at a time. diff --git a/Objective-J/Tools/objj/main.js b/Objective-J/Tools/objj/main.js index 9db3b3284..d4d1ba9d4 100644 --- a/Objective-J/Tools/objj/main.js +++ b/Objective-J/Tools/objj/main.js @@ -17,12 +17,11 @@ if (!this.objj_import) load(OBJJ_LIB+'/Frameworks-Rhino/Objective-J/Objective-J.js'); } */ -OBJJ_INCLUDE_PATHS = []; var OBJJ_INCLUDE_PATHS_STRING = getenv("OBJJ_INCLUDE_PATHS"); if (OBJJ_INCLUDE_PATHS_STRING) - OBJJ_INCLUDE_PATHS = OBJJ_INCLUDE_PATHS.concat(OBJJ_INCLUDE_PATHS_STRING.split(":")); + OBJJ_INCLUDE_PATHS = OBJJ_INCLUDE_PATHS_STRING.split(":").concat(OBJJ_INCLUDE_PATHS); try { @@ -35,7 +34,7 @@ try args[count] = String(args[count]); while (args.length && args[0].indexOf('-I') === 0) - OBJJ_INCLUDE_PATHS = OBJJ_INCLUDE_PATHS.concat(args.shift().substr(2).split(':')) + OBJJ_INCLUDE_PATHS = args.shift().substr(2).split(':').concat(OBJJ_INCLUDE_PATHS); } if (args.length > 0) diff --git a/Rake/Resources/objj-executable b/Rake/Resources/objj-executable index 7465df500..451929d45 100755 --- a/Rake/Resources/objj-executable +++ b/Rake/Resources/objj-executable @@ -24,7 +24,7 @@ #fi OBJJ_LIB="$OBJJ_HOME/lib" - +FRAMEWORKS="$OBJJ_HOME/lib/Frameworks" MAIN="$OBJJ_LIB/$(basename $SELF_PATH)/main.j" # convert paths for Cygwin @@ -33,4 +33,4 @@ if [[ `uname` == CYGWIN* ]]; then BAKE=`cygpath -w "$BLEND"` fi -objj $MAIN $@ +objj -I$FRAMEWORKS $MAIN $@