Added create-frameworks to steam, and began adding Templating system.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2009-02-02 01:59:50 -08:00
1 parent 63f813d8ad
commit 9aad67ae04
8 files changed
+222 -54

No files matched your search

@@ -0,0 +1,39 @@
/*
* 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
@@ -0,0 +1,12 @@
<?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>
@@ -0,0 +1,36 @@
<?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>
@@ -0,0 +1,37 @@
<?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>
+18
View File
@@ -0,0 +1,18 @@
/*
* 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);
}
+63 -1
View File
@@ -1,4 +1,66 @@
function createFrameworks()
{
return create(Array.concat.apply(arguments, ["-f"]));
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);
}
+15 -52
View File
@@ -3,12 +3,12 @@ function create()
if (arguments.length < 1)
printUsage("create");
var link = false,
var shouldSymbolicallyLink = false,
index = 0,
count = arguments.length,
destination = NULL,
justFrameworks = false;
template = "Application",
destination = "";
for (; index < count; ++index)
{
@@ -16,61 +16,24 @@ function create()
switch (arguments[index])
{
case "-l": link = true;
break;
case "-f": justFrameworks = true;
break;
default: destination = argument;
case "-l": shouldSymbolicallyLink = true;
break;
case "--template": template = arguments[++index];
break;
default: destination = argument;
}
}
var sourceNewApplication = new File(OBJJ_HOME + "/lib/NewApplication"),
destinationNewApplication = new File(destination),
sourceFrameworks = new File(OBJJ_HOME + "/lib/Frameworks"),
sourceDebugFrameworks = new File(OBJJ_HOME + "/lib/Frameworks-Debug"),
destinationFrameworks = new File(destination + "/Frameworks"),
destinationDebugFrameworks = new File(destination + "/Frameworks/Debug");
var sourceTemplate = new File(OBJJ_HOME + "/lib/steam/Templates/" + template),
destinationProject = new File(destination);
System.out.println(sourceNewApplication.getCanonicalPath() + "," + destinationNewApplication.getCanonicalPath() + "," + sourceFrameworks.getCanonicalPath() + "," + destinationFrameworks.getCanonicalPath());
if (justFrameworks || !destinationNewApplication.exists())
if (!destinationProject.exists())
{
if (!justFrameworks)
exec(["cp", "-vR", sourceNewApplication.getCanonicalPath(), destinationNewApplication.getCanonicalPath()], true);
exec(["cp", "-vR", sourceTemplate.getCanonicalPath(), destinationProject.getCanonicalPath()], true);
if (!link)
{
exec(["cp", "-vR", sourceFrameworks.getCanonicalPath(), destinationFrameworks.getCanonicalPath()], true);
exec(["cp", "-vR", sourceDebugFrameworks.getCanonicalPath(), destinationDebugFrameworks.getCanonicalPath()], true);
}
else
{
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(destination + "/Frameworks/Objective-J").getCanonicalPath()], true);
exec(["ln", "-s", new File(STEAM_BUILD + "/Release/Foundation").getCanonicalPath(),
new File(destination + "/Frameworks/Foundation").getCanonicalPath()], true);
exec(["ln", "-s", new File(STEAM_BUILD + "/Release/AppKit").getCanonicalPath(),
new File(destination + "/Frameworks/AppKit").getCanonicalPath()], true);
// Debug Frameworks
new File(destinationDebugFrameworks).mkdir();
exec(["ln", "-s", new File(STEAM_BUILD + "/Debug/Objective-J").getCanonicalPath(),
new File(destination + "/Frameworks/Debug/Objective-J").getCanonicalPath()], true);
exec(["ln", "-s", new File(STEAM_BUILD + "/Debug/Foundation").getCanonicalPath(),
new File(destination + "/Frameworks/Debug/Foundation").getCanonicalPath()], true);
exec(["ln", "-s", new File(STEAM_BUILD + "/Debug/AppKit").getCanonicalPath(),
new File(destination + "/Frameworks/Debug/AppKit").getCanonicalPath()], true);
}
createFrameworksInFile(destinationProject, shouldSymbolicallyLink);
}
else
System.out.println("Directory already exists");
+2 -1
View File
@@ -24,7 +24,8 @@ if [ -z $OBJJ_HOME ]; then
fi
OBJJ_LIB="$OBJJ_HOME/lib"
CLASSPATH="$OBJJ_LIB:$OBJJ_LIB/js.jar"
STEAM="$OBJJ_LIB/steam"
CLASSPATH="$STEAM:$OBJJ_LIB:$OBJJ_LIB/js.jar"
# convert paths for Cygwin
if [[ `uname` == CYGWIN* ]]; then