├── doc ├── _config.yml ├── images │ ├── tip.png │ ├── note.png │ ├── asf-logo.gif │ ├── asf-logo.png │ ├── buildr.png │ ├── favicon.png │ ├── zbuildr.png │ ├── zbuildr.tif │ ├── buildr-hires.png │ ├── growl-icon.tiff │ ├── project-structure.png │ └── 1442160941-frontcover.jpg ├── _layouts │ └── preface.html ├── css │ ├── syntax.css │ └── print.css ├── scripts │ ├── install-jruby.sh │ ├── install-osx.sh │ └── install-linux.sh ├── mailing_lists.textile └── preface.textile ├── all-in-one ├── buildr.cmd └── buildr ├── lib ├── buildr │ ├── resources │ │ ├── buildr.icns │ │ ├── failed.png │ │ ├── completed.png │ │ └── icons-license.txt │ ├── java │ │ ├── org │ │ │ └── apache │ │ │ │ └── buildr │ │ │ │ └── JavaTestFilter.class │ │ ├── ecj.rb │ │ ├── external.rb │ │ ├── test_result.rb │ │ ├── ant.rb │ │ └── doc.rb │ ├── scala │ │ ├── org │ │ │ └── apache │ │ │ │ └── buildr │ │ │ │ ├── SpecsSingletonRunner.class │ │ │ │ ├── Specs2Runner.java │ │ │ │ └── SpecsSingletonRunner.java │ │ └── shell.rb │ ├── version.rb │ ├── groovy.rb │ ├── clojure.rb │ ├── scala.rb │ ├── packaging │ │ ├── test_jar.rb │ │ └── gems.rb │ ├── core │ │ ├── linux.rb │ │ ├── jrebel.rb │ │ ├── run.rb │ │ ├── osx.rb │ │ ├── assets.rb │ │ ├── help.rb │ │ └── environment.rb │ ├── clojure │ │ └── shell.rb │ ├── groovy │ │ ├── shell.rb │ │ ├── doc.rb │ │ └── bdd.rb │ └── rspec_check.rb └── buildr.rb ├── addon └── buildr │ ├── org │ └── apache │ │ └── buildr │ │ ├── BuildrNail.class │ │ ├── JettyWrapper.class │ │ ├── BuildrNail$Main.class │ │ ├── JettyWrapper$1.class │ │ ├── JettyWrapper$BuildrHandler.class │ │ └── BuildrNail.java │ ├── emma.rb │ ├── cobertura.rb │ ├── git_auto_version.rb │ ├── top_level_generate_dir.rb │ ├── antlr.rb │ ├── jaxb_xjc.rb │ ├── package_as_nsis.rb │ ├── protobuf.rb │ ├── single_intermediate_layout.rb │ ├── gpg.rb │ ├── javacc.rb │ ├── scss_lint-report.xsl │ ├── jibx.rb │ ├── css_lint-report.xsl │ ├── checkstyle-report.xsl │ ├── openjpa.rb │ └── xmlbeans.rb ├── tests ├── include_as │ ├── doc │ │ └── index.html │ └── Buildfile ├── include_path │ ├── doc │ │ └── index.html │ └── Buildfile ├── junit3 │ ├── Buildfile │ └── src │ │ ├── main │ │ └── java │ │ │ └── Foo.java │ │ └── test │ │ └── java │ │ └── FooTest.java ├── package_war_as_jar │ ├── Buildfile │ └── src │ │ └── main │ │ └── java │ │ └── Foo.java ├── compile_with_parent │ ├── Buildfile │ └── child │ │ └── src │ │ └── main │ │ └── java │ │ └── Foo.java ├── JavaSystemProperty │ ├── Buildfile │ └── src │ │ └── test │ │ └── java │ │ └── FooTest.java ├── helloWorld │ ├── Buildfile │ └── src │ │ └── main │ │ └── java │ │ └── HelloWorld.java ├── BUILDR-320 │ └── Buildfile └── integration_testing.rb ├── Gemfile ├── .gitignore ├── ci-setup.sh ├── .travis.yml ├── NOTICE ├── ci.bat ├── bin └── buildr ├── spec ├── scala │ ├── scala.rb │ └── doc_spec.rb ├── core │ ├── generate_spec.rb │ ├── console_spec.rb │ └── run_spec.rb ├── java │ ├── ant_spec.rb │ ├── doc_spec.rb │ ├── external_spec.rb │ └── run_spec.rb ├── addon │ └── checkstyle_spec.rb ├── packaging │ └── packaging_helper.rb ├── groovy │ ├── doc_spec.rb │ └── bdd_spec.rb └── xpath_matchers.rb ├── _buildr ├── _jbuildr ├── rakelib ├── metrics.rake ├── checks.rake ├── package.rake ├── rspec.rake └── all-in-one.rake ├── Rakefile └── README.rdoc /doc/_config.yml: -------------------------------------------------------------------------------- 1 | pygments: true 2 | -------------------------------------------------------------------------------- /all-in-one/buildr.cmd: -------------------------------------------------------------------------------- 1 | @%~dp0\..\embedded\jruby.exe %* -------------------------------------------------------------------------------- /doc/images/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/tip.png -------------------------------------------------------------------------------- /doc/images/note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/note.png -------------------------------------------------------------------------------- /doc/images/asf-logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/asf-logo.gif -------------------------------------------------------------------------------- /doc/images/asf-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/asf-logo.png -------------------------------------------------------------------------------- /doc/images/buildr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/buildr.png -------------------------------------------------------------------------------- /doc/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/favicon.png -------------------------------------------------------------------------------- /doc/images/zbuildr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/zbuildr.png -------------------------------------------------------------------------------- /doc/images/zbuildr.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/zbuildr.tif -------------------------------------------------------------------------------- /doc/images/buildr-hires.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/buildr-hires.png -------------------------------------------------------------------------------- /doc/images/growl-icon.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/growl-icon.tiff -------------------------------------------------------------------------------- /doc/images/project-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/project-structure.png -------------------------------------------------------------------------------- /lib/buildr/resources/buildr.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/lib/buildr/resources/buildr.icns -------------------------------------------------------------------------------- /lib/buildr/resources/failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/lib/buildr/resources/failed.png -------------------------------------------------------------------------------- /lib/buildr/resources/completed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/lib/buildr/resources/completed.png -------------------------------------------------------------------------------- /doc/images/1442160941-frontcover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/doc/images/1442160941-frontcover.jpg -------------------------------------------------------------------------------- /addon/buildr/org/apache/buildr/BuildrNail.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/addon/buildr/org/apache/buildr/BuildrNail.class -------------------------------------------------------------------------------- /addon/buildr/org/apache/buildr/JettyWrapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/addon/buildr/org/apache/buildr/JettyWrapper.class -------------------------------------------------------------------------------- /addon/buildr/org/apache/buildr/BuildrNail$Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/addon/buildr/org/apache/buildr/BuildrNail$Main.class -------------------------------------------------------------------------------- /addon/buildr/org/apache/buildr/JettyWrapper$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/addon/buildr/org/apache/buildr/JettyWrapper$1.class -------------------------------------------------------------------------------- /tests/include_as/doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Index 4 | 5 | 6 | Hello world 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/buildr/java/org/apache/buildr/JavaTestFilter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/lib/buildr/java/org/apache/buildr/JavaTestFilter.class -------------------------------------------------------------------------------- /tests/include_path/doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Index 4 | 5 | 6 | Hello world 7 | 8 | 9 | -------------------------------------------------------------------------------- /addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class -------------------------------------------------------------------------------- /lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zendesk/buildr/master/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # Use `bundle install` in order to install these gems 2 | # Use `bundle exec rake` in order to run the specs using the bundle 3 | source "http://rubygems.org" 4 | gemspec 5 | -------------------------------------------------------------------------------- /tests/junit3/Buildfile: -------------------------------------------------------------------------------- 1 | 2 | repositories.remote << "http://repo1.maven.org/maven2" 3 | Buildr.settings.build['junit'] = '3.8.1' 4 | 5 | define "foo" do 6 | compile 7 | test 8 | 9 | end -------------------------------------------------------------------------------- /tests/package_war_as_jar/Buildfile: -------------------------------------------------------------------------------- 1 | 2 | module PackageWarAsJar 3 | 4 | def package_as_war_spec(spec) 5 | spec.merge(:type => "jar") 6 | end 7 | end 8 | 9 | define "webapp", :version => "1.0", :group => "org.group" do 10 | project.extend PackageWarAsJar 11 | 12 | package(:war) 13 | 14 | end 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /announce-email.txt 2 | /vote-email.txt 3 | /rake 4 | /dist 5 | /pkg 6 | /failed 7 | /buildr.pdf 8 | /rdoc 9 | /_reports 10 | /_site 11 | /_snapshot 12 | /_staged 13 | /_release 14 | /tmp 15 | *.swp 16 | /*.log 17 | /_all-in-one 18 | /nbproject 19 | /.rakeTasks 20 | /*.iml 21 | /*.ipr 22 | /*.iws 23 | /setup.* 24 | /libs 25 | /Gemfile.lock 26 | *.rbc 27 | /site 28 | /lib/buildr/scala/org/apache/buildr/Specs2Runner.class 29 | -------------------------------------------------------------------------------- /tests/compile_with_parent/Buildfile: -------------------------------------------------------------------------------- 1 | 2 | repositories.remote << "http://repo1.maven.org/maven2" 3 | 4 | LOG4J = artifact("log4j:log4j:jar:1.2.16") 5 | unless File.exist? File.join("lib", File.basename(LOG4J.to_s)) 6 | LOG4J.invoke 7 | cp LOG4J.to_s, "lib" 8 | end 9 | 10 | define "parent" do 11 | 12 | define "child" do 13 | 14 | compile.with project.parent.path_to(File.join("lib", File.basename(LOG4J.to_s))) 15 | 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/buildr/resources/icons-license.txt: -------------------------------------------------------------------------------- 1 | 2 | MouseRunner.com Green/Red icons 3 | ------------------------------- 4 | 5 | The graphics contained in the 'completed.png' and 'failed.png' files are 6 | licensed under the Creative Commons Attribution-ShareAlike 2.5 License 7 | 8 | Furthermore, 9 | You may not claim the works as your own. 10 | You must provide a link back to www.MouseRunner.com when using on a website, 11 | for commercial purposes, and for applications. 12 | 13 | Visit the address below to learn more about the Creative Commons license. 14 | http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode 15 | -------------------------------------------------------------------------------- /ci-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | update_bundler() { 4 | gem list | grep 'bundler' &> /dev/null 5 | if [ $? -gt 0 ]; then 6 | gem install bundler 7 | fi 8 | if [ "$1" = 'quiet' ]; then 9 | bundle update #> /dev/null 2> /dev/null 10 | else 11 | bundle update 12 | fi 13 | bundle check > /dev/null 2> /dev/null 14 | return $? 15 | } 16 | 17 | i="0" 18 | 19 | until (bundle check > /dev/null 2> /dev/null) || (update_bundler 'quiet') || [ $i -gt 10 ]; do 20 | echo "Bundle update. Attempt: $i" 21 | update_bundler 'quiet' 22 | i=$[$i+1] 23 | done 24 | 25 | if !(bundle check > /dev/null 2> /dev/null); then 26 | echo "Last Bundle update attempt." 27 | update_bundler 28 | fi 29 | -------------------------------------------------------------------------------- /doc/_layouts/preface.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | buildr 5 | 9 | 12 | 13 | 14 | 15 | 16 |
17 |
18 | {{ content }} 19 |
20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | jdk: 3 | - oraclejdk7 4 | - openjdk6 5 | rvm: 6 | - 2.1.0 7 | - 2.0.0 8 | - 1.9.3 9 | - 1.8.7 10 | - jruby-19mode 11 | - jruby-18mode 12 | git: 13 | depth: 10 14 | scala: 15 | # - 2.10.0 16 | - 2.9.2 17 | # - 2.9.1 18 | # - 2.8.1 19 | install: 20 | - source ci-setup.sh 21 | - export JRUBY_OPTS="-J-XX:MaxPermSize=312m -J-Xmx700M" 22 | - export JAVA_OPTS="-Xmx700m -XX:MaxPermSize=312m" 23 | script: rake ci 24 | notifications: 25 | email: 26 | recipients: 27 | - commits@buildr.apache.org 28 | - donaldp@apache.org 29 | - peter@realityforge.org 30 | on_success: always 31 | on_failure: always 32 | notifications: 33 | irc: "irc.freenode.org#buildr" 34 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache Buildr 2 | Copyright 2007-2009 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | 8 | COPYRIGHT NOTICES 9 | ----------------- 10 | Copyright 2007 Intalio 11 | 12 | This product includes software developed by Intalio 13 | http://www.intalio.com 14 | 15 | 16 | MATERIALS IN DOCUMENTATION 17 | -------------------------- 18 | The following materials are incorporated into the documentation 19 | of this software. 20 | 21 | * DejaVu - http://dejavu.sourceforge.net 22 | Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. 23 | Bitstream Vera is a trademark of Bitstream, Inc. 24 | 25 | * ColorCons - http://www.mouserunner.com/ 26 | Copyright (c) 2006 Ken Saunders 27 | -------------------------------------------------------------------------------- /all-in-one/buildr: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ----------------------------------------------------------------------------- 3 | # buildr.sh - Start Script for the Buildr interpreter 4 | # ----------------------------------------------------------------------------- 5 | 6 | ## resolve links - $0 may be a link to home 7 | PRG=$0 8 | progname=`basename "$0"` 9 | 10 | while [ -h "$PRG" ] ; do 11 | ls=`ls -ld "$PRG"` 12 | link=`expr "$ls" : '.*-> \(.*\)$'` 13 | if expr "$link" : '.*/.*' > /dev/null; then 14 | if expr "$link" : '/' > /dev/null; then 15 | PRG="$link" 16 | else 17 | PRG="`dirname ${PRG}`/${link}" 18 | fi 19 | else 20 | PRG="`dirname $PRG`/$link" 21 | fi 22 | done 23 | 24 | BUILDR_HOME=`dirname "$PRG"` 25 | 26 | $BUILDR_HOME/../embedded/bin/jruby -S buildr "$@" 27 | -------------------------------------------------------------------------------- /ci.bat: -------------------------------------------------------------------------------- 1 | SET SCALA_HOME=F:\hudson\tools\scala-2.9.0.1 2 | SET JRUBY_OPTS=-J-XX:MaxPermSize=312m -J-Xmx1024M 3 | SET JAVA_OPTS=-Xmx1024m -XX:MaxPermSize=312m 4 | 5 | IF "X%BUILD_RVM%" == "X1.9.3" SET RUBY_HOME=F:\hudson\tools\Ruby193-p194 6 | IF "X%BUILD_RVM%" == "X1.9.2" SET RUBY_HOME=F:\hudson\tools\Ruby192-p290 7 | IF "X%BUILD_RVM%" == "X1.8.7" SET RUBY_HOME=F:\hudson\tools\Ruby187-p370 8 | IF "X%BUILD_RVM%" == "Xjruby" SET RUBY_HOME=F:\hudson\tools\jruby-1.6.7 9 | 10 | IF "X%BUILD_JVM%" == "X1.5" SET JAVA_HOME=F:\hudson\tools\java\jdk1.5.0_22-64 11 | IF "X%BUILD_JVM%" == "X1.6" SET JAVA_HOME=F:\hudson\tools\java\jdk1.6.0_27-64 12 | IF "X%BUILD_JVM%" == "X1.7" SET JAVA_HOME=F:\hudson\tools\java\jdk1.7.0 13 | 14 | SET PATH=%JAVA_HOME%\bin;%RUBY_HOME%\bin;%PATH% 15 | 16 | CALL gem install bundler 17 | CALL bundle update 18 | 19 | SET BUILD_RAKE_TASK=ci 20 | CALL rake clobber %BUILD_RAKE_TASK% --trace 21 | -------------------------------------------------------------------------------- /lib/buildr/version.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | VERSION = '1.4.22.dev'.freeze 18 | end 19 | -------------------------------------------------------------------------------- /tests/package_war_as_jar/src/main/java/Foo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | public class Foo { 19 | } 20 | -------------------------------------------------------------------------------- /tests/JavaSystemProperty/Buildfile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | define "proj" do 17 | ::Java.java.lang.System.setProperty("foo", "bar") 18 | end -------------------------------------------------------------------------------- /bin/buildr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with this 4 | # work for additional information regarding copyright ownership. The ASF 5 | # licenses this file to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | # License for the specific language governing permissions and limitations under 15 | # the License. 16 | 17 | require 'rubygems' 18 | require 'bundler/setup' 19 | require 'buildr' 20 | Buildr.application.run 21 | -------------------------------------------------------------------------------- /tests/helloWorld/Buildfile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | define "helloWorld", :version => "1.0", :group => "org.buildr" do 17 | 18 | package(:jar) 19 | 20 | end -------------------------------------------------------------------------------- /tests/junit3/src/main/java/Foo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | public class Foo { 19 | 20 | public String bar() { 21 | return "bar"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/buildr/groovy.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | require 'buildr/groovy/compiler' 18 | require 'buildr/groovy/bdd' 19 | require 'buildr/groovy/doc' 20 | require 'buildr/groovy/shell' 21 | -------------------------------------------------------------------------------- /tests/helloWorld/src/main/java/HelloWorld.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | public class HelloWorld { 19 | 20 | public void foo() { 21 | System.err.println("bar"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/JavaSystemProperty/src/test/java/FooTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | import org.junit.Test; 19 | 20 | public class FooTest { 21 | 22 | @Test 23 | public void testSomething() {} 24 | } 25 | -------------------------------------------------------------------------------- /tests/compile_with_parent/child/src/main/java/Foo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | import org.apache.log4j.Logger; 19 | 20 | public class Foo { 21 | 22 | private static final Logger _logger = Logger.getLogger(Foo.class); 23 | } 24 | -------------------------------------------------------------------------------- /addon/buildr/emma.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | if Buildr::VERSION < '1.5' 17 | Buildr.application.deprecated "'buildr/emma', use 'buildr/java/emma' instead" 18 | require 'buildr/java/emma' 19 | else 20 | raise "#{__FILE__} should be removed since its use is deprecated since version 1.3.4" 21 | end 22 | -------------------------------------------------------------------------------- /addon/buildr/cobertura.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | if Buildr::VERSION < '1.5' 17 | Buildr.application.deprecated "'buildr/cobertura', use 'buildr/java/cobertura' instead" 18 | require 'buildr/java/cobertura' 19 | else 20 | raise "#{__FILE__} should be removed since its use is deprecated since version 1.3.4" 21 | end 22 | -------------------------------------------------------------------------------- /tests/BUILDR-320/Buildfile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | define "whole" do 17 | define 'sub' do 18 | define 'C' do 19 | compile.with project('sub:B') 20 | end 21 | 22 | define 'A' do 23 | end 24 | 25 | define 'B' do 26 | compile.with project('sub:A') 27 | end 28 | end 29 | end -------------------------------------------------------------------------------- /tests/junit3/src/test/java/FooTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | import junit.framework.TestCase; 19 | import static junit.framework.Assert.assertEquals; 20 | 21 | public class FooTest extends TestCase { 22 | 23 | public void testFoo() { 24 | Foo foo = new Foo(); 25 | assertEquals("bar", foo.bar()); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /tests/include_as/Buildfile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | repositories.remote = ["http://repo1.maven.org/maven2"] 17 | SLF4J_API = "org.slf4j:slf4j-api:jar:1.6.1" 18 | 19 | define "proj" do 20 | project.version = "1.0" 21 | project.group = "org.example" 22 | package(:zip).include(_("doc"), :as => "docu") 23 | package(:zip).include(artifact(SLF4J_API), :as => "lib/logging.jar") 24 | end -------------------------------------------------------------------------------- /tests/include_path/Buildfile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | repositories.remote = ["http://repo1.maven.org/maven2"] 17 | SLF4J_API = "org.slf4j:slf4j-api:jar:1.6.1" 18 | 19 | define "proj" do 20 | project.version = "1.0" 21 | project.group = "org.example" 22 | package(:zip).include(_("doc"), :path => "distrib") 23 | package(:zip).include(artifact(SLF4J_API), :path => "distrib/lib") 24 | end -------------------------------------------------------------------------------- /lib/buildr/clojure.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | module Buildr::Clojure #:nodoc: 18 | 19 | REQUIRES = ArtifactNamespace.for(self) do |ns| 20 | ns.clojure! 'org.clojure:clojure:jar:1.2.0' 21 | ns.jline! 'jline:jline:jar:0.9.94' 22 | end 23 | 24 | class << self 25 | def dependencies #:nodoc: 26 | REQUIRES.artifacts 27 | end 28 | end 29 | 30 | end 31 | 32 | require 'buildr/clojure/shell' 33 | -------------------------------------------------------------------------------- /doc/css/syntax.css: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with this 3 | * work for additional information regarding copyright ownership. The ASF 4 | * licenses this file to you under the Apache License, Version 2.0 (the 5 | * "License"); you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | .highlight .k, .highlight .kp { color: blue } /* keyword */ 18 | .highlight .no { color: darkblue } /* constant */ 19 | .highlight .s1 { color: green } /* string */ 20 | .highlight .n { color: black } /* identifier */ 21 | .highlight .o, .highlight .p { color: darkblue } /* = + */ 22 | .highlight .ss { color: darkblue } /* symbol */ 23 | .highlight .c1 { color: gray } /* comment */ 24 | -------------------------------------------------------------------------------- /lib/buildr/scala.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | ENV['SCALA_HOME'] ||= '/opt/local/share/scala/' if File.exist?('/opt/local/share/scala/lib/scala-compiler.jar') 18 | Buildr.repositories.remote << 'http://oss.sonatype.org/content/repositories/releases' 19 | 20 | require 'buildr/scala/compiler' 21 | require 'buildr/scala/tests' 22 | require 'buildr/scala/bdd' 23 | require 'buildr/scala/doc' 24 | require 'buildr/scala/shell' 25 | 26 | Object::Scala = Buildr::Scala 27 | -------------------------------------------------------------------------------- /lib/buildr/packaging/test_jar.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | module PackageAsTestJar 18 | def package_as_test_jar_spec(spec) #:nodoc: 19 | spec.merge(:type => :jar, :classifier => 'tests') 20 | end 21 | 22 | def package_as_test_jar(file_name) #:nodoc: 23 | ZipTask.define_task(file_name).tap do |zip| 24 | zip.include :from => [test.compile.target, test.resources.target].compact 25 | end 26 | end 27 | end 28 | end 29 | 30 | class Buildr::Project 31 | include Buildr::PackageAsTestJar 32 | end 33 | -------------------------------------------------------------------------------- /addon/buildr/org/apache/buildr/BuildrNail.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with this 3 | * work for additional information regarding copyright ownership. The ASF 4 | * licenses this file to you under the Apache License, Version 2.0 (the 5 | * "License"); you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | 18 | package org.apache.buildr; 19 | 20 | import com.martiansoftware.nailgun.NGContext; 21 | 22 | public interface BuildrNail { 23 | 24 | public void main(NGContext ctx); 25 | 26 | public static class Main { 27 | private static BuildrNail nail; 28 | public static void setNail(BuildrNail _nail) { nail = _nail; } 29 | public static void nailMain(NGContext ctx) { 30 | nail.main(ctx); 31 | } 32 | } 33 | 34 | } 35 | 36 | /* 37 | * Local Variables: 38 | * indent-tabs-mode: nil 39 | * c-basic-offset: 2 40 | * End: 41 | */ 42 | -------------------------------------------------------------------------------- /spec/scala/scala.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) 18 | 19 | describe 'scala' do 20 | 21 | it 'should automatically add the remote oss.sonatype.org repository' do 22 | # NOTE: the sandbox environment clears "repositories.remote" so we can't 23 | # test for this spec right now. 24 | # 25 | # repositories.remote.should include('http://oss.sonatype.org/content/repositories/releases') 26 | end 27 | 28 | it "should provide the Scala version string" do 29 | Scala.version_str.should eql(Buildr::Scala::SCALA_VERSION_FOR_SPECS) 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /addon/buildr/git_auto_version.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr 17 | module GitAutoVersion 18 | module ProjectExtension 19 | include Extension 20 | 21 | before_define do |project| 22 | unless project.version 23 | version_suffix = ENV['BUILD_NUMBER'] ? "-#{ENV['BUILD_NUMBER']}" : '' 24 | version_prefix = ENV['VERSION_PREFIX'] ? "#{ENV['VERSION_PREFIX']}-" : '' 25 | project.version = version_prefix + `git describe --tags --always`.strip + version_suffix 26 | end 27 | end 28 | end 29 | end 30 | end 31 | 32 | class Buildr::Project 33 | include Buildr::GitAutoVersion::ProjectExtension 34 | end 35 | -------------------------------------------------------------------------------- /spec/core/generate_spec.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) 18 | 19 | 20 | describe Buildr::Generate do 21 | 22 | describe 'Generated buildfile' do 23 | it 'should be a legal buildfile' do 24 | File.open('buildfile', 'w') { |file| file.write Generate.from_directory(Dir.pwd).join("\n") } 25 | lambda { Buildr.application.run }.should_not raise_error 26 | end 27 | 28 | it 'should not contain NEXT_VERSION because it was removed in buildr 1.3.3' do 29 | buildfile = Generate.from_directory(Dir.pwd) 30 | buildfile.each { |line| line.should_not include('NEXT_VERSION')} 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/buildr/core/linux.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | # Let's see if we can use notify-send. Must be running from console in verbose mode. 17 | if $stdout.isatty && verbose 18 | system("which notify-send > /dev/null 2>/dev/null") 19 | if $?.exitstatus == 0 20 | def notify_send(type, title, message) 21 | icon = File.join(File.dirname(__FILE__), '../resources/', type.to_s + '.png') 22 | system "notify-send -i #{icon} \"#{title}\" \"#{message}\"" 23 | end 24 | 25 | Buildr.application.on_completion { |title, message| notify_send(:completed, title, message) if verbose } 26 | Buildr.application.on_failure { |title, message, ex| notify_send(:failed, title, message) if verbose } 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /spec/java/ant_spec.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) 18 | 19 | 20 | describe Buildr::Ant do 21 | 22 | it 'should pick Ant version from ant build settings' do 23 | begin 24 | Buildr::Ant.instance_eval { @dependencies = nil } 25 | write 'build.yaml', 'ant: 1.2.3' 26 | Buildr::Ant.dependencies.should include("org.apache.ant:ant:jar:1.2.3") 27 | ensure 28 | Buildr::Ant.instance_eval { @dependencies = nil } 29 | end 30 | end 31 | 32 | it 'should have REQUIRES up to version 1.5 since it was deprecated in version 1.3.3' do 33 | Buildr::VERSION.should < '1.5' 34 | lambda { Ant::REQUIRES }.should_not raise_error 35 | end 36 | 37 | end 38 | -------------------------------------------------------------------------------- /lib/buildr/scala/org/apache/buildr/Specs2Runner.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with this 3 | * work for additional information regarding copyright ownership. The ASF 4 | * licenses this file to you under the Apache License, Version 2.0 (the 5 | * "License"); you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.apache.buildr; 18 | 19 | import java.lang.reflect.Field; 20 | import java.lang.reflect.Method; 21 | 22 | public class Specs2Runner { 23 | 24 | public static void main(String[] args) { 25 | try { 26 | ClassLoader loader = Thread.currentThread().getContextClassLoader(); 27 | Class clazz = loader.loadClass("org.specs2.runner.ClassRunner"); 28 | Object instance = clazz.newInstance(); 29 | Method main = clazz.getMethod("main", String[].class); 30 | main.invoke(instance, new Object[] { args }); 31 | } catch (Exception e) { 32 | throw new RuntimeException(e); 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /lib/buildr/core/jrebel.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | module JRebel 18 | def jrebel_home 19 | unless @jrebel_home 20 | @jrebel_home = ENV['REBEL_HOME'] || ENV['JREBEL'] || ENV['JREBEL_HOME'] 21 | end 22 | 23 | (@jrebel_home && File.exists?(@jrebel_home)) ? @jrebel_home : nil 24 | end 25 | 26 | def rebel_jar 27 | if jrebel_home 28 | # jrebel_home may point to jrebel.jar directly 29 | File.directory?(jrebel_home) ? File.join(jrebel_home, 'jrebel.jar') : jrebel_home 30 | end 31 | end 32 | 33 | def jrebel_args 34 | rebel_jar ? [ '-noverify', "-javaagent:#{rebel_jar}" ] : [] 35 | end 36 | 37 | def jrebel_props(project) 38 | {} 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /addon/buildr/top_level_generate_dir.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr 17 | 18 | # A simple extension that modifies the project layout to place generated files at the top level. 19 | # Generated files are typically created below layout[:target, :generated], placing them at the top 20 | # level makes it easy for IDEs to inspect source in the generated directory while ignoring the dir 21 | # containing the intermediate artifacts. 22 | # 23 | module TopLevelGenerateDir 24 | module ProjectExtension 25 | include Extension 26 | 27 | before_define do |project| 28 | project.layout[:target, :generated] = "generated" 29 | project.clean { rm_rf project._(:target, :generated) } 30 | end 31 | end 32 | end 33 | end 34 | 35 | class Buildr::Project 36 | include Buildr::TopLevelGenerateDir::ProjectExtension 37 | end 38 | -------------------------------------------------------------------------------- /lib/buildr/core/run.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | module Run #:nodoc: 18 | 19 | class JavaRunner < Base 20 | include Buildr::JRebel 21 | 22 | specify :name => :java, :languages => [:java, :scala, :groovy, :clojure] 23 | 24 | def run(task) 25 | fail "Missing :main option" unless task.options[:main] 26 | cp = project.compile.dependencies + [project.path_to(:target, :classes), project.path_to(:target, :resources)] + task.classpath 27 | Java::Commands.java(task.options[:main], { 28 | :properties => jrebel_props(project).merge(task.options[:properties] || {}), 29 | :classpath => cp, 30 | :java_args => jrebel_args + (task.options[:java_args] || []) 31 | }) 32 | end 33 | end # JavaRunnner 34 | 35 | end 36 | end 37 | 38 | Buildr::Run.runners << Buildr::Run::JavaRunner 39 | -------------------------------------------------------------------------------- /_buildr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with this 4 | # work for additional information regarding copyright ownership. The ASF 5 | # licenses this file to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | # License for the specific language governing permissions and limitations under 15 | # the License. 16 | 17 | 18 | # Run buildr from source, specifically for testing stuff without doing a rake install. 19 | 20 | require 'rubygems' 21 | $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib') << File.join(File.dirname(__FILE__), 'addon') 22 | 23 | require 'buildr/version' 24 | spec = Gem::Specification.load(File.join(File.dirname(__FILE__), 'buildr.gemspec')) 25 | # To avoid a warning about the version_requirements deprecation, we use this method inline. 26 | def version_required(gem_def) 27 | return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements 28 | end 29 | spec.dependencies.each do |dep| 30 | gem dep.name, version_required(dep).to_s if dep.type == :runtime 31 | end 32 | Gem.loaded_specs['buildr'] = spec # Prevents RubyGem from loading files from installed Buildr gems 33 | 34 | require 'buildr' 35 | Buildr.application.run 36 | -------------------------------------------------------------------------------- /_jbuildr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env jruby 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with this 4 | # work for additional information regarding copyright ownership. The ASF 5 | # licenses this file to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | # License for the specific language governing permissions and limitations under 15 | # the License. 16 | 17 | 18 | # Run buildr from source, specifically for testing stuff without doing a rake install. 19 | 20 | require 'rubygems' 21 | $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib') << File.join(File.dirname(__FILE__), 'addon') 22 | 23 | require 'buildr/version' 24 | spec = Gem::Specification.load(File.join(File.dirname(__FILE__), 'buildr.gemspec')) 25 | # To avoid a warning about the version_requirements deprecation, we use this method inline. 26 | def version_required(gem_def) 27 | return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements 28 | end 29 | spec.dependencies.each do |dep| 30 | gem dep.name, version_required(dep).to_s if dep.type == :runtime 31 | end 32 | Gem.loaded_specs['buildr'] = spec # Prevents RubyGem from loading files from installed Buildr gems 33 | 34 | require 'buildr' 35 | Buildr.application.run 36 | -------------------------------------------------------------------------------- /doc/scripts/install-jruby.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with this 4 | # work for additional information regarding copyright ownership. The ASF 5 | # licenses this file to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | # License for the specific language governing permissions and limitations under 15 | # the License. 16 | if [ -z `which jruby` ] ; then 17 | version=1.6.2 18 | target=/opt/jruby 19 | echo "Installing JRuby ${version} in ${target}" 20 | sudo mkdir -p $(dirname ${target}) 21 | wget http://jruby.org.s3.amazonaws.com/downloads/${version}/jruby-bin-${version}.tar.gz 22 | tar -xz < jruby-bin-${version}.tar.gz 23 | sudo mv jruby-${version} ${target} 24 | rm jruby-bin-${version}.tar.gz 25 | export PATH=$PATH:${target} 26 | if [ -e ~/.bash_profile ] ; then 27 | echo "export PATH=${target}/bin:\$PATH" >> ~/.bash_profile 28 | elif [ -e ~/.profile ] ; then 29 | echo "export PATH=${target}/bin:\$PATH" >> ~/.profile 30 | else 31 | echo "You need to add ${target}/bin to the PATH" 32 | fi 33 | fi 34 | 35 | if [ `which buildr` ] ; then 36 | echo "Updating to the latest version of Buildr" 37 | sudo jruby -S gem update buildr 38 | else 39 | echo "Installing the latest version of Buildr" 40 | sudo jruby -S gem install buildr 41 | fi 42 | echo 43 | 44 | jruby -S buildr --version 45 | -------------------------------------------------------------------------------- /rakelib/metrics.rake: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | namespace 'metrics' do 17 | desc 'run Saikuro reports' 18 | task 'saikuro' do 19 | gem 'atoulme-Saikuro' 20 | require 'saikuro' 21 | require 'pathname' 22 | output_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', '_reports', 'saikuro')) 23 | base_dir = Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), '..'))) 24 | rb_files = %w(lib addon).collect { |folder| 25 | FileList[File.expand_path(File.join(File.dirname(__FILE__), '..', folder, '**', '*.rb'))] 26 | }.flatten.collect {|path| 27 | Pathname.new(path).relative_path_from(base_dir).to_s 28 | } 29 | SaikuroRunner.new.run(rb_files, output_dir) 30 | end 31 | 32 | desc 'generate ccn treemap' 33 | task 'ccn_treemap' do 34 | require 'saikuro_treemap' 35 | SaikuroTreemap.generate_treemap :code_dirs => %w(lib addon), :output_file => '_reports/saikuro_treemap.html' 36 | end 37 | end 38 | 39 | desc 'Run all metrics tools' 40 | task 'metrics' => %w(metrics:saikuro metrics:ccn_treemap) 41 | -------------------------------------------------------------------------------- /doc/mailing_lists.textile: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Mailing Lists 4 | --- 5 | 6 |
Search all Buildr archives:

