From 579cc98e4f09bb80d7eb89b4ae8ace32ba432808 Mon Sep 17 00:00:00 2001 From: Derek Hammer Date: Sun, 7 Feb 2010 23:22:32 -0500 Subject: [PATCH] Adding the --symlink and --build flags. capp gen -l something is now just an alias for capp gen --symlink --build something. This allows for easy copying of built Frameworks for those hacking on Cappuccino --- Tools/capp/Generate.j | 30 ++++++++++++++++++++---------- Tools/capp/main.j | 2 ++ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Tools/capp/Generate.j b/Tools/capp/Generate.j index 5e3e7b8e1..b53315813 100644 --- a/Tools/capp/Generate.j +++ b/Tools/capp/Generate.j @@ -15,6 +15,7 @@ function gen(/*va_args*/) count = arguments.length, shouldSymbolicallyLink = false, + shouldUseCappBuild = false, justFrameworks = false, noConfig = false, force = false, @@ -30,6 +31,15 @@ function gen(/*va_args*/) { case "-l": shouldSymbolicallyLink = true; + shouldUseCappBuild = true; + break; + + case "--symlink": + shouldSymbolicallyLink = true; + break; + + case "--build": + shouldUseCappBuild = true; break; case "-t": @@ -70,7 +80,7 @@ function gen(/*va_args*/) configuration = noConfig ? [Configuration defaultConfiguration] : [Configuration userConfiguration]; if (justFrameworks) - createFrameworksInFile(destinationProject, shouldSymbolicallyLink, force); + createFrameworksInFile(destinationProject, shouldSymbolicallyLink, shouldUseCappBuild, force); else if (!FILE.exists(destinationProject)) { @@ -123,13 +133,13 @@ function gen(/*va_args*/) if (config.FrameworksPath) frameworkDestination = FILE.join(frameworkDestination, config.FrameworksPath); - createFrameworksInFile(frameworkDestination, shouldSymbolicallyLink); + createFrameworksInFile(frameworkDestination, shouldSymbolicallyLink, shouldUseCappBuild); } else print("Directory already exists"); } -function createFrameworksInFile(/*String*/ aFile, /*Boolean*/ symlink, /*Boolean*/ force) +function createFrameworksInFile(/*String*/ aFile, /*Boolean*/ symlink, /*Boolean*/ build, /*Boolean*/ force) { var destination = FILE.path(FILE.absolute(aFile)); var frameworks = ["Foundation", "AppKit"]; @@ -145,7 +155,7 @@ function createFrameworksInFile(/*String*/ aFile, /*Boolean*/ symlink, /*Boolean //destinationFrameworks.mkdirs(); // redundant destinationDebugFrameworks.mkdirs(); - if (symlink) { + if (build) { if (!(SYSTEM.env["CAPP_BUILD"] || SYSTEM.env["STEAM_BUILD"])) throw "CAPP_BUILD or STEAM_BUILD must be defined"; @@ -155,8 +165,8 @@ function createFrameworksInFile(/*String*/ aFile, /*Boolean*/ symlink, /*Boolean sourceDebugFrameworks = builtFrameworks.join("Debug"); frameworks.concat("Objective-J").forEach(function(framework) { - installFramework(sourceFrameworks.join(framework), destinationFrameworks.join(framework), force, true); - installFramework(sourceDebugFrameworks.join(framework), destinationDebugFrameworks.join(framework), force, true); + installFramework(sourceFrameworks.join(framework), destinationFrameworks.join(framework), force, symlink); + installFramework(sourceDebugFrameworks.join(framework), destinationDebugFrameworks.join(framework), force, symlink); }); } else { @@ -165,8 +175,8 @@ function createFrameworksInFile(/*String*/ aFile, /*Boolean*/ symlink, /*Boolean var objjPath = objjHome.join("Frameworks", "Objective-J"); var objjDebugPath = objjHome.join("Frameworks", "Debug", "Objective-J"); - installFramework(objjPath, destinationFrameworks.join("Objective-J"), force, false); - installFramework(objjDebugPath, destinationDebugFrameworks.join("Objective-J"), force, false); + installFramework(objjPath, destinationFrameworks.join("Objective-J"), force, symlink); + installFramework(objjDebugPath, destinationDebugFrameworks.join("Objective-J"), force, symlink); // Frameworks. Search frameworks paths frameworks.forEach(function(framework) { @@ -175,7 +185,7 @@ function createFrameworksInFile(/*String*/ aFile, /*Boolean*/ symlink, /*Boolean for (var i = 0, found = false; !found && i < OBJJ.objj_frameworks.length; i++) { var sourceFramework = FILE.path(OBJJ.objj_frameworks[i]).join(framework); if (FILE.isDirectory(sourceFramework)) { - installFramework(sourceFramework, destinationFrameworks.join(framework), force, false); + installFramework(sourceFramework, destinationFrameworks.join(framework), force, symlink); found = true; } } @@ -185,7 +195,7 @@ function createFrameworksInFile(/*String*/ aFile, /*Boolean*/ symlink, /*Boolean for (var i = 0, found = false; !found && i < OBJJ.objj_debug_frameworks.length; i++) { var sourceDebugFramework = FILE.path(OBJJ.objj_debug_frameworks[i]).join(framework); if (FILE.isDirectory(sourceDebugFramework)) { - installFramework(sourceDebugFramework, destinationDebugFrameworks.join(framework), force, false); + installFramework(sourceDebugFramework, destinationDebugFrameworks.join(framework), force, symlink); found = true; } } diff --git a/Tools/capp/main.j b/Tools/capp/main.j index 0d48ae1e3..881d4be51 100644 --- a/Tools/capp/main.j +++ b/Tools/capp/main.j @@ -47,6 +47,8 @@ function printUsage() print(" -t, --template Specify the template name to use (listed in capp/Resources/Templates)"); print(" -f, --frameworks Create only frameworks, not a full application"); print(" --force Overwrite Frameworks directory if it already exists"); + print(" --symlink Create a symlink to the source Frameworks"); + print(" --build Source the Frameworks directory files from your $CAPP_BUILD or $STEAM_BUILD directory"); print(""); print(ANSITextApplyProperties(" config ", ANSI_BOLD)); print(" name value Set a value for a given key");