Skip to content

Commit

Permalink
Fixed some build bugs and moved capp to new build system.
Browse files Browse the repository at this point in the history
Reviewed by me.
  • Loading branch information
Francisco Tolmasky committed Mar 18, 2009
1 parent 1dcc6db commit ad93ad5
Show file tree
Hide file tree
Showing 32 changed files with 201 additions and 1,033 deletions.
2 changes: 0 additions & 2 deletions AppKit/Tools/blend/main.j
Expand Up @@ -294,5 +294,3 @@ function exec(/*Array*/ command, /*Boolean*/ showOutput)
}

@end

main.apply(main, args);
2 changes: 1 addition & 1 deletion AppKit/Tools/blend/rakefile
Expand Up @@ -34,5 +34,5 @@ file_d $ENVIRONMENT_BIN_PRODUCT do
end

file_d $ENVIRONMENT_LIB_PRODUCT => [:blend] do
cp_r($BUILD_PATH, $ENVIRONMENT_LIB_PRODUCT)
cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_LIB_PRODUCT)
end
2 changes: 1 addition & 1 deletion Objective-J/Tools/objj/main.js
Expand Up @@ -49,7 +49,7 @@ try
if (debug)
print("Loading: " + mainFilePath);

objj_import(mainFilePath, YES, function() { if (typeof main === "Function") main.apply(main, args); } );
objj_import(mainFilePath, YES, function() { if (typeof main === "function") main.apply(main, args); } );

serviceTimeouts();

Expand Down
15 changes: 15 additions & 0 deletions Tools/Rakefile
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby

require 'rake'
require '../common'


subprojects = %w{capp nib2cib}

%w(build clean).each do |task_name|
task task_name do
subrake(subprojects)
end
end

#task :deploy => [:build]
84 changes: 83 additions & 1 deletion Tools/Utilities/bridge.js
Expand Up @@ -584,4 +584,86 @@ if (!OBJJ_HOME)
{
OBJJ_HOME = "/usr/local/share/objj";
alert("OBJJ_HOME environment variable not set, defaulting to " + OBJJ_HOME);
}
}

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)
Packages.java.lang.System.out.println(line);

output += line + '\n';
}

reader = new Packages.java.io.BufferedReader(new Packages.java.io.InputStreamReader(process.getErrorStream()));

while (line = reader.readLine())
Packages.java.lang.System.out.println(line);

try
{
if (process.waitFor() != 0)
Packages.java.lang.System.err.println("exit value = " + process.exitValue());
}
catch (anException)
{
Packages.java.lang.System.err.println(anException);
}

return output;
}


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;
}
38 changes: 38 additions & 0 deletions Tools/capp/Rakefile
@@ -0,0 +1,38 @@
#!/usr/bin/env ruby

require 'rake'
require '../../common'
require 'objective-j'
require 'objective-j/bundletask'


$PRODUCT = :capp
$BUILD_PATH = File.join($BUILD_DIR, $CONFIGURATION, 'capp')
$ENVIRONMENT_BIN_PRODUCT = File.join($ENVIRONMENT_BIN_DIR, 'capp')
$ENVIRONMENT_LIB_PRODUCT = File.join($ENVIRONMENT_LIB_DIR, 'capp')

task :build => [:capp, $ENVIRONMENT_BIN_PRODUCT, $ENVIRONMENT_LIB_PRODUCT]

# Debug Framework
ObjectiveJ::BundleTask.new(:capp) do |t|
t.name = 'capp'
t.identifier = 'com.280n.capp'
t.version = '0.6.5'
t.author = '280 North, Inc.'
t.email = 'feedback @nospam@ 280north.com'
t.summary = 'Setup up Cappuccino projects'
t.sources = FileList['*.j']
t.resources = FileList['Resources/*']
t.license = ObjectiveJ::License::LGPL_v2_1
t.build_path = $BUILD_PATH
t.flag = 'DEBUG' if $CONFIGURATION == 'Debug'
end

#executable in environment directory
file_d $ENVIRONMENT_BIN_PRODUCT do
make_objj_executable($ENVIRONMENT_BIN_PRODUCT)
end

file_d $ENVIRONMENT_LIB_PRODUCT => [:capp] do
cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_LIB_PRODUCT)
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
69 changes: 61 additions & 8 deletions Tools/steam/create-frameworks.js → Tools/capp/main.j
@@ -1,9 +1,21 @@
function createFrameworks()

importClass(java.io.File);
importClass(java.io.FileOutputStream);
importClass(java.io.BufferedWriter);
importClass(java.io.OutputStreamWriter);

function main()
{
var shouldSymbolicallyLink = false,
index = 0,
if (arguments.length < 1)
return printUsage();

var index = 0,
count = arguments.length,

shouldSymbolicallyLink = false,
justFrameworks = false,

template = "Application",
destination = "";

for (; index < count; ++index)
Expand All @@ -12,14 +24,50 @@ function createFrameworks()

switch (arguments[index])
{
case "-l": shouldSymbolicallyLink = true;
break;
case "-l": shouldSymbolicallyLink = true;
break;

case "-h":
case "--help": printUsage();
return;

default: destination = argument;
case "-t":
case "--template": template = arguments[++index];
break;

case "-f":
case "--frameworks": justFrameworks = true;
break;

default: destination = argument;
}
}

createFrameworksInFile(new File(destination), shouldSymbolicallyLink);
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");
}

function createFrameworksInFile(/*File*/ aFile, /*Boolean*/ shouldSymbolicallyLink)
Expand Down Expand Up @@ -63,4 +111,9 @@ function createFrameworksInFile(/*File*/ aFile, /*Boolean*/ shouldSymbolicallyLi

exec(["ln", "-s", new File(STEAM_BUILD + "/Debug/AppKit").getCanonicalPath(),
new File(aFile.getCanonicalPath() + "/Frameworks/Debug/AppKit").getCanonicalPath()], true);
}
}

function printUsage()
{
print("capp /path/to/your/app [options]");
}
2 changes: 1 addition & 1 deletion Tools/nib2cib/Rakefile
Expand Up @@ -34,5 +34,5 @@ file_d $ENVIRONMENT_BIN_PRODUCT do
end

file_d $ENVIRONMENT_LIB_PRODUCT => [:nib2cib] do
cp_r($BUILD_PATH, $ENVIRONMENT_LIB_PRODUCT)
cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_LIB_PRODUCT)
end
2 changes: 0 additions & 2 deletions Tools/nib2cib/main.j
Expand Up @@ -248,5 +248,3 @@ function main()
else
convert(inputFileName, outputFileName, resourcesPath);
}

main.apply(main, args);

0 comments on commit ad93ad5

Please sign in to comment.