7 | 8 | |_. users |_. For developers working with Buildr | 9 | | Post | "users@buildr.apache.org":mailto:users@buildr.apache.org | 10 | | Search | "http://buildr.markmail.org/search/list:users":http://buildr.markmail.org/search/list:users | 11 | | Subscribe | "users-subscribe@buildr.apache.org":mailto:users-subscribe@buildr.apache.org | 12 | | Unsubscribe | "users-unsubscribe@buildr.apache.org":mailto:users-unsubscribe@buildr.apache.org | 13 | |_. dev |_. For development of Buildr itself | 14 | | Post | "dev@buildr.apache.org":mailto:dev@buildr.apache.org | 15 | | Search | "http://buildr.markmail.org/search/list:dev":http://buildr.markmail.org/search/list:dev | 16 | | Subscribe | "dev-subscribe@buildr.apache.org":mailto:dev-subscribe@buildr.apache.org | 17 | | Unsubscribe | "dev-unsubscribe@buildr.apache.org":mailto:dev-unsubscribe@buildr.apache.org | 18 | |_. commits |_. Commit messages and JIRA status | 19 | | Search | "http://buildr.markmail.org/search/list:commits":http://buildr.markmail.org/search/list:commits | 20 | | Subscribe | "commits-subscribe@buildr.apache.org":mailto:commits-subscribe@buildr.apache.org | 21 | | Unsubscribe | "commits-unsubscribe@buildr.apache.org":mailto:commits-unsubscribe@buildr.apache.org | 22 | |_. ci |_. Continuous integration status | 23 | | Search | "http://buildr.markmail.org/search/list:ci":http://buildr.markmail.org/search/list:ci | 24 | | Subscribe | "ci-subscribe@buildr.apache.org":mailto:ci-subscribe@buildr.apache.org | 25 | | Unsubscribe | "ci-unsubscribe@buildr.apache.org":mailto:ci-unsubscribe@buildr.apache.org | 26 | -------------------------------------------------------------------------------- /lib/buildr/scala/shell.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | module Scala #:nodoc: 18 | class ScalaShell < Buildr::Shell::Base 19 | include Buildr::JRebel 20 | 21 | specify :name => :scala, :languages => [:scala] 22 | 23 | def launch(task) 24 | jline = [File.expand_path("lib/jline.jar", Scalac.scala_home)].find_all { |f| File.exist? f } 25 | jline = ['jline:jline:jar:0.9.94'] if jline.empty? 26 | 27 | cp = project.compile.dependencies + 28 | Scalac.dependencies + 29 | project.test.dependencies + 30 | task.classpath 31 | 32 | java_args = jrebel_args + task.java_args 33 | 34 | props = jrebel_props(project).merge(task.properties) 35 | 36 | Java::Commands.java 'scala.tools.nsc.MainGenericRunner', 37 | '-cp', cp.join(File::PATH_SEPARATOR), 38 | { 39 | :properties => props, 40 | :classpath => cp + jline, 41 | :java_args => java_args 42 | } 43 | end 44 | end 45 | end 46 | end 47 | 48 | Buildr::Shell.providers << Buildr::Scala::ScalaShell 49 | -------------------------------------------------------------------------------- /lib/buildr/clojure/shell.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr::Shell #:nodoc: 17 | 18 | class Clojure < Base 19 | include JRebel 20 | 21 | specify :name => :clj, :lang => :clojure 22 | 23 | # don't build if it's *only* Clojure sources 24 | def build? 25 | !has_source?(:clojure) or has_source?(:java) or has_source?(:scala) or has_source?(:groovy) 26 | end 27 | 28 | def launch(task) 29 | cp = project.compile.dependencies + 30 | ::Buildr::Clojure.dependencies + 31 | [ build? ? project.path_to(:target, :classes) : project.path_to(:src, :main, :clojure) ] 32 | 33 | Java::Commands.java 'jline.ConsoleRunner', 'clojure.lang.Repl', { 34 | :properties => jrebel_props(project).merge(task.properties), 35 | :classpath => cp, 36 | :java_args => jrebel_args + task.java_args 37 | } 38 | end 39 | 40 | private 41 | def clojure_home 42 | @home ||= ENV['CLOJURE_HOME'] 43 | end 44 | 45 | def has_source?(lang) 46 | File.exists? project.path_to(:src, :main, lang) 47 | end 48 | end 49 | end 50 | 51 | Buildr::Shell.providers << Buildr::Shell::Clojure 52 | -------------------------------------------------------------------------------- /rakelib/checks.rake: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | desc 'Check that source files contain the Apache license' 17 | task 'license' => FileList['{addon,lib,doc,rakelib}/**/*.{xsl,rb,rake,java}', 'buildr.gemspec', 'Rakefile'] do |task| 18 | puts 'Checking that files contain the Apache license ... ' 19 | required = task.prerequisites.select { |fn| File.file?(fn) } 20 | missing = required.reject { |fn| 21 | comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|^-#\s+(.*?)$|/m). 22 | map { |match| match.compact }.flatten.join("\n") 23 | comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/ 24 | } 25 | fail "#{missing.join(', ')} missing Apache License, please add it before making a release!" unless missing.empty? 26 | puts '[x] Source files contain the Apache license' 27 | end 28 | 29 | desc 'Check that files in addon directory do not have the .rake suffix.' 30 | task 'addon_extensions:check' do 31 | bad_files = FileList['addon/**/*.rake'] 32 | fail "#{bad_files.join(', ')} named with .rake extension but should be .rb, fix them before making a release!" unless bad_files.empty? 33 | end 34 | -------------------------------------------------------------------------------- /doc/scripts/install-osx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with this 4 | # work for additional information regarding copyright ownership. The ASF 5 | # licenses this file to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | # License for the specific language governing permissions and limitations under 15 | # the License. 16 | version=$(ruby --version) 17 | if [ ${version:5:5} \< '1.8.6' ] ; then 18 | echo "You do not have Ruby 1.8.6 or later, attempting to install a newer version." 19 | if [ `which port` ] ; then 20 | echo "Installing Ruby using MacPorts" 21 | sudo port install ruby rb-rubygems 22 | elif [ `which fink` ] ; then 23 | echo "Installing Ruby using Fink" 24 | sudo fink install ruby ruby18-dev rubygems-rb18 25 | else 26 | echo "Can only upgrade to Ruby 1.8.6 using either MacPorts or Fink, and can't find either one" 27 | exit 1 28 | fi 29 | echo 30 | fi 31 | 32 | if [ -z $JAVA_HOME ] ; then 33 | echo "Setting JAVA_HOME" 34 | export JAVA_HOME=/Library/Java/Home 35 | fi 36 | 37 | if [ $(gem --version) \< '1.3.1' ] ; then 38 | echo "Upgrading to latest version of RubyGems" 39 | sudo gem update --system 40 | echo 41 | fi 42 | 43 | if [ `which buildr` ] ; then 44 | echo "Updating to the latest version of Buildr" 45 | sudo env JAVA_HOME=$JAVA_HOME gem update buildr 46 | else 47 | echo "Installing the latest version of Buildr" 48 | sudo env JAVA_HOME=$JAVA_HOME gem install buildr 49 | fi 50 | echo 51 | 52 | buildr --version 53 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | # To work-around a bug with gemcutter: http://stackoverflow.com/questions/4932881/gemcutter-rake-build-now-throws-undefined-method-write-for-syckemitter 17 | require 'psych' if RUBY_VERSION >= '1.9.2' && !RUBY_PLATFORM[/java/] 18 | 19 | # We need JAVA_HOME for most things (setup, spec, etc). 20 | unless ENV['JAVA_HOME'] 21 | if RUBY_PLATFORM[/java/] 22 | ENV['JAVA_HOME'] = Java.java.lang.System.getProperty('java.home') 23 | elsif RUBY_PLATFORM[/darwin/] 24 | ENV['JAVA_HOME'] = '/System/Library/Frameworks/JavaVM.framework/Home' 25 | else 26 | fail "Please set JAVA_HOME first (set JAVA_HOME=... or env JAVA_HOME=... rake ...)" 27 | end 28 | end 29 | 30 | 31 | # Load the Gem specification for the current platform (Ruby or JRuby). 32 | def spec(platform = RUBY_PLATFORM[/java/] || 'ruby') 33 | @specs ||= ['ruby', 'java', 'x86-mswin32'].inject({}) { |hash, spec_platform| 34 | ENV['BUILDR_PLATFORM'] = spec_platform 35 | hash.update(spec_platform=> Gem::Specification.load('buildr.gemspec')) 36 | Gem::Specification._clear_load_cache 37 | ENV['BUILDR_PLATFORM'] = nil 38 | hash 39 | } 40 | @specs[platform] 41 | end 42 | 43 | desc 'Clean up all temporary directories used for running tests, creating documentation, packaging, etc.' 44 | task :clobber 45 | -------------------------------------------------------------------------------- /spec/java/doc_spec.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) 18 | 19 | describe 'Javadoc' do 20 | def sources 21 | @sources ||= (1..3).map { |i| "Test#{i}" }. 22 | each { |name| write "src/main/java/foo/#{name}.java", "package foo; public class #{name}{}" }. 23 | map { |name| "src/main/java/foo/#{name}.java" } 24 | end 25 | 26 | it 'should pick -windowtitle from project name by default' do 27 | define 'foo' do 28 | compile.using(:javac) 29 | 30 | define 'bar' do 31 | compile.using(:javac) 32 | end 33 | end 34 | 35 | project('foo').doc.options[:windowtitle].should eql('foo') 36 | project('foo:bar').doc.options[:windowtitle].should eql('foo:bar') 37 | end 38 | 39 | it 'should pick -windowtitle from project description by default, if available' do 40 | desc 'My App' 41 | define 'foo' do 42 | compile.using(:javac) 43 | end 44 | project('foo').doc.options[:windowtitle].should eql('My App') 45 | end 46 | 47 | it 'should not override explicit :windowtitle' do 48 | define 'foo' do 49 | compile.using(:javac) 50 | doc.using :windowtitle => 'explicit' 51 | end 52 | project('foo').doc.options[:windowtitle].should eql('explicit') 53 | end 54 | 55 | end 56 | -------------------------------------------------------------------------------- /lib/buildr/groovy/shell.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | module Groovy #:nodoc: 18 | class GroovySH < Buildr::Shell::Base 19 | include JRebel 20 | 21 | SUFFIX = if Util.win_os? then '.bat' else '' end 22 | 23 | specify :name => :groovy, :languages => [:groovy] 24 | 25 | def launch(task) 26 | cp = Groovy.dependencies + 27 | project.compile.dependencies + 28 | [ project.path_to(:target, :classes) ] + 29 | task.classpath 30 | props = jrebel_props(project).merge(task.properties) 31 | java_args = jrebel_args + task.java_args 32 | 33 | groovy_home = nil 34 | if groovy_home 35 | cmd_args = " -classpath '#{cp.join(File::SEPARATOR)}'" 36 | trace "groovysh #{cmd_args}" 37 | system(File.expand_path("bin#{File::SEPARATOR}groovysh#{SUFFIX}", groovy_home) + cmd_args) 38 | else 39 | Java::Commands.java 'org.codehaus.groovy.tools.shell.Main', { 40 | :properties => props, 41 | :classpath => cp, 42 | :java_args => java_args 43 | } 44 | end 45 | end 46 | 47 | private 48 | def groovy_home 49 | @home ||= ENV['GROOVY_HOME'] 50 | end 51 | end 52 | end 53 | end 54 | 55 | Buildr::Shell.providers << Buildr::Groovy::GroovySH 56 | -------------------------------------------------------------------------------- /lib/buildr/rspec_check.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | 18 | @@rspec_checked = false 19 | 20 | def self.rspec_present? 21 | unless @@rspec_checked 22 | begin 23 | require 'rspec' 24 | rescue LoadError 25 | # If Rspec is not present then that is ok 26 | end 27 | @@rspec_checked = true 28 | end 29 | 30 | # Need to check 'rspec.rb' for jruby-1.6.7.2 and earlier 31 | $LOADED_FEATURES.any?{|f| f == 'rspec.rb' || f =~ /[\\\/]rspec\.rb$/ } 32 | end 33 | 34 | def self.ensure_rspec(context) 35 | unless rspec_present? 36 | # Has the rspec dependency been loaded? 37 | message = 38 | "#{context} but RSpec has not been loaded.\n" + 39 | "\n" + 40 | "Buildr prior to version 1.4.22, included rspec as a dependency but as\n" + 41 | "of version 1.4.22, it is expected users manually add RSpec to their\n" + 42 | "Gemfile. The following lines should be added to restore the version\n" + 43 | "of rspec included in 1.4.22:\n" + 44 | "\n" + 45 | "gem 'rspec-expectations', '= 2.14.3'\n" + 46 | "gem 'rspec-mocks', '= 2.14.3'\n" + 47 | "gem 'rspec-core', '= 2.14.5'\n" + 48 | "gem 'rspec', '= 2.14.1'\n" 49 | fail message 50 | end 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /spec/addon/checkstyle_spec.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | require File.expand_path('../spec_helpers', File.dirname(__FILE__)) 17 | Sandbox.require_optional_extension 'buildr/checkstyle' 18 | artifacts(Buildr::Checkstyle::dependencies).map(&:invoke) 19 | 20 | CHECKS_CONTENT = < 22 | 25 | 26 | 27 | CHECKS 28 | GOOD_CONTENT = < 1 && args[1].equals("-c")); 33 | String spec = colors ? args[2] : args[1]; 34 | 35 | run(args[0], colors, spec); 36 | } 37 | 38 | // Incompatible with JVM 1.4 target 39 | // @throws(classOf[Throwable]) 40 | static void run(String path, boolean colors, String spec) { 41 | try { 42 | File parent = new File(path); 43 | URL specURL = new File(parent, spec.replace('.', '/') + ".class").toURL(); 44 | URLClassLoader loader = new URLClassLoader(new URL[] { specURL }, Thread.currentThread().getContextClassLoader()); 45 | 46 | Class clazz = loader.loadClass(spec); 47 | Object instance = clazz.getField("MODULE$").get(null); 48 | 49 | Method main = clazz.getMethod("main", String[].class); 50 | 51 | String[] args = colors ? new String[] { "-c" } : new String[] {}; 52 | main.invoke(instance, new Object[] { args }); 53 | } catch (Exception e) { 54 | throw new RuntimeException(e); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /doc/preface.textile: -------------------------------------------------------------------------------- 1 | --- 2 | layout: preface 3 | --- 4 | 5 | p(title). !images/zbuildr.png! 6 | 7 |
    8 |
  1. "Quick Start":quick_start.html
  2. 9 |
  3. "Installing and Running":installing.html
  4. 10 |
  5. "Projects":projects.html
  6. 11 |
  7. "Building":building.html
  8. 12 |
  9. "Artifacts":artifacts.html
  10. 13 |
  11. "Packaging":packaging.html
  12. 14 |
  13. "Testing":testing.html
  14. 15 |
  15. "Settings & Profiles":settings_profiles.html
  16. 16 |
  17. "Languages":languages.html
  18. 17 |
  19. "More Stuff":more_stuff.html
  20. 18 |
  21. "Extending Buildr":extending.html
  22. 19 |
  23. "Contributing":contributing.html
  24. 20 |
