buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r608657 [1/2] - in /incubator/buildr/trunk: ./ bin/ doc/ doc/css/ doc/pages/ lib/ lib/buildr/ lib/core/ lib/java/ spec/
Date Thu, 03 Jan 2008 22:15:26 GMT
Author: assaf
Date: Thu Jan  3 14:15:24 2008
New Revision: 608657

URL: http://svn.apache.org/viewvc?rev=608657&view=rev
Log:
Cleaned up documentation, removed deprecated features, make wrapper behave like JRuby include, using YAML for documentation ToC, requires Docter 1.1

Added:
    incubator/buildr/trunk/doc/print.toc.yaml
    incubator/buildr/trunk/doc/web.toc.yaml
Removed:
    incubator/buildr/trunk/doc/print.toc.textile
    incubator/buildr/trunk/doc/web.toc.textile
Modified:
    incubator/buildr/trunk/CHANGELOG
    incubator/buildr/trunk/Rakefile
    incubator/buildr/trunk/bin/buildr
    incubator/buildr/trunk/doc/css/default.css
    incubator/buildr/trunk/doc/pages/building.textile
    incubator/buildr/trunk/doc/pages/contributing.textile
    incubator/buildr/trunk/doc/pages/projects.textile
    incubator/buildr/trunk/doc/web.haml
    incubator/buildr/trunk/lib/buildr.rb
    incubator/buildr/trunk/lib/buildr/antlr.rb
    incubator/buildr/trunk/lib/buildr/javacc.rb
    incubator/buildr/trunk/lib/buildr/jetty.rb
    incubator/buildr/trunk/lib/buildr/openjpa.rb
    incubator/buildr/trunk/lib/core.rb
    incubator/buildr/trunk/lib/core/build.rb
    incubator/buildr/trunk/lib/core/compile.rb
    incubator/buildr/trunk/lib/core/environment.rb
    incubator/buildr/trunk/lib/java.rb
    incubator/buildr/trunk/lib/java/ant.rb
    incubator/buildr/trunk/lib/java/artifact.rb
    incubator/buildr/trunk/lib/java/compilers.rb
    incubator/buildr/trunk/lib/java/java.rb
    incubator/buildr/trunk/lib/java/packaging.rb
    incubator/buildr/trunk/lib/java/test_frameworks.rb
    incubator/buildr/trunk/spec/artifact_spec.rb
    incubator/buildr/trunk/spec/build_spec.rb
    incubator/buildr/trunk/spec/packaging_spec.rb
    incubator/buildr/trunk/spec/project_spec.rb
    incubator/buildr/trunk/spec/sandbox.rb
    incubator/buildr/trunk/spec/test_spec.rb

Modified: incubator/buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/CHANGELOG (original)
+++ incubator/buildr/trunk/CHANGELOG Thu Jan  3 14:15:24 2008
@@ -10,26 +10,27 @@
 * Changed: For compile and test, use dependencies instead of classpath (with works are before).
 * Changed: Test framework componentized along the same lines as the compilers.
 * Removed: Prepare tasks removed.
+* Removed: All deprecated features since 1.1.  If you've seen warnings before, except the build to break.
 * Fixed: Artifact.pom resolves artifact without classifier, i.e org.testng:testng:jar:jdk15:5.1 uses org.testng:testng:pom:5.1 (Tommy).
 * Fixed: More patches towards JRuby support, courtesy of Vic Borja.
 
-1.2.10 (11/26/2007)
+1.2.10 (2007-11-26)
 * Changed: Resources sets permission on copied files to make them read/write-able.
 * Changed: Artifact download no longer generates destination directory if not downloaded (Antoine).
 * Fixed: EOL in MANIFEST.MF.
 * Fixed: Bunch of typos, courtesy of Merlyn Albery-Speyer and Soemirno Kartosoewito.
 
-1.2.9 (11/8/2007)
+1.2.9 (2007-11-08)
 * Changed: Upgraded to RJB 1.0.11.
 * Fixed: Backward compatibility in Java.rjb/wrapper.
 
-1.2.8 (11/1/2007)
+1.2.8 (2007-11-01)
 * Added: Resolving Maven snapshots from remote repository (Rhett Sutphin)
 * Changed: scala options.target now takes number, e.g. "1.5" instead of "jvm-1.5" (Nathan Hamblen)
 * Changed: Eclipse task uses updated Scala plugin nature and builder (Alex Boisvert)
 * Fixed: Bringing Buildr back to 1.0.9, XMLBeans fix.
 
-1.2.7 (10/29/2007)
+1.2.7 (2007-10-29)
 * Added: You can create an artifact from a given file using artifact(<spec>).from(<path>).  You can then install it into the local repository or upload it to the release server using install(<artifacts>) and upload(<artifacts>). (Idea: Shane Witbeck and Tommy Mason).
 * Added: ANTLR support.
 * Changed: Speed boost to ZIP packaging.
@@ -40,7 +41,7 @@
 * Fixed: Jetty task no longer sets "log4j.configuration" system property
 * Fixed: release task didn't work
 
-1.2.6 (9/26/2007)
+1.2.6 (2007-09-26)
 * Added: Option for setting environment name (-e) and attribute accessor (Buildr.environment).  Default taken from BUILDR_ENV environment variable.
 * Added: AAR packaging for Axis2 service archives (Alex Boisvert)
 * Added: Environment variable for JUnit tests (test.using :environment=>).
@@ -60,12 +61,12 @@
 * Fixed: archive.exclude doesn't work when including a directory using :from/:as option.
 * Fixed: JUnit/TestNG no longer run inner classes as test classes (Mark Feeney).
 
-1.2.5 (8/13/2007)
+1.2.5 (2007-08-13)
 * Fixed: Buildr not finding buildfile in parent directory, or switching to parent directory.
 * Fixed: checks.rb:103: warning: multiple values for a block parameter (2 for 1)
 * Fixed: ZIPs include empty META-INF directory.
 
-1.2.4 (8/3/2007)
+1.2.4 (2007-08-03)
 * Added: Forking option for JUnit test framework: :once to fork for each project, :each to fork for each test case, and false to not fork. (Tammo van Lessen)
 * Added: Path traversal in Zip, so zip.path("foo/bar").path("..") returns zip.path("foo").
 * Fixed: JUnit test framework output shows errors in console, more readable when forking is on (Tammo van Lessen).
@@ -82,21 +83,21 @@
 * Fixed: ZIP/JAR/WAR include directory entries in some cases and not others.
 * Fixed: Computation of relative paths in Eclipse project generation (Cameron Pope)
 
-1.2.3 (7/26/2007)
+1.2.3 (2007-07-26)
 * Added: Get your buildfile created form existing POM, just run buildr on existing Maven project (Anatol Pomozov).
 * Added: package(:tar), package(:tgz), TarballTask dn TarTask (Tommy Knowlton).
 * Changed: The ArchiveTask needs no introduction: it's a base task that provides common functionality for ZipTask, TarTask and friends.
 * Fixed: Release runs buildr instead of buildr.cmd on Windows (Chris Power).
 * Fixed: Cobertura reports broken (Anatol Pomozov).
 
