<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>External/Rakefile</filename>
    </added>
    <added>
      <filename>Objective-J/Tools/objj/bin/objj</filename>
    </added>
    <added>
      <filename>Objective-J/Tools/objj/bin/objjc</filename>
    </added>
    <added>
      <filename>Objective-J/Tools/objj/bin/plutil</filename>
    </added>
    <added>
      <filename>Objective-J/Tools/objj/lib/objj/objj.js</filename>
    </added>
    <added>
      <filename>Objective-J/Tools/objj/lib/objj/objjc.js</filename>
    </added>
    <added>
      <filename>Objective-J/Tools/objj/package.json</filename>
    </added>
    <added>
      <filename>Objective-J/Tools/shrinksafe.jar</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -5,7 +5,6 @@
 @import &lt;AppKit/CPTheme.j&gt;
 @import &lt;BlendKit/BlendKit.j&gt;
 
-importClass(java.io.File);
 importClass(java.io.FileOutputStream);
 importClass(java.io.BufferedWriter);
 importClass(java.io.OutputStreamWriter);
@@ -14,7 +13,7 @@ importClass(java.io.OutputStreamWriter);
 function main()
 {
     var index = 0,
-        count = arguments.length,
+        count = system.args.length,
         
         outputFilePath = &quot;&quot;,
         descriptorFiles = [],
@@ -23,22 +22,22 @@ function main()
     
     for (; index &lt; count; ++index)
     {
-        var argument = arguments[index];
+        var argument = system.args[index];
         
         switch (argument)
         {
             case &quot;-c&quot;:      
-            case &quot;--cib&quot;:       cibFiles.push(arguments[++index]);
+            case &quot;--cib&quot;:       cibFiles.push(system.args[++index]);
                                 break;
             
             case &quot;-d&quot;:      
-            case &quot;-descriptor&quot;: descriptorFiles.push(arguments[++index]);
+            case &quot;-descriptor&quot;: descriptorFiles.push(system.args[++index]);
                                 break;
 
-            case &quot;-o&quot;:          outputFilePath = arguments[++index];
+            case &quot;-o&quot;:          outputFilePath = system.args[++index];
                                 break;
 
-            case &quot;-R&quot;:          resourcesPath = arguments[++index];
+            case &quot;-R&quot;:          resourcesPath = system.args[++index];
                                 break;
 
             default:            jExtensionIndex = argument.indexOf(&quot;.j&quot;);
@@ -67,7 +66,7 @@ function main()
             
             var objectTemplates = BKThemeObjectTemplatesForClass(theClass);
                 data = cibDataFromTopLevelObjects(objectTemplates.concat([themeTemplate])),
-                temporaryCibFile = File.createTempFile(&quot;temp&quot;, &quot;.cib&quot;),
+                temporaryCibFile = Packages.java.io.File.createTempFile(&quot;temp&quot;, &quot;.cib&quot;),
                 temporaryCibFilePath = temporaryCibFile.getAbsolutePath(),
                 writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(temporaryCibFilePath), &quot;UTF-8&quot;));
     
@@ -116,7 +115,7 @@ function buildBlendFromCibFiles(cibFiles, outputFilePath, resourcesPath)
     var resourcesFile = nil;
     
     if (resourcesPath)
-        resourcesFile = new File(resourcesPath);
+        resourcesFile = new Packages.java.io.File(resourcesPath);
     
     var count = cibFiles.length,
         replacedFiles = [],
@@ -124,7 +123,7 @@ function buildBlendFromCibFiles(cibFiles, outputFilePath, resourcesPath)
     
     while (count--)
     {
-        var theme = themeFromCibFile(new File(cibFiles[count])),
+        var theme = themeFromCibFile(new Packages.java.io.File(cibFiles[count])),
         
             // Archive our theme.
             filePath = [theme name] + &quot;.keyedtheme&quot;,
@@ -145,7 +144,7 @@ function buildBlendFromCibFiles(cibFiles, outputFilePath, resourcesPath)
     [infoDictionary setObject:replacedFiles forKey:@&quot;CPBundleReplacedFiles&quot;];
     [infoDictionary setObject:staticContentName forKey:@&quot;CPBundleExecutable&quot;];
     
-    var outputFile = new File(outputFilePath).getCanonicalFile();
+    var outputFile = new Packages.java.io.File(outputFilePath).getCanonicalFile();
 
     outputFile.mkdirs();
     
@@ -162,7 +161,7 @@ function buildBlendFromCibFiles(cibFiles, outputFilePath, resourcesPath)
     writer.close();
     
     if (resourcesPath)
-        rsync(new File(resourcesPath), new File(outputFilePath));
+        rsync(new Packages.java.io.File(resourcesPath), new Packages.java.io.File(outputFilePath));
 }
 
 function themeFromCibFile(aFile)</diff>
      <filename>AppKit/Tools/blend/main.j</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,35 @@
 #!/usr/bin/env ruby
 
-require 'rake'
 require '../../common'
+require 'objective-j'
+require 'rake'
+require 'rake/clean'
+
+$ENVIRONMENT_NARWHAL_PRODUCT = File.join($ENVIRONMENT_DIR, 'narwhal')
+$ENVIRONMENT_OBJJ_PRODUCT = File.join($ENVIRONMENT_NARWHAL_PRODUCT, 'packages', 'objj')
 
+$OBJJC_JS_COMPILER = File.join($ENVIRONMENT_LIB_DIR, 'shrinksafe.jar')
 
-subprojects = %w{cplutil objj objjc}
+$EXECUTABLES = ['objj', 'objjc', 'plutil']
+$EXECUTABLES_PRODUCTS = $EXECUTABLES.map {|e| File.join($ENVIRONMENT_BIN_DIR, e) }
+
+file_d $ENVIRONMENT_OBJJ_PRODUCT do
+    cp_r('objj', $ENVIRONMENT_OBJJ_PRODUCT)
+end
 
-%w(build clean clobber).each do |task_name|
-  task task_name do
-    subrake(subprojects, task_name)
+$EXECUTABLES.each do |executable|
+  source = File.join('objj', 'bin', executable)
+  dest = File.join($ENVIRONMENT_BIN_DIR, executable)
+  file_d dest =&gt; source do
+    #cp(source, dest)
+    FileUtils.ln_s(&quot;../narwhal/packages/objj/bin/#{executable}&quot;, dest)
   end
 end
+
+file_d $OBJJC_JS_COMPILER =&gt; 'shrinksafe.jar' do
+    cp('shrinksafe.jar', $OBJJC_JS_COMPILER)
+end
+
+task :build =&gt; [$ENVIRONMENT_OBJJ_PRODUCT, $OBJJC_JS_COMPILER].concat($EXECUTABLES_PRODUCTS)
+
+CLOBBER.include($ENVIRONMENT_OBJJ_PRODUCT, $EXECUTABLES_PRODUCTS, $OBJJC_JS_COMPILER)</diff>
      <filename>Objective-J/Tools/Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -158,8 +158,8 @@ function fragment_evaluate_code(aFragment)
     try
     {
 #if RHINO
-        //compiled = eval(&quot;function(){&quot;+GET_CODE(aFragment)+&quot;}&quot;);
-        compiled = Packages.org.mozilla.javascript.Context.getCurrentContext().compileFunction(window, &quot;function(){&quot;+GET_CODE(aFragment)+&quot;}&quot;, GET_FILE(aFragment).path, 0, null);
+        compiled = eval(&quot;function(){&quot;+GET_CODE(aFragment)+&quot;}&quot;);
+        //compiled = Packages.org.mozilla.javascript.Context.getCurrentContext().compileFunction(window, &quot;function(){&quot;+GET_CODE(aFragment)+&quot;}&quot;, GET_FILE(aFragment).path, 0, null);
 #else
         compiled = new Function(GET_CODE(aFragment));
         compiled.displayName = GET_FILE(aFragment).path;</diff>
      <filename>Objective-J/evaluate.js</filename>
    </modified>
    <modified>
      <diff>@@ -279,10 +279,6 @@ function CPPropertyListCreateFromXMLData(XMLNodeOrData)
     
     if (XMLNode.string)
     {
-#if RHINO
-        XMLNode = DOCUMENT_ELEMENT(_documentBuilder.parse(
-            new Packages.org.xml.sax.InputSource(new Packages.java.io.StringReader(XMLNode.string))));
-#else
         if (window.ActiveXObject)
         {
             XMLNode = new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);
@@ -290,7 +286,6 @@ function CPPropertyListCreateFromXMLData(XMLNodeOrData)
         }
         else
             XMLNode = DOCUMENT_ELEMENT(new DOMParser().parseFromString(XMLNodeOrData.string, &quot;text/xml&quot;));
-#endif
     }
 
     // Skip over DOCTYPE and so forth.</diff>
      <filename>Objective-J/plist.js</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@ require 'rake'
 require 'rake/clean'
 
 
-subprojects = %w{Objective-J Foundation AppKit Tools}
+subprojects = %w{External Objective-J Foundation AppKit Tools External/ojunit}
 
 %w(build clean clobber).each do |task_name|
     task task_name do
@@ -82,6 +82,8 @@ task :test =&gt; [:build] do
     puts &quot;tests failed, aborting the build&quot;
     puts build_result
     rake abort
+  else  
+    puts build_result
   end
 end
 </diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -3,8 +3,7 @@
 require 'rake'
 require '../common'
 
-
-subprojects = %w{bake capp nib2cib press ojunit}
+subprojects = %w{capp bake nib2cib press}
 
 %w(build clean clobber).each do |task_name|
   task task_name do</diff>
      <filename>Tools/Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,3 @@
-
-importClass(java.lang.System);
-importClass(java.io.File);
 importClass(java.io.FileWriter);
 importClass(java.io.FileOutputStream);
 importClass(java.io.BufferedWriter);
@@ -10,11 +7,11 @@ importClass(java.io.OutputStreamWriter);
 
 function main()
 {
-    if (arguments.length &lt; 1)
+    if (system.args.length &lt; 1)
         return printUsage();
 
     var index = 0,
-        count = arguments.length,
+        count = system.args.length,
         
         shouldSymbolicallyLink = false,
         justFrameworks = false,
@@ -24,9 +21,9 @@ function main()
 
     for (; index &lt; count; ++index)
     {
-        var argument = arguments[index];
+        var argument = system.args[index];
         
-        switch (arguments[index])
+        switch (system.args[index])
         {
             case &quot;-l&quot;:              shouldSymbolicallyLink = true;
                                     break;
@@ -36,7 +33,7 @@ function main()
                                     return;
             
             case &quot;-t&quot;:
-            case &quot;--template&quot;:      template = arguments[++index];
+            case &quot;--template&quot;:      template = system.args[++index];
                                     break;
                                 
             case &quot;-f&quot;:
@@ -47,8 +44,8 @@ function main()
         }
     }
 
-    var sourceTemplate = new File(OBJJ_HOME + &quot;/lib/capp/Resources/Templates/&quot; + template),
-        destinationProject = new File(destination);
+    var sourceTemplate = new java.io.File(OBJJ_HOME + &quot;/lib/capp/Resources/Templates/&quot; + template),
+        destinationProject = new java.io.File(destination);
     
     if (!destinationProject.exists())
     {
@@ -79,43 +76,43 @@ function main()
 
 function createFrameworksInFile(/*File*/ aFile, /*Boolean*/ shouldSymbolicallyLink)
 {
-        var destinationFrameworks = new File(aFile.getCanonicalPath()+ &quot;/Frameworks&quot;),
-            destinationDebugFrameworks = new File(aFile.getCanonicalPath() + &quot;/Frameworks/Debug&quot;);
+        var destinationFrameworks = new java.io.File(aFile.getCanonicalPath()+ &quot;/Frameworks&quot;),
+            destinationDebugFrameworks = new java.io.File(aFile.getCanonicalPath() + &quot;/Frameworks/Debug&quot;);
 
         if (!shouldSymbolicallyLink)
         {
-            var sourceFrameworks = new File(OBJJ_HOME + &quot;/lib/Frameworks&quot;);
+            var sourceFrameworks = new java.io.File(OBJJ_HOME + &quot;/lib/Frameworks&quot;);
         
             exec([&quot;cp&quot;, &quot;-vR&quot;, sourceFrameworks.getCanonicalPath(), destinationFrameworks.getCanonicalPath()], true);
 
             return true;
         }
         
-        var STEAM_BUILD = System.getenv(&quot;STEAM_BUILD&quot;);
+        var STEAM_BUILD = system.env(&quot;STEAM_BUILD&quot;);
         
         // Release Frameworks
-        new File(destinationFrameworks).mkdir();
+        new java.io.File(destinationFrameworks).mkdir();
         
-        exec([&quot;ln&quot;, &quot;-s&quot;,   new File(STEAM_BUILD + &quot;/Release/Objective-J&quot;).getCanonicalPath(),
-                            new File(aFile.getCanonicalPath() + &quot;/Frameworks/Objective-J&quot;).getCanonicalPath()], true);
+        exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(STEAM_BUILD + &quot;/Release/Objective-J&quot;).getCanonicalPath(),
+                            new java.io.File(aFile.getCanonicalPath() + &quot;/Frameworks/Objective-J&quot;).getCanonicalPath()], true);
 
-        exec([&quot;ln&quot;, &quot;-s&quot;,   new File(STEAM_BUILD + &quot;/Release/Foundation&quot;).getCanonicalPath(),
-                            new File(aFile.getCanonicalPath() + &quot;/Frameworks/Foundation&quot;).getCanonicalPath()], true);
+        exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(STEAM_BUILD + &quot;/Release/Foundation&quot;).getCanonicalPath(),
+                            new java.io.File(aFile.getCanonicalPath() + &quot;/Frameworks/Foundation&quot;).getCanonicalPath()], true);
 
-        exec([&quot;ln&quot;, &quot;-s&quot;,   new File(STEAM_BUILD + &quot;/Release/AppKit&quot;).getCanonicalPath(),
-                            new File(aFile.getCanonicalPath() + &quot;/Frameworks/AppKit&quot;).getCanonicalPath()], true);
+        exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(STEAM_BUILD + &quot;/Release/AppKit&quot;).getCanonicalPath(),
+                            new java.io.File(aFile.getCanonicalPath() + &quot;/Frameworks/AppKit&quot;).getCanonicalPath()], true);
 
         // Debug Frameworks