21 | 22 | 23 | p(preface). !images/asf-logo.png! 24 | 25 | Copyright 2007-2009 Apache Buildr 26 | 27 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 28 | 29 | http://www.apache.org/licenses/LICENSE-2.0 30 | 31 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 32 | 33 | 34 | 35 |
36 | "Daniel Spiewak":http://www.codecommit.com/blog: 37 | 38 | bq. If you think about it, the question isn’t “Why use Buildr?”, it’s really “Why use anything else?” The advantages afforded by Buildr are so substantial, I really can’t see myself going with any other tool, at least not when I have a choice. 39 | 40 | "Tristan Juricek":http://tristanhunt.com/: 41 | 42 | bq. That’s still the strongest sell: it builds everything I need, and as I’ve needed more, I just got things working without a lot of fuss. 43 | 44 | "Matthieu Riou":http://offthelip.org/: 45 | 46 | bq. We used to rely on Ant, with a fairly extensive set of scripts. It worked but was expensive to maintain. The biggest mistake afterward was to migrate to Maven2. I could write pages of rants explaining all the problems we ran into and we still ended up with thousands of lines of XML. 47 | 48 | "Martin Grotzke":http://www.javakaffee.de/blog/: 49 | 50 | bq. The positive side effect for me as a java user is that I learn a little ruby, and that’s easy but lots of fun… :-) 51 |
52 | 53 | 54 | p(preface). 55 | -------------------------------------------------------------------------------- /rakelib/package.rake: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | require 'rubygems/package_task' 17 | 18 | Gem::PackageTask.new(spec) do |pkg| 19 | pkg.need_tar = true 20 | pkg.need_zip = true 21 | end 22 | 23 | desc 'Compile Java libraries used by Buildr' 24 | task 'compile' do 25 | puts 'Compiling Java libraries ...' 26 | args = RbConfig::CONFIG['ruby_install_name'], File.expand_path(RUBY_PLATFORM[/java/] ? '_jbuildr' : '_buildr'), '--buildfile', 'buildr.buildfile', 'compile' 27 | args << '--trace' if Rake.application.options.trace 28 | sh *args 29 | end 30 | file Gem::PackageTask.new(spec).package_dir => 'compile' 31 | file Gem::PackageTask.new(spec).package_dir_path => 'compile' 32 | 33 | # We also need the other packages (JRuby if building on Ruby, and vice versa) 34 | # Must call new with block, even if block does nothing, otherwise bad things happen. 35 | @specs.values.each do |s| 36 | Gem::PackageTask.new(s) { |task| } 37 | end 38 | 39 | desc 'Upload snapshot packages over to people.apache.org' 40 | task 'snapshot' => %w(package) do 41 | rm_rf '_snapshot' # Always start with empty directory 42 | puts 'Copying existing gems from Apache' 43 | sh 'rsync', '--progress', '--recursive', 'people.apache.org:public_html/buildr/snapshot/', '_snapshot/' 44 | puts 'Copying new gems over' 45 | cp FileList['pkg/{*.gem,*.tgz,*.zip}'], '_snapshot/gems' 46 | puts 'Generating gem index ...' 47 | sh 'gem', 'generate_index', '--directory', '_snapshot' 48 | puts 'Copying gem and index back to Apache' 49 | sh 'rsync', '--progress', '--recursive', '_snapshot/', 'people.apache.org:public_html/buildr/snapshot/' 50 | end 51 | task('clobber') { rm_rf 'target' } 52 | task('clobber') { rm_rf '_snapshot' } 53 | -------------------------------------------------------------------------------- /spec/core/console_spec.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) 17 | 18 | describe Buildr::Console do 19 | 20 | describe 'console_dimensions' do 21 | 22 | it 'should return a value' do 23 | Buildr::Console.console_dimensions.should_not be_nil 24 | end if $stdout.isatty && !ENV["TRAVIS"] && !Buildr::Util.win_os? 25 | end 26 | 27 | describe 'color' do 28 | 29 | describe 'when use_color is true' do 30 | before do 31 | Buildr::Console.use_color = true 32 | end 33 | 34 | it 'should emit red code when asked' do 35 | Buildr::Console.color('message', :red).should eql("\e[31mmessage\e[0m") 36 | end 37 | 38 | it 'should emit green code when asked' do 39 | Buildr::Console.color('message', :green).should eql("\e[32mmessage\e[0m") 40 | end 41 | 42 | it 'should emit blue code when asked' do 43 | Buildr::Console.color('message', :blue).should eql("\e[34mmessage\e[0m") 44 | end 45 | end if $stdout.isatty && !Buildr::Util.win_os? 46 | 47 | describe ' use_color is false' do 48 | before do 49 | Buildr::Console.use_color = false 50 | end 51 | 52 | it 'should not emit red code when asked' do 53 | Buildr::Console.color('message', :red).should eql("message") 54 | end 55 | 56 | it 'should not emit green code when asked' do 57 | Buildr::Console.color('message', :green).should eql("message") 58 | end 59 | 60 | it 'should not emit blue code when asked' do 61 | Buildr::Console.color('message', :blue).should eql("message") 62 | end 63 | end 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /spec/java/external_spec.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) 18 | 19 | COMPILERS = Buildr::Compiler.compilers.dup 20 | COMPILERS_WITHOUT_JAVAC = COMPILERS.dup 21 | COMPILERS_WITHOUT_JAVAC.delete Buildr::Compiler::Javac 22 | 23 | describe Buildr::Compiler::ExternalJavac do 24 | 25 | before(:all) do 26 | Buildr::Compiler.send :compilers=, COMPILERS_WITHOUT_JAVAC 27 | end 28 | 29 | # Fails sometimes under windows? 30 | describe "should compile a Java project just in the same way javac does", :retry => 4 do 31 | javac_spec = File.read(File.join(File.dirname(__FILE__), "compiler_spec.rb")) 32 | javac_spec = javac_spec.match(Regexp.escape("require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))\n")).post_match 33 | javac_spec.gsub!("javac", "externaljavac") 34 | javac_spec.gsub!("--trace=externaljavac", "--trace=javac") 35 | javac_spec.gsub!("trace_categories = [:externaljavac]", "trace_categories = [:javac]") 36 | eval(javac_spec) 37 | end 38 | 39 | it "should accept a :jvm option as JAVA_HOME" do 40 | write 'src/main/java/Foo.java', 'public class Foo {}' 41 | define "foo" do 42 | compile.using(:externaljavac).options.jvm = "somepath" 43 | end 44 | begin 45 | trace true #We set it true to grab the trace statement with the jvm path in it! 46 | lambda {lambda {project("foo").compile.invoke}.should raise_error(RuntimeError, /Failed to compile, see errors above/)}.should show(/somepath\/bin\/javac .*/) 47 | end 48 | trace false 49 | end 50 | 51 | after :all do 52 | Buildr::Compiler.send :compilers=, COMPILERS 53 | end 54 | 55 | end 56 | -------------------------------------------------------------------------------- /spec/packaging/packaging_helper.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | shared_examples_for 'packaging' do 18 | it 'should create artifact of proper type' do 19 | packaging = @packaging 20 | package_type = @package_type || @packaging 21 | define 'foo', :version=>'1.0' do 22 | package(packaging).type.should eql(package_type) rescue exit! 23 | end 24 | end 25 | 26 | it 'should create file with proper extension' do 27 | packaging = @packaging 28 | package_type = @package_type || @packaging 29 | define 'foo', :version=>'1.0' do 30 | package(packaging).to_s.should match(/.#{package_type}$/) 31 | end 32 | end 33 | 34 | it 'should always return same task for the same package' do 35 | packaging = @packaging 36 | define 'foo', :version=>'1.0' do 37 | package(packaging) 38 | package(packaging, :id=>'other') 39 | end 40 | project('foo').packages.uniq.size.should eql(2) 41 | end 42 | 43 | it 'should complain if option not known' do 44 | packaging = @packaging 45 | define 'foo', :version=>'1.0' do 46 | lambda { package(packaging, :unknown_option=>true) }.should raise_error(ArgumentError, /no such option/) 47 | end 48 | end 49 | 50 | it 'should respond to with() and return self' do 51 | packaging = @packaging 52 | define 'foo', :version=>'1.0' do 53 | package(packaging).with({}).should be(package(packaging)) 54 | end 55 | end 56 | 57 | it 'should respond to with() and complain if unknown option' do 58 | packaging = @packaging 59 | define 'foo', :version=>'1.0' do 60 | lambda { package(packaging).with(:unknown_option=>true) }.should raise_error(ArgumentError, /does not support the option/) 61 | end 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /spec/groovy/doc_spec.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) 18 | 19 | describe "Groovydoc" do 20 | 21 | it 'should pick :windowtitle from project name by default' do 22 | define 'foo' do 23 | doc.using :groovydoc 24 | 25 | define 'bar' do 26 | doc.using :groovydoc 27 | end 28 | end 29 | 30 | project('foo').doc.options[:windowtitle].should eql('foo') 31 | project('foo:bar').doc.options[:windowtitle].should eql('foo:bar') 32 | end 33 | 34 | it 'should pick :windowtitle from project description by default, if available' do 35 | desc 'My App' 36 | define 'foo' do 37 | doc.using :groovydoc 38 | end 39 | project('foo').doc.options[:windowtitle].should eql('My App') 40 | end 41 | 42 | it 'should not override explicit :windowtitle option' do 43 | define 'foo' do 44 | doc.using :groovydoc 45 | doc.using :windowtitle => 'explicit' 46 | end 47 | project('foo').doc.options[:windowtitle].should eql('explicit') 48 | end 49 | 50 | it 'should identify itself from groovy source directories' do 51 | write 'src/main/groovy/some/A.java', 'package some; public class A {}' 52 | write 'src/main/groovy/some/B.groovy', 'package some; public class B {}' 53 | define('foo') do 54 | doc.engine.should be_a(Buildr::Doc::Groovydoc) 55 | end 56 | end 57 | 58 | it 'should produce Groovydocs' do 59 | write 'src/main/groovy/some/A.java', 'package some; public class A {}' 60 | write 'src/main/groovy/some/B.groovy', 'package some; public class B {}' 61 | define('foo') 62 | project('foo').doc.invoke 63 | file('target/doc/index.html').should exist 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /addon/buildr/antlr.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr 17 | # Provides ANTLR grammar generation tasks. Require explicitly using require "buildr/antlr". 18 | module ANTLR 19 | REQUIRES = [ "org.antlr:antlr:jar:3.0", "antlr:antlr:jar:2.7.7", "org.antlr:stringtemplate:jar:3.0" ] 20 | 21 | Java.classpath << REQUIRES 22 | 23 | class << self 24 | def antlr(*args) 25 | options = Hash === args.last ? args.pop : {} 26 | rake_check_options options, :output, :token 27 | 28 | args = args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "/**/*.g"] : f }.flatten 29 | args = ["-o", options[:output]] + args if options[:output] 30 | if options[:token] 31 | # antlr expects the token directory to exist when it starts 32 | mkdir_p options[:token] 33 | args = ["-lib", options[:token]] + args 34 | end 35 | Java.load 36 | #Java.org.antlr.Tool.new_with_sig("[Ljava.lang.String;", args).process 37 | Java.org.antlr.Tool.new(args.to_java(Java.java.lang.String)).process 38 | end 39 | end 40 | 41 | def antlr(*args) 42 | if Hash === args.last 43 | options = args.pop 44 | in_package = options[:in_package].split(".") 45 | token = options[:token].split(".") if options[:token] 46 | else 47 | in_package = []; token = nil 48 | end 49 | file(path_to(:target, :generated, :antlr)=>args.flatten) do |task| 50 | args = {:output=>File.join(task.name, in_package)} 51 | args.merge!({:token=>File.join(task.name, token)}) if token 52 | ANTLR.antlr task.prerequisites, args 53 | end 54 | end 55 | 56 | end 57 | 58 | class Project 59 | include ANTLR 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /rakelib/rspec.rake: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | require 'rspec/core/rake_task' 17 | directory '_reports' 18 | 19 | def default_spec_opts 20 | default = %w{--order random:123 --format documentation --out _reports/specs.txt --backtrace} 21 | default << '--colour' if $stdout.isatty && !(RbConfig::CONFIG['host_os'] =~ /mswin|win32|dos/i) 22 | default 23 | end 24 | 25 | # RSpec doesn't support file exclusion, so hack our own. 26 | class RSpec::Core::RakeTask 27 | attr_accessor :rspec_files 28 | private 29 | def files_to_run 30 | @rspec_files 31 | end 32 | end 33 | 34 | desc 'Run all specs' 35 | RSpec::Core::RakeTask.new :spec => ['_reports', :compile] do |task| 36 | ENV['USE_FSC'] = 'no' 37 | files = FileList['spec/**/*_spec.rb'] 38 | files = files.delete_if {|f| f =~ /^spec\/groovy\//} if RUBY_PLATFORM[/java/] 39 | task.rspec_files = files 40 | task.rspec_opts = %w{--order random:123 --format html --out _reports/specs.html --backtrace} 41 | end 42 | file('_reports/specs.html') { task(:spec).invoke } 43 | 44 | task :load_ci_reporter do 45 | gem 'ci_reporter' 46 | ENV['CI_REPORTS'] = '_reports/ci' 47 | # CI_Reporter does not quote the path to rspec_loader which causes problems when ruby is installed in C:/Program Files. 48 | # However, newer versions of rspec don't like double quotes escaping as well, so removing them for now. 49 | ci_rep_path = Gem.loaded_specs['ci_reporter'].full_gem_path 50 | ENV['SPEC_OPTS'] = [ENV['SPEC_OPTS'], default_spec_opts, '--require', "#{ci_rep_path}/lib/ci/reporter/rake/rspec_loader.rb", '--format', 'CI::Reporter::RSpec'].join(" ") 51 | end 52 | 53 | desc 'Run all specs with CI reporter' 54 | task 'ci' => %w(clobber load_ci_reporter spec) 55 | 56 | task 'clobber' do 57 | rm_f 'failed' 58 | rm_rf '_reports' 59 | rm_rf 'tmp' 60 | end 61 | -------------------------------------------------------------------------------- /lib/buildr/core/osx.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | # Let's see if we can use Growl. Must be running from console in verbose mode. 17 | if $stdout.isatty && verbose 18 | def growl_notify(type, title, message) 19 | begin 20 | # Loading Ruby Cocoa can slow the build down (hooks on Object class), so we're 21 | # saving the best for last and only requiring it at the very end. 22 | require 'osx/cocoa' 23 | icon = OSX::NSApplication.sharedApplication.applicationIconImage 24 | icon = OSX::NSImage.alloc.initWithContentsOfFile(File.join(File.dirname(__FILE__), '../resources/buildr.icns')) 25 | 26 | # Register with Growl, that way you can turn notifications on/off from system preferences. 27 | OSX::NSDistributedNotificationCenter.defaultCenter. 28 | postNotificationName_object_userInfo_deliverImmediately(:GrowlApplicationRegistrationNotification, nil, 29 | { :ApplicationName=>'Buildr', :AllNotifications=>['Completed', 'Failed'], 30 | :ApplicationIcon=>icon.TIFFRepresentation }, true) 31 | 32 | OSX::NSDistributedNotificationCenter.defaultCenter. 33 | postNotificationName_object_userInfo_deliverImmediately(:GrowlNotification, nil, 34 | { :ApplicationName=>'Buildr', :NotificationName=>type, 35 | :NotificationTitle=>title, :NotificationDescription=>message }, true) 36 | rescue Exception 37 | # We get here in two cases: system doesn't have Growl installed so one of the OSX 38 | # calls raises an exception; system doesn't have osx/cocoa, e.g. MacPorts Ruby 1.9, 39 | # so we also need to rescue LoadError. 40 | end 41 | end 42 | 43 | Buildr.application.on_completion { |title, message| growl_notify('Completed', title, message) if verbose } 44 | Buildr.application.on_failure { |title, message, ex| growl_notify('Failed', title, message) if verbose } 45 | end 46 | -------------------------------------------------------------------------------- /lib/buildr/packaging/gems.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | Gem.autoload :Package, 'rubygems/package' 17 | 18 | module Buildr #:nodoc: 19 | 20 | class PackageGemTask < ArchiveTask 21 | 22 | def initialize(*args) 23 | super 24 | @spec = Gem::Specification.new 25 | end 26 | 27 | def spec 28 | yield @spec if block_given? 29 | @spec 30 | end 31 | 32 | def upload 33 | end 34 | 35 | private 36 | 37 | def create_from(file_map) 38 | spec.mark_version 39 | spec.validate 40 | 41 | File.open(name, 'wb') do |io| 42 | Gem::Package.open(io, 'w', nil) do |pkg| 43 | pkg.metadata = spec.to_yaml 44 | file_map.each do |path, content| 45 | next if content.nil? || File.directory?(content.to_s) 46 | pkg.add_file_simple(path, File.stat(content.to_s).mode & 0777, File.size(content.to_s)) do |os| 47 | File.open(content.to_s, "rb") do |file| 48 | os.write file.read(4096) until file.eof? 49 | end 50 | end 51 | end 52 | end 53 | end 54 | end 55 | end 56 | 57 | module PackageAsGem #:nodoc: 58 | 59 | def package_as_gem(file_name) #:nodoc: 60 | PackageGemTask.define_task(file_name).tap do |gem| 61 | %w{ lib test doc }.each do |dir| 62 | gem.include :from=>_(dir), :path=>dir if File.directory?(_(dir)) 63 | end 64 | gem.spec do |spec| 65 | spec.name = id 66 | spec.version = version.gsub('-','.') # RubyGems doesn't like '-' in version numbers 67 | spec.summary = full_comment 68 | spec.has_rdoc = true 69 | spec.rdoc_options << '--title' << comment 70 | spec.require_path = 'lib' 71 | end 72 | end 73 | end 74 | end 75 | 76 | class Project 77 | include PackageAsGem 78 | end 79 | end 80 | -------------------------------------------------------------------------------- /addon/buildr/jaxb_xjc.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr 17 | module JaxbXjc 18 | class << self 19 | 20 | def jaxb_version 21 | "2.2.1" 22 | end 23 | 24 | # The specs for requirements 25 | def dependencies 26 | [ 27 | "javax.xml.bind:jaxb-api:jar:#{jaxb_version}", 28 | "com.sun.xml.bind:jaxb-impl:jar:#{jaxb_version}", 29 | "com.sun.xml.bind:jaxb-xjc:jar:#{jaxb_version}" 30 | ] 31 | end 32 | 33 | # Repositories containing the requirements 34 | def remote_repository 35 | "http://download.java.net/maven/2" 36 | end 37 | 38 | def xjc(*args) 39 | cp = Buildr.artifacts(self.dependencies).each(&:invoke).map(&:to_s) 40 | Java::Commands.java 'com.sun.tools.xjc.XJCFacade', *(args + [{ :classpath => cp }]) 41 | end 42 | end 43 | 44 | def compile_jaxb(files, *args) 45 | options = Hash === args.last ? args.pop.dup : {} 46 | rake_check_options options, :directory, :keep_content, :package, :id 47 | args = args.dup 48 | files = Array === files ? files.flatten : [files] 49 | 50 | target_dir = File.expand_path(options[:directory] || _(:target, :generated, :jaxb, 'main/java')) 51 | timestamp_file = File.expand_path("#{target_dir}/jaxb-#{options[:id] || 1}.cache") 52 | 53 | project.iml.main_source_directories << target_dir if project.iml? 54 | 55 | file(target_dir => timestamp_file) 56 | 57 | file(timestamp_file => files.flatten) do |task| 58 | rm_rf target_dir unless options[:keep_content] 59 | mkdir_p target_dir 60 | args << "-d" << target_dir 61 | args << "-p" << options[:package] if options[:package] 62 | args += files.collect{|f| f.to_s} 63 | JaxbXjc.xjc args 64 | touch timestamp_file 65 | end 66 | 67 | target_dir 68 | end 69 | end 70 | end 71 | 72 | class Buildr::Project 73 | include Buildr::JaxbXjc 74 | end 75 | -------------------------------------------------------------------------------- /tests/integration_testing.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | TEST_DIR = File.dirname(File.expand_path(__FILE__)) 17 | BUILDR = ENV['BUILDR'] || File.expand_path("#{TEST_DIR}/../_buildr") 18 | 19 | require 'test/unit' 20 | require 'zip/zip' 21 | 22 | module Buildr 23 | module IntegrationTests 24 | 25 | def self.test(folder, cmd, after_block = nil) 26 | 27 | eval <<-TEST 28 | class #{folder.sub("-", "").capitalize} < Test::Unit::TestCase 29 | 30 | def test_#{folder.sub("-", "")} 31 | begin 32 | result = `cd #{TEST_DIR}/#{folder} ; #{BUILDR} #{cmd}` 33 | assert($?.success?, 'Command success?') 34 | #{ after_block || "" } 35 | ensure 36 | %x[cd #{TEST_DIR}/#{folder} ; #{BUILDR} clean] 37 | end 38 | 39 | end 40 | 41 | end 42 | TEST 43 | 44 | end 45 | 46 | #BUILDR-320 still not resolved. 47 | #test "BUILDR-320", "--trace -P" 48 | 49 | test "JavaSystemProperty", "test" 50 | 51 | test "helloWorld", "package" 52 | 53 | test "compile_with_parent", "compile" 54 | 55 | test "junit3", "test" 56 | 57 | test "include_path", "package", <<-CHECK 58 | path = File.expand_path("#{TEST_DIR}/include_path/target/proj-1.0.zip") 59 | assert(File.exist?(path), "File exists?") 60 | Zip::ZipFile.open(path) {|zip| 61 | assert(!zip.get_entry("distrib/doc/index.html").nil?) 62 | assert(!zip.get_entry("distrib/lib/slf4j-api-1.6.1.jar").nil?) 63 | } 64 | CHECK 65 | 66 | test "include_as", "package", <<-CHECK 67 | path = File.expand_path("#{TEST_DIR}/include_as/target/proj-1.0.zip") 68 | assert(File.exist? path) 69 | Zip::ZipFile.open(path) {|zip| 70 | assert(!zip.get_entry("docu/index.html").nil?) 71 | assert(!zip.get_entry("lib/logging.jar").nil?) 72 | } 73 | CHECK 74 | 75 | test "package_war_as_jar", "package", <<-CHECK 76 | assert(File.exist? "#{TEST_DIR}/package_war_as_jar/target/webapp-1.0.jar") 77 | %x[cd #{TEST_DIR}/package_war_as_jar ; #{BUILDR} clean] 78 | assert($?.success?) 79 | CHECK 80 | 81 | end 82 | end 83 | -------------------------------------------------------------------------------- /spec/groovy/bdd_spec.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) 17 | 18 | 19 | describe Buildr::Groovy::EasyB do 20 | 21 | def foo(*args, &prc) 22 | define('foo', *args) do 23 | test.using :easyb 24 | if prc 25 | instance_eval(&prc) 26 | else 27 | self 28 | end 29 | end 30 | end 31 | 32 | it 'should apply to a project having EasyB sources' do 33 | define('one', :base_dir => 'one') do 34 | write _('src/spec/groovy/SomeSpecification.groovy'), 'true;' 35 | Buildr::Groovy::EasyB.applies_to?(self).should be_true 36 | end 37 | define('two', :base_dir => 'two') do 38 | write _('src/test/groovy/SomeSpecification.groovy'), 'true;' 39 | Buildr::Groovy::EasyB.applies_to?(self).should be_false 40 | end 41 | define('three', :base_dir => 'three') do 42 | write _('src/spec/groovy/SomeStory.groovy'), 'true;' 43 | Buildr::Groovy::EasyB.applies_to?(self).should be_true 44 | end 45 | define('four', :base_dir => 'four') do 46 | write _('src/test/groovy/SomeStory.groovy'), 'true;' 47 | Buildr::Groovy::EasyB.applies_to?(self).should be_false 48 | end 49 | end 50 | 51 | it 'should be selected by :easyb name' do 52 | foo { test.framework.should eql(:easyb) } 53 | end 54 | 55 | it 'should select a java compiler if java sources are found' do 56 | foo do 57 | write _('src/spec/java/SomeSpecification.java'), 'public class SomeSpecification {}' 58 | test.compile.language.should eql(:java) 59 | end 60 | end 61 | 62 | it 'should include src/spec/groovy/*Specification.groovy' do 63 | foo do 64 | spec = _('src/spec/groovy/SomeSpecification.groovy') 65 | write spec, 'true' 66 | test.invoke 67 | test.tests.should include(spec) 68 | end 69 | end 70 | 71 | it 'should include src/spec/groovy/*Story.groovy' do 72 | foo do 73 | spec = _('src/spec/groovy/SomeStory.groovy') 74 | write spec, 'true' 75 | test.invoke 76 | test.tests.should include(spec) 77 | end 78 | end 79 | 80 | end # EasyB 81 | -------------------------------------------------------------------------------- /doc/scripts/install-linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with this 4 | # work for additional information regarding copyright ownership. The ASF 5 | # licenses this file to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | # License for the specific language governing permissions and limitations under 15 | # the License. 16 | if [ -z `which ruby` ] ; then 17 | echo "You do not have Ruby 1.8.6 ..." 18 | # yum comes first since some people have apt-get installed in addition to yum. 19 | # urpmi is added in case of mandriva : apt-get or yum are working for mandriva too 20 | if [ `which yum` ] ; then 21 | echo "Installing Ruby using yum" 22 | sudo yum install ruby rubygems ruby-devel gcc 23 | elif [ `which apt-get` ] ; then 24 | echo "Installing Ruby using apt-get" 25 | # ruby package does not contain RDoc, IRB, etc; ruby-full is a meta-package. 26 | # build-essentials not installed by default in Ubuntu, required for C extensions. 27 | sudo apt-get install ruby-full ruby1.8-dev libopenssl-ruby build-essential 28 | # RubyGems broken on Ubuntu, installing directly from source. 29 | echo "Installing RubyGems from RubyForge" 30 | wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz 31 | tar xzf rubygems-1.3.7.tgz 32 | cd rubygems-1.3.7 33 | sudo ruby setup.rb 34 | cd .. 35 | rm -rf rubygems-1.3.7 36 | # ruby is same as ruby1.8, we need gem that is same as gem1.8 37 | sudo ln -s /usr/bin/gem1.8 /usr/bin/gem 38 | elif [ `which urpmi` ] ; then 39 | echo "Installing Ruby using urpmi" 40 | sudo urpmi ruby rubygems ruby-devel gcc 41 | if [ $? -ne 0 ] ; then 42 | echo "URPMI install error" 43 | exit 1 44 | fi 45 | else 46 | echo "Can only install Ruby 1.8.6 using apt-get, yum or urpmi, and can't find any of them" 47 | exit 1 48 | fi 49 | echo 50 | fi 51 | 52 | if [ -z $JAVA_HOME ] ; then 53 | echo "Please set JAVA_HOME before proceeding" 54 | exit 1 55 | fi 56 | 57 | if [ $(gem --version) \< '1.3.7' ] ; then 58 | echo "Upgrading to latest version of RubyGems" 59 | sudo gem update --system 60 | sudo update_rubygems 61 | echo 62 | fi 63 | 64 | if [ `which buildr` ] ; then 65 | echo "Updating to the latest version of Buildr" 66 | sudo env JAVA_HOME=$JAVA_HOME gem update buildr 67 | else 68 | echo "Installing the latest version of Buildr" 69 | sudo env JAVA_HOME=$JAVA_HOME gem install buildr 70 | fi 71 | echo 72 | 73 | buildr --version 74 | -------------------------------------------------------------------------------- /spec/java/run_spec.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) 18 | 19 | 20 | describe Run::JavaRunner do 21 | 22 | it 'should fail on error' do 23 | define 'foo' do 24 | run.using :java, :main => 'org.example.NonExistentMain' # class doesn't exist 25 | end 26 | lambda { project('foo').run.invoke }.should raise_error(RuntimeError, /Failed to execute java/) 27 | end 28 | 29 | it 'should execute main class' do 30 | write 'src/main/java/org/example/Main.java', <<-JAVA 31 | package org.example; 32 | public class Main { 33 | public static void main(String[] args) { 34 | System.out.println("Hello, world!"); 35 | } 36 | } 37 | JAVA 38 | define 'foo' do 39 | run.using :main => 'org.example.Main' 40 | end 41 | project('foo').run.prerequisites.should include(task("foo:compile")) 42 | end 43 | 44 | it 'should accept :main option as an array including parameters for the main class' do 45 | define 'foo' do 46 | run.using :java, :main => ['org.example.Main', '-t', 'input.txt'] 47 | end 48 | Java::Commands.should_receive(:java).once.with do |*args| 49 | args[0].should == ['org.example.Main', '-t', 'input.txt'] 50 | end 51 | project('foo').run.invoke 52 | end 53 | 54 | it 'should accept :java_args and pass them to java' do 55 | define 'foo' do 56 | run.using :java, :main => 'foo', :java_args => ['-server'] 57 | end 58 | Java::Commands.should_receive(:java).once.with do |*args| 59 | args[0].should == 'foo' 60 | args[1][:java_args].should include('-server') 61 | end 62 | project('foo').run.invoke 63 | end 64 | 65 | it 'should accept :properties and pass them as -Dproperty=value to java' do 66 | define 'foo' do 67 | run.using :java, :main => 'foo', :properties => { :foo => 'one', :bar => 'two' } 68 | end 69 | Java::Commands.should_receive(:java).once.with do |*args| 70 | args[0].should == 'foo' 71 | args[1][:properties][:foo].should == 'one' 72 | args[1][:properties][:bar].should == 'two' 73 | end 74 | project('foo').run.invoke 75 | end 76 | 77 | end 78 | -------------------------------------------------------------------------------- /addon/buildr/package_as_nsis.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr 17 | module PackageAsNsis 18 | include Extension 19 | 20 | class NSISTask < Rake::FileTask 21 | attr_accessor :nsi 22 | attr_accessor :values 23 | attr_accessor :nsis_executable 24 | attr_accessor :nsis_major_version 25 | 26 | def initialize(*args) #:nodoc: 27 | self.nsis_executable = "makensis" 28 | self.nsis_major_version = 3 29 | self.values = {} 30 | 31 | super(*args) 32 | 33 | enhance do 34 | info "Calling makensis" 35 | # We make available one variable to the nsi script: 36 | # Use it like this: OutFile "${OUTPUT}" 37 | values = self.values.merge("OUTPUT" => to_s) 38 | 39 | log_level_param = (self.nsis_major_version == 2 ? "/" : "-") + (verbose ? "V2" : "V0") 40 | define_prefix = (self.nsis_major_version == 2) ? "/D" : "-D" 41 | 42 | command = "#{self.nsis_executable} #{log_level_param} #{values.inject([]) { |array, (key, value)| array << "#{define_prefix}#{key}=#{value}"; array }.join(" ")} #{self.nsi}" 43 | trace command 44 | system(command) or fail "Error while executing makeNSIS" 45 | end 46 | end 47 | 48 | # :call-seq: 49 | # with(options) => self 50 | # 51 | # Passes options to the task and returns self. Some tasks support additional options, for example, 52 | # the WarTask supports options like :manifest, :libs and :classes. 53 | # 54 | # For example: 55 | # package(:jar).with(:manifest=>'MANIFEST_MF') 56 | def with(options) 57 | options.each do |key, value| 58 | begin 59 | send "#{key}=", value 60 | rescue NoMethodError 61 | raise ArgumentError, "#{self.class.name} does not support the option #{key}" 62 | end 63 | end 64 | self 65 | end 66 | end 67 | 68 | def package_as_nsis(file_name) 69 | NSISTask.define_task(file_name) 70 | end 71 | 72 | def package_as_nsis_spec(spec) 73 | spec.merge(:type=>:exe) 74 | end 75 | end 76 | end 77 | 78 | class Buildr::Project 79 | include Buildr::PackageAsNsis 80 | end 81 | -------------------------------------------------------------------------------- /addon/buildr/protobuf.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr 17 | 18 | # Provides Protocol buffer code generation tasks. 19 | # 20 | # Require explicitly using require "buildr/protobuf". 21 | # 22 | # Usage in your project: 23 | # 24 | # protoc _("path/to/proto/files") 25 | # 26 | # and also supports two options, 27 | # 28 | # :output => "target/generated/protoc" # this is the default 29 | # :lang => "java" # defaults to compile.language 30 | # 31 | module Protobuf 32 | class << self 33 | def protoc(*args) 34 | options = Hash === args.last ? args.pop : {} 35 | rake_check_options options, :output, :lang, :include 36 | 37 | options[:lang] ||= :java 38 | options[:output] ||= File.expand_path "target/generated/protoc" 39 | options[:include] ||= [] 40 | 41 | command_line = [] 42 | 43 | command_line << "--#{options[:lang]}_out=#{options[:output]}" if options[:output] 44 | 45 | (paths_from_sources(*args) + options[:include]).each { |i| command_line << "-I#{i}" } 46 | 47 | command_line += files_from_sources(*args) 48 | 49 | mkdir_p( options[:output] ) 50 | 51 | system protoc_path, *command_line 52 | end 53 | 54 | def protoc_path 55 | ENV['PROTOC'] || "protoc" 56 | end 57 | 58 | def files_from_sources(*args) 59 | args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "/**/*.proto"] : f }.flatten 60 | end 61 | 62 | def paths_from_sources(*args) 63 | args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? f : File.dirname(f) } 64 | end 65 | end 66 | 67 | def protoc(*args) 68 | if Hash === args.last 69 | options = args.pop 70 | else 71 | options = {} 72 | end 73 | 74 | options[:output] ||= path_to(:target, :generated, :protoc) 75 | options[:lang] ||= compile.language if compile.language 76 | 77 | file(options[:output]=>Protobuf.files_from_sources(*args)) do |task| 78 | Protobuf.protoc task.prerequisites, options 79 | end 80 | end 81 | 82 | end 83 | 84 | class Project 85 | include Protobuf 86 | end 87 | end 88 | -------------------------------------------------------------------------------- /lib/buildr/core/assets.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | 18 | module Assets #:nodoc: 19 | 20 | # The base assets task that is responsible for 21 | # collecting all of the assets into a single output 22 | # directory 23 | class AssetsTask < Rake::FileTask 24 | attr_reader :project 25 | 26 | def project=(project) 27 | @project = project 28 | end 29 | 30 | # The list of input paths to add to output directory 31 | def paths 32 | unless @paths 33 | @paths = [] 34 | @paths << project._(:source, :main, :assets) if File.exist?(project._(:source, :main, :assets)) 35 | end 36 | @paths 37 | end 38 | 39 | protected 40 | 41 | def initialize(*args) #:nodoc: 42 | super 43 | enhance do 44 | paths = self.paths.flatten.compact 45 | if paths.size > 0 46 | mkdir_p name 47 | paths.collect do |a| 48 | a.is_a?(String) ? project.file(a) : a 49 | end.each do |a| 50 | a.invoke if a.respond_to?(:invoke) 51 | end.each do |asset| 52 | cp_r Dir["#{asset}/*"], "#{name}/" 53 | end 54 | end 55 | end 56 | end 57 | 58 | private 59 | 60 | def out_of_date?(stamp) 61 | super || 62 | self.paths.any? { |n| n.respond_to?(:needed?) && n.needed? } 63 | end 64 | 65 | end 66 | 67 | module ProjectExtension 68 | include Extension 69 | 70 | first_time do 71 | desc "Prepare the assets" 72 | Project.local_task("assets") 73 | end 74 | 75 | before_define do |project| 76 | # Force the construction of the assets task 77 | project.assets.paths 78 | end 79 | 80 | # Access the asset task 81 | def assets 82 | if @assets.nil? 83 | @assets = AssetsTask.define_task(project._(:target, :main, :assets) => []) 84 | @assets.project = self 85 | project.task('assets').enhance([@assets]) 86 | project.build.enhance([@assets]) 87 | end 88 | @assets 89 | end 90 | end 91 | end 92 | end 93 | 94 | class Buildr::Project #:nodoc: 95 | include ::Buildr::Assets::ProjectExtension 96 | end 97 | -------------------------------------------------------------------------------- /addon/buildr/single_intermediate_layout.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #nodoc 17 | class Project #nodoc 18 | class << self 19 | 20 | alias :original_define :define 21 | 22 | # Monkey patch the built-in define so that there is a single root directory for 23 | # all of the generated artifacts within a project hierarchy. 24 | # 25 | def define(name, properties = nil, &block) #:yields:project 26 | 27 | properties = properties.nil? ? {} : properties.dup 28 | 29 | parent_name = name.split(':')[0...-1] 30 | parent = parent_name.empty? ? nil : Buildr.application.lookup(parent_name.join(':')) 31 | 32 | # Follow the same algorithm as in project code 33 | if properties[:base_dir] 34 | base_dir = properties[:base_dir] 35 | elsif parent 36 | base_dir = File.expand_path(name.split(':').last, parent.base_dir) 37 | else 38 | base_dir = Dir.pwd 39 | end 40 | 41 | # The top directory is the base directory of the root project 42 | top_dir = base_dir 43 | while parent 44 | top_dir = parent.base_dir 45 | parent = parent.parent 46 | end 47 | 48 | target_dir = "#{top_dir}/target/#{name.gsub(':', '_')}" 49 | reports_dir = "#{top_dir}/reports/#{name.gsub(':', '_')}" 50 | target_dir = ::Buildr::Util.relative_path(target_dir, File.expand_path(base_dir)) 51 | reports_dir = ::Buildr::Util.relative_path(reports_dir, File.expand_path(base_dir)) 52 | 53 | properties[:layout] = Buildr::Layout::Default.new unless properties[:layout] 54 | properties[:layout][:target] = target_dir 55 | properties[:layout][:reports] = reports_dir 56 | properties[:layout][:target, :main] = target_dir 57 | 58 | Project.original_define(name, properties) do 59 | project.instance_eval &block 60 | if top_dir == base_dir && project.iml? 61 | project.iml.excluded_directories << "#{base_dir}/target" 62 | project.iml.excluded_directories << "#{base_dir}/reports" 63 | clean { rm_rf "#{base_dir}/target" } 64 | clean { rm_rf "#{base_dir}/reports" } 65 | end 66 | project 67 | end 68 | end 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /lib/buildr/groovy/doc.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | module Doc #:nodoc: 18 | 19 | module GroovydocDefaults #:nodoc: 20 | include Extension 21 | 22 | # Default groovydoc -doc-title to project's comment or name 23 | after_define(:groovydoc => :doc) do |project| 24 | if project.doc.engine? Groovydoc 25 | options = project.doc.options 26 | options[:windowtitle] = (project.comment || project.name) unless options[:windowtitle] 27 | end 28 | end 29 | end 30 | 31 | class Groovydoc < Base 32 | specify :language => :groovy, :source_ext => ['java', 'groovy'] 33 | 34 | def generate(sources, target, options = {}) 35 | mkdir_p target 36 | cmd_args = [ '-d', target, trace?(:groovydoc) ? '-verbose' : nil ].compact 37 | options.reject { |key, value| [:sourcepath, :classpath].include?(key) }. 38 | each { |key, value| value.invoke if value.respond_to?(:invoke) }. 39 | each do |key, value| 40 | case value 41 | when true, nil 42 | cmd_args << "-#{key}" 43 | when false 44 | cmd_args << "-no#{key}" 45 | when Hash 46 | value.each { |k,v| cmd_args << "-#{key}" << k.to_s << v.to_s } 47 | else 48 | cmd_args += Array(value).map { |item| ["-#{key}", item.to_s] }.flatten 49 | end 50 | end 51 | [:sourcepath, :classpath].each do |option| 52 | Array(options[option]).flatten.tap do |paths| 53 | cmd_args << "-#{option}" << paths.flatten.map(&:to_s).join(File::PATH_SEPARATOR) unless paths.empty? 54 | end 55 | end 56 | cmd_args += sources.flatten.uniq 57 | unless Buildr.application.options.dryrun 58 | info "Generating Groovydoc for #{project.name}" 59 | trace (['groovydoc'] + cmd_args).join(' ') 60 | result = Java::Commands.java('org.codehaus.groovy.tools.groovydoc.Main', cmd_args, 61 | :classpath => Buildr::Groovy.dependencies) 62 | end 63 | end 64 | end 65 | end 66 | 67 | class Project #:nodoc: 68 | include GroovydocDefaults 69 | end 70 | end 71 | 72 | Buildr::Doc.engines << Buildr::Doc::Groovydoc 73 | -------------------------------------------------------------------------------- /doc/css/print.css: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with this 3 | * work for additional information regarding copyright ownership. The ASF 4 | * licenses this file to you under the Apache License, Version 2.0 (the 5 | * "License"); you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | 18 | @media print { 19 | @page { size: letter; } 20 | @page:first { 21 | @top-left { content: normal } 22 | @top-right { content: normal } 23 | } 24 | @page:right { 25 | margin: 1.25in 1in 1.5in 1.5in; 26 | font: normal 10pt "Gill Sans" !important; 27 | @top-left { content: string(pagetitle); } 28 | @top-right { content: counter(page); } 29 | } 30 | @page:left { 31 | margin: 1.25in 1.5in 1.5in 1in; 32 | font: normal 10pt "Gill Sans" !important; 33 | @top-left { content: counter(page); } 34 | @top-right { content: string(pagetitle); } 35 | } 36 | 37 | title { string-set: doctitle content(); } 38 | 39 | body { 40 | font-family: "Palatino"; 41 | margin: 0; 42 | color: black; 43 | background: white; 44 | font-size: 11pt; 45 | } 46 | 47 | h1 { 48 | string-set: pagetitle content(); 49 | page-break-before: always; 50 | } 51 | h1:first-child { page-break-before: avoid; } 52 | h1, h2, h3 { 53 | font-family: "Gill Sans"; 54 | } 55 | pre, p, blockquote { page-break-inside: avoid; } 56 | pre, code { 57 | font-family: "Monaco", "DejaVu Sans Mono", "Courier New", "Courier"; 58 | font-size: 9pt; 59 | } 60 | pre br { 61 | display: none; 62 | } 63 | a:link, a:visited { 64 | background: transparent; 65 | text-decoration: none; 66 | } 67 | 68 | 69 | #header, #pages, #footer { display: none } 70 | #wrap, #content { 71 | float: none !important; 72 | color: black; 73 | background: transparent; 74 | width: auto !important; 75 | margin: 0; 76 | padding: 0; 77 | border: 0; 78 | } 79 | 80 | ol.toc a:link, ol.toc a:visited { text-decoration: none; } 81 | ol.toc a:after { content: leader('.') target-counter(attr(href), page); } 82 | 83 | .title { 84 | page-break-before: always; 85 | border: none; 86 | } 87 | .title img { 88 | display: block; 89 | width: 80%; 90 | margin: 2em auto 4em auto; 91 | } 92 | p.preface { 93 | page-break-before: always; 94 | padding-top: 1.5in; 95 | } 96 | div.preface.quotes { 97 | page-break-before: always; 98 | padding-top: 1in; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /lib/buildr/java/ecj.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | module Compiler #:nodoc: 18 | 19 | class Ecj < Javac 20 | 21 | OPTIONS = Buildr::Compiler::Javac::OPTIONS 22 | 23 | specify :language=>:java, :sources => 'java', :source_ext => 'java', 24 | :target=>'classes', :target_ext=>'class', :packaging=>:jar 25 | 26 | def compile(sources, target, dependencies) #:nodoc: 27 | check_options options, OPTIONS 28 | cmd_args = [] 29 | # tools.jar contains the Java compiler. 30 | dependencies << Java.tools_jar if Java.tools_jar 31 | cmd_args << '-classpath' << ('"' + dependencies.join(File::PATH_SEPARATOR) + '"') unless dependencies.empty? 32 | source_paths = sources.select { |source| File.directory?(source) } 33 | cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty? 34 | cmd_args << '-d' << File.expand_path(target) 35 | cmd_args += ecj_args 36 | cmd_args += files_from_sources(sources) 37 | unless Buildr.application.options.dryrun 38 | trace((%w[javac -classpath org.eclipse.jdt.internal.compiler.batch.Main] + cmd_args).join(' ')) 39 | Java.load 40 | Java.org.eclipse.jdt.internal.compiler.batch.Main.compile(cmd_args.join(" ")) or 41 | fail 'Failed to compile, see errors above' 42 | end 43 | end 44 | 45 | private 46 | 47 | # See arg list here: http://publib.boulder.ibm.com/infocenter/rsahelp/v7r0m0/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm 48 | def ecj_args #:nodoc: 49 | args = [] 50 | args << '-warn:none' unless options[:warnings] 51 | args << '-verbose' if trace?(:ecj) 52 | args << '-g' if options[:debug] 53 | args << '-deprecation' if options[:deprecation] 54 | args << '-source' << options[:source].to_s if options[:source] 55 | args << '-target' << options[:target].to_s if options[:target] 56 | case options[:lint] 57 | when Array then args << "-Xlint:#{options[:lint].join(',')}" 58 | when String then args << "-Xlint:#{options[:lint]}" 59 | when true then args << '-Xlint' 60 | end 61 | args + Array(options[:other]) 62 | end 63 | end 64 | end 65 | end 66 | 67 | Java.classpath << "org.eclipse.jdt.core.compiler:ecj:jar:3.5.1" 68 | # Adding ecj before javac 69 | Buildr::Compiler.compilers.unshift Buildr::Compiler::Ecj 70 | -------------------------------------------------------------------------------- /addon/buildr/gpg.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr 17 | 18 | # Signs the packages using gpg and uploads signatures as part of the upload process. 19 | # 20 | # Require explicitly using require "buildr/apg". This will result in all 21 | # packages being signed. The user must specify the GPG_USER environment key to identify 22 | # the key to use and may specify GPG_PASS if the key needs a password to access. e.g. 23 | # 24 | # $ GPG_USER=user@example.com GPG_PASSWD=secret buildr clean upload 25 | # 26 | module GPG 27 | class << self 28 | 29 | def sign_task(pkg) 30 | raise "ENV['GPG_USER'] not specified" unless ENV['GPG_USER'] 31 | asc_filename = pkg.to_s + '.asc' 32 | return if file(asc_filename).prerequisites.include?(pkg.to_s) 33 | file(asc_filename => [pkg.to_s]) do 34 | info "GPG signing #{pkg.to_spec}" 35 | 36 | cmd = [] 37 | cmd << 'gpg' 38 | cmd << '--local-user' 39 | cmd << ENV['GPG_USER'] 40 | cmd << '--armor' 41 | cmd << '--output' 42 | cmd << pkg.to_s + '.asc' 43 | if ENV['GPG_PASS'] 44 | cmd << '--passphrase' 45 | cmd << ENV['GPG_PASS'] 46 | end 47 | cmd << '--detach-sig' 48 | cmd << '--batch' 49 | cmd << '--yes' 50 | cmd << pkg 51 | trace(cmd.join(' ')) 52 | `#{cmd.join(' ')}` 53 | raise "Unable to generate signature for #{pkg}" unless File.exist?(asc_filename) 54 | end 55 | end 56 | 57 | def sign_and_upload(project, pkg) 58 | project.task(:upload).enhance do 59 | artifact = Buildr.artifact(pkg.to_spec_hash.merge(:type => "#{pkg.type}.asc")) 60 | artifact.from(sign_task(pkg)) 61 | artifact.invoke 62 | artifact.upload 63 | end 64 | end 65 | 66 | def sign_and_upload_all_packages(project) 67 | project.packages.each { |pkg| Buildr::GPG.sign_and_upload(project, pkg) } 68 | project.packages.select {|pkg| pkg.respond_to?(:pom) }.map { |pkg| pkg.pom }.compact.uniq.each { |pom| Buildr::GPG.sign_and_upload(project, pom) } 69 | end 70 | end 71 | 72 | module ProjectExtension 73 | include Extension 74 | 75 | after_define do |project| 76 | Buildr::GPG.sign_and_upload_all_packages(project) 77 | end 78 | end 79 | end 80 | end 81 | 82 | class Buildr::Project 83 | include Buildr::GPG::ProjectExtension 84 | end 85 | -------------------------------------------------------------------------------- /addon/buildr/javacc.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr 17 | # Provides JavaCC compile tasks. Require explicitly using require "buildr/javacc". 18 | module JavaCC 19 | 20 | REQUIRES = [ "net.java.dev.javacc:javacc:jar:4.0", "net.java.dev.javacc:javacc:jar:4.0" ] 21 | 22 | Java.classpath << REQUIRES 23 | 24 | class << self 25 | 26 | def javacc(*args) 27 | options = Hash === args.last ? args.pop : {} 28 | rake_check_options options, :output 29 | 30 | args = args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "/**/*.jj"] : f }.flatten 31 | args.unshift "-OUTPUT_DIRECTORY=#{options[:output]}" if options[:output] 32 | Java.load 33 | Java.org.javacc.parser.Main.mainProgram(args.to_java(Java.java.lang.String)) == 0 or 34 | fail "Failed to run JavaCC, see errors above." 35 | end 36 | 37 | def jjtree(*args) 38 | options = Hash === args.last ? args.pop : {} 39 | rake_check_options options, :output, :build_node_files 40 | 41 | args = args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "**/*.jjt"] : f }.flatten 42 | args.unshift "-OUTPUT_DIRECTORY=#{options[:output]}" if options[:output] 43 | args.unshift "-BUILD_NODE_FILES=#{options[:build_node_files] || false}" 44 | Java.load 45 | Java.org.javacc.jjtree.JJTree.new.main(args.to_java(Java.java.lang.String)) == 0 or 46 | fail "Failed to run JJTree, see errors above." 47 | end 48 | 49 | end 50 | 51 | def javacc(*args) 52 | if Hash === args.last 53 | options = args.pop 54 | in_package = options[:in_package].split(".") 55 | else 56 | in_package = [] 57 | end 58 | file(path_to(:target, :generated, :javacc)=>args.flatten) do |task| 59 | JavaCC.javacc task.prerequisites, :output=>File.join(task.name, in_package) 60 | end 61 | end 62 | 63 | def jjtree(*args) 64 | if Hash === args.last 65 | options = args.pop 66 | in_package = options[:in_package].split(".") 67 | build_node_files = options[:build_node_files] 68 | else 69 | in_package = [] 70 | end 71 | file(path_to(:target, :generated, :jjtree)=>args.flatten) do |task| 72 | JavaCC.jjtree task.prerequisites, :output=>File.join(task.name, in_package), :build_node_files=>build_node_files 73 | end 74 | end 75 | 76 | end 77 | 78 | class Project 79 | include JavaCC 80 | end 81 | end 82 | -------------------------------------------------------------------------------- /addon/buildr/scss_lint-report.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | 23 | 24 | 25 | 26 | ScssLint Violations 27 | 28 | 29 |