-1.2.2 (7/18/2007)
+1.2.2 (2007-07-18)
 * Added: resources.using and filter.using now accepts a format as the first argument, default being :maven, but you can also use :ant, :ruby or pass a regular expression (http://groups.google.com/group/buildr-talk/browse_thread/thread/5216d5ae8bfff29b).
 * Fixed: Sleek upload with changelog for each release courtesy of Anatol Pomozov.
 * Fixed: Zip.path.contains fails on paths with more than one directory (http://groups.google.com/group/buildr-talk/browse_thread/thread/5d305bbeeb814d1).
 * Fixed: Speed of sorting entries when creating new Zip file (http://groups.google.com/group/buildr-talk/browse_thread/thread/8b4d1b0e983f32f).
 * Fixed: Uploading using SFTP creates directory for uploaded file (http://groups.google.com/group/buildr-talk/browse_thread/thread/80021d35cecfecdc).
 
-1.2.1 (7/12/2007)
+1.2.1 (2007-07-12)
 * Added: Proxy exclusion, use environment variable NO_PROXY, or options.proxy.exclude = <url> || [<url>] (http://groups.google.com/group/buildr-talk/t/9f1e988e0dbeea9f).
 * Added: You can now copy resources from multiple source directories, using resources.from (http://groups.google.com/group/buildr-talk/browse_thread/thread/4f2867a6dbbc19d4).
 * Added: Hash.from_java_properties(string) and hash.to_java_properties.
@@ -109,7 +110,7 @@
 * Fixed: Hibernate.schema_export not passing Ant task when yielding.
 * Fixed: IntelliJ Idea project files generation for projects more than two degrees deep.
 
-1.2.0 (6/6/2007)
+1.2.0 (2007-06-06)
 * Added: Artifact.list returns specs for all registered artifacts (those created with artifact or package).
 * Added: Buildr.option.java_args are used when creating the RJB JVM, when running a Java process (unless you override directly), and when running JUnit tests (again, unless override).
 * Added: TestNG support (test.using :testng).
@@ -157,13 +158,13 @@
 * Fixed: Gets JVM version number from system property java.version instead of calling java -version.
 * Fixed: Artifact downloads POM first, such that you can download/create/fake it youself.
 
-1.1.3 (6/12/2007)
+1.1.3 (2007-06-12)
 * Added: Long awaited idea project files generation. Very early code, the iml seems to be generated okay but needs testing. The ipr is still missing but will come in due time (and it's not always necessary anyway).
 *Fixed: Doc bug: unzip doesn't have an into(dir) method.
 *Fixed: File names don't always have a dot.
 *Fixed: For Jetty servers, http://foo//bar is not http://foo/bar
 
-1.1.2 (5/29/2007)
+1.1.2 (2007-05-29)
 * Added: Allow passing :java_args option to the junit task
 * Added: Hibernate XDoclet and SchemaExport tasks. (Requires buildr/hibernate)
 * Added: JDepend UI for seeing depenencies across all projects. (Requires buildr/jdepend)
@@ -171,13 +172,13 @@
 * Changed: tools_jar now returns empty array on OS/X, part of the ongoing Write Once/Test Everywere effort. (Credit Paul Brown)
 * Fixed: Work around keep_alive bug in Net::HTTP. (http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/10818)
 
-1.1.1 (5/16/2007)
+1.1.1 (2007-05-16)
 * Changed: Test case class names must end with Test, TestCase, Suite or TestSuite.
 * Changed: You can now run rake test:{foo,bar} to match against either foo or bar (requires \{..\} on UNIX).
 * Changed: JAVA_HOME now required on all platforms, along with more OS/X fixes. (Credit Paul Brown)
 * Fixed: You can now run rake test:<name> from any directory, and it will find just the right test cases.
 
-1.1.0 (5/13/2007)
+1.1.0 (2007-05-13)
 * Added: Proxy setting for downloading from remote repositories (use repositories.proxy = ...).
 * Added: projects task to list all the projects you can build.
 * Added: Project attribute target to specify the target directory.
@@ -194,7 +195,7 @@
 * Fixed: Manifest gets EOL to keep EOF company. (Credit Tommy Knowlton)
 * Fixed: Compile tasks clean after themselves when target directory changed. (Credit Lyle Johnson)
 
-1.0.0 (5/4/2007)
+1.0.0 (2007-05-04)
 * Added: buildr:freeze and buildr:unfreeze task. These set the Rakefile to use a particular version of Buildr, freezing by setting to the current version of Buildr, unfreeze to use the latest Gem.
 * Added: Buildr.options, with three options to start with: test, debug and parallel.
 * Added: Buildr.option.debug or environment variable DEBUG to control the compiler debug option. Defaults to yes, except when doing a release.
@@ -205,7 +206,7 @@
 * Changed: OpenJPA 0.9.7 no longer snapshoted.
 * Fixed: For Windows users: user's home directory, fu_check_options is now rake_check_options, java command works around funky system bbug.
 
-0.22 (4/26/2007)
+0.22 (2007-04-26)
 * Added: Calling projects(:in=>foo) returns only the sub-projects defined in foo.
 * Added: _() as shortcut for path_to().
 * Added: You can pass properties to java by setting the :properties options.
@@ -222,7 +223,7 @@
 * Removed: Tasks no longer use a base directory, always map paths directly using file, path_to or _().
 * Fixed: The artifacts task no longer downloads POMs for artifacts created by the Rakefile.
 
-0.21 (4/20/2007)
+0.21 (2007-04-20)
 * Added: Methods to read and write a file (shortcut for File.read/File.open.write).
 * Changed: Filter task now takes a source directory and target directory, and copies all included (sans excluded) files between the two.
 * Changed: Artifact type is now symbol instead of string (so :jar instead of "jar"). You can still specify a string, but the return value from #to_spec or #type is a symbol.
@@ -230,7 +231,7 @@
 * Changed: The test task will now run JUnit test cases from classes ending with Test or Suite. And the inclusion pattern is always set.
 * Fixed: Project property not inherited if false.
 
-0.20 (4/18/2007)
+0.20 (2007-04-18)
 * Added: JavadocTask to generate Javadoc documentation for the project, javadoc method on the project itself to return its javadoc task, and Java.javadoc to do all the heavy lifting.
 * Changed: Release code is now implemented as module instead of class. SVN copy made from working copy instead of double commit.
 * Removed: package :file_name options. Does not work with deployed artifacts or POMs.
@@ -238,7 +239,7 @@
 * Fixed: JARs and WARs include redundant META-INF directory.
 * Fixed: The local package task is now a dependency for install/deploy, and build is dependency for package.
 
-0.19 (4/13/2007)
+0.19 (2007-04-13)
 * Fixed: Eclipse task correctly handles FileTasks
 * Fixed: Eclipse task output directory is "target/classes" (Project.compile.target) instead of "/target"
 * Added: Set specific file permissions when uploading with SFTP transport with :permission option
@@ -283,7 +284,7 @@
 * Fixed: Eclipse task now executed whenever a change is made in the Rakefile, or any file it requires, include buildr.rb and task files.
 * Fixed: Circular dependency in release task.
 
-0.18 (3/26/2007)
+0.18 (2007-03-26)
 * Added: manifest attribute on project, used by default when packaging JAR/WAR.
 * Added: default manifest includes build-by, build-jdk and implementation-title.
 * Added: compile.from(sources) in the same vein as compile.with(classpath)
@@ -306,7 +307,7 @@
 * Fixed: compile task now properly detects when not all files compiled.
 * Fixed: bug that caused project file tasks to execute twice.
 
-0.17 (3/14/2007)
+0.17 (2007-03-14)
 * Added: project.task acts like Rake's task but can also fetch a task from
   a project using the project's namespace.
 * Added: project.file acts like Rake's file but resolve relative paths
@@ -328,7 +329,7 @@
 * Changed: cannot access a project before it's defined, but can do that with
   sub-projects to establish dependencies.
 
-0.16 (3/7/2007)
+0.16 (2007-03-07)
 * Added: zip.include :as=> to include file under specified name.
 * Added: zip.merge to include the (expanded) contents of one zip file in another.
 * Added: experimental test task using JUnit and JMock.
@@ -340,11 +341,11 @@
 * Fixed: release task now deletes old tagged copy and reports SVN usage.
 * Fixed: OpenJPA not including target directory in classpath.
 
-0.15 (2/28/2007)
+0.15 (2007-02-28)
 * Fixed: tasks fail unless deployment server specified.
 * Changed: deploy method executes deployment, instead of returning a task.
 
-0.14 (2/28/2007)
+0.14 (2007-02-28)
 * Added: check task that looks for obvious errors in the Rakefile.
 * Added: deploy task for managing deployment.
 * Added: release task that updates version numbers, commits and tags SVN.
@@ -359,7 +360,7 @@
 * Fixed: timing issues.
 * Fixed: Maven classifier now used properly.
 
-0.13 (2/26/2007)
+0.13 (2007-02-26)
 * Added: global java method.
 * Added: project build method.
 * Added: OpenJPA mapping_tool method.
@@ -371,7 +372,7 @@
   that does not map to any project.
 * Fixed: to work with Rake 0.7.2.
 
-0.12 (2/24/2007)
+0.12 (2007-02-24)
 * Added: call prepare with list of tasks to add them as prerequisites.
 * Added: project.id returns the compound name, e.g. foo, foo-bar, foo-bar-baz.
 * Added: JavaCC, XMLBeans schema compiler, OpenJPA enhancer, APT tasks.
@@ -386,7 +387,7 @@
 * Fixed: zip dependencies were all fucked up.
 * Fixed: package should not depend on build.
 
-0.11 (2/16/2007)
+0.11 (2007-02-16)
 * Added: test cases for unzip task
 * Added: prepare method to access prepare task
 * Added: prepare, compile and resources accept a block you can use to enhance the task
@@ -399,7 +400,7 @@
 * Changed: unzip now using UnzipTask with its own shorthand syntax.
 * Changed: filter task gets a consistent syntax to unzip
 
-0.10 (2/13/2007)
+0.10 (2007-02-13)
 * Added: modifier for artifacts
 * Added: ZipTask, WarTask
 * Added: get POM artifact directly from artifact
@@ -407,7 +408,7 @@
 * Changed: options for packaging, but not affecting current Rakefile
 * Remove: delete task
 
-0.9 (2/9/2007)
+0.9 (2007-02-09)
 * Added: attributes for configuring compile (sources, classpath, target, options)
 * Added: shorthand notation for specifying compilation (to, with, using)
 * Changed: copy task is dead (name conflict), instead we get the better filter
@@ -419,7 +420,7 @@
 * Changed: resources task now working as expected
 * Remove: global task artifacts was the root of all evil and got canned.
 
-0.8 (2/5/2007)
+0.8 (2007-02-05)
 * Added: release task and release_to configuration for repositories
 * Added: SFTP uploader for releases
 * Added: convenience method group() for specifying multiple artifacts in same
@@ -436,7 +437,7 @@
 * Changed: moved HTTP download logic to transports.rb
 * Removed: deprecated grouping with multiple artifacts under id key
 
-0.6 (2/1/2007)
+0.6 (2007-02-01)
 * Added:   Artifact resolution introduces the notion of a spec,
            which can be supported using ActsAsArtifact
 * Added:   You can now use a project as an artifact, resulting in all its
@@ -450,7 +451,7 @@
 * Changed: attributes now stored directly as instance variables
 * Changed: ANSI colors and progress bar now using Ruby Facets
 
-0.5 (1/24/2007)
+0.5 (2007-01-24)
 * Added: Build number for each top-level project, build_number method for accessing
   it and build:increment task for updating the build number file.
 * Added: to_path method on project to resolve paths relative to base_dir.
@@ -466,7 +467,7 @@
 * Changed: Directory structure, now split into rbs, rbs-java and tasks.
 * Removed: project.options. Using a different attributes mechanism.
 
-0.4 (1/23/2007)
+0.4 (2007-01-23)
 * Added: CopyTask now deals with files and directories, can copy multiple files,
   and applies filter to all of them. Filter can be a hash or a proc.
 * Added: Project gets resources_filter attribute that can be used to set the
@@ -475,19 +476,19 @@
 * Changed: Dependencies now check signatures for every file, if available,
   and show download progress.
 
-0.3 (1/22/2007)
+0.3 (2007-01-22)
 * Added: Dependencies loaded from Maven repositories if not existing or built by project.
   Use rake dependencies to force update, or let compilation take care of it.
 * Added: Copy task for copying one file to another, and filtering support.
 
-0.2 (1/21/2007)
+0.2 (2007-01-21)
 * Added: remove task to get rid of packages added to the local repository.
 * Changed: recompile project if any of its dependencies is newer than the source code.
   Will cause recompile if any of the dependencies was compiled and packaged again.
 * Changed: compile task depends on javac task and resource copy tasks.
   This might change when adding filtering later on.
 
-0.1 (1/19/2007)
+0.1 (2007-01-19)
 * Added: build and clean tasks
 * Added: resources are now copied over during compilation
 * Added: POM file generated in local repository (keep Maven happy)

Modified: incubator/buildr/trunk/Rakefile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/Rakefile?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/Rakefile (original)
+++ incubator/buildr/trunk/Rakefile Thu Jan  3 14:15:24 2008
@@ -1,6 +1,7 @@
 require 'rubygems'
 Gem::manage_gems
 require 'rake/gempackagetask'
+require 'rake/rdoctask'
 require 'spec/rake/spectask'
 
 
@@ -93,6 +94,7 @@
 # Documentation.
 begin
   require 'rake/rdoctask'
+  gem 'docter', '~>1.1'
   require 'docter'
   require 'docter/server'
   require 'docter/ultraviolet'
@@ -106,17 +108,21 @@
     rdoc.rdoc_files.include spec.extra_rdoc_files
   end
 
-  web_collection = Docter.collection.using('doc/web.toc.textile').include('doc/pages', 'CHANGELOG')
-  web_template = Docter.template('doc/web.haml').include('doc/css', 'doc/images', 'html/report.html', 'html/coverage')
-  print_collection = Docter.collection.using('doc/print.toc.textile').include('doc/pages')
-  print_template = Docter.template('doc/print.haml').include('doc/css', 'doc/images')
+  web_docs = {
+    :collection => Docter.collection('Buildr').using('doc/web.toc.yaml').include('doc/pages', 'LICENSE', 'CHANGELOG'),
+    :template   => Docter.template('doc/web.haml').include('doc/css', 'doc/images', 'html/report.html', 'html/coverage')
+  }
+  print_docs = {
+    :collection => Docter.collection('Buildr &mdash; The build system that doesn\'t suck').using('doc/print.toc.yaml').include('doc/pages', 'LICENSE'),
+    :template   => Docter.template('doc/print.haml').include('doc/css', 'doc/images')
+  }
 
   Docter.filter_for(:footnote) do |html|
     html.gsub(/<p id="fn(\d+)">(.*?)<\/p>/, %{<p id="fn\\1" class="footnote">\\2</p>})
   end
 
   desc 'Produce PDF'
-  print = Docter::Rake.generate('print', print_collection, print_template, :one_page)
+  print = Docter::Rake.generate('print', print_docs[:collection], print_docs[:template], :one_page)
   pdf_file = file('html/buildr.pdf'=>print) do |task|
     mkpath 'html'
     sh *%W{prince #{print}/index.html -o #{task.name}} do |ok, res|
@@ -126,9 +132,9 @@
   task('pdf'=>pdf_file) { |task| `kpdf #{File.expand_path(pdf_file.to_s)}` }
 
   desc 'Generate HTML documentation'
-  html = Docter::Rake.generate('html', web_collection, web_template)
+  html = Docter::Rake.generate('html', web_docs[:collection], web_docs[:template])
   desc 'Run Docter server'
-  Docter::Rake.serve :docter, web_collection, web_template, :port=>3000
+  Docter::Rake.serve :docter, web_docs[:collection], web_docs[:template], :port=>3000
 
   desc 'Generate all documentation merged into the html directory'
   task 'docs'=>[html, rdoc.name, pdf_file]
@@ -166,7 +172,7 @@
     require 'rubyforge'
 
     # Read the changes for this release.
-    pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d+\/\d+\/\d+\)\s*((:?^[^\n]+\n)*))/
+    pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
     changelog = File.read(__FILE__.pathmap('%d/CHANGELOG'))
     changes = changelog.scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
     current = changes[spec.version.to_s]

Modified: incubator/buildr/trunk/bin/buildr
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/bin/buildr?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/bin/buildr (original)
+++ incubator/buildr/trunk/bin/buildr Thu Jan  3 14:15:24 2008
@@ -1,7 +1,7 @@
 begin
-  require "buildr"
+  require 'buildr'
 rescue LoadError
-  require "rubygems"
-  require "buildr"
+  require 'rubygems'
+  require 'buildr'
 end
 Rake.application.run

Modified: incubator/buildr/trunk/doc/css/default.css
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/css/default.css?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/css/default.css (original)
+++ incubator/buildr/trunk/doc/css/default.css Thu Jan  3 14:15:24 2008
@@ -82,20 +82,24 @@
 ol.toc {
   list-style: none;
   padding: 0;
-  margin-bottom: 2em; !important
+  margin-bottom: 2em !important;
 }
 
 ol.toc li {
-  margin-left: 0.5em;
-  margin-bottom: 0.3em;
+  padding: 0.3em 0 0.3em 0 !important;
+  margin: 0;
 }
 
-ol.toc ol {
+ol.toc ol.toc {
   list-style: none;
+  margin: 0.3em 0 0.5em 0;
   padding: 0;
-  margin-left: 1.3em;
-  margin-bottom: 0.3em;
 }
+
+ol.toc ol.toc li {
+  padding-left: 0.5em !important;
+}
+
 
 #content .footnote {
   margin-top: 2.5em;

Modified: incubator/buildr/trunk/doc/pages/building.textile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/pages/building.textile?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/pages/building.textile (original)
+++ incubator/buildr/trunk/doc/pages/building.textile Thu Jan  3 14:15:24 2008
@@ -1,4 +1,4 @@
-lding
+h1. Building
 
 To remove any confusion, Buildr's build task is actually called @build@.  It's also the default task that executes when you run @buildr@ without any task name.
 

Modified: incubator/buildr/trunk/doc/pages/contributing.textile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/pages/contributing.textile?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/pages/contributing.textile (original)
+++ incubator/buildr/trunk/doc/pages/contributing.textile Thu Jan  3 14:15:24 2008
@@ -1,8 +1,8 @@
 h1. Contributing
 
-Step 1, join the "mailing list":mailing_lists.html.  It's the best place to ask
-questions, report "features", submit patches and let us know how you use Buildr
-in your own projects.
+Step 1, join the "mailing list":mailing_lists.html.  It's the best place to
+ask questions, report "features", submit patches and let us know how you use
+Buildr in your own projects.
 
 Step 2, checkout "Buildr from
 SVN":http://svn.apache.org/repos/asf/incubator/buildr:

Modified: incubator/buildr/trunk/doc/pages/projects.textile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/pages/projects.textile?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/pages/projects.textile (original)
+++ incubator/buildr/trunk/doc/pages/projects.textile Thu Jan  3 14:15:24 2008
@@ -81,7 +81,7 @@
   |   |
   |   |__ target         <- JAR goes here
   |   |   |__ classes    <- Generated bytecode
-  |   |__ reporets       <- From test cases,
+  |   |__ reports        <- From test cases,
   |       |__ junit      <- like JUnit
   |
   |__ teh-impl

Added: incubator/buildr/trunk/doc/print.toc.yaml
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/print.toc.yaml?rev=608657&view=auto
==============================================================================
--- incubator/buildr/trunk/doc/print.toc.yaml (added)
+++ incubator/buildr/trunk/doc/print.toc.yaml Thu Jan  3 14:15:24 2008
@@ -0,0 +1,11 @@
+- Welcome: index.html
+- Getting Started: getting_started.html
+- Projects: projects.html
+- Building: building.html
+- Artifcats: artifacts.html
+- Packaging: packaging.html
+- Testing: testing.html
+- More Stuff: more_stuff.html
+- Extending: extending.html
+- Contributing: contributing.html
+- License: license.html

Modified: incubator/buildr/trunk/doc/web.haml
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/web.haml?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/web.haml (original)
+++ incubator/buildr/trunk/doc/web.haml Thu Jan  3 14:15:24 2008
@@ -2,7 +2,7 @@
 %html
   %head
     %meta{ 'http-equiv'=>'Content-Type', :content=>'text/html;charset=UTF-8' }/
-    %title= "#{collection.title} &#8211; #{page.title}"
+    %title= "#{collection.title} &mdash; #{page.title}"
     %link{ :rel=>'stylesheet', :type=>'text/css', :href=>'css/default.css' }
     %link{ :rel=>'stylesheet', :type=>'text/css', :href=>'css/eiffel.css' }
     %style{ :type=>'text/css', :media=>'print' }
@@ -18,7 +18,7 @@
           %img{ :src=>'images/buildr.png', :alt=>collection.title }
         .tagline= 'The build system that doesn\'t suck'
       #pages
-        = collection.toc.to_html
+        = collection.toc.to_html(:nested=>1, :class=>'toc')
         %form{ :id=>'searchbox_003673095760649043902:ogcgrzu0l2y', :action=>'http://www.google.com/cse' }
           %input{ :type=>'hidden', :name=>'cx', :value=>'003673095760649043902:ogcgrzu0l2y' }
           %input{ :type=>'hidden', :name=>'cof', :value=>'FORID:0' }

Added: incubator/buildr/trunk/doc/web.toc.yaml
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/web.toc.yaml?rev=608657&view=auto
==============================================================================
--- incubator/buildr/trunk/doc/web.toc.yaml (added)
+++ incubator/buildr/trunk/doc/web.toc.yaml Thu Jan  3 14:15:24 2008
@@ -0,0 +1,26 @@
+- Main:  
+  - Welcome: index.html
+  - Download
+  - Printable PDF: buildr.pdf
+- Using Buildr:
+  - Getting Started: getting_started.html
+  - Projects: projects.html
+  - Building: building.html
+  - Artifcats: artifacts.html
+  - Packaging: packaging.html
+  - Testing: testing.html
+  - More Stuff: more_stuff.html
+  - Extending: extending.html
+- Reference:
+  - API: rdoc/index.html
+  - Rake: http://docs.rubyrake.org
+  - Antwrap: http://antwrap.rubyforge.org
+- Getting Involved:
+  - Mailing Lists: mailing_lists.html
+  - Issues/Bugs: http://issues.apache.org/jira/browse/Buildr
+  - Contributing: contributing.html
+- Project Status:
+  - License: license.html
+  - Change Log: changelog.html
+  - Test Report: report.html
+  - Test Coverage: coverage/index.html

Modified: incubator/buildr/trunk/lib/buildr.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr.rb (original)
+++ incubator/buildr/trunk/lib/buildr.rb Thu Jan  3 14:15:24 2008
@@ -4,10 +4,10 @@
 require 'needle'
 require 'net/ssh'
 
-require "highline"
-require "highline/import"
+require 'highline'
+require 'highline/import'
 # &:symbol goodness.
-require "facet/symbol/to_proc"
+require 'facet/symbol/to_proc'
 # blank? on string and nil
 require 'facet/string/blank'
 require 'facet/nilclass/blank'

Modified: incubator/buildr/trunk/lib/buildr/antlr.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/antlr.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/antlr.rb (original)
+++ incubator/buildr/trunk/lib/buildr/antlr.rb Thu Jan  3 14:15:24 2008
@@ -5,7 +5,7 @@
   module ANTLR
     REQUIRES = [ "org.antlr:antlr:jar:3.0", "antlr:antlr:jar:2.7.7", "org.antlr:stringtemplate:jar:3.0" ]
 
-    Java.wrapper.classpath << REQUIRES
+    Java.classpath << REQUIRES
 
     class << self
       def antlr(*args)
@@ -19,13 +19,11 @@
           mkdir_p options[:token] 
           args = ["-lib",  options[:token]] + args 
         end
-        Java.wrapper do |wrapper|
-          antlr_class = wrapper.import("org.antlr.Tool")
-          antlr_tool = antlr_class.new_with_sig("[Ljava.lang.String;", args)
-          antlr_tool.process
-          #wrapper.import("org.antlr.Tool").main(args) == 0 or
-          #  fail "Failed to run ANTLR, see errors above."
-        end
+        antlr_class = Java.import("org.antlr.Tool")
+        antlr_tool = antlr_class.new_with_sig("[Ljava.lang.String;", args)
+        antlr_tool.process
+        #wrapper.import("org.antlr.Tool").main(args) == 0 or
+        #  fail "Failed to run ANTLR, see errors above."
       end
     end
 

Modified: incubator/buildr/trunk/lib/buildr/javacc.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/javacc.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/javacc.rb (original)
+++ incubator/buildr/trunk/lib/buildr/javacc.rb Thu Jan  3 14:15:24 2008
@@ -6,7 +6,7 @@
 
     REQUIRES = [ "net.java.dev.javacc:javacc:jar:4.0", "net.java.dev.javacc:javacc:jar:4.0" ]
 
-    Java.wrapper.classpath << REQUIRES
+    Java.classpath << REQUIRES
 
     class << self
 
@@ -16,10 +16,8 @@
 
         args = args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "/**/*.jj"] : f }.flatten
         args.unshift "-OUTPUT_DIRECTORY=#{options[:output]}" if options[:output]
-        Java.wrapper do |jw|
-          jw.import("org.javacc.parser.Main").mainProgram(args) == 0 or
-            fail "Failed to run JavaCC, see errors above."
-        end
+        Java.import("org.javacc.parser.Main").mainProgram(args) == 0 or
+          fail "Failed to run JavaCC, see errors above."
       end
 
       def jjtree(*args)
@@ -29,10 +27,8 @@
         args = args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "**/*.jjt"] : f }.flatten
         args.unshift "-OUTPUT_DIRECTORY=#{options[:output]}" if options[:output]
         args.unshift "-BUILD_NODE_FILES=#{options[:build_node_files] || false}"
-        Java.wrapper do |jw|
-          jw.import("org.javacc.jjtree.JJTree").new.main(args) == 0 or
-            fail "Failed to run JJTree, see errors above."
-        end
+        Java.import("org.javacc.jjtree.JJTree").new.main(args) == 0 or
+          fail "Failed to run JJTree, see errors above."
       end
 
     end

Modified: incubator/buildr/trunk/lib/buildr/jetty.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/jetty.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/jetty.rb (original)
+++ incubator/buildr/trunk/lib/buildr/jetty.rb Thu Jan  3 14:15:24 2008
@@ -28,15 +28,15 @@
   class Jetty
 
     # Which version of Jetty we're using by default (change with options.jetty.version).
-    VERSION = "6.1.3"
+    VERSION = "6.1.3" unless const_defined?('VERSION')
     SLF4J_VERSION = "1.4.3"
     
     # Libraries used by Jetty.
     REQUIRES = [ "org.mortbay.jetty:jetty:jar:#{VERSION}", "org.mortbay.jetty:jetty-util:jar:#{VERSION}",
       "org.mortbay.jetty:servlet-api-2.5:jar:#{VERSION}", "org.slf4j:slf4j-api:jar:#{SLF4J_VERSION}", 
       "org.slf4j:slf4j-simple:jar:#{SLF4J_VERSION}", "org.slf4j:jcl104-over-slf4j:jar:#{SLF4J_VERSION}" ]
-      
-    Java.wrapper.setup { |jw| jw.classpath << REQUIRES << File.join(__DIR__, "jetty") }
+     
+    Java.classpath <<  REQUIRES << File.join(__DIR__, "jetty")
     
     # Default URL for Jetty (change with options.jetty.url).
     URL = "http://localhost:8080"
@@ -74,14 +74,12 @@
     # invoke the #use task instead.
     def start(sync = nil)
       begin
-        Java.wrapper do |jw|
-          puts "classpath #{jw.classpath.inspect}"
-          port = URI.parse(url).port
-          puts "Starting Jetty at http://localhost:#{port}" if verbose
-          jetty = jw.import("JettyWrapper").new(port)
-          sync << "Started" if sync
-          sleep # Forever
-        end
+        puts "classpath #{Java.classpath.inspect}"
+        port = URI.parse(url).port
+        puts "Starting Jetty at http://localhost:#{port}" if verbose
+        jetty = Java.import("JettyWrapper").new(port)
+        sync << "Started" if sync
+        sleep # Forever
       rescue Interrupt # Stopped from console
       rescue Exception=>error
         puts "#{error.class}: #{error.message}"

Modified: incubator/buildr/trunk/lib/buildr/openjpa.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/openjpa.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/openjpa.rb (original)
+++ incubator/buildr/trunk/lib/buildr/openjpa.rb Thu Jan  3 14:15:24 2008
@@ -17,7 +17,7 @@
       "org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec:jar:1.0",
       "net.sourceforge.serp:serp:jar:1.11.0" ]
 
-    Java.wrapper.classpath << REQUIRES
+    Java.classpath << REQUIRES
 
     class << self
 

Modified: incubator/buildr/trunk/lib/core.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core.rb (original)
+++ incubator/buildr/trunk/lib/core.rb Thu Jan  3 14:15:24 2008
@@ -12,7 +12,7 @@
   # Put first, so other extensions can over-ride Buildr methods.
   include Buildr
   include Buildr::Build
-  include Buildr::Checks
   include Buildr::Compile
   include Buildr::Test
+  include Buildr::Checks
 end

Modified: incubator/buildr/trunk/lib/core/build.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/build.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/build.rb (original)
+++ incubator/buildr/trunk/lib/core/build.rb Thu Jan  3 14:15:24 2008
@@ -1,6 +1,7 @@
-require "core/project"
-require "core/common"
-require "core/checks"
+require 'core/project'
+require 'core/common'
+require 'core/checks'
+require 'core/environment'
 
 module Buildr
 
@@ -17,7 +18,7 @@
 
   end
 
-  task("parallel") { Buildr.options.parallel = true }
+  task('parallel') { Buildr.options.parallel = true }
 
 
   module Build
@@ -27,21 +28,21 @@
     include Extension
 
     first_time do
-      desc "Build the project"
-      Project.local_task("build") { |name| "Building #{name}" }
-      desc "Clean files generated during a build"
-      Project.local_task("clean") { |name| "Cleaning #{name}" }
-      desc "Create packages"
-      Project.local_task("package"=>"build") { |name| "Packaging #{name}" }
-      desc "Install packages created by the project"
-      Project.local_task("install"=>"package") { |name| "Installing packages from #{name}" }
-      desc "Remove previously installed packages"
-      Project.local_task("uninstall") { |name| "Uninstalling packages from #{name}" }
-      desc "Upload packages created by the project"
-      Project.local_task("upload"=>"package") { |name| "Deploying packages from #{name}" }
+      desc 'Build the project'
+      Project.local_task('build') { |name| "Building #{name}" }
+      desc 'Clean files generated during a build'
+      Project.local_task('clean') { |name| "Cleaning #{name}" }
+      desc 'Create packages'
+      Project.local_task('package'=>'build') { |name| "Packaging #{name}" }
+      desc 'Install packages created by the project'
+      Project.local_task('install'=>'package') { |name| "Installing packages from #{name}" }
+      desc 'Remove previously installed packages'
+      Project.local_task('uninstall') { |name| "Uninstalling packages from #{name}" }
+      desc 'Upload packages created by the project'
+      Project.local_task('upload'=>'package') { |name| "Deploying packages from #{name}" }
 
-      desc "The default task it build"
-      task "default"=>"build"
+      desc 'The default task it build'
+      task 'default'=>'build'
     end
 
     before_define do |project|
@@ -85,7 +86,7 @@
     #
     # Returns the project's build task. With arguments or block, also enhances that task.
     def build(*prereqs, &block)
-      task("build").enhance prereqs, &block
+      task('build').enhance prereqs, &block
     end
 
     # :call-seq:
@@ -94,7 +95,7 @@
     #
     # Returns the project's clean task. With arguments or block, also enhances that task.
     def clean(*prereqs, &block)
-      task("clean").enhance prereqs, &block
+      task('clean').enhance prereqs, &block
     end
 
   end
@@ -119,13 +120,13 @@
           sh "#{command} clean upload #{options.join(' ')}"
         end
         tag version
-        commit version + "-SNAPSHOT"
+        commit version + '-SNAPSHOT'
       end
 
     protected
 
       def command() #:nodoc:
-        Config::CONFIG["arch"] =~ /dos|win32/i ? $PROGRAM_NAME.ext("cmd") : $PROGRAM_NAME
+        Config::CONFIG['arch'] =~ /dos|win32/i ? $PROGRAM_NAME.ext('cmd') : $PROGRAM_NAME
       end
 
       # :call-seq:
@@ -136,7 +137,7 @@
       def check()
         fail "SVN URL must end with 'trunk' or 'branches/...'" unless svn_url =~ /(trunk)|(branches.*)$/
         # Status check reveals modified file, but also SVN externals which we can safely ignore.
-        status = svn("status", "--ignore-externals").reject { |line| line =~ /^X\s/ }
+        status = svn('status', '--ignore-externals').reject { |line| line =~ /^X\s/ }
         fail "Uncommitted SVN files violate the First Principle Of Release!\n#{status}" unless
           status.empty?
       end
@@ -161,13 +162,13 @@
       #   NEXT_VERSION = 1.2.1
       # and the method will return 1.2.0.
       def with_next_version()
-        new_filename = Rake.application.rakefile + ".next"
+        new_filename = Rake.application.rakefile + '.next'
         modified = change_version do |this_version, next_version|
-          one_after = next_version.split(".")
+          one_after = next_version.split('.')
           one_after[-1] = one_after[-1].to_i + 1
-          [ next_version, one_after.join(".") ]
+          [ next_version, one_after.join('.') ]
         end
-        File.open(new_filename, "w") { |file| file.write modified }
+        File.open(new_filename, 'w') { |file| file.write modified }
         begin
           yield new_filename
           mv new_filename, Rake.application.rakefile
@@ -193,7 +194,7 @@
           fail "Looking for NEXT_VERSION = \"...\" in your Buildfile, none found"
         this_version, next_version = yield(this_version, next_version)
         if verbose
-          puts "Upgrading version numbers:"
+          puts 'Upgrading version numbers:'
           puts "  This:  #{this_version}"
           puts "  Next:  #{next_version}"
         end
@@ -207,8 +208,8 @@
       # Tags the current working copy with the release version number.
       def tag(version)
         url = svn_url.sub(/(trunk$)|(branches.*)$/, "tags/#{version}")
-        svn "remove", url, "-m", "Removing old copy" rescue nil
-        svn "copy", Dir.pwd, url, "-m", "Release #{version}"
+        svn 'remove', url, '-m', 'Removing old copy' rescue nil
+        svn 'copy', Dir.pwd, url, '-m', "Release #{version}"
       end
 
       # :call-seq:
@@ -218,8 +219,8 @@
       def commit(version)
         rakefile = File.read(Rake.application.rakefile).
           gsub(THIS_VERSION_PATTERN) { |ver| ver.sub(/(["']).*\1/, %Q{"#{version}"}) }
-        File.open(Rake.application.rakefile, "w") { |file| file.write rakefile }
-        svn "commit", "-m", "Changed version number to #{version}", Rake.application.rakefile
+        File.open(Rake.application.rakefile, 'w') { |file| file.write rakefile }
+        svn 'commit', '-m', "Changed version number to #{version}", Rake.application.rakefile
       end
 
       # :call-seq:
@@ -227,21 +228,21 @@
       #
       # Executes SVN command and returns the output.
       def svn(*args)
-        cmd = "svn " + args.map { |arg| arg[" "] ? %Q{"#{arg}"} : arg }.join(" ")
+        cmd = 'svn ' + args.map { |arg| arg[' '] ? %Q{"#{arg}"} : arg }.join(' ')
         puts cmd if verbose
-        `#{cmd}`.tap { fail "SVN command failed" unless $?.exitstatus == 0 }
+        `#{cmd}`.tap { fail 'SVN command failed' unless $?.exitstatus == 0 }
       end
 
       # Return the current SVN URL
       def svn_url
-        url = svn("info").scan(/URL: (.*)/)[0][0]
+        url = svn('info').scan(/URL: (.*)/)[0][0]
       end
     end
 
   end
 
-  desc "Make a release"
-  task "release" do |task|
+  desc 'Make a release'
+  task 'release' do |task|
     Release.make
   end
 

Modified: incubator/buildr/trunk/lib/core/compile.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/compile.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/compile.rb (original)
+++ incubator/buildr/trunk/lib/core/compile.rb Thu Jan  3 14:15:24 2008
@@ -7,8 +7,8 @@
 
       # Select a compiler by its name.
       def select(name)
-        raise ArgumentError, "No #{name} compiler available. Did you install it?" unless compilers.include?(name.to_sym)
-        compilers[name.to_sym]
+        raise ArgumentError, "No #{name} compiler available. Did you install it?" unless @compilers.has_key?(name.to_sym)
+        @compilers[name.to_sym]
       end
 
       # Identify which compiler applies based on one of two arguments:
@@ -16,17 +16,18 @@
       # * :source -- The source directory (src/main, src/test), from which it will look up a particular source
       #     directory (e.g. src/main/java).
       def identify(from)
-        compilers.values.detect { |compiler| compiler.identify?(from) }
+        @compilers.values.detect { |compiler| compiler.identify?(from) }
       end
 
       # Adds a compiler to the list of supported compiler.
       def add(compiler)
+        @compilers ||= {}
         compiler = compiler.new if Class === compiler
-        compilers[compiler.name.to_sym] = compiler
+        @compilers[compiler.name.to_sym] = compiler
       end
 
       def compilers #:nodoc:
-        @compilers ||= {}
+        @compilers.values.clone
       end
 
     end
@@ -129,13 +130,20 @@
   end
 
 
-  # Wraps Javac in a task that does all the heavy lifting.
+  # Compile task.
+  #
+  # Attempts to determine which compiler to use based on the project layout, for example,
+  # uses the Javac compiler if it finds any .java files in src/main/java.  You can also
+  # select the compiler explicitly:
+  #   compile.using(:scalac)
   #
   # Accepts multiple source directories that are invoked as prerequisites before compilation.
-  # You can pass a task as a source directory, e.g. compile.from(apt).
+  # You can pass a task as a source directory:
+  #   compile.from(apt)
   #
   # Likewise, dependencies are invoked before compiling. All dependencies are evaluated as
-  # #artifacts, so you can pass artifact specifications and even projects.
+  # #artifacts, so you can pass artifact specifications and even projects:
+  #   compile.with("module1.jar", "log4j:log4j:jar:1.0", project("foo"))
   #
   # Creates a file task for the target directory, so executing that task as a dependency will
   # execute the compile task first.
@@ -249,7 +257,7 @@
     #   compile.using(:scala)
     def using(*args)
       args.pop.each { |key, value| options.send "#{key}=", value } if Hash === args.last
-      select args.first unless args.empty?
+      select args.pop until args.empty?
       self
     end
 
@@ -449,9 +457,9 @@
     #   # Run the OpenJPA bytecode enhancer after compilation.
     #   compile { open_jpa_enhance }
     #   # Pick a given compiler.
-    #   compile.using(:gcc).from('src')
+    #   compile.using(:scalac).from('src/scala')
     #
-    # For more information, see Java::CompileTask.
+    # For more information, see CompileTask.
     def compile(*sources, &block)
       task('compile').from(sources).enhance &block
     end

Modified: incubator/buildr/trunk/lib/core/environment.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/environment.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/environment.rb (original)
+++ incubator/buildr/trunk/lib/core/environment.rb Thu Jan  3 14:15:24 2008
@@ -1,4 +1,5 @@
 require 'yaml'
+require 'facet/openobject'
 
 
 module Buildr

Modified: incubator/buildr/trunk/lib/java.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java.rb (original)
+++ incubator/buildr/trunk/lib/java.rb Thu Jan  3 14:15:24 2008
@@ -3,7 +3,5 @@
 require 'java/packaging'
 
 class Buildr::Project
-  include Buildr::Test
   include Buildr::Java::Packaging
-  include Buildr::Javadoc
 end

Modified: incubator/buildr/trunk/lib/java/ant.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/ant.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/ant.rb (original)
+++ incubator/buildr/trunk/lib/java/ant.rb Thu Jan  3 14:15:24 2008
@@ -8,27 +8,11 @@
   module Ant
 
     # Which version of Ant we're using by default.
-    VERSION = "1.7.0"
+    VERSION = "1.7.0" unless const_defined?('VERSION')
 
     # Libraries used by Ant.
     REQUIRES = [ "org.apache.ant:ant:jar:#{VERSION}", "org.apache.ant:ant-launcher:jar:#{VERSION}", "xerces:xercesImpl:jar:2.6.2" ]
-    Java.wrapper.setup { |jw| jw.classpath << REQUIRES }
-
-    class << self
-
-      # *Deprecated* Use ant { ... } instead.
-      def declarative(name, options = nil, &block)
-        warn_deprecated "Use ant { ... } instead."
-        Buildr.ant name, options, &block
-      end
-
-      # *Deprecated* Use ant { ... } instead.
-      def executable(name, options = nil, &block)
-        warn_deprecated "Use ant { ... } instead."
-        Buildr.ant name, options, &block
-      end
-
-    end
+    Java.classpath << REQUIRES
 
     # :call-seq:
     #   ant(name) { |AntProject| ... } => AntProject
@@ -45,17 +29,15 @@
     #       fileset :dir=>source, :includes=>"**/*.java"
     #     end
     #   end
-    def ant(name, options=nil, &block)
-      warn_deprecated "Options are ignored." if options
+    def ant(name, &block)
       options = { :name=>name, :basedir=>Dir.pwd, :declarative=>true }
       options.merge!(:logger=> Logger.new(STDOUT), :loglevel=> Logger::DEBUG) if Rake.application.options.trace
-      Java.wrapper do
-        AntProject.new(options).tap do |project|
-          # Set Ant logging level to debug (--trace), info (default) or error only (--quiet).
-          project.project.getBuildListeners().get(0).
-            setMessageOutputLevel((Rake.application.options.trace && 4) || (verbose && 2) || 0)
-          yield project if block_given?
-        end
+      Java.load
+      AntProject.new(options).tap do |project|
+        # Set Ant logging level to debug (--trace), info (default) or error only (--quiet).
+        project.project.getBuildListeners().get(0).
+          setMessageOutputLevel((Rake.application.options.trace && 4) || (verbose && 2) || 0)
+        yield project if block_given?
       end
     end
 

Modified: incubator/buildr/trunk/lib/java/artifact.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/artifact.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/artifact.rb (original)
+++ incubator/buildr/trunk/lib/java/artifact.rb Thu Jan  3 14:15:24 2008
@@ -443,48 +443,6 @@
       end
     end
 
-    # *Deprecated* Please use options.proxy.http instead of repositories.proxy.
-    def proxy()
-      warn_deprecated "Please use options.proxy.http instead of repositories.proxy"
-      Buildr.options.proxy.http
-    end
-
-    # *Deprecated* Please use options.proxy.http = <url> instead of repositories.proxy.
-    def proxy=(proxy)
-      warn_deprecated "Please use options.proxy.http = <url> instead of repositories.proxy"
-      Buildr.options.proxy.http = proxy
-    end
-  
-    # *Deprecated* Just create an artifact and invoke it. 
-    def download(spec)
-      warn_deprecated "Just create and artifact and invoke it."
-      spec = Artifact.to_hash(spec) unless Hash === spec
-      filename = locate(spec)
-      
-      puts "Downloading #{Artifact.to_spec(spec)}" if Rake.application.options.trace
-      return filename if remote.any? do |repo_url|
-        repo_url = URI.parse(repo_url) unless URI === repo_url
-        repo_url.path += "/" unless repo_url.path[-1] == "/"
-        begin
-          path = spec[:group].gsub(".", "/") +
-            "/#{spec[:id]}/#{spec[:version]}/#{Artifact.hash_to_file_name(spec)}"
-          mkpath File.dirname(filename), :verbose=>false
-          # We absolutely need the POM, so make sure we download it before the artifact
-          # (unless the artifact is a POM).
-          URI.download repo_url + path.ext("pom"), filename.ext("pom")  unless type == :pom
-          URI.download repo_url + path, filename
-          true
-        rescue URI::NotFoundError
-          false
-        rescue Exception=>error
-          puts error if verbose
-          puts error.backtrace.join("\n") if Rake.application.options.trace
-          false
-        end
-      end
-      fail "Failed to download #{Artifact.to_spec(spec)}, tried the following repositories:\n#{remote.join("\n")}"
-    end
-
     # :call-seq:
     #   release_to = url
     #   release_to = hash
@@ -518,18 +476,6 @@
       @release_to ||= {}
     end
 
-    # *Deprecated* See release_to.
-    def deploy_to=(options)
-      warn_deprecated "Please use release_to instead."
-      self.release_to = options
-    end
-
-    # *Deprecated* See release_to.
-    def deploy_to()
-      warn_deprecated "Please use release_to instead."
-      self.release_to
-    end
-
   end
 
   # :call-seq:
@@ -698,39 +644,6 @@
       task.enhance &block if block
       task.enhance all do
         all.each { |artifact| artifact.upload }
-      end
-    end
-  end
-
-  # *Deprecated* For artifact, call it's upload method; for anything else, use URI.upload.
-  def deploy(*args)
-    warn_deprecated "If it's an artifact, call it's upload method directly. Otherwise, use URI.upload."
-    # Where do we release to?
-    options = Hash === args.last ? args.pop : {}
-    deploy_to = options[:url] ? options : repositories.release_to
-    fail "Don't know where to deploy, perhaps you forgot to set repositories.deploy_to" if deploy_to[:url].blank?
-
-    args.flatten.each { |arg| arg.invoke if arg.respond_to?(:invoke) }
-    # Set the upload URI, including mandatory slash (we expect it to be the base directory).
-    # Username/password may be part of URI, or separate entities.
-    uri = URI.parse(deploy_to[:url].clone)
-    uri.path = uri.path + "/" unless uri.path[-1] == "/"
-    uri.user = deploy_to[:username] if deploy_to[:username]
-    uri.password = deploy_to[:password] if deploy_to[:password]
-
-    args.each do |arg|
-      if arg.respond_to?(:to_spec)
-        # Upload artifact relative to base URL, need to create path before uploading.
-        puts "Deploying #{arg.to_spec}" if verbose
-        spec = arg.to_spec_hash
-        path = spec[:group].gsub(".", "/") + "/#{spec[:id]}/#{spec[:version]}/" + Artifact.hash_to_file_name(spec)
-        URI.upload uri + path, arg.to_s, :permissions=>deploy_to[:permissions]
-      else
-        # Upload file to URL.
-        puts "Deploying #{arg}" if verbose
-        path = File.basename(args.to_s)
-        path = File.join(options[:path], path) if options[:path]
-        URI.upload uri + path, arg.to_s, :permissions=>deploy_to[:permissions]
       end
     end
   end

Modified: incubator/buildr/trunk/lib/java/compilers.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/compilers.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/compilers.rb (original)
+++ incubator/buildr/trunk/lib/java/compilers.rb Thu Jan  3 14:15:24 2008
@@ -6,15 +6,30 @@
 
 module Buildr
   module Compiler
-    class Javac < Base #:nodoc:
+
+    # Javac compiler:
+    #   compile.using(:javac)
+    # Used by default if .java files are found in the src/main/java directory (or src/test/java)
+    # and sets the target directory to target/classes (or target/test/classes).
+    #
+    # Accepts the following options:
+    # * :wranings -- Issue warnings when compiling.  True when running in verbose mode.
+    # * :debug    -- Generates bytecode with debugging information.  Set from the debug environment
+    #                variable/global option.
+    # * :deprecation -- If true, shows deprecation messages.  False by default.
+    # * :source      -- Source code compatibility.
+    # * :target      -- Bytecode compatibility.
+    # * :lint        -- Lint option is one of true, false (default), name (e.g. 'cast') or array.
+    # * :other       -- Array of options passed to the compiler (e.g. '-implicit:none')
+    class Javac < Base
       
       OPTIONS = [:warnings, :debug, :deprecation, :source, :target, :lint, :other]
 
-      def initialize
+      def initialize #:nodoc:
         super :language=>:java, :target_path=>'classes', :target_ext=>'.class'
       end
 
-      def configure(task, source, target)
+      def configure(task, source, target) #:nodoc:
         super
         update_options_from_parent! task, OPTIONS
         task.options.warnings ||= verbose
@@ -23,13 +38,15 @@
         task.options.debug ||= Buildr.options.debug
       end
 
-      def compile(files, task)
+      def compile(files, task) #:nodoc:
         check_options task, OPTIONS
         ::Buildr::Java.javac files, :sourcepath=>task.sources.select { |source| File.directory?(source) },
           :classpath=>task.dependencies, :output=>task.target, :javac_args=>javac_args_from(task.options)
       end
 
-      def javac_args_from(options)
+    private
+
+      def javac_args_from(options) #:nodoc:
         args = []  
         args << '-nowarn' unless options.warnings
         args << '-verbose' if Rake.application.options.trace
@@ -42,13 +59,11 @@
           when String; args << "-Xlint:#{options.lint}"
           when true; args << '-Xlint'
         end
-        options.other = options.other.map { |name, value| [ "-#{name}", value.to_s ] }.flatten if Hash === options.other
         args + Array(options.other)
       end
 
     end
 
-    Compiler.add Javac
   end
 
 
@@ -231,4 +246,34 @@
     end
 
   end
+
+
+  # Methods added to Project to support the Java Annotation Processor.
+  module Apt
+
+    # :call-seq:
+    #   apt(*sources) => task
+    #
+    # Returns a task that will use Java#apt to generate source files in target/generated/apt,
+    # from all the source directories passed as arguments. Uses the compile.sources list if
+    # on arguments supplied.
+    #
+    # For example:
+    #
+    def apt(*sources)
+      sources = compile.sources if sources.empty?
+      file(path_to(:target, "generated/apt")=>sources) do |task|
+        Java.apt(sources.map(&:to_s) - [task.name], :output=>task.name,
+          :classpath=>compile.classpath, :source=>compile.options.source)
+      end
+    end
+
+  end
+
+end
+
+Buildr::Compiler.add Buildr::Compiler::Javac
+class Buildr::Project
+  include Buildr::Javadoc
+  include Buildr::Apt
 end

Modified: incubator/buildr/trunk/lib/java/java.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/java.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/java.rb (original)
+++ incubator/buildr/trunk/lib/java/java.rb Thu Jan  3 14:15:24 2008
@@ -57,11 +57,6 @@
         self
       end
       
-      def onload(&block)
-        warn_deprecated "use setup { |wrapper| ... } instead"
-        setup &block
-      end
-
       def load(&block)
         @setup.each { |block| block.call self }
         @setup.clear
@@ -183,11 +178,9 @@
         unless Rake.application.options.dryrun
           puts "Running apt" if verbose
           puts (["apt"] + cmd_args).join(" ") if Rake.application.options.trace
-          Java.wrapper do |jw|
-            cmd_args = cmd_args.to_java_array(::Java.java.lang.String) if Java.jruby?
-            jw.import("com.sun.tools.apt.Main").process(cmd_args) == 0 or
-              fail "Failed to process annotations, see errors above"
-          end
+          cmd_args = cmd_args.to_java_array(::Java.java.lang.String) if Java.jruby?
+          Java.com.sun.tools.apt.Main.process(cmd_args) == 0 or
+            fail "Failed to process annotations, see errors above"
         end
       end
 
@@ -221,11 +214,9 @@
         unless Rake.application.options.dryrun
           puts "Compiling #{files.size} source files in #{name}" if verbose
           puts (["javac"] + cmd_args).join(" ") if Rake.application.options.trace
-          Java.wrapper do |jw|
-            cmd_args = cmd_args.to_java_array(::Java.java.lang.String) if Java.jruby?
-            jw.import("com.sun.tools.javac.Main").compile(cmd_args) == 0 or 
-              fail "Failed to compile, see errors above"
-          end
+          cmd_args = cmd_args.to_java_array(::Java.java.lang.String) if Java.jruby?
+          Java.com.sun.tools.javac.Main.compile(cmd_args) == 0 or 
+            fail "Failed to compile, see errors above"
         end
       end
 
@@ -273,51 +264,14 @@
         unless Rake.application.options.dryrun
           puts "Generating Javadoc for #{name}" if verbose
           puts (["javadoc"] + cmd_args).join(" ") if Rake.application.options.trace
-          Java.wrapper do |jw|
-            cmd_args = cmd_args.to_java_array(::Java.java.lang.String) if Java.jruby?
-            jw.import("com.sun.tools.javadoc.Main").execute(cmd_args) == 0 or
-              fail "Failed to generate Javadocs, see errors above"
-          end
+          Java.load
+          cmd_args = cmd_args.to_java_array(::Java.java.lang.String) if Java.jruby?
+          Java.import("com.sun.tools.javadoc.Main").execute(cmd_args) == 0 or
+            fail "Failed to generate Javadocs, see errors above"
         end
       end
 
       # :call-seq:
-      #   junit(*classes, options) => [ passed, failed ]
-      #
-      # Runs JUnit test cases from the specified classes. Returns an array with two lists,
-      # one containing the names of all classes that passes, the other containing the names
-      # of all classes that failed.
-      #
-      # The last argument may be a Hash with additional options:
-      # * :classpath -- One or more file names, tasks or artifact specifications.
-      #   These are all expanded into artifacts, and all tasks are invoked.
-      # * :properties -- Hash of system properties (e.g. "path"=>base_dir).
-      # * :java_args -- Any additional arguments to pass (e.g. -hotspot, -xms)
-      # * :verbose -- If true, prints the command and all its argument.
-      #
-      # *Deprecated:* Please use JUnitTask instead.Use the test task to run JUnit and other test frameworks.
-      def junit(*args)
-        warn_deprecated "Use the test task to run JUnit and other test frameworks"
-        options = Hash === args.last ? args.pop : {}
-        options[:verbose] ||= Rake.application.options.trace || false
-        rake_check_options options, :verbose, :classpath, :properties, :java_args
-
-        classpath = classpath_from(options) + JUnitTask::requires
-        tests = args.flatten
-        failed = tests.inject([]) do |failed, test|
-          begin
-            java "junit.textui.TestRunner", test, :classpath=>classpath, :properties=>options[:properties],
-              :name=>"#{test}", :verbose=>options[:verbose], :java_args=>options[:java_args]
-            failed
-          rescue
-            failed << test
-          end
-        end
-        [ tests - failed, failed ]
-      end
-
-
-      # :call-seq:
       #   wrapper() => JavaWrapper
       #   wrapper() { ... }
       #
@@ -346,11 +300,6 @@
         end
       end
 
-      def rjb(&block)
-        warn_deprecated "please use Java.wrapper() instead"
-        wrapper &block
-      end
-
       # :call-seq:
       #   path_to_bin(cmd?) => path
       #
@@ -372,8 +321,7 @@
       # Extracts the classpath from the options, expands it by calling artifacts, invokes
       # each of the artifacts and returns an array of paths.
       def classpath_from(options)
-        classpath = (options[:classpath] || []).collect
-        Buildr.artifacts(classpath).each { |t| t.invoke if t.respond_to?(:invoke) }.map(&:to_s)
+        Buildr.artifacts(options[:classpath] || []).map(&:to_s).each { |t| task(t).invoke }
       end
 
       def darwin?() #:nodoc:
@@ -387,21 +335,37 @@
       Java.java(*args)
     end
 
-    # :call-seq:
-    #   apt(*sources) => task
-    #
-    # Returns a task that will use Java#apt to generate source files in target/generated/apt,
-    # from all the source directories passed as arguments. Uses the compile.sources list if
-    # on arguments supplied.
-    #
-    # For example:
-    #
-    def apt(*sources)
-      sources = compile.sources if sources.empty?
-      file(path_to(:target, "generated/apt")=>sources) do |task|
-        Java.apt(sources.map(&:to_s) - [task.name], :output=>task.name,
-          :classpath=>compile.classpath, :source=>compile.options.source)
+    def self.classpath
+      wrapper.classpath
+    end
+
+    def self.load
+      wrapper.load
+    end
+
+
+    module Package #:nodoc:
+
+      def method_missing(sym, *args, &block)
+        begin
+          @package ||= []
+          ::Rjb.import((@package + [sym.to_s]).join('.'))
+        rescue NoClassDefFoundError
+          @packages ||= {}
+          @packages[sym.to_s] ||= Module.new.extend(Package).tap { |pkg| pkg.instance_variable_set :@package, (@package || []) + [sym.to_s] }
+        end
       end
+    end
+
+    module ::Rjb
+      extend Package
+    end
+
+    extend Package
+
+    def self.import(cls)
+      wrapper.load
+      cls.split('.').inject(wrapper) { |wrapper, name| wrapper.send(name) }
     end
 
   end

Modified: incubator/buildr/trunk/lib/java/packaging.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/packaging.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/packaging.rb (original)
+++ incubator/buildr/trunk/lib/java/packaging.rb Thu Jan  3 14:15:24 2008
@@ -310,6 +310,7 @@
       # and must return the same file task on each call.
       def package(type = :jar, options = nil)
         options = options.nil? ? {} : options.dup
+        rake_check_options options, *ActsAsArtifact::ARTIFACT_ATTRIBUTES
         options[:id] ||= self.id
         options[:group] ||= self.group
         options[:version] ||= self.version
@@ -318,7 +319,7 @@
 
         packager = method("package_as_#{type}") rescue
           fail("Don't know how to create a package of type #{type}")
-        package = packager.call(file_name, options) { warn_deprecated "Yielding from package_as_ no longer necessary." }
+        package = packager.call(file_name, options)
         unless packages.include?(package)
           # Make it an artifact using the specifications, and tell it how to create a POM.
           package.extend ActsAsArtifact
@@ -435,72 +436,34 @@
 
     protected
 
-      def package_as_jar(file_name, options) #:nodoc:
+      def package_as_jar(file_name, spec) #:nodoc:
         unless Rake::Task.task_defined?(file_name)
-          rake_check_options options, *PACKAGE_OPTIONS + [:manifest, :meta_inf, :include]
           Java::Packaging::JarTask.define_task(file_name).tap do |jar|
             jar.with :manifest=>manifest, :meta_inf=>meta_inf
-            [:manifest, :meta_inf].each do |option|
-              if options.has_key?(option)
-                warn_deprecated "The :#{option} option in package(:jar) is deprecated, please use package(:jar).with(:#{option}=>) instead."
-                jar.with option=>options[option]
-              end
-            end
-            if options[:include]
-              warn_deprecated "The :include option in package(:jar) is deprecated, please use package(:jar).include(files) instead."
-              jar.include options[:include]
-            else
-              jar.with compile.target unless compile.sources.empty?
-              jar.with resources.target unless resources.sources.empty?
-            end
+            jar.with compile.target unless compile.sources.empty?
+            jar.with resources.target unless resources.sources.empty?
           end
-        else
-          rake_check_options options, *PACKAGE_OPTIONS
         end
         file(file_name)
       end
 
-      def package_as_war(file_name, options) #:nodoc:
+      def package_as_war(file_name, spec) #:nodoc:
         unless Rake::Task.task_defined?(file_name)
-          rake_check_options options, *PACKAGE_OPTIONS + [:manifest, :meta_inf, :classes, :libs, :include]
           Java::Packaging::WarTask.define_task(file_name).tap do |war|
             war.with :manifest=>manifest, :meta_inf=>meta_inf
-            [:manifest, :meta_inf].each do |option|
-              if options.has_key?(option)
-                warn_deprecated "The :#{option} option in package :war is deprecated, please use package(:war).with(:#{option}=>) instead."
-                war.with option=>options[option]
-              end
-            end
             # Add libraries in WEB-INF lib, and classes in WEB-INF classes
-            if options.has_key?(:classes)
-              warn_deprecated "The :classes option in package(:war) is deprecated, please use package(:war).with(:classes=>) instead."
-              war.with :classes=>options[:classes]
-            else
-              war.with :classes=>compile.target unless compile.sources.empty?
-              war.with :classes=>resources.target unless resources.sources.empty?
-            end
-            if options.has_key?(:libs)
-              warn_deprecated "The :libs option in package(:war) is deprecated, please use package(:war).with(:libs=>) instead."
-              war.with :libs=>options[:libs].collect
-            else
-              war.with :libs=>compile.classpath
-            end
+            war.with :classes=>compile.target unless compile.sources.empty?
+            war.with :classes=>resources.target unless resources.sources.empty?
+            war.with :libs=>compile.dependencies
             # Add included files, or the webapp directory.
-            if options.has_key?(:include)
-              warn_deprecated "The :include option in package(:war) is deprecated, please use package(:war).include(files) instead."
-              war.include options[:include]
-            else
-              path_to(:source, :main, :webapp).tap { |path| war.with path if File.exist?(path) }
-            end
+            webapp = path_to(:source, :main, :webapp)
+            war.with webapp if File.exist?(webapp)
           end
-        else
-          rake_check_options options, *PACKAGE_OPTIONS
         end
         file(file_name)
       end
 
-      def package_as_aar(file_name, options) #:nodoc:
-        rake_check_options options, *PACKAGE_OPTIONS
+      def package_as_aar(file_name, spec) #:nodoc:
         unless Rake::Task.task_defined?(file_name)
           Java::Packaging::AarTask.define_task(file_name).tap do |aar|
             aar.with :manifest=>manifest, :meta_inf=>meta_inf
@@ -508,50 +471,39 @@
             aar.with :services_xml=>path_to(:source, :main, :axis2, 'services.xml') 
             aar.with compile.target unless compile.sources.empty?
             aar.with resources.target unless resources.sources.empty?
-            aar.with :libs=>compile.classpath
+            aar.with :libs=>compile.dependencies
           end
         end
         file(file_name)
       end
 
-      def package_as_zip(file_name, options) #:nodoc:
-        unless Rake::Task.task_defined?(file_name)
-          rake_check_options options, *PACKAGE_OPTIONS + [:include]
-          ZipTask.define_task(file_name).tap do |zip|
-            if options[:include]
-              warn_deprecated "The :include option in package(:zip) is deprecated, please use package(:zip).include(files) instead."
-              zip.include options[:include]
-            end
-          end
-        else
-          rake_check_options options, *PACKAGE_OPTIONS
-        end
-        file(file_name)
+      def package_as_zip(file_name, spec) #:nodoc:
+        ZipTask.define_task(file_name)
       end
 
-      def package_as_tar(file_name, options) #:nodoc:
-        rake_check_options options, *PACKAGE_OPTIONS
-        unless Rake::Task.task_defined?(file_name)
-          TarTask.define_task(file_name)
-        end
-        file(file_name)
+      def package_as_tar(file_name, spec) #:nodoc:
+        TarTask.define_task(file_name)
       end
       alias :package_as_tgz :package_as_tar
 
-      def package_as_sources(file_name, options) #:nodoc:
-        rake_check_options options, *PACKAGE_OPTIONS
-        options.merge!(:type=>:zip, :classifier=>"sources")
-        file_name = path_to(:target, Artifact.hash_to_file_name(options))
-        ZipTask.define_task(file_name).tap { |zip| zip.include :from=>compile.sources } unless Rake::Task.task_defined?(file_name)
+      def package_as_sources(file_name, spec) #:nodoc:
+        spec.merge!(:type=>:zip, :classifier=>"sources")
+        file_name = path_to(:target, Artifact.hash_to_file_name(spec))
+        unless Rake::Task.task_defined?(file_name)
+          ZipTask.define_task(file_name).tap do |zip|
+            zip.include :from=>compile.sources
+          end
+        end
         file(file_name)
       end
 
-      def package_as_javadoc(file_name, options) #:nodoc:
-        rake_check_options options, *PACKAGE_OPTIONS
-        options.merge!(:type=>:zip, :classifier=>"javadoc")
-        file_name = path_to(:target, Artifact.hash_to_file_name(options))
+      def package_as_javadoc(file_name, spec) #:nodoc:
+        spec.merge!(:type=>:zip, :classifier=>"javadoc")
+        file_name = path_to(:target, Artifact.hash_to_file_name(spec))
         unless Rake::Task.task_defined?(file_name)
-          ZipTask.define_task(file_name).tap { |zip| zip.include :from=>javadoc.target }
+          ZipTask.define_task(file_name).tap do |zip|
+            zip.include :from=>javadoc.target
+          end
           javadoc.options[:windowtitle] ||= project.comment || project.name
         end
         file(file_name)

Modified: incubator/buildr/trunk/lib/java/test_frameworks.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/test_frameworks.rb?rev=608657&r1=608656&r2=608657&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/test_frameworks.rb (original)
+++ incubator/buildr/trunk/lib/java/test_frameworks.rb Thu Jan  3 14:15:24 2008
@@ -5,207 +5,217 @@
 
 
 module Buildr
-  class TestFramework
 
-    module JMock
-      # JMock version..
-      JMOCK_VERSION = '1.2.0'
-      # JMock specification.
-      JMOCK_REQUIRES = ["jmock:jmock:jar:#{JMOCK_VERSION}"]
-    end
-
-
-    class JUnit < Base
-
-      # Used by the junit:report task. Access through JUnit#report if you want to set various
-      # options for that task, for example:
-      #   JUnit.report.frames = false
-      class Report
+  # JMock is available when using JUnit and TestNG.
+  module JMock
+    # JMock version..
+    VERSION = '1.2.0' unless const_defined?('VERSION')
+    # JMock specification.
+    REQUIRES = ["jmock:jmock:jar:#{VERSION}"]
+  end
 
-        # Ant-Trax required for running the JUnitReport task.
-        Java.wrapper.setup { |jw| jw.classpath << "org.apache.ant:ant-trax:jar:#{Ant::VERSION}" }
 
-        # Parameters passed to the Ant JUnitReport task.
-        attr_reader :params
-        # True (default) to produce a report using frames, false to produce a single-page report.
-        attr_accessor :frames
-        # Directory for the report style (defaults to using the internal style).
-        attr_accessor :style_dir
-        # Target directory for generated report.
-        attr_accessor :target
-
-        def initialize
-          @params = {}
-          @frames = true
-          @target = 'reports/junit'
-        end
+  # JUnit test framework, the default test framework for Java.
+  #   test.using :junit
+  #
+  # Support the following options:
+  # * :fork        -- If true/:once (default), fork for each test class.  If :each, fork for each individual
+  #                   test case.  If false, run all tests in the same VM (fast, but dangerous).
+  # * :clonevm     -- If true clone the VM each time it is forked.
+  # * :properties  -- Hash of system properties available to the test case.
+  # * :environment -- Hash of environment variables available to the test case.
+  # * :java_args   -- Arguments passed as is to the JVM.
+  class JUnit < TestFramework::Base
+
+    # Used by the junit:report task. Access through JUnit#report if you want to set various
+    # options for that task, for example:
+    #   JUnit.report.frames = false
+    class Report
+
+      # Ant-Trax required for running the JUnitReport task.
+      Java.classpath << "org.apache.ant:ant-trax:jar:#{Ant::VERSION}"
+
+      # Parameters passed to the Ant JUnitReport task.
+      attr_reader :params
+      # True (default) to produce a report using frames, false to produce a single-page report.
+      attr_accessor :frames
+      # Directory for the report style (defaults to using the internal style).
+      attr_accessor :style_dir
+      # Target directory for generated report.
+      attr_accessor :target
 
-        # :call-seq:
-        #   generate(projects, target?)
-        #
-        # Generates a JUnit report for these projects (must run JUnit tests first) into the
-        # target directory. You can specify a target, or let it pick the default one from the
-        # target attribute.
-        def generate(projects, target = @target.to_s)
-          html_in = File.join(target, 'html')
-          rm_rf html_in ; mkpath html_in
-          
-          Buildr.ant('junit-report') do |ant|
-            ant.junitreport :todir=>target do
-              projects.select { |project| project.test.framework == :junit }.
-                map { |project| project.test.report_to.to_s }.select { |path| File.exist?(path) }.
-                each { |path| ant.fileset(:dir=>path) { ant.include :name=>'TEST-*.xml' }  }
-              options = { :format=>frames ? 'frames' : 'noframes' }
-              options[:styledir] = style_dir if style_dir
-              ant.report options.merge(:todir=>html_in) do
-                params.each { |key, value| ant.param :name=>key, :expression=>value }
-              end
+      def initialize
+        @params = {}
+        @frames = true
+        @target = 'reports/junit'
+      end
+
+      # :call-seq:
+      #   generate(projects, target?)
+      #
+      # Generates a JUnit report for these projects (must run JUnit tests first) into the
+      # target directory. You can specify a target, or let it pick the default one from the
+      # target attribute.
+      def generate(projects, target = @target.to_s)
+        html_in = File.join(target, 'html')
+        rm_rf html_in ; mkpath html_in
+        
+        Buildr.ant('junit-report') do |ant|
+          ant.junitreport :todir=>target do
+            projects.select { |project| project.test.framework == :junit }.
+              map { |project| project.test.report_to.to_s }.select { |path| File.exist?(path) }.
+              each { |path| ant.fileset(:dir=>path) { ant.include :name=>'TEST-*.xml' }  }
+            options = { :format=>frames ? 'frames' : 'noframes' }
+            options[:styledir] = style_dir if style_dir
+            ant.report options.merge(:todir=>html_in) do
+              params.each { |key, value| ant.param :name=>key, :expression=>value }
             end
           end
         end
-
       end
 
-      class << self
+    end
 
-        # :call-seq:
-        #    report()
-        #
-        # Returns the Report object used by the junit:report task. You can use this object to set
-        # various options that affect your report, for example:
-        #   JUnit.report.frames = false
-        #   JUnit.report.params['title'] = 'My App'
-        def report
-          @report ||= Report.new
-        end
+    class << self
 
+      # :call-seq:
+      #    report()
+      #
+      # Returns the Report object used by the junit:report task. You can use this object to set
+      # various options that affect your report, for example:
+      #   JUnit.report.frames = false
+      #   JUnit.report.params['title'] = 'My App'
+      def report
+        @report ||= Report.new
       end
 
+    end
 
-      # Ant-JUnit requires for JUnit and JUnit reports tasks.
-      ::Buildr::Java.wrapper.setup { |jw| jw.classpath << "org.apache.ant:ant-junit:jar:#{Ant::VERSION}" }
 
-      include JMock
+    # Ant-JUnit requires for JUnit and JUnit reports tasks.
+    Java.classpath << "org.apache.ant:ant-junit:jar:#{Ant::VERSION}"
 
-      # JUnit version number.
-      JUNIT_VERSION = '4.3.1'
-      # JUnit specification.
-      JUNIT_REQUIRES = ["junit:junit:jar:#{JUNIT_VERSION}"] + JMOCK_REQUIRES
-      # Pattern for selecting JUnit test classes. Regardless of include/exclude patterns, only classes
-      # that match this pattern are used.
-      JUNIT_TESTS_PATTERN = [ 'Test*.class', '*Test.class' ]
+    # JUnit version number.
+    VERSION = '4.3.1' unless const_defined?('VERSION')
+    # JUnit specification.
+    REQUIRES = ["junit:junit:jar:#{VERSION}"] + JMock::REQUIRES
+    # Pattern for selecting JUnit test classes. Regardless of include/exclude patterns, only classes
+    # that match this pattern are used.
+    TESTS_PATTERN = [ 'Test*.class', '*Test.class' ]
 
-      def initialize
-        super :requires=>JUNIT_REQUIRES, :patterns=>JUNIT_TESTS_PATTERN
-      end
+    def initialize #:nodoc:
+      super :requires=>REQUIRES, :patterns=>TESTS_PATTERN
+    end
 
-      def files(path)
-        # Ignore anonymous classes.
-        super(path).reject { |name| name =~ /\$/ }
-      end
-
-      def run(files, task, dependencies)
-        # Use Ant to execute the Junit tasks, gives us performance and reporting.
-        Buildr.ant('junit') do |ant|
-          case task.options[:fork]
-          when false
-            forking = {}
-          when :each
-            forking = { :fork=>true, :forkmode=>'perTest' }
-          when true, :once
-            forking = { :fork=>true, :forkmode=>'once' }
-          else
-            fail 'Option fork must be :once, :each or false.'
-          end
-          mkpath task.report_to.to_s
-          ant.junit forking.merge(:clonevm=>task.options[:clonevm] || false, :dir=>task.send(:project).path_to) do
-            ant.classpath :path=>dependencies.each { |path| file(path).invoke }.join(File::PATH_SEPARATOR)
-            (task.options[:properties] || []).each { |key, value| ant.sysproperty :key=>key, :value=>value }
-            (task.options[:environment] || []).each { |key, value| ant.env :key=>key, :value=>value }
-            java_args = task.options[:java_args] || Buildr.options.java_args
-            java_args = java_args.split(/\s+/) if String === java_args
-            java_args.each { |value| ant.jvmarg :value=>value } if java_args
-            ant.formatter :type=>'plain'
-            ant.formatter :type=>'plain', :usefile=>false # log test
-            ant.formatter :type=>'xml'
-            ant.batchtest :todir=>task.report_to.to_s, :failureproperty=>'failed' do
-              ant.fileset :dir=>task.compile.target.to_s do
-                files.each { |file| ant.include :name=>file }
-              end
+    def files(path) #:nodoc:
+      # Ignore anonymous classes.
+      super(path).reject { |name| name =~ /\$/ }
+    end
+
+    def run(files, task, dependencies) #:nodoc:
+      # Use Ant to execute the Junit tasks, gives us performance and reporting.
+      Buildr.ant('junit') do |ant|
+        case task.options[:fork]
+        when false
+          forking = {}
+        when :each
+          forking = { :fork=>true, :forkmode=>'perTest' }
+        when true, :once
+          forking = { :fork=>true, :forkmode=>'once' }
+        else
+          fail 'Option fork must be :once, :each or false.'
+        end
+        mkpath task.report_to.to_s
+        ant.junit forking.merge(:clonevm=>task.options[:clonevm] || false, :dir=>task.send(:project).path_to) do
+          ant.classpath :path=>dependencies.each { |path| file(path).invoke }.join(File::PATH_SEPARATOR)
+          (task.options[:properties] || []).each { |key, value| ant.sysproperty :key=>key, :value=>value }
+          (task.options[:environment] || []).each { |key, value| ant.env :key=>key, :value=>value }
+          java_args = task.options[:java_args] || Buildr.options.java_args
+          java_args = java_args.split(/\s+/) if String === java_args
+          java_args.each { |value| ant.jvmarg :value=>value } if java_args
+          ant.formatter :type=>'plain'
+          ant.formatter :type=>'plain', :usefile=>false # log test
+          ant.formatter :type=>'xml'
+          ant.batchtest :todir=>task.report_to.to_s, :failureproperty=>'failed' do
+            ant.fileset :dir=>task.compile.target.to_s do
+              files.each { |file| ant.include :name=>file }
             end
           end
-          return [] unless ant.project.getProperty('failed')
-        end
-        # But Ant doesn't tell us what went kaput, so we'll have to parse the test files.
-        files.inject([]) do |failed, file|
-          test = file.ext('').gsub(File::SEPARATOR, '.')
-          report_file = File.join(task.report_to.to_s, "TEST-#{test}.txt")
-          if File.exist?(report_file)
-            report = File.read(report_file)
-            # The second line (if exists) is the status line and we scan it for its values.
-            status = (report.split("\n")[1] || '').scan(/(run|failures|errors):\s*(\d+)/i).
-              inject(Hash.new(0)) { |hash, pair| hash[pair[0].downcase.to_sym] = pair[1].to_i ; hash }
-            failed << test if status[:failures] > 0 || status[:errors] > 0
-          end
-          failed
         end
+        return [] unless ant.project.getProperty('failed')
       end
-
-      namespace 'junit' do
-        desc "Generate JUnit tests report in #{report.target}"
-        task('report') do |task|
-          report.generate Project.projects
-          puts "Generated JUnit tests report in #{report.target}" if verbose
+      # But Ant doesn't tell us what went kaput, so we'll have to parse the test files.
+      files.inject([]) do |failed, file|
+        test = file.ext('').gsub(File::SEPARATOR, '.')
+        report_file = File.join(task.report_to.to_s, "TEST-#{test}.txt")
+        if File.exist?(report_file)
+          report = File.read(report_file)
+          # The second line (if exists) is the status line and we scan it for its values.
+          status = (report.split("\n")[1] || '').scan(/(run|failures|errors):\s*(\d+)/i).
+            inject(Hash.new(0)) { |hash, pair| hash[pair[0].downcase.to_sym] = pair[1].to_i ; hash }
+          failed << test if status[:failures] > 0 || status[:errors] > 0
         end
+        failed
       end
+    end
 
-      task('clean') { rm_rf report.target.to_s }
-
+    namespace 'junit' do
+      desc "Generate JUnit tests report in #{report.target}"
+      task('report') do |task|
+        report.generate Project.projects
+        puts "Generated JUnit tests report in #{report.target}" if verbose
+      end
     end
 
-    TestFramework.add JUnit
+    task('clean') { rm_rf report.target.to_s }
 
+  end
 
-    class TestNG < Base
 
-      include JMock
+  # TestNG test framework.
+  #   test.using :testng
+  #
+  # Support the following options:
+  # * :properties -- Hash of properties passed to the test suite.
+  # * :java_args -- Arguments passed to the JVM.
+  class TestNG < TestFramework::Base
+
+    # TestNG version number.
+    VERSION = '5.5' unless const_defined?('VERSION')
+    # TestNG specification.
+    REQUIRES = ["org.testng:testng:jar:jdk15:#{VERSION}"] + JMock::REQUIRES
+    # Pattern for selecting TestNG test classes. Regardless of include/exclude patterns, only classes
+    # that match this pattern are used.
+    TESTS_PATTERN = [ 'Test*.class', '*Test.class', '*TestCase.class' ]
 
-      # TestNG version number.
-      TESTNG_VERSION = '5.5'
-      # TestNG specification.
-      TESTNG_REQUIRES = ["org.testng:testng:jar:jdk15:#{TESTNG_VERSION}"] + JMOCK_REQUIRES
-      # Pattern for selecting TestNG test classes. Regardless of include/exclude patterns, only classes
-      # that match this pattern are used.
-      TESTNG_TESTS_PATTERN = [ 'Test*.class', '*Test.class', '*TestCase.class' ]
+    def initialize #:nodoc:
+      super :requires=>REQUIRES, :patterns=>TESTS_PATTERN
+    end
 
-      def initialize
-        super :requires=>TESTNG_REQUIRES, :patterns=>TESTNG_TESTS_PATTERN
-      end
+    def files(path) #:nodoc:
+      # Ignore anonymous classes.
+      super(path).reject { |name| name =~ /\$/ }
+    end
 
-      def files(path)
-        # Ignore anonymous classes.
-        super(path).reject { |name| name =~ /\$/ }
-      end
-
-      def run(files, task, dependencies)
-        cmd_args = [ 'org.testng.TestNG', '-sourcedir', task.compile.sources.join(';'), '-suitename', task.send(:project).name ]
-        cmd_args << '-d' << task.report_to.to_s
-        cmd_options = { :properties=>task.options[:properties], :java_args=>task.options[:java_args],
-                        :classpath=>dependencies }
-        files.map { |file| file.ext('').gsub(File::SEPARATOR, '.') }.inject([]) do |failed, test|
-          begin
-            Buildr.java cmd_args, '-testclass', test, cmd_options.merge(:name=>test)
-            failed
-          rescue
-            failed << test
-          end
+    def run(files, task, dependencies) #:nodoc:
+      cmd_args = [ 'org.testng.TestNG', '-sourcedir', task.compile.sources.join(';'), '-suitename', task.send(:project).name ]
+      cmd_args << '-d' << task.report_to.to_s
+      cmd_options = { :properties=>task.options[:properties], :java_args=>task.options[:java_args],
+                      :classpath=>dependencies }
+      files.map { |file| file.ext('').gsub(File::SEPARATOR, '.') }.inject([]) do |failed, test|
+        begin
+          Buildr.java cmd_args, '-testclass', test, cmd_options.merge(:name=>test)
+          failed
+        rescue
+          failed << test
         end
       end
-
     end
 
-    TestFramework.add TestNG
-
   end
 
 end
+
+
+Buildr::TestFramework.add Buildr::TestNG
+Buildr::TestFramework.add Buildr::JUnit



Mime
View raw message