-        new File(destinationDebugFrameworks).mkdir();
+        new java.io.File(destinationDebugFrameworks).mkdir();
         
-        exec([&quot;ln&quot;, &quot;-s&quot;,   new File(STEAM_BUILD + &quot;/Debug/Objective-J&quot;).getCanonicalPath(),
-                            new File(aFile.getCanonicalPath() + &quot;/Frameworks/Debug/Objective-J&quot;).getCanonicalPath()], true);
+        exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(STEAM_BUILD + &quot;/Debug/Objective-J&quot;).getCanonicalPath(),
+                            new java.io.File(aFile.getCanonicalPath() + &quot;/Frameworks/Debug/Objective-J&quot;).getCanonicalPath()], true);
 
-        exec([&quot;ln&quot;, &quot;-s&quot;,   new File(STEAM_BUILD + &quot;/Debug/Foundation&quot;).getCanonicalPath(),
-                            new File(aFile.getCanonicalPath() + &quot;/Frameworks/Debug/Foundation&quot;).getCanonicalPath()], true);
+        exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(STEAM_BUILD + &quot;/Debug/Foundation&quot;).getCanonicalPath(),
+                            new java.io.File(aFile.getCanonicalPath() + &quot;/Frameworks/Debug/Foundation&quot;).getCanonicalPath()], true);
 
