| Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
|---|---|---|---|---|
| lib/buildr/java/ant.rb | 94 | 44 | 28.72%
|
36.36%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
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 require 'buildr/core/project' |
21 require 'buildr/core/help' |
22 |
23 |
24 module Buildr |
25 module Ant |
26 |
27 # Which version of Ant we're using by default. |
28 VERSION = '1.8.0' |
29 |
30 class << self |
31 # Current version of Ant being used. |
32 def version |
33 Buildr.settings.build['ant'] || VERSION |
34 end |
35 |
36 # Ant classpath dependencies. |
37 def dependencies |
38 # Ant-Trax required for running the JUnitReport task, and there's no other place |
39 # to put it but the root classpath. |
40 @dependencies ||= ["org.apache.ant:ant:jar:#{version}", "org.apache.ant:ant-launcher:jar:#{version}", |
41 "org.apache.ant:ant-trax:jar:#{version}"] |
42 end |
43 |
44 private |
45 def const_missing(const) |
46 return super unless const == :REQUIRES # TODO: remove in 1.5 |
47 Buildr.application.deprecated "Please use Ant.dependencies/.version instead of Ant::REQUIRES/VERSION" |
48 dependencies |
49 end |
50 end |
51 |
52 |
53 Java.classpath << lambda { Ant.dependencies } |
54 |
55 # :call-seq: |
56 # ant(name) { |AntProject| ... } => AntProject |
57 # |
58 # Creates a new AntProject with the specified name, yield to the block for defining various |
59 # Ant tasks, and executes each task as it's defined. |
60 # |
61 # For example: |
62 # ant("hibernatedoclet') do |doclet| |
63 # doclet.taskdef :name=>'hibernatedoclet', |
64 # :classname=>'xdoclet.modules.hibernate.HibernateDocletTask', :classpath=>DOCLET |
65 # doclet.hibernatedoclet :destdir=>dest_dir, :force=>'true' do |
66 # hibernate :version=>'3.0' |
67 # fileset :dir=>source, :includes=>'**/*.java' |
68 # end |
69 # end |
70 def ant(name, &block) |
71 options = { :name=>name, :basedir=>Dir.pwd, :declarative=>true } |
72 options.merge!(:logger=> Logger.new(STDOUT), :loglevel=> Logger::DEBUG) if trace?(:ant) |
73 Java.load |
74 Antwrap::AntProject.new(options).tap do |project| |
75 # Set Ant logging level to debug (--trace), info (default) or error only (--quiet). |
76 project.project.getBuildListeners().get(0). |
77 setMessageOutputLevel((trace?(:ant) && 4) || (verbose && 2) || 0) |
78 yield project if block_given? |
79 end |
80 end |
81 |
82 end |
83 |
84 include Ant |
85 class Project |
86 include Ant |
87 end |
88 |
89 Buildr.help do |
90 Java.load |
91 "\nUsing Java #{ENV_JAVA['java.version']}, Ant #{Ant.version}." |
92 end |
93 |
94 end |
Generated on 2011-07-06 23:35:37 -0700 with rcov 0.9.8