diff --git a/Objective-J/Tools/executable b/Objective-J/Tools/executable index f2d87c461..efec401f6 100644 --- a/Objective-J/Tools/executable +++ b/Objective-J/Tools/executable @@ -1,7 +1,7 @@ #!/bin/sh # if OBJJ_HOME isn't set, try to determine it out -if [ -z $OBJJ_HOME ]; then +#if [ -z $OBJJ_HOME ]; then # get path of the executable SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0") @@ -15,13 +15,13 @@ if [ -z $OBJJ_HOME ]; then 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 +# 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" CLASSPATH="$OBJJ_LIB:$OBJJ_LIB/js.jar:$OBJJ_HOME/lib/$(basename $SELF_PATH):$CLASSPATH" diff --git a/Objective-J/Tools/objj/main.js b/Objective-J/Tools/objj/main.js index 3dce72c56..9db3b3284 100644 --- a/Objective-J/Tools/objj/main.js +++ b/Objective-J/Tools/objj/main.js @@ -2,6 +2,7 @@ debug = false; args = arguments; // FIXME: remove these Rhino/Java dependencies +/* var OBJJ_LIB = Packages.java.lang.System.getenv("OBJJ_LIB"); // chicken/egg problem, getenv is defined in bridge.js if (!this.window) @@ -15,17 +16,13 @@ if (!this.objj_import) print("Loading Objective-J."); load(OBJJ_LIB+'/Frameworks-Rhino/Objective-J/Objective-J.js'); } - -var defaultFrameworks = OBJJ_LIB+'/Frameworks-Rhino'; -OBJJ_INCLUDE_PATHS = [defaultFrameworks]; +*/ +OBJJ_INCLUDE_PATHS = []; var OBJJ_INCLUDE_PATHS_STRING = getenv("OBJJ_INCLUDE_PATHS"); if (OBJJ_INCLUDE_PATHS_STRING) -{ - OBJJ_INCLUDE_PATHS = OBJJ_INCLUDE_PATHS_STRING.split(":"); - OBJJ_INCLUDE_PATHS.push(defaultFrameworks); -} + OBJJ_INCLUDE_PATHS = OBJJ_INCLUDE_PATHS.concat(OBJJ_INCLUDE_PATHS_STRING.split(":")); try { @@ -37,6 +34,12 @@ try while (count--) 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(':')) + } + + if (args.length > 0) + { // Grab the location of the objj file to run. var mainFilePath = args.shift(); diff --git a/Rake/Resources/objj-exec b/Rake/Resources/objj-exec deleted file mode 100644 index f2d87c461..000000000 --- a/Rake/Resources/objj-exec +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -# if OBJJ_HOME isn't set, try to determine it out -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" -CLASSPATH="$OBJJ_LIB:$OBJJ_LIB/js.jar:$OBJJ_HOME/lib/$(basename $SELF_PATH):$CLASSPATH" - -OBJJ="$OBJJ_LIB/objj.js" -RLWRAP=`which rlwrap` - -# if there's a "lib" directory, add all the jars from it -if [ -d "lib" ]; then - JARS=`find ./lib -name '*.jar' 2> /dev/null | tr "\n" ":"` - CLASSPATH="$JARS:$CLASSPATH" -fi - -# convert paths for Cygwin -if [[ `uname` == CYGWIN* ]]; then - OBJJ_HOME=`cygpath -wp "$OBJJ_HOME"` - OBJJ_LIB=`cygpath -wp "$OBJJ_LIB"` - OBJJ=`cygpath -wp "$OBJJ"` - CLASSPATH=`cygpath -wp "$CLASSPATH"` -fi - -export OBJJ_LIB -echo $RLWRAP java -classpath $CLASSPATH main $@ -#if [ -e $STEAM_BUILD/Objective-J.build/Release/Rhino ]; then - $RLWRAP java -classpath $CLASSPATH main $@ - #$RLWRAP java -classpath $CLASSPATH org.mozilla.javascript.tools.shell.Main $OBJJ $@ -#else -# echo "Missing frameworks at $STEAM_BUILD/Objective-J.build/Release/Rhino" 1>&2 -#fi diff --git a/Rake/Resources/objj-executable b/Rake/Resources/objj-executable new file mode 100755 index 000000000..7465df500 --- /dev/null +++ b/Rake/Resources/objj-executable @@ -0,0 +1,36 @@ +#!/bin/sh + +# 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" + +MAIN="$OBJJ_LIB/$(basename $SELF_PATH)/main.j" + +# convert paths for Cygwin +if [[ `uname` == CYGWIN* ]]; then + OBJJ_HOME=`cygpath -w "$OBJJ_HOME"` + BAKE=`cygpath -w "$BLEND"` +fi + +objj $MAIN $@ diff --git a/Tools/blend/BlendKit/BKShowcaseController.j b/Tools/blend/BlendKit/BKShowcaseController.j deleted file mode 100644 index 885417f3e..000000000 --- a/Tools/blend/BlendKit/BKShowcaseController.j +++ /dev/null @@ -1,120 +0,0 @@ - -@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/Tools/blend/BlendKit/BKUtilities.j b/Tools/blend/BlendKit/BKUtilities.j deleted file mode 100644 index bda6e696a..000000000 --- a/Tools/blend/BlendKit/BKUtilities.j +++ /dev/null @@ -1,145 +0,0 @@ - -@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/Tools/blend/BlendKit/BlendKit.j b/Tools/blend/BlendKit/BlendKit.j deleted file mode 100644 index 09821ddd7..000000000 --- a/Tools/blend/BlendKit/BlendKit.j +++ /dev/null @@ -1,3 +0,0 @@ - -@import "BKShowcaseController.j" -@import "BKUtilities.j" diff --git a/Tools/blend/BlendKit/BlendKit.steam b/Tools/blend/BlendKit/BlendKit.steam deleted file mode 100644 index 75d93232e..000000000 --- a/Tools/blend/BlendKit/BlendKit.steam +++ /dev/null @@ -1,42 +0,0 @@ - - - - - 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/Tools/blend/BlendKit/Info.plist b/Tools/blend/BlendKit/Info.plist deleted file mode 100644 index 898e2e6c0..000000000 --- a/Tools/blend/BlendKit/Info.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - CPBundleIdentifier - com.280n.BlendKit - CPBundleInfoDictionaryVersion - 6.0 - CPBundleName - BlendKit - CPBundlePackageType - FMWK - - diff --git a/Tools/blend/BlendKit/build.xml b/Tools/blend/BlendKit/build.xml deleted file mode 100644 index 67c5ff641..000000000 --- a/Tools/blend/BlendKit/build.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tools/blend/Tool/blend b/Tools/blend/Tool/blend deleted file mode 100755 index 7d3ae9cac..000000000 --- a/Tools/blend/Tool/blend +++ /dev/null @@ -1,57 +0,0 @@ -#!/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/Tools/blend/Tool/blend.steam b/Tools/blend/Tool/blend.steam deleted file mode 100644 index b4287d226..000000000 --- a/Tools/blend/Tool/blend.steam +++ /dev/null @@ -1,46 +0,0 @@ - - - - - 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/Tools/blend/Tool/build.xml b/Tools/blend/Tool/build.xml deleted file mode 100644 index a3773f38b..000000000 --- a/Tools/blend/Tool/build.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tools/blend/Tool/main.j b/Tools/blend/Tool/main.j deleted file mode 100644 index d441154e4..000000000 --- a/Tools/blend/Tool/main.j +++ /dev/null @@ -1,298 +0,0 @@ - -@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/Tools/blend/build.xml b/Tools/blend/build.xml deleted file mode 100644 index 903d5a94a..000000000 --- a/Tools/blend/build.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common.rb b/common.rb index 7cba7ef64..e94392af6 100644 --- a/common.rb +++ b/common.rb @@ -79,5 +79,12 @@ def cat(files, outfile) end end +$OBJJ_TEMPLATE_EXECUTABLE = File.join($HOME_DIR, 'Rake', 'Resources', 'objj-executable') + +def make_objj_executable(path) + cp($OBJJ_TEMPLATE_EXECUTABLE, path) + File.chmod 0755, path +end + task :build => [$ENVIRONMENT_JS] task :default => [:build]