-        exec([&quot;ln&quot;, &quot;-s&quot;,   new File(STEAM_BUILD + &quot;/Debug/AppKit&quot;).getCanonicalPath(),
-                            new File(aFile.getCanonicalPath() + &quot;/Frameworks/Debug/AppKit&quot;).getCanonicalPath()], true);
+        exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(STEAM_BUILD + &quot;/Debug/AppKit&quot;).getCanonicalPath(),
+                            new java.io.File(aFile.getCanonicalPath() + &quot;/Frameworks/Debug/AppKit&quot;).getCanonicalPath()], true);
 }
 
 function printUsage()
@@ -136,3 +133,84 @@ function writeContentsToFile(/*String*/ aString, /*File*/ aFile)
 
     writer.close();
 }
+
+function exec(/*Array*/ command, /*Boolean*/ showOutput)
+{
+    var line = &quot;&quot;,
+        output = &quot;&quot;,
+        
+        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(&quot;exit value = &quot; + process.exitValue());
+    }
+    catch (anException)
+    {
+        Packages.java.lang.System.err.println(anException);
+    }
+    
+    return output;
+}
+
+function getFiles(/*File*/ sourceDirectory, /*nil|String|Array&lt;String&gt;*/ extensions, /*Array*/ exclusions)
+{
+    var matches = [],
+        files = sourceDirectory.listFiles(),
+        hasMultipleExtensions = typeof extensions !== &quot;string&quot;;
+
+    if (files)
+    {
+        var index = 0,
+            count = files.length;
+        
+        for (; index &lt; count; ++index)
+        {
+            var file = files[index].getCanonicalFile(),
+                name = String(file.getName()),
+                isValidExtension = !extensions;
+            
+            if (exclusions &amp;&amp; fileArrayContainsFile(exclusions, file))
+                continue;
+            
+            if (!isValidExtension)
+                if (hasMultipleExtensions)
+                {
+                    var extensionCount = extensions.length;
+                    
+                    while (extensionCount-- &amp;&amp; !isValidExtension)
+                    {
+                        var extension = extensions[extensionCount];
+                        
+                        if (name.substring(name.length - extension.length - 1) === (&quot;.&quot; + extension))
+                            isValidExtension = true;
+                    }
+                }
+                else if (name.substring(name.length - extensions.length - 1) === (&quot;.&quot; + extensions))
+                    isValidExtension = true;
+                
+            if (isValidExtension)
+                matches.push(file);
+            
+            if (file.isDirectory())
+                matches = matches.concat(getFiles(file, extensions, exclusions));
+        }
+    }
+    
+    return matches;
+}</diff>
      <filename>Tools/capp/main.j</filename>
    </modified>
    <modified>
      <diff>@@ -36,7 +36,7 @@ CPLogRegister(CPLogPrint);
 
 function exec(command)
 {
-	var p = Packages.java.lang.Runtime.getRuntime().exec(jsArrayToJavaArray(command));
+	var p = Packages.java.lang.Runtime.getRuntime().exec(command);
 	var result = p.waitFor();
 	
 	var reader = new Packages.java.io.BufferedReader(new Packages.java.io.InputStreamReader(p.getInputStream()));</diff>
      <filename>Tools/nib2cib/main.j</filename>
    </modified>
    <modified>
      <diff>@@ -77,40 +77,14 @@ end
 def subrake(directories, task_name)
     directories.each do |directory|
       if (File.directory?(directory) &amp;&amp; File.file?(File.join(directory, &quot;Rakefile&quot;)))
-        system %{cd #{directory} &amp;&amp; #{$serialized_env} #{$0} #{task_name}}
+        ok = system(%{cd #{directory} &amp;&amp; #{$serialized_env} #{$0} #{task_name}})
+        rake abort unless ok
       else
         puts &quot;warning: subrake missing: &quot; + directory +&quot; (this is not necessarily an error, &quot;+directory+&quot; may be optional)&quot;
       end
     end
 end
 
-# Shared Resrouces in env
-$JSJAR_PATH = File.expand_path(File.join($HOME_DIR, 'Tools/Utilities/js.jar'))
-$ENVIRONMENT_JS = File.join($ENVIRONMENT_LIB_DIR, 'js.jar')
-
-file_d $ENVIRONMENT_JS do
-    cp($JSJAR_PATH, $ENVIRONMENT_JS)
-end
-
-def js2java(inputfile, className, debug)
-    
-    debugString = '-nosource -debug' if debug
-    
-    IO.popen(&quot;java -classpath #{$JSJAR_PATH}:. #{debugString} org.mozilla.javascript.tools.jsc.Main -o #{className} #{inputfile}&quot;) do |shrinksafe|
-        puts shrinksafe.read
-    end
-end
-
-def cat(files, outfile)
-
-    File.open(outfile, &quot;w&quot;) do |concated|
-    
-        files.each do |file|
-          concated.write IO.read(file)
-        end 
-    end
-end
-
 def executable_exists?(name)
   ENV[&quot;PATH&quot;].split(&quot;:&quot;).any? {|p| File.executable? File.join(p, name) }
 end
@@ -122,7 +96,7 @@ def make_objj_executable(path)
     File.chmod 0755, path
 end
 
-task :build =&gt; [$ENVIRONMENT_JS]
+task :build
 task :default =&gt; [:build]
 
 task :release do</diff>
      <filename>common.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>Objective-J/Tools/cplutil/Rakefile</filename>
    </removed>
    <removed>
      <filename>Objective-J/Tools/cplutil/main.js</filename>
    </removed>
    <removed>
      <filename>Objective-J/Tools/executable</filename>
    </removed>
    <removed>
      <filename>Objective-J/Tools/objj/Rakefile</filename>
    </removed>
    <removed>
      <filename>Objective-J/Tools/objj/main.js</filename>
    </removed>
    <removed>
      <filename>Objective-J/Tools/objjc/Rakefile</filename>
    </removed>
    <removed>
      <filename>Objective-J/Tools/objjc/main.js</filename>
    </removed>
    <removed>
      <filename>Objective-J/Tools/objjc/shrinksafe.jar</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>b31abab59501ed182ccc9d851c4d280bf8877a9a</id>
    </parent>
  </parents>
  <author>
    <name>tlrobinson</name>
    <email>tom@280north.com</email>
  </author>
  <url>http://github.com/280north/cappuccino/commit/6e11a66cb090c3c08031ddae74840fe88ee5e391</url>
  <id>6e11a66cb090c3c08031ddae74840fe88ee5e391</id>
  <committed-date>2009-05-10T03:35:31-07:00</committed-date>
  <authored-date>2009-05-10T03:35:31-07:00</authored-date>
  <message>Updated all Rakefiles and tools to work with Narwhal</message>
  <tree>a24889ca2d90aa33e581a17f822c8f68b1812764</tree>
  <committer>
    <name>tlrobinson</name>
    <email>tom@280north.com</email>
  </committer>
</commit>