30 | Coding Style Check Results 31 |

32 | 33 | 34 | 37 | 38 | 39 | 40 | 43 | 44 | 45 | 46 | 49 | 50 |
35 | Summary 36 |
Files with errors 41 | 42 |
Total errors 47 | 48 |
51 |
52 |

The following are violations of the ScssLint Rules:

53 |

54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 66 | 67 |
File: 64 | 65 |
68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 |
LineColumnSeverityReason
77 |

78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /lib/buildr/java/external.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | module Compiler #:nodoc: 18 | class ExternalJavac< Buildr::Compiler::Javac 19 | 20 | OPTIONS = [:jvm, :warnings, :debug, :deprecation, :source, :target, :lint, :other] 21 | 22 | specify :language=>:java, :sources => 'java', :source_ext => 'java', 23 | :target=>'classes', :target_ext=>'class', :packaging=>:jar 24 | 25 | 26 | def compile(sources, target, dependencies) #:nodoc: 27 | check_options options, OPTIONS 28 | cmd_args = [] 29 | # tools.jar contains the Java compiler. 30 | dependencies << Java.tools_jar if Java.tools_jar 31 | cmd_args << '-classpath' << dependencies.join(File::PATH_SEPARATOR) unless dependencies.empty? 32 | source_paths = sources.select { |source| File.directory?(source) } 33 | cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty? 34 | cmd_args << '-d' << File.expand_path(target) 35 | cmd_args += externaljavac_args 36 | Tempfile.open("external") {|tmp| 37 | tmp.write files_from_sources(sources).join(' ') 38 | cmd_args << "@#{tmp.path}" 39 | } 40 | unless Buildr.application.options.dryrun 41 | javac_path = File.join(options[:jvm] || ENV['JAVA_HOME'], "bin", "javac") 42 | final_args = cmd_args.insert(0, javac_path).push('2>&1').join(' ') 43 | trace(final_args) 44 | info %x[#{final_args}] 45 | fail 'Failed to compile, see errors above' unless $?.success? 46 | end 47 | end 48 | 49 | private 50 | 51 | # See arg list here: http://publib.boulder.ibm.com/infocenter/rsahelp/v7r0m0/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm 52 | def externaljavac_args #:nodoc: 53 | args = [] 54 | args << '-nowarn' unless options[:warnings] 55 | args << '-verbose' if trace?(:javac) 56 | args << '-g' if options[:debug] 57 | args << '-deprecation' if options[:deprecation] 58 | args << '-source' << options[:source].to_s if options[:source] 59 | args << '-target' << options[:target].to_s if options[:target] 60 | case options[:lint] 61 | when Array then args << "-Xlint:#{options[:lint].join(',')}" 62 | when String then args << "-Xlint:#{options[:lint]}" 63 | when true then args << '-Xlint' 64 | end 65 | args + Array(options[:other]) 66 | end 67 | 68 | end 69 | 70 | end 71 | end 72 | 73 | Buildr::Compiler.compilers << Buildr::Compiler::ExternalJavac 74 | -------------------------------------------------------------------------------- /lib/buildr/java/test_result.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | # It is necessary to require these files here as the bdd plugin directly includes this file 17 | require 'yaml' 18 | require 'rspec/core/formatters/base_formatter' 19 | 20 | module Buildr #:nodoc: 21 | module TestFramework #:nodoc: 22 | 23 | # A class used by buildr for jruby based frameworks, so that buildr can know 24 | # which tests succeeded/failed. 25 | class TestResult 26 | 27 | class Error < ::Exception 28 | attr_reader :message, :backtrace 29 | def initialize(message, backtrace) 30 | @message = message 31 | @backtrace = backtrace 32 | set_backtrace backtrace 33 | end 34 | 35 | def self.dump_yaml(file, e) 36 | FileUtils.mkdir_p File.dirname(file) 37 | File.open(file, 'w') { |f| f.puts(YAML.dump(Error.new(e.message, e.backtrace))) } 38 | end 39 | 40 | def self.guard(file) 41 | begin 42 | yield 43 | rescue => e 44 | dump_yaml(file, e) 45 | end 46 | end 47 | end 48 | 49 | attr_accessor :failed, :succeeded 50 | 51 | def initialize 52 | @failed, @succeeded = [], [] 53 | end 54 | 55 | # An Rspec formatter used by buildr 56 | class YamlFormatter < ::RSpec::Core::Formatters::BaseFormatter 57 | attr_reader :result 58 | 59 | def initialize(output) 60 | super(output) 61 | @result = Hash.new 62 | @result[:succeeded] = [] 63 | @result[:failed] = [] 64 | end 65 | 66 | def example_passed(example) 67 | super(example) 68 | result.succeeded << example_name(example) 69 | end 70 | 71 | def example_pending(example) 72 | super(example) 73 | result.succeeded << example_name(example) 74 | end 75 | 76 | def example_failed(example) 77 | super(example) 78 | result.failed << example_name(example) 79 | end 80 | 81 | def start(example_count) 82 | super(example_count) 83 | @result = TestResult.new 84 | end 85 | 86 | def close 87 | super 88 | result.succeeded = result.succeeded - result.failed 89 | output.puts YAML.dump(result) 90 | end 91 | 92 | private 93 | def example_name(example) 94 | example.file_path 95 | end 96 | end # YamlFormatter 97 | 98 | end # TestResult 99 | end 100 | end 101 | -------------------------------------------------------------------------------- /lib/buildr/java/ant.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | gem 'atoulme-Antwrap' 18 | autoload :Antwrap, 'antwrap' 19 | autoload :Logger, 'logger' 20 | 21 | module Buildr #:nodoc: 22 | module Ant 23 | 24 | # Which version of Ant we're using by default. 25 | VERSION = '1.8.3' 26 | 27 | class << self 28 | # Current version of Ant being used. 29 | def version 30 | Buildr.settings.build['ant'] || VERSION 31 | end 32 | 33 | # Ant classpath dependencies. 34 | def dependencies 35 | # Ant-Trax required for running the JUnitReport task, and there's no other place 36 | # to put it but the root classpath. 37 | @dependencies ||= ["org.apache.ant:ant:jar:#{version}", "org.apache.ant:ant-launcher:jar:#{version}"] 38 | end 39 | 40 | private 41 | def const_missing(const) 42 | return super unless const == :REQUIRES # TODO: remove in 1.5 43 | Buildr.application.deprecated "Please use Ant.dependencies/.version instead of Ant::REQUIRES/VERSION" 44 | dependencies 45 | end 46 | end 47 | 48 | 49 | Java.classpath << lambda { Ant.dependencies } 50 | 51 | # :call-seq: 52 | # ant(name) { |AntProject| ... } => AntProject 53 | # 54 | # Creates a new AntProject with the specified name, yield to the block for defining various 55 | # Ant tasks, and executes each task as it's defined. 56 | # 57 | # For example: 58 | # ant("hibernatedoclet') do |doclet| 59 | # doclet.taskdef :name=>'hibernatedoclet', 60 | # :classname=>'xdoclet.modules.hibernate.HibernateDocletTask', :classpath=>DOCLET 61 | # doclet.hibernatedoclet :destdir=>dest_dir, :force=>'true' do 62 | # hibernate :version=>'3.0' 63 | # fileset :dir=>source, :includes=>'**/*.java' 64 | # end 65 | # end 66 | def ant(name, &block) 67 | options = { :name=>name, :basedir=>Dir.pwd, :declarative=>true } 68 | options.merge!(:logger=> Logger.new(STDOUT), :loglevel=> Logger::DEBUG) if trace?(:ant) 69 | Java.load 70 | Antwrap::AntProject.new(options).tap do |project| 71 | # Set Ant logging level to debug (--trace), info (default) or error only (--quiet). 72 | project.project.getBuildListeners().get(0). 73 | setMessageOutputLevel((trace?(:ant) && 4) || (verbose && 2) || 0) 74 | yield project if block_given? 75 | end 76 | end 77 | 78 | end 79 | 80 | include Ant 81 | class Project 82 | include Ant 83 | end 84 | 85 | Buildr.help do 86 | Java.load 87 | "\nUsing Java #{ENV_JAVA['java.version']}, Ant #{Ant.version}." 88 | end 89 | 90 | end 91 | -------------------------------------------------------------------------------- /addon/buildr/jibx.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | require 'java/java' 17 | 18 | module Buildr 19 | 20 | # Provides JiBX bytecode enhancement. Require explicitly using require 'buildr/jibx'. 21 | module JiBX 22 | 23 | JIBX_VERSION = '1.1.5' 24 | BCEL_VERSION = '5.2' 25 | STAX_VERSION = '1.0-2' 26 | XPP3_VERSION = '1.1.4c' 27 | 28 | REQUIRES = ["org.jibx:jibx-bind:jar:#{JIBX_VERSION}", 29 | "org.jibx:jibx-run:jar:#{JIBX_VERSION}", 30 | "org.apache.bcel:bcel:jar:#{BCEL_VERSION}", 31 | "javax.xml.stream:stax-api:jar:#{STAX_VERSION}", 32 | "xpp3:xpp3:jar:#{XPP3_VERSION}"] 33 | 34 | Java.classpath << REQUIRES 35 | 36 | class << self 37 | 38 | def bind(options) 39 | rake_check_options options, :classpath, :output, :binding, :target, :verbose, :load 40 | artifacts = Buildr.artifacts(options[:classpath]).each { |a| a.invoke }.map(&:to_s) + [options[:output].to_s] 41 | binding = file(options[:binding]).tap { |task| task.invoke }.to_s 42 | 43 | Buildr.ant 'jibx' do |ant| 44 | ant.taskdef :name=>'bind', 45 | :classname=>'org.jibx.binding.ant.CompileTask', 46 | :classpath => requires.join(File::PATH_SEPARATOR) 47 | ant.bind :verbose => options[:verbose].to_s, :load => options[:load].to_s, :binding=>options[:binding].to_s do 48 | ant.classpath :path => artifacts.join(File::PATH_SEPARATOR) 49 | end 50 | end 51 | end 52 | 53 | private 54 | 55 | def requires() 56 | @requires ||= Buildr.artifacts(REQUIRES).each { |artifact| artifact.invoke }.map(&:to_s) 57 | end 58 | 59 | end 60 | 61 | def jibx_bind(options = nil) 62 | 63 | # FIXME - add support for :bindingfileset and :classpathset 64 | # Note: either :binding or :bindingfileset should be set, and either 65 | # :classpath or :classpathset should be set, and options passed to 66 | # ant.bind should be adjusted accordingly. At present, only :binding 67 | # and :classpath are supported (which should be fine for most!) 68 | jibx_options = {:output => compile.target, 69 | :classpath => compile.classpath, 70 | :binding => path_to(:source, :main, :resources, 'META-INF/binding.xml'), 71 | :target => compile.target, 72 | :load => false, 73 | :verbose => false 74 | } 75 | 76 | JiBX.bind jibx_options.merge(options || {}) 77 | end 78 | 79 | end 80 | 81 | class Project 82 | include JiBX 83 | end 84 | end 85 | -------------------------------------------------------------------------------- /lib/buildr/java/doc.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | module Doc #:nodoc: 18 | 19 | module JavadocDefaults 20 | include Extension 21 | 22 | # Default javadoc -windowtitle to project's comment or name 23 | after_define(:javadoc => :doc) do |project| 24 | if project.doc.engine? Javadoc 25 | options = project.doc.options 26 | options[:windowtitle] = (project.comment || project.name) unless options[:windowtitle] 27 | end 28 | end 29 | end 30 | 31 | # A convenient task for creating Javadocs from the project's compile task. Minimizes all 32 | # the hard work to calling #from and #using. 33 | # 34 | # For example: 35 | # doc.from(projects('myapp:foo', 'myapp:bar')).using(:windowtitle=>'My App') 36 | # Or, short and sweet: 37 | # desc 'My App' 38 | # define 'myapp' do 39 | # . . . 40 | # doc projects('myapp:foo', 'myapp:bar') 41 | # end 42 | class Javadoc < Base 43 | 44 | specify :language => :java, :source_ext => 'java' 45 | 46 | def generate(sources, target, options = {}) 47 | cmd_args = [ '-d', target, trace?(:javadoc) ? '-verbose' : '-quiet' ] 48 | options.reject { |key, value| [:sourcepath, :classpath].include?(key) }. 49 | each { |key, value| value.invoke if value.respond_to?(:invoke) }. 50 | each do |key, value| 51 | case value 52 | when true, nil 53 | cmd_args << "-#{key}" 54 | when false 55 | cmd_args << "-no#{key}" 56 | when Hash 57 | value.each { |k,v| cmd_args << "-#{key}" << k.to_s << v.to_s } 58 | else 59 | cmd_args += Array(value).map { |item| ["-#{key}", item.to_s] }.flatten 60 | end 61 | end 62 | [:sourcepath, :classpath].each do |option| 63 | Array(options[option]).flatten.tap do |paths| 64 | cmd_args << "-#{option}" << paths.flatten.map(&:to_s).join(File::PATH_SEPARATOR) unless paths.empty? 65 | end 66 | end 67 | cmd_args += sources.flatten.uniq 68 | unless Buildr.application.options.dryrun 69 | info "Generating Javadoc for #{project.name}" 70 | trace (['javadoc'] + cmd_args).join(' ') 71 | Java.load 72 | Java.com.sun.tools.javadoc.Main.execute(cmd_args.to_java(Java.java.lang.String)) == 0 or 73 | fail 'Failed to generate Javadocs, see errors above' 74 | end 75 | end 76 | end 77 | end 78 | 79 | class Project #:nodoc: 80 | include JavadocDefaults 81 | end 82 | end 83 | 84 | Buildr::Doc.engines << Buildr::Doc::Javadoc 85 | -------------------------------------------------------------------------------- /lib/buildr/core/help.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | 18 | module Help #:nodoc: 19 | class << self 20 | 21 | def <<(arg) 22 | if arg.respond_to?(:call) 23 | texters << arg 24 | else 25 | texters << lambda { arg } 26 | end 27 | end 28 | 29 | def to_s 30 | texters.map(&:call).join("\n") 31 | end 32 | 33 | protected 34 | def texters 35 | @texters ||= [] 36 | end 37 | 38 | end 39 | end 40 | 41 | class << self 42 | def help(&block) 43 | Help << block if block_given? 44 | Help 45 | end 46 | end 47 | 48 | end 49 | 50 | 51 | task 'help' do 52 | # Greeter 53 | puts 'Usage:' 54 | puts ' buildr [-f rakefile] {options} targets...' 55 | puts 56 | 57 | # Show only the top-level projects. 58 | projects.reject(&:parent).tap do |top_level| 59 | unless top_level.empty? 60 | puts 'Top-level projects (buildr help:projects for full list):' 61 | width = [top_level.map(&:name).map(&:size), 20].flatten.max 62 | top_level.each do |project| 63 | puts project.comment.to_s.empty? ? project.name : (" %-#{width}s # %s" % [project.name, project.comment]) 64 | end 65 | puts 66 | end 67 | end 68 | 69 | # Show all the top-level tasks, excluding projects. 70 | puts 'Common tasks:' 71 | task('help:tasks').invoke 72 | puts 73 | puts 'For help on command line options:' 74 | puts ' buildr --help' 75 | puts Buildr.help.to_s 76 | end 77 | 78 | 79 | module Buildr 80 | 81 | # :call-seq: 82 | # help() { ... } 83 | # 84 | # Use this to enhance the help task, e.g. to print some important information about your build, 85 | # configuration options, build instructions, etc. 86 | def help(&block) 87 | Buildr.help << block 88 | end 89 | 90 | end 91 | 92 | 93 | namespace 'help' do 94 | 95 | desc 'List all projects defined by this buildfile' 96 | task 'projects' do 97 | width = projects.map(&:name).map(&:size).max 98 | projects.each do |project| 99 | puts project.comment.to_s.empty? ? " #{project.name}" : (" %-#{width}s # %s" % [project.name, project.comment]) 100 | end 101 | end 102 | 103 | desc 'List all tasks available from this buildfile' 104 | task 'tasks' do 105 | Buildr.application.tasks.select(&:comment).reject { |task| Project === task }.tap do |tasks| 106 | width = [tasks.map(&:name).map(&:size), 20].flatten.max 107 | tasks.each do |task| 108 | printf " %-#{width}s # %s\n", task.name, task.comment 109 | end 110 | puts 111 | end 112 | end 113 | 114 | end 115 | -------------------------------------------------------------------------------- /addon/buildr/css_lint-report.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | 23 | 24 | 25 | CssLint Violations 26 | 27 | 28 |

