Skip to content

Commit

Permalink
Fixed a few minor issues in steam.
Browse files Browse the repository at this point in the history
Reviewed by me.
  • Loading branch information
Francisco Ryan Tolmasky I committed Jan 22, 2009
1 parent 06601ba commit 6f3a0bd
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 7 deletions.
2 changes: 1 addition & 1 deletion AppKit/AppKit.steam
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<key>Name</key>
<string>AppKit</string>
<key>Targets</key>
<array>
Expand Down
48 changes: 42 additions & 6 deletions Tools/steam/steam.js
Expand Up @@ -89,6 +89,8 @@ function Project(/*String*/ aFilePath, /*String*/ aBuildPath)
// 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");

Expand Down Expand Up @@ -125,6 +127,11 @@ function Project(/*String*/ aFilePath, /*String*/ aBuildPath)
return this;
}

Project.prototype.name = function()
{
return this._name;
}

Project.prototype.targetWithName = function(/*String*/ aName)
{
var targets = this._targets,
Expand Down Expand Up @@ -227,6 +234,10 @@ Project.prototype.activeFlags = function()

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;
Expand Down Expand Up @@ -298,6 +309,10 @@ Project.prototype.build = function()

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);
}
Expand Down Expand Up @@ -565,11 +580,12 @@ function fileArrayContainsFile(/*Array*/ files, /*File*/ aFile)
return false;
}

function getFiles(/*File*/ sourceDirectory, /*String*/ extension, /*Array*/ exclusions)
function getFiles(/*File*/ sourceDirectory, /*nil|String|Array<String>*/ extensions, /*Array*/ exclusions)
{
var matches = [],
files = sourceDirectory.listFiles();

files = sourceDirectory.listFiles(),
hasMultipleExtensions = typeof extensions !== "string";

if (files)
{
var index = 0,
Expand All @@ -578,13 +594,33 @@ function getFiles(/*File*/ sourceDirectory, /*String*/ extension, /*Array*/ excl
for (; index < count; ++index)
{
var file = files[index].getCanonicalFile(),
name = String(file.getName());
name = String(file.getName()),
isValidExtension = !extensions;

if ((!extension || name.substring(name.length - extension.length - 1) == ("." + extension)) && (!exclusions || !fileArrayContainsFile(exclusions, file)))
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, extension, exclusions));
matches = matches.concat(getFiles(file, extensions, exclusions));
}
}

Expand Down

0 comments on commit 6f3a0bd

Please sign in to comment.