buildr 1.4.7.pre2-java → 1.4.8-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +65 -2
- data/Rakefile +3 -6
- data/addon/buildr/bnd.rb +13 -3
- data/addon/buildr/{checkstyle.rake → checkstyle.rb} +1 -1
- data/addon/buildr/{findbugs.rake → findbugs.rb} +0 -0
- data/addon/buildr/git_auto_version.rb +33 -0
- data/addon/buildr/gwt.rb +82 -0
- data/addon/buildr/jacoco.rb +194 -0
- data/addon/buildr/{javancss.rake → javancss.rb} +0 -0
- data/addon/buildr/nailgun.rb +2 -2
- data/addon/buildr/{pmd.rake → pmd.rb} +3 -1
- data/addon/buildr/sonar.rb +142 -0
- data/buildr.buildfile +1 -1
- data/buildr.gemspec +37 -26
- data/doc/_layouts/default.html +0 -2
- data/doc/contributing.textile +47 -0
- data/doc/download.textile +24 -0
- data/doc/index.textile +43 -23
- data/doc/languages.textile +65 -6
- data/doc/more_stuff.textile +43 -0
- data/doc/packaging.textile +2 -0
- data/doc/settings_profiles.textile +1 -1
- data/etc/KEYS +44 -0
- data/lib/buildr.rb +3 -7
- data/lib/buildr/core/application.rb +41 -8
- data/lib/buildr/core/build.rb +102 -1
- data/lib/buildr/core/cc.rb +14 -8
- data/lib/buildr/core/doc.rb +9 -3
- data/lib/buildr/core/generate.rb +150 -9
- data/lib/buildr/core/run.rb +1 -1
- data/lib/buildr/core/shell.rb +1 -1
- data/lib/buildr/core/test.rb +1 -1
- data/lib/buildr/core/util.rb +5 -5
- data/lib/buildr/ide/eclipse.rb +118 -4
- data/lib/buildr/ide/idea.rb +278 -1
- data/lib/buildr/java/ant.rb +2 -3
- data/lib/buildr/java/bdd.rb +4 -4
- data/lib/buildr/java/commands.rb +1 -1
- data/lib/buildr/java/pom.rb +5 -4
- data/lib/buildr/java/rjb.rb +5 -4
- data/lib/buildr/java/test_result.rb +4 -0
- data/lib/buildr/packaging/artifact.rb +1 -1
- data/lib/buildr/packaging/version_requirement.rb +1 -1
- data/lib/buildr/packaging/zip.rb +1 -1
- data/lib/buildr/packaging/ziptask.rb +2 -2
- data/lib/buildr/run.rb +3 -2
- data/lib/buildr/scala.rb +1 -1
- data/lib/buildr/scala/bdd.rb +9 -2
- data/lib/buildr/scala/compiler.rb +94 -4
- data/lib/buildr/scala/doc.rb +17 -5
- data/lib/buildr/scala/org/apache/buildr/Specs2Runner.class +0 -0
- data/lib/buildr/scala/tests.rb +15 -4
- data/lib/buildr/version.rb +1 -1
- data/rakelib/all-in-one.rake +50 -47
- data/rakelib/checks.rake +4 -4
- data/rakelib/doc.rake +84 -87
- data/rakelib/metrics.rake +9 -9
- data/rakelib/package.rake +14 -35
- data/rakelib/release.rake +11 -12
- data/rakelib/rspec.rake +73 -60
- data/rakelib/stage.rake +32 -54
- data/spec/addon/bnd_spec.rb +61 -7
- data/spec/core/application_spec.rb +1 -1
- data/spec/core/build_spec.rb +117 -0
- data/spec/core/cc_spec.rb +37 -15
- data/spec/core/common_spec.rb +3 -2
- data/spec/core/compile_spec.rb +3 -3
- data/spec/core/doc_spec.rb +1 -1
- data/spec/core/generate_from_eclipse_spec.rb +280 -0
- data/spec/core/run_spec.rb +17 -4
- data/spec/core/test_spec.rb +5 -3
- data/spec/ide/idea_spec.rb +2 -2
- data/spec/java/bdd_spec.rb +2 -2
- data/spec/java/cobertura_spec.rb +4 -0
- data/spec/java/emma_spec.rb +4 -1
- data/spec/java/java_spec.rb +1 -1
- data/spec/java/packaging_spec.rb +2 -1
- data/spec/java/pom_spec.rb +125 -0
- data/spec/packaging/archive_spec.rb +25 -2
- data/spec/packaging/artifact_spec.rb +3 -3
- data/spec/sandbox.rb +7 -2
- data/spec/scala/compiler_spec.rb +41 -0
- data/spec/scala/doc_spec.rb +22 -3
- data/spec/scala/scala.rb +2 -2
- data/spec/scala/tests_spec.rb +2 -2
- data/spec/spec_helpers.rb +6 -1
- data/spec/version_requirement_spec.rb +2 -0
- metadata +651 -480
- data/lib/buildr/ide/eclipse/java.rb +0 -49
- data/lib/buildr/ide/eclipse/plugin.rb +0 -67
- data/lib/buildr/ide/eclipse/scala.rb +0 -64
data/CHANGELOG
CHANGED
|
@@ -1,4 +1,67 @@
|
|
|
1
|
-
1.4.
|
|
1
|
+
1.4.8 (2012-11-01)
|
|
2
|
+
* Change: Revert to importing non-verbose FileUtils utility methods to match buildr 1.4.6 release and earlier.
|
|
3
|
+
* Added: Experimental support for jacoco code coverage tool.
|
|
4
|
+
* Fixed: BUILDR-655 - Support JDK1.7 under OSX
|
|
5
|
+
* Change: Updated dependency versions;
|
|
6
|
+
- builder (3.1.3)
|
|
7
|
+
- rubyforge (2.0.4)
|
|
8
|
+
- net-ssh (2.6.0)
|
|
9
|
+
- hoe (3.1.0)
|
|
10
|
+
- rjb (1.4.2)
|
|
11
|
+
- rdoc (3.12)
|
|
12
|
+
- xml-simple (1.1.1)
|
|
13
|
+
- rspec-expectations (2.11.3)
|
|
14
|
+
- rspec-mocks (2.11.3)
|
|
15
|
+
- rspec-core (2.11.1)
|
|
16
|
+
- rspec (2.11.0)
|
|
17
|
+
- rubyzip (0.9.9)
|
|
18
|
+
* Added: BUILDR-652 Generate buildfile from Eclipse workspace. (Niklaus Giger)
|
|
19
|
+
* Fixed: BUILDR-627 Support explicitly listed source files in buildr cc task. (Christopher Tiwald)
|
|
20
|
+
* Fixed: BUILDR-606 Transitive artifact resolution should not include artifacts in 'provided' scope in poms to
|
|
21
|
+
match maven behaviour. (Julio Arias)
|
|
22
|
+
* Change: BUILDR-640 Enable building jekyll and rdoc under more rubies. (Niklaus Giger)
|
|
23
|
+
* Change: Mark Buildr:Bnd.remote_repository as deprecated as dependencies appear in maven central.
|
|
24
|
+
* Added: BUILDR-654 Add the ability to configure the version of BND used by bnd addon. (Niklaus Giger)
|
|
25
|
+
* Added: Create the git_auto_version addon that automatically specifies a version for a git project based
|
|
26
|
+
on git describe.
|
|
27
|
+
* Added: Integrate with Zinc (incremental compilation wrapper for scalac 2.9+)
|
|
28
|
+
* Change: Default to Scala 2.9.2, ScalaTest 1.8, Scala Specs2 1.11,
|
|
29
|
+
ScalaCheck 1.10.0.
|
|
30
|
+
* Change: Scala artifact repository changed to
|
|
31
|
+
http://oss.sonatype.org/content/repositories/releases
|
|
32
|
+
* Added: BUILDR-645 Support Mercurial as a version control system (Tan Quach)
|
|
33
|
+
* Fixed: BUILDR-646 TGZ files do not keep their permissions when extracted
|
|
34
|
+
via Buildr::Unzip#extract
|
|
35
|
+
* Added: Add add_exploded_ear_artifact and add_exploded_ejb_artifact to the idea project extension.
|
|
36
|
+
* Change: Default to using Checkstyle 5.5 in the checkstyle addon.
|
|
37
|
+
* Fixed: Fix the add_exploded_war_artifact method on the idea project by adding in missing method
|
|
38
|
+
`partition_dependencies`.
|
|
39
|
+
* Fixed: Fix the extension of the gwt plugin so that it can be required as an addon.
|
|
40
|
+
* Fixed: Fix the undefined default_web_xml variable in the add_web_facet method on the idea project.
|
|
41
|
+
|
|
42
|
+
1.4.7 (2012-05-29)
|
|
43
|
+
* Added: BUILDR-618 pom properties feature does not support hierarchy (kafka liu)
|
|
44
|
+
* Added: Add a Sonar extension.
|
|
45
|
+
* Change: BUILDR-638 Update to rake 0.9.2.2 (Russell Teabeault)
|
|
46
|
+
* Added: BUILDR-316 Add a GWT extension
|
|
47
|
+
* Change: BUILDR-624 Update rspec version to 2.9.0 (Russell Teabeault)
|
|
48
|
+
* Change: BUILDR-632 Update net-ssh version to 2.3.0 (Russell Teabeault)
|
|
49
|
+
* Change: BUILDR-632 Update net-sftp version to 2.0.5 (Russell Teabeault)
|
|
50
|
+
* Fixed: BUILDR-635 JRE container entry to be declared before user sources and dependencies (Dani Perez)
|
|
51
|
+
* Change: BUILDR-639 Stop requiring pygmentize to run "rake -T" (Russell Teabeault)
|
|
52
|
+
* Added: Enhance the IDEA extension to support the addition of several explicit facets such as
|
|
53
|
+
ejb, jruby, jpa, web and gwt.
|
|
54
|
+
* Added: Add several utility methods to IDEA extension for defining artifacts and configurations.
|
|
55
|
+
Add some explicit methods to support a gwt configuration and a "Exploded War" artifact.
|
|
56
|
+
* Change: Upgraded to Apache Ant 1.8.3
|
|
57
|
+
* Change: Default maven2 repository is now repo1.maven.org/maven2.
|
|
58
|
+
* Change: Make minimumTokenCount and encoding configurable for the PMD/CPD action
|
|
59
|
+
and default encoding to UTF-8 for compatibility with external tools (i.e. Jenkins)
|
|
60
|
+
* Change: BUILDR-615 VersionRequirement.version? now returns true for
|
|
61
|
+
versions following pattern "r9999", e.g. "r09"
|
|
62
|
+
* Change: BUILDR-630 Run task should not add test dependencies (Russell Teabeault)
|
|
63
|
+
* Change: BUILDR-629 JavaRunner should include target/resources in classpath (Russell Teabeault)
|
|
64
|
+
* Fixed: BUILDR-617 pom exclusion does not work (Kafka Liu)
|
|
2
65
|
* Added: Add a Findbugs extension.
|
|
3
66
|
* Added: Add a Checkstyle extension.
|
|
4
67
|
* Added: Add a JavaNCSS extension.
|
|
@@ -43,7 +106,7 @@
|
|
|
43
106
|
* Change: Move to Bundler to manage the project dependencies
|
|
44
107
|
* Change: BUILDR-548 Remove support for JTestR as it is no longer maintained (Antoine Toulme)
|
|
45
108
|
* Change: BUILDR-614 Buildr development - Using rvm, bundler and OSX installs the wrong rjb (Russell Teabeault)
|
|
46
|
-
* Change: Upgrade to RJB 1.
|
|
109
|
+
* Change: Upgrade to RJB 1.4.0
|
|
47
110
|
* Fixed: ArtifactNamespace fails when using artifacts with classfier.
|
|
48
111
|
* Fixed: Buildr.artifacts() should handle any object with :to_spec method
|
|
49
112
|
(i.e., any object that ActsAsArtifact)
|
data/Rakefile
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
# License for the specific language governing permissions and limitations under
|
|
14
14
|
# the License.
|
|
15
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
|
+
|
|
16
19
|
# We need JAVA_HOME for most things (setup, spec, etc).
|
|
17
20
|
unless ENV['JAVA_HOME']
|
|
18
21
|
if RUBY_PLATFORM[/java/]
|
|
@@ -34,11 +37,5 @@ def spec(platform = RUBY_PLATFORM[/java/] || 'ruby')
|
|
|
34
37
|
@specs[platform]
|
|
35
38
|
end
|
|
36
39
|
|
|
37
|
-
# Tell us if we need sudo for various commands.
|
|
38
|
-
def sudo_needed?
|
|
39
|
-
Config::CONFIG['host_os'] !~ /windows|cygwin|bccwin|cygwin|djgpp|mingw|mswin|wince/i && !ENV['GEM_HOME']
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
|
|
43
40
|
desc 'Clean up all temporary directories used for running tests, creating documentation, packaging, etc.'
|
|
44
41
|
task :clobber
|
data/addon/buildr/bnd.rb
CHANGED
|
@@ -16,14 +16,24 @@
|
|
|
16
16
|
module Buildr
|
|
17
17
|
module Bnd
|
|
18
18
|
class << self
|
|
19
|
+
@@version = '1.50.0'
|
|
20
|
+
def version
|
|
21
|
+
@@version
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def version=(newVersion)
|
|
25
|
+
@@version = newVersion
|
|
26
|
+
end
|
|
27
|
+
|
|
19
28
|
# The specs for requirements
|
|
20
29
|
def dependencies
|
|
21
|
-
["biz.aQute:bnd:jar
|
|
30
|
+
["biz.aQute:bnd:jar:#{version}"]
|
|
22
31
|
end
|
|
23
32
|
|
|
24
33
|
# Repositories containing the requirements
|
|
25
34
|
def remote_repository
|
|
26
|
-
"
|
|
35
|
+
Buildr.application.deprecated "'Buildr:Bnd.remote_repository deprecated as the dependencies appear in maven central."
|
|
36
|
+
"http://www.aqute.biz/repo"
|
|
27
37
|
end
|
|
28
38
|
|
|
29
39
|
def bnd_main(*args)
|
|
@@ -102,7 +112,7 @@ module Buildr
|
|
|
102
112
|
f.print params.collect { |k, v| "#{k}=#{v}" }.join("\n")
|
|
103
113
|
end
|
|
104
114
|
|
|
105
|
-
Buildr::Bnd.bnd_main(
|
|
115
|
+
Buildr::Bnd.bnd_main( bnd_filename )
|
|
106
116
|
begin
|
|
107
117
|
Buildr::Bnd.bnd_main( "print", "-verify", filename )
|
|
108
118
|
rescue => e
|
|
@@ -23,7 +23,7 @@ module Buildr
|
|
|
23
23
|
# The specs for requirements
|
|
24
24
|
def dependencies
|
|
25
25
|
[
|
|
26
|
-
'com.puppycrawl.tools:checkstyle:jar:5.
|
|
26
|
+
'com.puppycrawl.tools:checkstyle:jar:5.5',
|
|
27
27
|
'commons-cli:commons-cli:jar:1.2',
|
|
28
28
|
'antlr:antlr:jar:2.7.7',
|
|
29
29
|
'com.google.collections:google-collections:jar:1.0',
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
project.version = `git describe --tags --always`.strip + version_suffix
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class Buildr::Project
|
|
32
|
+
include Buildr::GitAutoVersion::ProjectExtension
|
|
33
|
+
end
|
data/addon/buildr/gwt.rb
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
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 GWT
|
|
18
|
+
|
|
19
|
+
class << self
|
|
20
|
+
# The specs for requirements
|
|
21
|
+
def dependencies
|
|
22
|
+
['com.google.gwt:gwt-dev:jar:2.4.0']
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def gwtc_main(modules, source_artifacts, output_dir, options = {})
|
|
26
|
+
cp = Buildr.artifacts(self.dependencies).each(&:invoke).map(&:to_s) + Buildr.artifacts(source_artifacts).each(&:invoke).map(&:to_s)
|
|
27
|
+
style = options[:style] || "OBFUSCATED," # "PRETTY", "DETAILED"
|
|
28
|
+
log_level = options[:log_level] # ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL
|
|
29
|
+
workers = options[:workers] || 2
|
|
30
|
+
|
|
31
|
+
args = []
|
|
32
|
+
if log_level
|
|
33
|
+
args << "-logLevel"
|
|
34
|
+
args << log_level
|
|
35
|
+
end
|
|
36
|
+
args << "-strict"
|
|
37
|
+
args << "-style"
|
|
38
|
+
args << style
|
|
39
|
+
args << "-localWorkers"
|
|
40
|
+
args << workers
|
|
41
|
+
args << "-war"
|
|
42
|
+
args << output_dir
|
|
43
|
+
if options[:compile_report_dir]
|
|
44
|
+
args << "-compileReport"
|
|
45
|
+
args << "-extra"
|
|
46
|
+
args << options[:compile_report_dir]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
if options[:draft_compile]
|
|
50
|
+
args << "-draftCompile"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
args += modules
|
|
54
|
+
|
|
55
|
+
Java::Commands.java 'com.google.gwt.dev.Compiler', *(args + [{:classpath => cp, :properties => options[:properties], :java_args => options[:java_args]}])
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
module ProjectExtension
|
|
60
|
+
include Extension
|
|
61
|
+
|
|
62
|
+
def gwt(module_names, options = {})
|
|
63
|
+
output_key = options[:output_key] || project.id
|
|
64
|
+
output_dir = project._(:target, :generated, :gwt, output_key)
|
|
65
|
+
artifacts = (project.compile.sources + project.resources.sources).collect do |a|
|
|
66
|
+
a.is_a?(String) ? file(a) : a
|
|
67
|
+
end
|
|
68
|
+
dependencies = artifacts(options[:dependencies]) || project.compile.dependencies
|
|
69
|
+
task = file(output_dir) do
|
|
70
|
+
Buildr::GWT.gwtc_main(module_names, dependencies + artifacts, output_dir, options.dup)
|
|
71
|
+
end
|
|
72
|
+
task.enhance(dependencies)
|
|
73
|
+
task.enhance([project.compile])
|
|
74
|
+
task
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
class Buildr::Project
|
|
81
|
+
include Buildr::GWT::ProjectExtension
|
|
82
|
+
end
|
|
@@ -0,0 +1,194 @@
|
|
|
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
|
+
# Initial support for JaCoCo coverage reports.
|
|
18
|
+
# WARNING: Experimental and may change radically.
|
|
19
|
+
module JaCoCo
|
|
20
|
+
class << self
|
|
21
|
+
VERSION = '0.5.10.201208310627'
|
|
22
|
+
|
|
23
|
+
def version
|
|
24
|
+
@version || Buildr.settings.build['jacoco'] || VERSION
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def version=(value)
|
|
28
|
+
@version = value
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def agent_spec
|
|
32
|
+
["org.jacoco:org.jacoco.agent:jar:runtime:#{version}"]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def ant_spec
|
|
36
|
+
[
|
|
37
|
+
"org.jacoco:org.jacoco.report:jar:#{version}",
|
|
38
|
+
"org.jacoco:org.jacoco.core:jar:#{version}",
|
|
39
|
+
"org.jacoco:org.jacoco.ant:jar:#{version}",
|
|
40
|
+
'asm:asm:jar:3.3.1',
|
|
41
|
+
'asm:asm-commons:jar:3.3.1',
|
|
42
|
+
'asm:asm-tree:jar:3.3.1'
|
|
43
|
+
]
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class Config
|
|
48
|
+
|
|
49
|
+
attr_writer :enabled
|
|
50
|
+
|
|
51
|
+
def enabled?
|
|
52
|
+
@enabled.nil? ? true : @enabled
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
attr_writer :destfile
|
|
56
|
+
|
|
57
|
+
def destfile
|
|
58
|
+
@destfile || "#{self.report_dir}/jacoco.cov"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
attr_writer :output
|
|
62
|
+
|
|
63
|
+
def output
|
|
64
|
+
@output || 'file'
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
attr_accessor :sessionid
|
|
68
|
+
attr_accessor :address
|
|
69
|
+
attr_accessor :port
|
|
70
|
+
attr_accessor :classdumpdir
|
|
71
|
+
attr_accessor :dumponexit
|
|
72
|
+
attr_accessor :append
|
|
73
|
+
attr_accessor :exclclassloader
|
|
74
|
+
|
|
75
|
+
def includes
|
|
76
|
+
@includes ||= []
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def excludes
|
|
80
|
+
@excludes ||= []
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
attr_writer :report_dir
|
|
84
|
+
|
|
85
|
+
def report_dir
|
|
86
|
+
@report_dir || project._(:reports, :jacoco)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
attr_writer :generate_xml
|
|
90
|
+
|
|
91
|
+
def generate_xml?
|
|
92
|
+
@generate_xml.nil? ? false : @generate_xml
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
attr_writer :xml_output_file
|
|
96
|
+
|
|
97
|
+
def xml_output_file
|
|
98
|
+
@xml_output_file || "#{self.report_dir}/jacoco.xml"
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
attr_writer :generate_html
|
|
102
|
+
|
|
103
|
+
def generate_html?
|
|
104
|
+
@generate_html.nil? ? false : @generate_html
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
attr_writer :html_output_directory
|
|
108
|
+
|
|
109
|
+
def html_output_directory
|
|
110
|
+
@html_output_directory || "#{self.report_dir}/jacoco"
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
protected
|
|
114
|
+
|
|
115
|
+
def initialize(project)
|
|
116
|
+
@project = project
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
attr_reader :project
|
|
120
|
+
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
module ProjectExtension
|
|
124
|
+
include Extension
|
|
125
|
+
|
|
126
|
+
def jacoco
|
|
127
|
+
@jacoco ||= Buildr::JaCoCo::Config.new(project)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
after_define do |project|
|
|
131
|
+
unless project.test.compile.target.nil? || !project.jacoco.enabled?
|
|
132
|
+
project.test.setup do
|
|
133
|
+
agent_jar = Buildr.artifacts(Buildr::JaCoCo.agent_spec).each(&:invoke).map(&:to_s).join('')
|
|
134
|
+
options = []
|
|
135
|
+
["destfile",
|
|
136
|
+
"append",
|
|
137
|
+
"exclclassloader",
|
|
138
|
+
"sessionid",
|
|
139
|
+
"dumponexit",
|
|
140
|
+
"output",
|
|
141
|
+
"address",
|
|
142
|
+
"port",
|
|
143
|
+
"classdumpdir"].each do |option|
|
|
144
|
+
value = project.jacoco.send(option.to_sym)
|
|
145
|
+
options << "#{option}=#{value}" unless value.nil?
|
|
146
|
+
end
|
|
147
|
+
options << "includes=#{project.jacoco.includes.join(':')}" unless project.jacoco.includes.empty?
|
|
148
|
+
options << "excludes=#{project.jacoco.excludes.join(':')}" unless project.jacoco.excludes.empty?
|
|
149
|
+
|
|
150
|
+
agent_config = "-javaagent:#{agent_jar}=#{options.join(',')}"
|
|
151
|
+
project.test.options[:java_args] = (project.test.options[:java_args] || []) + [agent_config]
|
|
152
|
+
end
|
|
153
|
+
namespace 'jacoco' do
|
|
154
|
+
if project.jacoco.generate_xml?
|
|
155
|
+
desc "Generate JaCoCo reports."
|
|
156
|
+
task 'reports' do
|
|
157
|
+
Buildr.ant "jacoco" do |ant|
|
|
158
|
+
ant.taskdef(:resource => "org/jacoco/ant/antlib.xml") do |ant|
|
|
159
|
+
ant.classpath :path => Buildr.artifacts(Buildr::JaCoCo.ant_spec).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
|
|
160
|
+
end
|
|
161
|
+
ant.report do |ant|
|
|
162
|
+
ant.executiondata do |ant|
|
|
163
|
+
ant.file :file => project.jacoco.destfile
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
ant.structure(:name => project.name) do |ant|
|
|
167
|
+
if project.compile.target
|
|
168
|
+
ant.classfiles do |ant|
|
|
169
|
+
ant.fileset :dir => project.compile.target
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
ant.sourcefiles(:encoding => "UTF-8") do |ant|
|
|
173
|
+
project.compile.sources.each do |path|
|
|
174
|
+
ant.fileset :dir => path.to_s
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
ant.xml :destfile => project.jacoco.xml_output_file if project.jacoco.generate_xml?
|
|
180
|
+
ant.html :destdir => project.jacoco.html_output_directory if project.jacoco.generate_html?
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
class Buildr::Project
|
|
193
|
+
include Buildr::JaCoCo::ProjectExtension
|
|
194
|
+
end
|