Name changes.

Reviewed by me.
This commit is contained in:
Francisco Tolmasky committed 2009-03-18 16:53:00 -07:00
1 parent 3eed879fd2
commit c6e266b08f
26 files changed
-1361

No files matched your search

File renamed without changes.
File renamed without changes.
File renamed without changes.
-331
View File
@@ -1,331 +0,0 @@
importClass(java.io.FileOutputStream);
importClass(java.io.BufferedWriter);
importClass(java.io.OutputStreamWriter);
function Target(dictionary)
{
this._name = dictionary_getValue(dictionary, "Name");
var flagsString = dictionary_getValue(dictionary, "Flags");
this._flags = flagsString ? flagsString.split(/\s+/) : [];
this._type = dictionary_getValue(dictionary, "Type");
if (!this._type)
this._type = "280N.application";
this._exclusions = [];
var exclusions = dictionary_getValue(dictionary, "Excluded");
if (exclusions)
{
var index = 0,
count = exclusions.length;
for (; index < count; ++index)
this._exclusions.push(new File((exclusions[index])).getCanonicalFile());
}
return this;
}
Target.prototype.name = function()
{
return this._name;
}
Target.prototype.exclusions = function()
{
return this._exclusions;
}
Target.prototype.flags = function()
{
return this._flags;
}
Target.prototype.type = function()
{
return this._type;
}
function Configuration(dictionary)
{
this._name = dictionary_getValue(dictionary, "Name");
var flagsString = dictionary_getValue(dictionary, "Flags");
this._flags = flagsString ? flagsString.split(/\s+/) : [];
return this;
}
Configuration.prototype.name = function()
{
return this._name;
}
Configuration.prototype.flags = function()
{
return this._flags;
}
function Project(/*String*/ aFilePath, /*String*/ aBuildPath)
{
this._file = new File(aFilePath).getCanonicalFile();
this._root = this._file.getParentFile();
// Read the project file (its just a plist).
this._properties = readPlist(this._file);
this._name = dictionary_getValue(this._properties, "Name");
// Read existing Info.plist if it exists.
var infoPlist = new File(this._root.getAbsolutePath() + "/Info.plist");
if (infoPlist.exists())
this._infoDictionary = readPlist(new File(this._root.getAbsolutePath() + "/Info.plist"));
else
this._infoDictionary = new objj_dictionary();
this.buildPath = aBuildPath;
// Covert target dictionaries to target objects.
var targetDictionaries = dictionary_getValue(this._properties, "Targets");
this._targets = [];
for (var index = 0, count = targetDictionaries.length; index < count; ++index)
this._targets.push(new Target(targetDictionaries[index]));
this.setActiveTarget(this._targets[0]);
// Covert target dictionaries to target objects.
var configurationDictionaries = dictionary_getValue(this._properties, "Configurations");
this._configurations = [];
for (index = 0, count = configurationDictionaries.length; index < count; ++index)
this._configurations.push(new Configuration(configurationDictionaries[index]));
this.setActiveConfiguration(this._configurations[0]);
// Grab the Resources Directory (if it exists)
this._resources = new File(this._root.getAbsolutePath() + "/Resources/").getCanonicalFile();
return this;
}
Project.prototype.name = function()
{
return this._name;
}
Project.prototype.targetWithName = function(/*String*/ aName)
{
var targets = this._targets,
index = 0,
count = targets.length;
for (; index < count; ++index)
{
var target = targets[index];
if (target.name() == aName)
return target;
}
return null;
}
Project.prototype.configurationWithName = function(/*String*/ aName)
{
var configurations = this._configurations,
index = 0,
count = configurations.length;
for (; index < count; ++index)
{
var configuration = configurations[index];
if (configuration.name() == aName)
return configuration;
}
return null;
}
Project.prototype.setActiveTarget = function(/*Target*/ aTarget)
{
this._activeTarget = aTarget;
this._buildProducts = null;
this._buildIntermediates = null;
this._buildObjects = null;
}
Project.prototype.activeTarget = function()
{
return this._activeTarget;
}
Project.prototype.setActiveConfiguration = function(/*Configuration*/ aConfiguration)
{
this._activeConfiguration = aConfiguration;
this._buildProducts = null;
this._buildIntermediates = null;
this._buildObjects = null;
}
Project.prototype.activeConfiguration = function()
{
return this._activeConfiguration;
}
Project.prototype.buildProducts = function()
{
if (!this._buildProducts)
{
this._buildProducts = new File(this.buildPath + '/' + this._activeConfiguration.name() + '/' + this._activeTarget.name()).getCanonicalFile();
this._buildProducts.mkdirs();
}
return this._buildProducts;
}
Project.prototype.buildIntermediates = function()
{
if (!this._buildIntermediates)
{
this._buildIntermediates = new File(this.buildPath + '/' + this._activeTarget.name() + ".build/" + this._activeConfiguration.name()).getCanonicalFile();
this._buildIntermediates.mkdirs();
}
return this._buildIntermediates;
}
Project.prototype.buildObjects = function()
{
if (!this._buildObjects)
{
this._buildObjects = new File(this.buildIntermediates().getAbsolutePath() + '/' + this._activeTarget.name()).getCanonicalFile();
this._buildObjects.mkdirs();
}
return this._buildObjects;
}
Project.prototype.activeFlags = function()
{
return this.activeTarget().flags().concat(this.activeConfiguration().flags());
}
Project.prototype.build = function()
{
java.lang.System.out.println("Building Target \"" + this.activeTarget().name() +
"\" of Project \"" + this.name() +
"\" with Configuration \"" + this.activeConfiguration().name() + "\".");
var jFiles = getFiles(this._root, "j", this._activeTarget.exclusions()),
replacedFiles = [];
hasModifiedJFiles = false;
shouldObjjPreprocess = true,
shouldGzip = this._gzip,
objjcComponents = ["sh", OBJJ_HOME + "/bin/objjc"];
objjcComponents = objjcComponents.concat(this.activeFlags());
if (!shouldObjjPreprocess)
objjcComponents.push("-E");
var buildObjects = this.buildObjects(),
buildProducts = this.buildProducts();
for (index = 0, count = jFiles.length; index < count; ++index)
{
var file = jFiles[index],
builtFile = new File(buildObjects.getAbsolutePath() + '/' + getFileNameWithoutExtension(file) + '.o');
replacedFiles.push(file.getName() + "");
if (builtFile.exists() && file.lastModified() < builtFile.lastModified())
continue;
else
hasModifiedJFiles = true;
objjcComponents.push(file.getAbsolutePath());
objjcComponents.push("-o");
objjcComponents.push(buildObjects.getAbsolutePath() + '/' + getFileNameWithoutExtension(file) + '.o');
}
exec(objjcComponents, true);
var oFiles = getFiles(buildObjects, 'o'),
sjFile = new File(buildProducts.getCanonicalPath() + '/' + this._activeTarget.name() + ".sj");
if (hasModifiedJFiles)
{
// concatenate sjheader.txt and individual .o
exec(["sh", "-c", "cat '" + OBJJ_STEAM + "/sjheader.txt' '" + oFiles.join("' '") + "' > '" + sjFile.getCanonicalPath() + "'"], true);
}
if (shouldGzip)
{
// gzip and copy .htaccess file
exec(["sh", "-c", "gzip -c '" + sjFile.getCanonicalPath() + "' > '" + sjFile.getCanonicalPath() + ".gz'"], true);
exec(["cp", OBJJ_HOME + "/lib/htaccess", sjFile.getParentFile().getCanonicalPath() + "/.htaccess"], true);
}
else
{
// remove gzip and .htaccess file if present
exec(["rm", "-f", sjFile.getParentFile().getCanonicalPath() + "/.htaccess", sjFile.getCanonicalPath() + ".gz"], true);
}
dictionary_setValue(this._infoDictionary, "CPBundleExecutable", this._activeTarget.name() + ".sj");
dictionary_setValue(this._infoDictionary, "CPBundleReplacedFiles", replacedFiles);
this.writeInfoPlist();
this.copyResources();
// FIXME: This should be, if this is an app...
if (dictionary_getValue(this._infoDictionary, "CPBundlePackageType") == "280N")
this.copyIndexFile();
}
Project.prototype.clean = function()
{
java.lang.System.out.println("Cleaning Target \"" + this.activeTarget().name() +
"\" of Project \"" + this.name() +
"\" with Configuration \"" + this.activeConfiguration().name() + "\".");
exec(["rm", "-rf", this.buildIntermediates().getAbsolutePath()], true);
exec(["rm", "-rf", this.buildProducts().getAbsolutePath()], true);
}
Project.prototype.copyIndexFile = function()
{
var indexFile = new File(this._root.getAbsolutePath() + "/index.html").getCanonicalFile();
rsync(indexFile, this.buildProducts());
}
Project.prototype.writeInfoPlist = function()
{
var writer = new BufferedWriter(new FileWriter(this.buildProducts().getAbsolutePath() + '/' + "Info.plist"));
writer.write(CPPropertyListCreateXMLData(this._infoDictionary).string);
writer.close();
}
Project.prototype.copyResources = function()
{
rsync(this._resources, this.buildProducts());
}
@@ -1,39 +0,0 @@
/*
* AppController.j
* __Product__
*
* Created by __Me__ on __Date__.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
var label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[label setStringValue:@"Hello World!"];
[label setFont:[CPFont boldSystemFontOfSize:24.0]];
[label sizeToFit];
[label setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
[label setFrameOrigin:CGPointMake((CGRectGetWidth([contentView bounds]) - CGRectGetWidth([label frame])) / 2.0, (CGRectGetHeight([contentView bounds]) - CGRectGetHeight([label frame])) / 2.0)];
[contentView addSubview:label];
[theWindow orderFront:self];
// Uncomment the following line to turn on the standard menu bar.
//[CPMenu setMenuBarVisible:YES];
}
@end
@@ -1,12 +0,0 @@
<?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>CPApplicationDelegateClass</key>
<string>AppController</string>
<key>CPBundleName</key>
<string>__Product__</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
</plist>
@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en">
<!--
//
// index-debug.html
// __Product__
//
// Created by __Me__ on __Date__.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
-->
<head>
<title>Hello World</title>
<script type = "text/javascript">
OBJJ_MAIN_FILE = "main.j";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
</script>
<script src = "Frameworks/Debug/Objective-J/Objective-J.js" type = "text/javascript"></script>
</head>
<body>
<div style="position: absolute; left: 50%; top: 50%;">
<center>
<img src = "Frameworks/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorSpinningStyleRegular.gif" style="left: -32px; position: relative; top: -32px;" />
</center>
</div>
</body>
</html>
@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en">
<!--
//
// index.html
// __Product__
//
// Created by __Me__ on __Date__.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
-->
<head>
<title>Hello World</title>
<script type = "text/javascript">
OBJJ_MAIN_FILE = "main.j";
</script>
<script src = "Frameworks/Objective-J/Objective-J.js" type = "text/javascript"></script>
</head>
<body>
<div style="position: absolute; left: 50%; top: 50%;">
<center>
<img src = "Frameworks/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorSpinningStyleRegular.gif" style="left: -32px; position: relative; top: -32px;" />
</center>
</div>
</body>
</html>
@@ -1,18 +0,0 @@
/*
* main.j
* __Product__
*
* Created by __Me__ on __Date__.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
@@ -1,12 +0,0 @@
<?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>CPApplicationDelegateClass</key>
<string>BKShowcaseController</string>
<key>CPBundleName</key>
<string>__Product__</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
</plist>
@@ -1,33 +0,0 @@
/*
* ThemeDescriptors.j
* __Product__
*
* Created by __Me__ on __Date__.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation __Product__ThemeDescriptor : CPObject
{
}
+ (CPString)themeName
{
return @"__Product__";
}
+ (CPTextField)themedTextField
{
var textField = [[CPTextField alloc] initWithFrame:CGRectMake(0.0, 0.0, 200.0, 20.0)];
[textField setValue:[CPColor blueColor] forThemedAttributeName:@"bezel-color"];
[textField setValue:[CPColor redColor] forThemedAttributeName:@"text-color"];
[textField setStringValue:@"Yikes!"];
return textField;
}
@end
@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en">
<!--
//
// index-debug.html
// __Product__
//
// Created by __Me__ on __Date__.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
-->
<head>
<title>Hello World</title>
<script type = "text/javascript">
OBJJ_MAIN_FILE = "main.j";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
</script>
<script src = "Frameworks/Debug/Objective-J/Objective-J.js" type = "text/javascript"></script>
</head>
<body>
<div style="position: absolute; left: 50%; top: 50%;">
<center>
<img src = "Frameworks/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorSpinningStyleRegular.gif" style="left: -32px; position: relative; top: -32px;" />
</center>
</div>
</body>
</html>
@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en">
<!--
//
// index.html
// __Product__
//
// Created by __Me__ on __Date__.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
-->
<head>
<title>Hello World</title>
<script type = "text/javascript">
OBJJ_MAIN_FILE = "main.j";
</script>
<script src = "Frameworks/Objective-J/Objective-J.js" type = "text/javascript"></script>
</head>
<body>
<div style="position: absolute; left: 50%; top: 50%;">
<center>
<img src = "Frameworks/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorSpinningStyleRegular.gif" style="left: -32px; position: relative; top: -32px;" />
</center>
</div>
</body>
</html>
@@ -1,19 +0,0 @@
/*
* main.j
* __Product__
*
* Created by __Me__ on __Date__.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import <BlendKit/BlendKit.j>
@import "ThemeDescriptors.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
-102
View File
@@ -1,102 +0,0 @@
function build()
{
var index = 0,
count = arguments.length,
actions = [],
targetName = null,
configurationName = null,
buildPath = null,
projectFilePath = null,
gzip = false;
for (; index < count; ++index)
{
switch (arguments[index])
{
case "-f": if (index + 1 == count)
throw "-f needs project file.";
projectFilePath = arguments[++index];
break;
case "-t": if (index + 1 == count)
throw "-t needs a target";
targetName = arguments[++index];
break;
case "-c": if (index + 1 == count)
throw "-c needs configuration";
configurationName = arguments[++index];
break;
case "-b": if (index + 1 == count)
throw "-b needs a build location";
buildPath = arguments[++index];
break;
case "--gzip": gzip = true;
break;
case "clean":
case "build": actions.push(arguments[index]);
break;
}
}
// If no project file was specified, look for one.
if (!projectFilePath)
{
var candidates = getFiles(new File('.'), "steam");
if (candidates.length < 1)
throw "No project file specified or found.";
projectFilePath = candidates[0];
}
// Construct the Build Directory
if (!buildPath)
{
buildPath = System.getenv("STEAM_BUILD");
if (!buildPath)
buildPath = "Build";
}
var project = new Project(projectFilePath, buildPath);
project._gzip = gzip;
if (targetName)
{
var target = project.targetWithName(targetName);
if (!target)
throw "Target \"" + targetName + "\" not found in project.";
project.setActiveTarget(target);
}
if (configurationName)
{
var configuration = project.configurationWithName(configurationName);
if (!configuration)
throw "Configuration \"" + configurationName + "\" not found in project.";
project.setActiveConfiguration(configuration);
}
if (!actions.length)
actions.push("build");
for (index = 0, count = actions.length; index < count; ++index)
project[actions[index]]();
}
-55
View File
@@ -1,55 +0,0 @@
<?xml version = "1.0"?>
<project name = "steam" default = "build" basedir = "." >
<import file = "../../../common.xml" />
<property name = "Build.Intermediate" location = "${Build}/steam.build/${Configuration}" />
<property name = "Build.steam" location = "${Build}/${Configuration}/steam" />
<property name = "Build.steam.bin" location = "${Build.steam}/bin" />
<property name = "Build.steam.lib" location = "${Build.steam}/lib/steam" />
<target name = "clean">
<delete dir = "${Build.steam}" verbose = "true" />
</target>
<target name = "build">
<mkdir dir = "${Build.steam}" />
<mkdir dir = "${Build.Intermediate}" />
<copy file = "${basedir}/sjheader.txt" tofile = "${PATH.SYSTEM.LIB}/steam/sjheader.txt" />
<copy file = "${basedir}/steam.xml" tofile = "${PATH.SYSTEM.LIB}/steam/steam.xml" />
<copy file = "${basedir}/htaccess" tofile = "${PATH.SYSTEM.LIB}/steam/htaccess" />
<copy todir = "${PATH.SYSTEM.LIB}/steam/Templates" >
<fileset dir = "${basedir}/Templates" />
</copy>
<copy file = "../executable" tofile = "${PATH.SYSTEM.BIN}/steam" />
<preprocess file = "${basedir}/main.js" output = "${Build.Intermediate}/steam-preprocessed.js" />
<concat destfile = "${Build.Intermediate}/steam-flattened.js">
<filelist>
<file name="${Checkout}/Tools/Utilities/bridge.js" />
<file name="${Checkout}/Tools/Utilities/regex-bridge.js" />
<file name="${Build}/Objective-J.build/\${Configuration}/Rhino/Objective-J.js" />
<file name="${Build.Intermediate}/steam-preprocessed.js" />
</filelist>
</concat>
<jsc>
<arguments>
<arg line = "-o main.class" />
<arg value = "-nosource" />
<arg value = "${Build.Intermediate}/steam-flattened.js" />
</arguments>
</jsc>
<move file = "${Build.Intermediate}/main.class" tofile = "${PATH.SYSTEM.LIB}/steam/main.class" />
</target>
</project>
@@ -1,66 +0,0 @@
function createFrameworks()
{
var shouldSymbolicallyLink = false,
index = 0,
count = arguments.length,
destination = "";
for (; index < count; ++index)
{
var argument = arguments[index];
switch (arguments[index])
{
case "-l": shouldSymbolicallyLink = true;
break;
default: destination = argument;
}
}
createFrameworksInFile(new File(destination), shouldSymbolicallyLink);
}
function createFrameworksInFile(/*File*/ aFile, /*Boolean*/ shouldSymbolicallyLink)
{
var destinationFrameworks = new File(aFile.getCanonicalPath()+ "/Frameworks"),
destinationDebugFrameworks = new File(aFile.getCanonicalPath() + "/Frameworks/Debug");
if (!shouldSymbolicallyLink)
{
var sourceFrameworks = new File(OBJJ_HOME + "/lib/Frameworks"),
sourceDebugFrameworks = new File(OBJJ_HOME + "/lib/Frameworks-Debug");
exec(["cp", "-vR", sourceFrameworks.getCanonicalPath(), destinationFrameworks.getCanonicalPath()], true);
exec(["cp", "-vR", sourceDebugFrameworks.getCanonicalPath(), destinationDebugFrameworks.getCanonicalPath()], true);
return true;
}
var STEAM_BUILD = System.getenv("STEAM_BUILD");
// Release Frameworks
new File(destinationFrameworks).mkdir();
exec(["ln", "-s", new File(STEAM_BUILD + "/Release/Objective-J").getCanonicalPath(),
new File(aFile.getCanonicalPath() + "/Frameworks/Objective-J").getCanonicalPath()], true);
exec(["ln", "-s", new File(STEAM_BUILD + "/Release/Foundation").getCanonicalPath(),
new File(aFile.getCanonicalPath() + "/Frameworks/Foundation").getCanonicalPath()], true);
exec(["ln", "-s", new File(STEAM_BUILD + "/Release/AppKit").getCanonicalPath(),
new File(aFile.getCanonicalPath() + "/Frameworks/AppKit").getCanonicalPath()], true);
// Debug Frameworks
new File(destinationDebugFrameworks).mkdir();
exec(["ln", "-s", new File(STEAM_BUILD + "/Debug/Objective-J").getCanonicalPath(),
new File(aFile.getCanonicalPath() + "/Frameworks/Debug/Objective-J").getCanonicalPath()], true);
exec(["ln", "-s", new File(STEAM_BUILD + "/Debug/Foundation").getCanonicalPath(),
new File(aFile.getCanonicalPath() + "/Frameworks/Debug/Foundation").getCanonicalPath()], true);
exec(["ln", "-s", new File(STEAM_BUILD + "/Debug/AppKit").getCanonicalPath(),
new File(aFile.getCanonicalPath() + "/Frameworks/Debug/AppKit").getCanonicalPath()], true);
}
-54
View File
@@ -1,54 +0,0 @@
function create()
{
if (arguments.length < 1)
printUsage("create");
var shouldSymbolicallyLink = false,
index = 0,
count = arguments.length,
template = "Application",
destination = "";
for (; index < count; ++index)
{
var argument = arguments[index];
switch (arguments[index])
{
case "-l": shouldSymbolicallyLink = true;
break;
case "--template": template = arguments[++index];
break;
default: destination = argument;
}
}
var sourceTemplate = new File(OBJJ_HOME + "/lib/steam/Templates/" + template),
destinationProject = new File(destination);
if (!destinationProject.exists())
{
exec(["cp", "-vR", sourceTemplate.getCanonicalPath(), destinationProject.getCanonicalPath()], true);
var files = getFiles(destinationProject, ['j', "plist", "html"]),
index = 0,
count = files.length;
for (; index < count; ++index)
{
var file = files[index],
contents = readFile(file);
contents = contents.replace(/__Product__/g, destinationProject.getName());
writeContentsToFile(contents, file);
}
createFrameworksInFile(destinationProject, shouldSymbolicallyLink);
}
else
System.out.println("Directory already exists");
}
-12
View File
@@ -1,12 +0,0 @@
Options +FollowSymLinks
AddEncoding x-gzip .gz
AddType text/plain .gz
RewriteEngine on
# These conditions slow down the requests significantly. We can probably assume they're always true.
# We should ensure the gzipped version always exists if we include this .htaccess. All supported browsers accept gzip encoding.
#RewriteCond %{REQUEST_FILENAME}.gz -f
#RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule ^(.*\.(sj|js))$ %{REQUEST_URI}/../$1.gz
-156
View File
@@ -1,156 +0,0 @@
function inlineBundle()
{
var index = 0,
count = arguments.length,
bundlePath = NULL;
for (; index < count; ++index)
{
var argument = arguments[index];
switch (arguments[index])
{
case "-d": directoryPath = arguments[++index];
break;
default: bundlePath = argument;
}
}
var bundleFile = new File(bundlePath).getCanonicalFile(),
bundlePath = String(bundleFile.getCanonicalPath()),
inlinedBundle = readBundle(bundleFile, true),
inlinedFiles = [],
replacedFiles = [],
staticContent = "";
// Find all internal bundles.
var bundleCandidates = getFiles(bundleFile, "plist"),
bundleCandidatesCount = bundleCandidates.length;
while (bundleCandidatesCount--)
{
var bundleCandidate = bundleCandidates[bundleCandidatesCount];
// We only care about Info.plists, specifically the ones that aren't us.
if (String(bundleCandidate.getName()) !== "Info.plist" || String(bundleCandidate.getCanonicalPath()) === inlinedBundle.path)
continue;
var infoDictionary = readPlist(bundleCandidate);
// At least one of these two has to be present for this to be a real deal bundle.
if (!dictionary_getValue(infoDictionary, "CPBundleIdentifier") && !dictionary_getValue(infoDictionary, "CPBundleName"))
continue;
java.lang.System.out.println(" Examining " + pathRelativeTo(bundleCandidate.getCanonicalPath(), bundlePath));
dictionary_removeValue(infoDictionary, "CPBundleExecutable");
var bundle = readBundle(bundleCandidate.getParentFile(), true);
bundle.path = pathRelativeTo(bundle.path, bundlePath);
// We want to inline the info plist too.
var inlinedFiles = [makeOBJJPlistFile(infoDictionary, bundleCandidate, bundle)].concat(bundle.files),
index = 0,
count = inlinedFiles.length;
for (; index < count; ++index)
{
var file = inlinedFiles[index];
file.path = pathRelativeTo(String(file.path), bundlePath);
java.lang.System.out.println(" Inlining " + file.path);
replacedFiles.push(file.path);
staticContent += fileToMarkedString(inlinedFiles[index], true);
}
}
var index = 0,
existingStaticFiles = inlinedBundle.files,
count = existingStaticFiles.length,
topLevelContent = "@STATIC;1.0;";
for (; index < count; ++index)
{
var file = existingStaticFiles[index];
// If this isn't actually part of our bundle, drop it!
if (file.bundle !== inlinedBundle)
continue;
file.path = pathRelativeTo(String(file.path), bundlePath);
replacedFiles.push(file.path);
topLevelContent += fileToMarkedString(file, false);
}
dictionary_setValue(inlinedBundle.info, "CPBundleReplacedFiles", replacedFiles);
writeContentsToFile(CPPropertyListCreateXMLData(inlinedBundle.info).string, inlinedBundle.path);
writeContentsToFile(topLevelContent + staticContent, inlinedBundle._staticContentPath);
}
function fileToMarkedString(anOBJJFile, encodeBundle)
{
var markedString = "";
markedString += MARKER_PATH + ';' + anOBJJFile.path.length + ';' + anOBJJFile.path;
if (encodeBundle)
markedString += MARKER_BUNDLE + ';' + anOBJJFile.bundle.path.length + ';' + anOBJJFile.bundle.path;
var fragments = anOBJJFile.fragments;
if (fragments && fragments.length > 0)
{
var fragmentIndex = 0,
fragmentCount = fragments.length;
for (; fragmentIndex < fragmentCount; ++fragmentIndex)
markedString += fragments[fragmentIndex].toMarkedString();
}
else
markedString += MARKER_TEXT + ';' + anOBJJFile.contents.length + ';' + anOBJJFile.contents;
return markedString;
}
function makeOBJJPlistFile(aDictionary, aFile, aBundle)
{
var file = new objj_file();
file.path = typeof aFile === "string" ? aFile : aFile.getCanonicalPath();
file.bundle = aBundle;
file.contents = CPPropertyListCreate280NorthData(aDictionary).string;
return file;
}
function pathRelativeTo(target, relativeTo)
{
var components = [],
targetParts = target.split("/"),
relativeParts = relativeTo ? relativeTo.split("/") : [];
var i = 0;
while (i < targetParts.length)
{
if (targetParts[i] != relativeParts[i])
break;
i++;
}
for (var j = i; j < relativeParts.length; j++)
components.push("..");
for (var j = i; j < targetParts.length; j++)
components.push(targetParts[j]);
var result = components.join("/");
return result;
}
-203
View File
@@ -1,203 +0,0 @@
importPackage(java.lang);
importPackage(java.util);
importClass(java.io.File);
importClass(java.io.BufferedReader);
importClass(java.io.FileReader);
importClass(java.io.BufferedWriter);
importClass(java.io.FileWriter);
importClass(java.io.SequenceInputStream);
#include "../Utilities/bundle.js"
#include "Project.js"
OBJJ_STEAM = OBJJ_HOME + "/lib/steam/";
function main()
{
if (arguments.length < 1)
printUsage();
var command = Array.prototype.shift.apply(arguments);
switch (command)
{
case "create": create.apply(create, arguments);
break;
case "create-frameworks": createFrameworks.apply(createFrameworks, arguments);
break;
case "inline-bundle": inlineBundle.apply(inlineBundle, arguments);
break;
case "build": build.apply(build, arguments);
break;
case "help": printUsage(arguments[1]);
break;
case "version":
case "--version": printVersion();
break;
default : printUsage(command);
}
}
function fileArrayContainsFile(/*Array*/ files, /*File*/ aFile)
{
var index = 0,
count = files.length;
for (; index < count; ++index)
if (files[index].equals(aFile))
return true;
return false;
}
function getFiles(/*File*/ sourceDirectory, /*nil|String|Array<String>*/ extensions, /*Array*/ exclusions)
{
var matches = [],
files = sourceDirectory.listFiles(),
hasMultipleExtensions = typeof extensions !== "string";
if (files)
{
var index = 0,
count = files.length;
for (; index < count; ++index)
{
var file = files[index].getCanonicalFile(),
name = String(file.getName()),
isValidExtension = !extensions;
if (exclusions && fileArrayContainsFile(exclusions, file))
continue;
if (!isValidExtension)
if (hasMultipleExtensions)
{
var extensionCount = extensions.length;
while (extensionCount-- && !isValidExtension)
{
var extension = extensions[extensionCount];
if (name.substring(name.length - extension.length - 1) === ("." + extension))
isValidExtension = true;
}
}
else if (name.substring(name.length - extensions.length - 1) === ("." + extensions))
isValidExtension = true;
if (isValidExtension)
matches.push(file);
if (file.isDirectory())
matches = matches.concat(getFiles(file, extensions, exclusions));
}
}
return matches;
}
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;
}
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 getFileName(aPath)
{
var index = aPath.lastIndexOf('/');
if (index == -1)
return aPath;
return aPath.substr(index + 1);
}
function getFileNameWithoutExtension(aFileOrFileName)
{
var name = typeof aFileOrFileName === "string" ? aFileOrFileName : aFileOrFileName.getName(),
index = name.lastIndexOf('.');
if (index == -1 || index == 0)
return name;
return name.substr(0, index);
}
function getFileExtension(aPath)
{
var slash = aPath.lastIndexOf('/'),
period = aPath.lastIndexOf('.');
if (period < slash || (period == slash + 1))
return "";
return aPath.substr(period + 1);
}
main.apply(main, arguments);
#include "build.js"
#include "create.js"
#include "create-frameworks.js"
#include "inline-bundle.js"
#include "usage.js"
#include "version.js"
-1
View File
@@ -1 +0,0 @@
@STATIC;1.0;
-38
View File
@@ -1,38 +0,0 @@
#!/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"
STEAM="$OBJJ_LIB/steam"
CLASSPATH="$STEAM:$OBJJ_LIB:$OBJJ_LIB/js.jar"
# convert paths for Cygwin
if [[ `uname` == CYGWIN* ]]; then
CLASSPATH=`cygpath -wp "$CLASSPATH"`
STEAM_BUILD=`cygpath -wp "$STEAM_BUILD"`
fi
export OBJJ_LIB
java -classpath $CLASSPATH steam $@
-37
View File
@@ -1,37 +0,0 @@
<project>
<!-- Steam -->
<macrodef name = "steam-build">
<element name = "arguments" optional = "true" implicit = "true"/>
<sequential>
<exec executable = "steam">
<arg value = "build"/>
<arguments/>
</exec>
</sequential>
</macrodef>
<macrodef name = "steam-inline-bundle">
<attribute name = "bundle" />
<element name = "arguments" optional = "true" implicit = "true"/>
<sequential>
<exec executable = "steam">
<arg value = "inline-bundle" />
<arg value = "@{bundle}" />
<arguments/>
</exec>
</sequential>
</macrodef>
</project>
-22
View File
@@ -1,22 +0,0 @@
function printUsage(command)
{
var usage = "usage: steam COMMAND [ARGS]\n\n"+
"The most commonly used steam commands are:\n"+
"\tbuild Build a project\n"+
"\tcreate Create a new project\n\n"+
"See 'steam help COMMAND' for more information on a specific command.";
switch (command)
{
case "--help":
case undefined: java.lang.System.out.println(usage);
break;
case "create": java.lang.System.out.println("Creates a new Cappuccino project.\n\nusage: steam create PROJECT_NAME [-l]\n\n"+
"\t-l Link Frameworks to $STEAM_BUILD/Release, instead of installing default Frameworks");
break;
default: java.lang.System.out.println("steam: '" + command + "' is not a steam command. See 'steam --help'.");
}
java.lang.System.exit(1);
}
-5
View File
@@ -1,5 +0,0 @@
function printVersion()
{
java.lang.System.out.println("steam version 0.6");
java.lang.System.exit(1);
}