29 | Coding Style Check Results 30 |

31 | 32 | 33 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 | 48 | 49 |
34 | Summary 35 |
Files with errors 40 | 41 |
Total errors 46 | 47 |
50 |
51 |

The following are violations of the ScssLint Rules:

52 |

53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 65 | 66 |
File: 63 | 64 |
67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 |
LineColumnSeverityReasonEvidence
77 |

78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /addon/buildr/checkstyle-report.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | 23 | 24 | 25 | Checkstyle Violations 26 | 27 | 28 |

29 | Coding Style Check Results 30 |

31 | 32 | 33 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 | 48 | 49 | 50 | 51 | 54 | 55 | 56 | 57 | 60 | 61 |
34 | Summary 35 |
Total files checked 40 | 41 |
Files with errors 46 | 47 |
Total errors 52 | 53 |
Errors per file 58 | 59 |
62 |
63 |

The following are violations of the Checkstyle Rules:

64 |

65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 77 | 78 |
File: 75 | 76 |
79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
Line NumberError MessageCheck
87 |

88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /addon/buildr/openjpa.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr 17 | 18 | # Provides OpenJPA bytecode enhancement and Mapping tool task. Require explicitly using require "buildr/openjpa". 19 | module OpenJPA 20 | 21 | VERSION = "1.0.1" 22 | 23 | REQUIRES = [ "org.apache.openjpa:openjpa:jar:#{VERSION}", 24 | "commons-collections:commons-collections:jar:3.1", 25 | "commons-dbcp:commons-dbcp:jar:1.2.1", 26 | "commons-lang:commons-lang:jar:2.1", 27 | "commons-pool:commons-pool:jar:1.2", 28 | "javax.persistence:persistence-api:jar:1.0", 29 | "org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.0", 30 | "org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec:jar:1.0", 31 | "net.sourceforge.serp:serp:jar:1.11.0" ] 32 | 33 | class << self 34 | 35 | def enhance(options) 36 | rake_check_options options, :classpath, :properties, :output 37 | artifacts = Buildr.artifacts(options[:classpath]).each { |a| a.invoke }.map(&:to_s) + [options[:output].to_s] 38 | properties = file(options[:properties]).tap { |task| task.invoke }.to_s 39 | 40 | Buildr.ant "openjpa" do |ant| 41 | ant.taskdef :name=>"enhancer", :classname=>"org.apache.openjpa.ant.PCEnhancerTask", 42 | :classpath=>requires.join(File::PATH_SEPARATOR) 43 | ant.enhancer :directory=>options[:output].to_s do 44 | ant.config :propertiesFile=>properties 45 | ant.classpath :path=>artifacts.join(File::PATH_SEPARATOR) 46 | end 47 | end 48 | end 49 | 50 | def mapping_tool(options) 51 | rake_check_options options, :classpath, :properties, :sql, :action 52 | artifacts = Buildr.artifacts(options[:classpath]).each{ |a| a.invoke }.map(&:to_s) 53 | properties = file(options[:properties].to_s).tap { |task| task.invoke }.to_s 54 | 55 | Buildr.ant("openjpa") do |ant| 56 | ant.taskdef :name=>"mapping", :classname=>"org.apache.openjpa.jdbc.ant.MappingToolTask", 57 | :classpath=>requires.join(File::PATH_SEPARATOR) 58 | ant.mapping :schemaAction=>options[:action], :sqlFile=>options[:sql].to_s, :ignoreErrors=>"true" do 59 | ant.config :propertiesFile=>properties 60 | ant.classpath :path=>artifacts.join(File::PATH_SEPARATOR) 61 | end 62 | end 63 | end 64 | 65 | private 66 | 67 | def requires() 68 | @requires ||= Buildr.artifacts(REQUIRES).each { |artifact| artifact.invoke }.map(&:to_s) 69 | end 70 | 71 | end 72 | 73 | def open_jpa_enhance(options = nil) 74 | jpa_options = { :output=>compile.target, :classpath=>compile.dependencies, 75 | :properties=>path_to(:source, :main, :resources, 'META-INF/persistence.xml') } 76 | OpenJPA.enhance jpa_options.merge(options || {}) 77 | end 78 | 79 | end 80 | 81 | class Project 82 | include OpenJPA 83 | end 84 | end 85 | -------------------------------------------------------------------------------- /spec/core/run_spec.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) 17 | 18 | describe Project, :run do 19 | 20 | it 'should return the project\'s run task' do 21 | define('foo') 22 | project('foo').run.name.should eql('foo:run') 23 | end 24 | 25 | it 'should return a RunTask' do 26 | define('foo') 27 | project('foo').run.should be_kind_of(Run::RunTask) 28 | end 29 | 30 | it 'should include compile dependencies' do 31 | define('foo') do 32 | compile.using(:javac).with 'group:compile:jar:1.0' 33 | test.compile.using(:javac).with 'group:test:jar:1.0' 34 | end 35 | project('foo').run.classpath.should include(artifact('group:compile:jar:1.0')) 36 | end 37 | 38 | it 'should not include test dependencies' do 39 | define('foo') do 40 | compile.using(:javac).with 'group:compile:jar:1.0' 41 | test.compile.using(:javac).with 'group:test:jar:1.0' 42 | end 43 | project('foo').run.classpath.should_not include(artifact('group:test:jar:1.0')) 44 | end 45 | 46 | it 'should respond to using() and return self' do 47 | define 'foo' do 48 | run.using(:foo=>'Fooing').should be(run) 49 | end 50 | end 51 | 52 | it 'should respond to using() and accept options' do 53 | define 'foo' do 54 | run.using :foo=>'Fooing' 55 | end 56 | project('foo').run.options[:foo].should eql('Fooing') 57 | end 58 | 59 | it 'should select runner using run.using' do 60 | define 'foo' do 61 | run.using :java 62 | end 63 | project('foo').run.runner.should be_a(Run::JavaRunner) 64 | end 65 | 66 | it 'should select runner based on compile language' do 67 | write 'src/main/java/Test.java', 'class Test {}' 68 | define 'foo' do 69 | # compile language detected as :java 70 | end 71 | project('foo').run.runner.should be_a(Run::JavaRunner) 72 | end 73 | 74 | it "should run with the project resources" do 75 | write 'src/main/java/Test.java', 'class Test {}' 76 | write 'src/main/resources/test.properties', '' 77 | define 'foo' 78 | project('foo').run.classpath.should include project('foo').resources.target 79 | end 80 | 81 | it 'should depend on project''s compile task' do 82 | define 'foo' 83 | project('foo').run.prerequisites.should include(project('foo').compile) 84 | end 85 | 86 | it 'should be local task' do 87 | define 'foo' do 88 | define('bar') 89 | end 90 | project('foo:bar').run.should_receive(:invoke_prerequisites) 91 | project('foo:bar').run.should_receive(:run) 92 | in_original_dir(project('foo:bar').base_dir) { task('run').invoke } 93 | end 94 | 95 | it 'should not recurse' do 96 | define 'foo' do 97 | define('bar') { run.using :java, :main => 'foo' } 98 | end 99 | project('foo:bar').run.should_not_receive(:invoke_prerequisites) 100 | project('foo:bar').run.should_not_receive(:run) 101 | project('foo').run.should_receive(:run) 102 | project('foo').run.invoke 103 | end 104 | 105 | end 106 | -------------------------------------------------------------------------------- /spec/xpath_matchers.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | require 'rexml/document' 17 | require 'rexml/element' 18 | 19 | module RSpec 20 | module Matchers 21 | 22 | # check if the xpath exists one or more times 23 | class HaveXpath 24 | def initialize(xpath) 25 | @xpath = xpath 26 | end 27 | 28 | def matches?(response) 29 | @response = response 30 | doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response) 31 | match = REXML::XPath.match(doc, @xpath) 32 | !match.empty? 33 | end 34 | 35 | def failure_message 36 | "Did not find expected xpath #{@xpath}" 37 | end 38 | 39 | def negative_failure_message 40 | "Did find unexpected xpath #{@xpath}" 41 | end 42 | 43 | def description 44 | "match the xpath expression #{@xpath}" 45 | end 46 | end 47 | 48 | def have_xpath(xpath) 49 | HaveXpath.new(xpath) 50 | end 51 | 52 | # check if the xpath has the specified value 53 | # value is a string and there must be a single result to match its 54 | # equality against 55 | class MatchXpath 56 | def initialize(xpath, val) 57 | @xpath = xpath 58 | @val= val 59 | end 60 | 61 | def matches?(response) 62 | @response = response 63 | doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response) 64 | ok = false 65 | REXML::XPath.each(doc, @xpath) do |e| 66 | @actual_val = case e 67 | when REXML::Attribute 68 | e.to_s 69 | when REXML::Element 70 | e.text 71 | else 72 | e.to_s 73 | end 74 | ok = true 75 | return false unless @val == @actual_val 76 | end 77 | return ok 78 | end 79 | 80 | def failure_message 81 | "The xpath #{@xpath} did not have the value '#{@val}' It was '#{@actual_val}'" 82 | end 83 | 84 | def description 85 | "match the xpath expression #{@xpath} with #{@val}" 86 | end 87 | end 88 | 89 | def match_xpath(xpath, val) 90 | MatchXpath.new(xpath, val) 91 | end 92 | 93 | # checks if the given xpath occurs num times 94 | class HaveNodes #:nodoc: 95 | def initialize(xpath, num) 96 | @xpath= xpath 97 | @num = num 98 | end 99 | 100 | def matches?(response) 101 | @response = response 102 | doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response) 103 | match = REXML::XPath.match(doc, @xpath) 104 | @num_found= match.size 105 | @num_found == @num 106 | end 107 | 108 | def failure_message 109 | "Did not find expected number of nodes #{@num} in xpath #{@xpath} Found #{@num_found}" 110 | end 111 | 112 | def description 113 | "match the number of nodes #{@num}" 114 | end 115 | end 116 | 117 | def have_nodes(xpath, num) 118 | HaveNodes.new(xpath, num) 119 | end 120 | 121 | end 122 | end 123 | -------------------------------------------------------------------------------- /addon/buildr/xmlbeans.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr 17 | 18 | # Provides XMLBeans schema compiler. Require explicitly using require "buildr/xmlbeans". 19 | # 20 | # require 'buildr/xmlbeans' 21 | # define 'some_proj' do 22 | # compile_xml_beans _(:source, :main, :xsd) # the directory with *.xsd 23 | # end 24 | module XMLBeans 25 | 26 | # You can use ArtifactNamespace to customize the versions of 27 | # :xmlbeans or :stax used by this module: 28 | # 29 | # require 'buildr/xmlbeans' 30 | # Buildr::XMLBeans::REQUIRES.xmlbeans = '2.2.0' 31 | REQUIRES = ArtifactNamespace.for(self) do |ns| 32 | ns.xmlbeans! 'org.apache.xmlbeans:xmlbeans:jar:2.3.0', '>2' 33 | ns.stax_api! 'stax:stax-api:jar:>=1.0.1' 34 | end 35 | 36 | class << self 37 | 38 | def compile(*args) 39 | options = Hash === args.last ? args.pop : {} 40 | options[:verbose] ||= trace?(:xmlbeans) 41 | rake_check_options options, :verbose, :noop, :javasource, :jar, :compile, :output, :xsb 42 | puts "Running XMLBeans schema compiler" if verbose 43 | Buildr.ant "xmlbeans" do |ant| 44 | ant.taskdef :name=>"xmlbeans", :classname=>"org.apache.xmlbeans.impl.tool.XMLBean", 45 | :classpath=>requires.join(File::PATH_SEPARATOR) 46 | ant.xmlbeans :srconly=>"true", :srcgendir=>options[:output].to_s, :classgendir=>options[:output].to_s, 47 | :javasource=>options[:javasource] do 48 | args.flatten.each { |file| ant.fileset File.directory?(file) ? { :dir=>file } : { :file=>file } } 49 | end 50 | end 51 | # Touch paths to let other tasks know there's an update. 52 | touch options[:output].to_s, :verbose=>false 53 | end 54 | 55 | def requires() 56 | @requires ||= REQUIRES.artifacts 57 | end 58 | end 59 | 60 | def compile_xml_beans(*args) 61 | # Run whenever XSD file changes, but typically we're given an directory of XSD files, or even file patterns 62 | # (the last FileList is there to deal with things like *.xsdconfig). 63 | files = args.flatten.map { |file| File.directory?(file) ? FileList["#{file}/*.xsd"] : FileList[file] }.flatten 64 | # Generate sources and add them to the compile task. 65 | generated = file(path_to(:target, :generated, :xmlbeans)=>files) do |task| 66 | XMLBeans.compile args.flatten, :output=>task.name, 67 | :javasource=>compile.options.source, :xsb=>compile.target 68 | end 69 | compile.using(:javac).from(generated).with(*XMLBeans.requires) 70 | # Once compiled, we need to copy the generated XSB/XSD and one (magical?) class file 71 | # into the target directory, or the rest is useless. 72 | compile do |task| 73 | verbose(false) do 74 | base = generated.to_s 75 | FileList["#{base}/**/*.{class,xsb,xsd}"].each do |file| 76 | target = File.join(compile.target.to_s, Util.relative_path(file, base)) 77 | mkpath File.dirname(target) ; cp file, target 78 | end 79 | end 80 | end 81 | end 82 | 83 | end 84 | 85 | class Project 86 | include XMLBeans 87 | end 88 | end 89 | -------------------------------------------------------------------------------- /spec/scala/doc_spec.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | 17 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) 18 | 19 | describe "Scaladoc" do 20 | 21 | it 'should pick -doc-title from project name by default' do 22 | define 'foo' do 23 | compile.using(:scalac) 24 | 25 | define 'bar' do 26 | compile.using(:scalac) 27 | end 28 | end 29 | 30 | project('foo').doc.options[:"doc-title"].should eql('foo') 31 | project('foo:bar').doc.options[:"doc-title"].should eql('foo:bar') 32 | end 33 | 34 | it 'should pick -doc-title from project description by default, if available' do 35 | desc 'My App' 36 | define 'foo' do 37 | compile.using(:scalac) 38 | end 39 | project('foo').doc.options[:"doc-title"].should eql('My App') 40 | end 41 | 42 | it 'should not override explicit "doc-title" option' do 43 | define 'foo' do 44 | compile.using(:scalac) 45 | doc.using "doc-title" => 'explicit' 46 | end 47 | project('foo').doc.options[:"doc-title"].should eql('explicit') 48 | end 49 | 50 | if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6" 51 | 52 | it 'should convert :windowtitle to -doc-title for Scala 2.8.1 and later' do 53 | write 'src/main/scala/com/example/Test.scala', 'package com.example; class Test { val i = 1 }' 54 | define('foo') do 55 | doc.using :windowtitle => "foo" 56 | end 57 | actual = Java.scala.tools.nsc.ScalaDoc.new 58 | scaladoc = Java.scala.tools.nsc.ScalaDoc.new 59 | Java.scala.tools.nsc.ScalaDoc.should_receive(:new) do 60 | scaladoc 61 | end 62 | scaladoc.should_receive(:process) do |args| 63 | # Convert Java Strings to Ruby Strings, if needed. 64 | xargs = args.map { |a| a.is_a?(String) ? a : a.toString } 65 | xargs.should include("-doc-title") 66 | xargs.should_not include("-windowtitle") 67 | actual.process(args).should eql(true) 68 | end 69 | project('foo').doc.invoke 70 | end unless Buildr::Scala.version?(2.7, "2.8.0") 71 | 72 | elsif Buildr::VERSION >= '1.5' 73 | raise "JVM version guard in #{__FILE__} should be removed since it is assumed that Java 1.5 is no longer supported." 74 | end 75 | 76 | end 77 | 78 | if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6" 79 | 80 | describe "package(:scaladoc)" do 81 | it "should generate target/project-version-scaladoc.jar" do 82 | write 'src/main/scala/Foo.scala', 'class Foo' 83 | define 'foo', :version=>'1.0' do 84 | package(:scaladoc) 85 | end 86 | 87 | scaladoc = project('foo').package(:scaladoc) 88 | scaladoc.should point_to_path('target/foo-1.0-scaladoc.jar') 89 | 90 | lambda { 91 | project('foo').task('package').invoke 92 | }.should change { File.exist?('target/foo-1.0-scaladoc.jar') }.to(true) 93 | 94 | scaladoc.should exist 95 | scaladoc.should contain('index.html') 96 | scaladoc.should contain('Foo.html') 97 | end 98 | end 99 | 100 | elsif Buildr::VERSION >= '1.5' 101 | raise "JVM version guard in #{__FILE__} should be removed since it is assumed that Java 1.5 is no longer supported." 102 | end 103 | -------------------------------------------------------------------------------- /lib/buildr/groovy/bdd.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | # The Groovy module 17 | module Buildr::Groovy 18 | 19 | # EasyB is a Groovy based BDD framework. 20 | # To use in your project: 21 | # 22 | # test.using :easyb 23 | # 24 | # This framework will search in your project for: 25 | # src/spec/groovy/**/*Story.groovy 26 | # src/spec/groovy/**/*Specification.groovy 27 | # 28 | # Support the following options: 29 | # * :format -- Report format :txt or :xml, default is :txt 30 | # * :properties -- Hash of properties passed to the test suite. 31 | # * :java_args -- Arguments passed to the JVM. 32 | class EasyB < TestFramework::JavaBDD 33 | @lang = :groovy 34 | @bdd_dir = :spec 35 | 36 | VERSION = "0.9" 37 | TESTS_PATTERN = [ /(Story|Specification).groovy$/ ] 38 | OPTIONS = [:format, :properties, :java_args] 39 | 40 | class << self 41 | def version 42 | Buildr.settings.build['jbehave'] || VERSION 43 | end 44 | 45 | def dependencies 46 | @dependencies ||= ["org.easyb:easyb:jar:#{version}", 47 | 'org.codehaus.groovy:groovy:jar:1.5.3','asm:asm:jar:2.2.3', 48 | 'commons-cli:commons-cli:jar:1.0','antlr:antlr:jar:2.7.7'] 49 | end 50 | 51 | def applies_to?(project) #:nodoc: 52 | %w{ 53 | **/*Specification.groovy **/*Story.groovy 54 | }.any? { |glob| !Dir[project.path_to(:source, bdd_dir, lang, glob)].empty? } 55 | end 56 | 57 | private 58 | def const_missing(const) 59 | return super unless const == :REQUIRES # TODO: remove in 1.5 60 | Buildr.application.deprecated "Please use JBehave.dependencies/.version instead of JBehave::REQUIRES/VERSION" 61 | dependencies 62 | end 63 | end 64 | 65 | def tests(dependencies) #:nodoc: 66 | Dir[task.project.path_to(:source, bdd_dir, lang, "**/*.groovy")]. 67 | select { |name| TESTS_PATTERN.any? { |pat| pat === name } } 68 | end 69 | 70 | def run(tests, dependencies) #:nodoc: 71 | options = { :format => :txt }.merge(self.options).only(*OPTIONS) 72 | 73 | if :txt == options[:format] 74 | easyb_format, ext = 'txtstory', '.txt' 75 | elsif :xml == options[:format] 76 | easyb_format, ext = 'xmlbehavior', '.xml' 77 | else 78 | raise "Invalid format #{options[:format]} expected one of :txt :xml" 79 | end 80 | 81 | cmd_args = [ 'org.disco.easyb.BehaviorRunner' ] 82 | cmd_options = { :properties => options[:properties], 83 | :java_args => options[:java_args], 84 | :classpath => dependencies } 85 | 86 | tests.inject([]) do |passed, test| 87 | name = test.sub(/.*?groovy[\/\\]/, '').pathmap('%X') 88 | report = File.join(task.report_to.to_s, name + ext) 89 | mkpath report.pathmap('%d') 90 | begin 91 | Java::Commands.java cmd_args, 92 | "-#{easyb_format}", report, 93 | test, cmd_options.merge(:name => name) 94 | rescue => e 95 | passed 96 | else 97 | passed << test 98 | end 99 | end 100 | end 101 | 102 | end # EasyB 103 | 104 | end 105 | 106 | Buildr::TestFramework << Buildr::Groovy::EasyB 107 | -------------------------------------------------------------------------------- /rakelib/all-in-one.rake: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | def workspace_dir 17 | "#{File.expand_path(File.join(File.dirname(__FILE__), ".."))}" 18 | end 19 | 20 | desc 'Create JRuby all-in-one distribution' 21 | task 'all-in-one' => 'all-in-one:all-in-one' 22 | 23 | namespace 'all-in-one' do 24 | 25 | version = '1.7.0' 26 | jruby_distro = "jruby-bin-#{version}.tar.gz" 27 | url = "http://jruby.org.s3.amazonaws.com/downloads/#{version}/#{jruby_distro}" 28 | dir = "jruby-#{version}" 29 | 30 | task 'all-in-one' => %w(gem prepare download_and_extract install_dependencies clean_dist package) 31 | 32 | desc 'Prepare to run' 33 | task 'prepare' do 34 | mkpath '_all-in-one' 35 | cd '_all-in-one' 36 | end 37 | 38 | desc 'Download and extract JRuby' 39 | task 'download_and_extract' do 40 | unless File.exist?(jruby_distro) 41 | puts "Downloading JRuby from #{url} ..." 42 | require 'open-uri' 43 | File.open(jruby_distro, "wb") do |saved_file| 44 | # the following "open" is provided by open-uri 45 | open(url) do |read_file| 46 | saved_file.write(read_file.read) 47 | end 48 | end 49 | puts '[X] Downloaded JRuby' 50 | end 51 | 52 | rm_rf dir if File.exist? dir 53 | 54 | puts "Extracting JRuby to #{dir} ..." 55 | sh 'tar', 'xzf', jruby_distro 56 | puts '[X] Extracted JRuby' 57 | cd dir 58 | end 59 | 60 | desc 'Cleanup JRuby distribution' 61 | task 'clean_dist' do 62 | puts 'Cleaning...' 63 | mv 'tool/nailgun/ng.exe', 'bin' 64 | rm_rf 'tool' 65 | rm_rf 'docs' 66 | rm_rf 'lib/ruby/1.8' 67 | rm_rf 'lib/ruby/gems/1.9/doc' 68 | rm_rf 'lib/ruby/gems/shared/doc' 69 | rm_rf 'samples' 70 | end 71 | 72 | desc 'Install Buildr gem and dependencies' 73 | task 'install_dependencies' do 74 | puts 'Install Buildr gem ...' 75 | java_gem = FileList["../../pkg/buildr-#{spec.version}-java.gem"].first 76 | command = ['bin/jruby', '-S', 'gem', 'install', java_gem, '--no-rdoc', '--no-ri', '--env-shebang'] 77 | system({'GEM_HOME' => nil, 'GEM_PATH' => nil, 'MY_RUBY_HOME' => nil, 'RUBYOPT' => nil}, *command) 78 | puts '[X] Install Buildr gem' 79 | end 80 | 81 | desc 'Package distribution' 82 | task 'package' do 83 | pkg_dir = "#{workspace_dir}/pkg" 84 | mkpath pkg_dir 85 | puts 'Zipping distribution ...' 86 | cd '..' 87 | new_dir = "#{spec.name}-all-in-one-#{spec.version}" 88 | rm_rf new_dir 89 | mkdir new_dir 90 | mv dir, "#{new_dir}/embedded" 91 | mkdir "#{new_dir}/bin" 92 | cp "#{workspace_dir}/all-in-one/buildr", "#{new_dir}/bin/buildr" 93 | cp "#{workspace_dir}/all-in-one/buildr.cmd", "#{new_dir}/bin/buildr.cmd" 94 | File.chmod(0500, "#{new_dir}/bin/buildr", "#{new_dir}/bin/buildr.cmd") 95 | zip = "#{pkg_dir}/#{new_dir}.zip" 96 | rm zip if File.exist? zip 97 | sh 'zip', '-q', '-r', zip, new_dir 98 | puts '[X] Zipped distribution' 99 | 100 | puts 'Tarring distribution ...' 101 | tar = "#{pkg_dir}/#{new_dir}.tar.gz" 102 | rm tar if File.exist? tar 103 | sh 'tar', 'czf', tar, new_dir 104 | puts '[X] Tarred distribution' 105 | 106 | rm_rf new_dir 107 | end 108 | 109 | end 110 | 111 | task('clobber') { rm_rf '_all-in-one' } 112 | -------------------------------------------------------------------------------- /lib/buildr/core/environment.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | module Buildr #:nodoc: 17 | 18 | # Collection of options for controlling Buildr. 19 | class Options 20 | 21 | # We use this to present environment variable as arrays. 22 | class EnvArray < Array #:nodoc: 23 | 24 | def initialize(name) 25 | @name = name.upcase 26 | replace((ENV[@name] || ENV[@name.downcase] || '').split(/\s*,\s*/).reject(&:empty?)) 27 | end 28 | 29 | (Array.instance_methods - Object.instance_methods - Enumerable.instance_methods - ['each']).sort.each do |method| 30 | class_eval %{def #{method}(*args, &block) ; result = super ; write_envarray ; result ; end} 31 | end 32 | 33 | private 34 | 35 | def write_envarray 36 | ENV[@name.downcase] = nil 37 | ENV[@name] = map(&:to_s).join(',') 38 | end 39 | 40 | end 41 | 42 | 43 | # Wraps around the proxy environment variables: 44 | # * :http -- HTTP_PROXY 45 | # * :https -- HTTPS_PROXY 46 | # * :exclude -- NO_PROXY 47 | class Proxies 48 | 49 | # Returns the HTTP_PROXY URL. 50 | def http 51 | ENV['HTTP_PROXY'] || ENV['http_proxy'] 52 | end 53 | 54 | # Sets the HTTP_PROXY URL. 55 | def http=(url) 56 | ENV['http_proxy'] = nil 57 | ENV['HTTP_PROXY'] = url 58 | end 59 | 60 | # Returns the HTTPS_PROXY URL. 61 | def https 62 | ENV['HTTPS_PROXY'] || ENV['https_proxy'] 63 | end 64 | 65 | # Sets the HTTPS_PROXY URL. 66 | def https=(url) 67 | ENV['https_proxy'] = nil 68 | ENV['HTTPS_PROXY'] = url 69 | end 70 | 71 | # Returns list of hosts to exclude from proxying (NO_PROXY). 72 | def exclude 73 | @exclude ||= EnvArray.new('NO_PROXY') 74 | end 75 | 76 | # Sets list of hosts to exclude from proxy (NO_PROXY). Accepts host name, array of names, 77 | # or nil to clear the list. 78 | def exclude=(url) 79 | exclude.clear 80 | exclude.concat [url].flatten if url 81 | exclude 82 | end 83 | 84 | end 85 | 86 | # :call-seq: 87 | # proxy => options 88 | # 89 | # Returns the proxy options. Currently supported options are: 90 | # * :http -- HTTP proxy for use when downloading. 91 | # * :exclude -- Do not use proxy for these hosts/domains. 92 | # 93 | # For example: 94 | # options.proxy.http = 'http://proxy.acme.com:8080' 95 | # You can also set it using the environment variable HTTP_PROXY. 96 | # 97 | # You can exclude individual hosts from being proxied, or entire domains, for example: 98 | # options.proxy.exclude = 'optimus' 99 | # options.proxy.exclude = ['optimus', 'prime'] 100 | # options.proxy.exclude << '*.internal' 101 | def proxy 102 | @proxy ||= Proxies.new 103 | end 104 | 105 | end 106 | 107 | 108 | class << self 109 | 110 | # :call-seq: 111 | # options => Options 112 | # 113 | # Returns the Buildr options. See Options. 114 | def options 115 | @options ||= Options.new 116 | end 117 | 118 | end 119 | 120 | # :call-seq: 121 | # options => Options 122 | # 123 | # Returns the Buildr options. See Options. 124 | def options 125 | Buildr.options 126 | end 127 | 128 | end 129 | -------------------------------------------------------------------------------- /lib/buildr.rb: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with this 3 | # work for additional information regarding copyright ownership. The ASF 4 | # licenses this file to you under the Apache License, Version 2.0 (the 5 | # "License"); you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations under 14 | # the License. 15 | 16 | unless defined?(Buildr::VERSION) 17 | require 'buildr/version' 18 | end 19 | 20 | require 'rake' 21 | include Rake::DSL 22 | Rake::TaskManager.record_task_metadata = true 23 | 24 | require 'rbconfig' 25 | require 'pathname' 26 | autoload :Tempfile, 'tempfile' 27 | autoload :YAML, 'yaml' 28 | autoload :REXML, 'rexml/document' 29 | autoload :XmlSimple, 'xmlsimple' 30 | autoload :Builder, 'builder' # A different kind of buildr, one we use to create XML. 31 | autoload :RSpec, 'rspec' 32 | require 'erb' 33 | require 'find' 34 | require 'uri' 35 | require 'stringio' 36 | require 'fileutils' 37 | require 'orderedhash' 38 | require 'securerandom' 39 | 40 | require 'buildr/core/util' 41 | require 'buildr/core/console' 42 | require 'buildr/core/common' 43 | require 'buildr/core/application' 44 | require 'buildr/core/jrebel' 45 | require 'buildr/core/project' 46 | require 'buildr/core/assets' 47 | require 'buildr/core/environment' 48 | require 'buildr/core/help' 49 | require 'buildr/core/checks' 50 | require 'buildr/core/build' 51 | require 'buildr/core/filter' 52 | require 'buildr/core/compile' 53 | require 'buildr/core/test' 54 | require 'buildr/shell' 55 | require 'buildr/java/commands' 56 | require 'buildr/core/shell' 57 | require 'buildr/run' 58 | require 'buildr/core/run' 59 | require 'buildr/core/transports' 60 | require 'buildr/java/pom' 61 | require 'buildr/core/generate' 62 | require 'buildr/core/cc' 63 | require 'buildr/core/doc' 64 | require 'buildr/core/osx' if RUBY_PLATFORM =~ /darwin/ 65 | require 'buildr/core/linux' if RUBY_PLATFORM =~ /linux/ 66 | require 'buildr/packaging/version_requirement' 67 | require 'buildr/packaging/artifact_namespace' 68 | require 'buildr/packaging/artifact' 69 | require 'buildr/packaging/package' 70 | require 'buildr/packaging/archive' 71 | require 'buildr/packaging/ziptask' 72 | require 'buildr/packaging/tar' 73 | require 'buildr/packaging/gems' 74 | require 'buildr/packaging/zip' 75 | require 'buildr/packaging/test_jar' 76 | require RUBY_PLATFORM == 'java' ? 'buildr/java/jruby' : 'buildr/java/rjb' 77 | require 'buildr/java/ant' 78 | require 'buildr/java/compiler' 79 | require 'buildr/java/external' 80 | require 'buildr/java/tests' 81 | require 'buildr/java/test_result' 82 | require 'buildr/java/bdd' 83 | require 'buildr/java/packaging' 84 | require 'buildr/java/commands' 85 | require 'buildr/java/doc' 86 | require 'buildr/java/deprecated' 87 | require 'buildr/ide/idea' 88 | require 'buildr/ide/eclipse' 89 | 90 | # Methods defined in Buildr are both instance methods (e.g. when included in Project) 91 | # and class methods when invoked like Buildr.artifacts(). 92 | module Buildr ; extend self ; end 93 | 94 | # The Buildfile object (self) has access to all the Buildr methods and constants. 95 | class << self ; include Buildr ; end 96 | 97 | # All modules defined under Buildr::* can be referenced without Buildr:: prefix 98 | # unless a conflict exists (e.g. Buildr::RSpec vs ::RSpec) 99 | class Object #:nodoc: 100 | Buildr.constants.each do |name| 101 | const = Buildr.const_get(name) 102 | if const.is_a?(Module) 103 | const_set name, const unless const_defined?(name) 104 | end 105 | end 106 | end 107 | 108 | # Need to set this again as jruby was not correctly 109 | # initialized, the first time it was called 110 | Buildr::Console.use_color = $stdout.isatty 111 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | = Buildr 2 | 3 | This is Buildr, the build system that lets you build like you code. 4 | 5 | http://buildr.apache.org/ 6 | 7 | == Get Started 8 | 9 | === Install Buildr 10 | 11 | Buildr needs Ruby 1.8 or later and RubyGems 0.9 or later. 12 | 13 | Windows users can get the one-click Ruby installer, which includes the latest 14 | version of Ruby and RubyGems: 15 | 16 | http://rubyinstaller.org 17 | 18 | Make sure to set JAVA_HOME environment variable first, then: 19 | 20 | gem install buildr 21 | 22 | (Use sudo for Linux and OS X) 23 | 24 | More installation and setup instructions available online 25 | http://buildr.apache.org/ 26 | 27 | 28 | === RTFM 29 | 30 | * Buildr documentation: http://buildr.apache.org 31 | * More about Rake: http://docs.rubyrake.org 32 | * Antwrap documentation: http://antwrap.rubyforge.org 33 | 34 | 35 | === Mailing list 36 | 37 | Users: users-subscribe@buildr.apache.org http://buildr.markmail.org/search/list:users 38 | 39 | Developers: dev-subscribe@buildr.apache.org http://buildr.markmail.org/search/list:dev 40 | 41 | Create your own Buildfile and start living the life! 42 | 43 | 44 | == Where's My Ruby? 45 | 46 | Buildr needs Ruby 1.8 or later and RubyGems 0.9 or later. All other 47 | dependencies are installed when you run: 48 | 49 | gem install buildr 50 | 51 | === Windows 52 | 53 | Windows users can get the one-click Ruby installer, which includes the latest 54 | version of Ruby and RubyGems: 55 | 56 | http://rubyinstaller.org 57 | 58 | Before installing Buildr, please set the JAVA_HOME environment variable to 59 | point to your JDK distribution. Next, use Ruby Gem to install Buildr: 60 | 61 | > gem install buildr 62 | 63 | When prompted for a platform, select mswin32. 64 | 65 | === Linux, BSD, Cygwin 66 | 67 | On Linux/BSD/Cygwin, use your default package manager, for example, for Ubuntu: 68 | 69 | $ sudo apt-get install ruby 70 | $ sudo apt-get install ruby1.8-dev 71 | $ sudo apt-get install build-essential 72 | $ sudo apt-get install libopenssl-ruby 73 | 74 | Before installing Buildr, please set the JAVA_HOME environment variable to 75 | point to your JDK distribution. Next, use Ruby Gem to install Buildr: 76 | 77 | $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr 78 | 79 | When prompted for a platform, select ruby. 80 | 81 | === OS X 82 | 83 | Leopard includes the latest version of Ruby, if you are using Tiger or an older 84 | release, we recommend re-installing the latest: 85 | 86 | http://hivelogic.com/narrative/articles/ruby-rails-mongrel-mysql-osx 87 | 88 | To install Buildr: 89 | 90 | $ sudo gem install buildr 91 | 92 | When prompted for a platform, select ruby. 93 | 94 | 95 | == Living On the Edge 96 | 97 | You can check the latest sources from GIT: 98 | 99 | git clone http://git.apache.org/buildr.git 100 | 101 | If you prefer GitHub, a mirror is available from http://github.com/apache/buildr: 102 | 103 | git clone git://github.com/apache/buildr.git 104 | 105 | To install Buildr locally from source: 106 | 107 | cd buildr 108 | export JRUBY_OPTS="-J-XX:MaxPermSize=312m -J-Xmx1024M" 109 | export JAVA_OPTS="-Xmx1024m -XX:MaxPermSize=312m" 110 | rake install 111 | 112 | If the cutting edge doesn't work, make sure to check the CHANGELOG, to see 113 | which changes might have broken your build. To run all the test cases: 114 | 115 | rake spec 116 | 117 | == License 118 | 119 | Licensed to the Apache Software Foundation (ASF) under one or more 120 | contributor license agreements. See the NOTICE file distributed with this 121 | work for additional information regarding copyright ownership. The ASF 122 | licenses this file to you under the Apache License, Version 2.0 (the 123 | "License"); you may not use this file except in compliance with the License. 124 | You may obtain a copy of the License at 125 | 126 | http://www.apache.org/licenses/LICENSE-2.0 127 | 128 | Unless required by applicable law or agreed to in writing, software 129 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 130 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 131 | License for the specific language governing permissions and limitations under 132 | the License. 133 | --------------------------------------------------------------------------------