vic-buildr 1.3.1 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. data/CHANGELOG +90 -8
  2. data/{README → README.rdoc} +29 -16
  3. data/Rakefile +17 -19
  4. data/_buildr +50 -0
  5. data/addon/buildr/cobertura.rb +47 -44
  6. data/addon/buildr/emma.rb +237 -0
  7. data/addon/buildr/jetty.rb +1 -1
  8. data/addon/buildr/nailgun.rb +581 -661
  9. data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail$Main.class +0 -0
  10. data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail.class +0 -0
  11. data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail.java +0 -0
  12. data/addon/buildr/xmlbeans.rb +1 -1
  13. data/bin/buildr +9 -2
  14. data/buildr.buildfile +53 -0
  15. data/buildr.gemspec +23 -15
  16. data/doc/css/default.css +51 -48
  17. data/doc/css/print.css +60 -55
  18. data/doc/css/syntax.css +40 -31
  19. data/doc/images/growl-icon.tiff +0 -0
  20. data/doc/images/project-structure.png +0 -0
  21. data/doc/pages/artifacts.textile +46 -156
  22. data/doc/pages/building.textile +63 -324
  23. data/doc/pages/contributing.textile +116 -88
  24. data/doc/pages/download.textile +20 -15
  25. data/doc/pages/extending.textile +27 -81
  26. data/doc/pages/getting_started.textile +47 -111
  27. data/doc/pages/index.textile +19 -37
  28. data/doc/pages/languages.textile +407 -0
  29. data/doc/pages/more_stuff.textile +92 -173
  30. data/doc/pages/packaging.textile +72 -237
  31. data/doc/pages/projects.textile +58 -233
  32. data/doc/pages/recipes.textile +19 -43
  33. data/doc/pages/settings_profiles.textile +39 -104
  34. data/doc/pages/testing.textile +41 -304
  35. data/doc/pages/troubleshooting.textile +29 -47
  36. data/doc/pages/whats_new.textile +66 -157
  37. data/doc/print.haml +0 -1
  38. data/doc/print.toc.yaml +1 -0
  39. data/doc/scripts/buildr-git.rb +1 -1
  40. data/doc/scripts/install-jruby.sh +1 -1
  41. data/doc/scripts/install-linux.sh +4 -4
  42. data/doc/site.toc.yaml +8 -5
  43. data/{KEYS → etc/KEYS} +0 -0
  44. data/etc/git-svn-authors +16 -0
  45. data/lib/buildr.rb +2 -13
  46. data/lib/buildr/core/application.rb +200 -95
  47. data/lib/buildr/core/application_cli.rb +6 -1
  48. data/lib/buildr/core/build.rb +140 -91
  49. data/lib/buildr/core/checks.rb +5 -5
  50. data/lib/buildr/core/common.rb +1 -1
  51. data/lib/buildr/core/compile.rb +14 -12
  52. data/lib/buildr/core/filter.rb +151 -46
  53. data/lib/buildr/core/generate.rb +9 -7
  54. data/lib/buildr/core/progressbar.rb +1 -1
  55. data/lib/buildr/core/project.rb +8 -7
  56. data/lib/buildr/core/test.rb +54 -29
  57. data/lib/buildr/core/transports.rb +25 -20
  58. data/lib/buildr/core/util.rb +80 -26
  59. data/lib/buildr/groovy.rb +18 -0
  60. data/lib/buildr/groovy/bdd.rb +105 -0
  61. data/lib/buildr/groovy/compiler.rb +138 -0
  62. data/lib/buildr/ide/eclipse.rb +102 -71
  63. data/lib/buildr/ide/idea.rb +7 -12
  64. data/lib/buildr/ide/idea7x.rb +20 -20
  65. data/lib/buildr/java.rb +4 -7
  66. data/lib/buildr/java/ant.rb +26 -5
  67. data/lib/buildr/java/bdd.rb +447 -0
  68. data/lib/buildr/java/commands.rb +8 -9
  69. data/lib/buildr/java/{compilers.rb → compiler.rb} +8 -90
  70. data/lib/buildr/java/jruby.rb +29 -11
  71. data/lib/buildr/java/jtestr_runner.rb.erb +114 -0
  72. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  73. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +4 -1
  74. data/lib/buildr/java/packaging.rb +23 -16
  75. data/lib/buildr/java/pom.rb +1 -1
  76. data/lib/buildr/java/rjb.rb +21 -8
  77. data/lib/buildr/java/test_result.rb +277 -0
  78. data/lib/buildr/java/{test_frameworks.rb → tests.rb} +121 -88
  79. data/lib/buildr/packaging/artifact.rb +12 -11
  80. data/lib/buildr/packaging/artifact_namespace.rb +7 -4
  81. data/lib/buildr/packaging/gems.rb +3 -3
  82. data/lib/buildr/packaging/zip.rb +13 -10
  83. data/lib/buildr/resources/buildr.icns +0 -0
  84. data/lib/buildr/scala.rb +19 -0
  85. data/lib/buildr/scala/compiler.rb +109 -0
  86. data/lib/buildr/scala/tests.rb +203 -0
  87. data/rakelib/apache.rake +31 -41
  88. data/rakelib/doc.rake +2 -2
  89. data/rakelib/package.rake +31 -2
  90. data/rakelib/rspec.rake +22 -20
  91. data/rakelib/rubyforge.rake +1 -0
  92. data/rakelib/setup.rake +34 -9
  93. data/spec/addon/cobertura_spec.rb +77 -0
  94. data/spec/addon/emma_spec.rb +120 -0
  95. data/spec/addon/test_coverage_spec.rb +249 -0
  96. data/spec/{application_spec.rb → core/application_spec.rb} +82 -4
  97. data/spec/{artifact_namespace_spec.rb → core/artifact_namespace_spec.rb} +12 -1
  98. data/spec/core/build_spec.rb +415 -0
  99. data/spec/{checks_spec.rb → core/checks_spec.rb} +1 -1
  100. data/spec/{common_spec.rb → core/common_spec.rb} +119 -30
  101. data/spec/{compile_spec.rb → core/compile_spec.rb} +17 -13
  102. data/spec/{project_spec.rb → core/project_spec.rb} +9 -6
  103. data/spec/{test_spec.rb → core/test_spec.rb} +226 -32
  104. data/spec/{transport_spec.rb → core/transport_spec.rb} +35 -23
  105. data/spec/groovy/bdd_spec.rb +80 -0
  106. data/spec/{groovy_compilers_spec.rb → groovy/compiler_spec.rb} +1 -1
  107. data/spec/ide/eclipse_spec.rb +243 -0
  108. data/spec/{java_spec.rb → java/ant.rb} +7 -17
  109. data/spec/java/bdd_spec.rb +358 -0
  110. data/spec/{java_compilers_spec.rb → java/compiler_spec.rb} +1 -1
  111. data/spec/java/java_spec.rb +88 -0
  112. data/spec/{java_packaging_spec.rb → java/packaging_spec.rb} +65 -4
  113. data/spec/{java_test_frameworks_spec.rb → java/tests_spec.rb} +50 -10
  114. data/spec/{archive_spec.rb → packaging/archive_spec.rb} +12 -2
  115. data/spec/{artifact_spec.rb → packaging/artifact_spec.rb} +10 -3
  116. data/spec/{packaging_helper.rb → packaging/packaging_helper.rb} +0 -0
  117. data/spec/{packaging_spec.rb → packaging/packaging_spec.rb} +1 -1
  118. data/spec/sandbox.rb +25 -4
  119. data/spec/{scala_compilers_spec.rb → scala/compiler_spec.rb} +1 -1
  120. data/spec/scala/tests_spec.rb +215 -0
  121. data/spec/spec_helpers.rb +38 -17
  122. metadata +119 -69
  123. data/lib/buildr/java/bdd_frameworks.rb +0 -265
  124. data/lib/buildr/java/groovyc.rb +0 -137
  125. data/spec/build_spec.rb +0 -193
  126. data/spec/java_bdd_frameworks_spec.rb +0 -238
  127. data/spec/spec.opts +0 -6
@@ -35,15 +35,6 @@ module Buildr
35
35
 
36
36
  after_define do |project|
37
37
  eclipse = project.task("eclipse")
38
- # We need paths relative to the top project's base directory.
39
- root_path = lambda { |p| f = lambda { |p| p.parent ? f[p.parent] : p.base_dir } ; f[p] }[project]
40
-
41
- # We want the Eclipse files changed every time the Buildfile changes, but also anything loaded by
42
- # the Buildfile (buildr.rb, separate file listing dependencies, etc), so we add anything required
43
- # after the Buildfile. So which don't know where Buildr shows up exactly, ignore files that show
44
- # in $LOADED_FEATURES that we cannot resolve.
45
- sources = Buildr.application.build_files.map { |file| File.expand_path(file) }.select { |file| File.exist?(file) }
46
- sources << File.expand_path(Buildr.application.buildfile, root_path) if Buildr.application.buildfile
47
38
 
48
39
  # Check if project has scala facet
49
40
  scala = project.compile.language == :scala
@@ -56,23 +47,14 @@ module Buildr
56
47
  eclipse.enhance [ file(project.path_to(".classpath")), file(project.path_to(".project")) ]
57
48
 
58
49
  # The only thing we need to look for is a change in the Buildfile.
59
- file(project.path_to(".classpath")=>sources) do |task|
60
- puts "Writing #{task.name}" if verbose
61
-
62
- # Find a path relative to the project's root directory.
63
- relative = lambda do |path|
64
- path or raise "Invalid path '#{path.inspect}'"
65
- msg = [:to_path, :to_str, :to_s].find { |msg| path.respond_to? msg }
66
- path = path.__send__(msg)
67
- Util.relative_path(File.expand_path(path), project.path_to)
68
- end
50
+ file(project.path_to(".classpath")=>Buildr.application.buildfile) do |task|
51
+ info "Writing #{task.name}"
69
52
 
70
53
  m2repo = Buildr::Repositories.instance.local
71
- excludes = [ '**/.svn/', '**/CVS/' ].join('|')
72
54
 
73
55
  File.open(task.name, "w") do |file|
74
- xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)
75
- xml.classpath do
56
+ classpathentry = ClasspathEntryWriter.new project, file
57
+ classpathentry.write do
76
58
  # Note: Use the test classpath since Eclipse compiles both "main" and "test" classes using the same classpath
77
59
  cp = project.test.compile.dependencies.map(&:to_s) - [ project.compile.target.to_s, project.resources.target.to_s ]
78
60
  cp = cp.uniq
@@ -89,81 +71,49 @@ module Buildr
89
71
  # Generated: classpath elements in the project are assumed to be generated
90
72
  generated, libs = others.partition { |path| path.to_s.index(project.path_to.to_s) == 0 }
91
73
 
92
- srcs = project.compile.sources
93
-
94
- srcs = srcs.map { |src| relative[src] } + generated.map { |src| relative[src] }
95
- srcs.sort.uniq.each do |path|
96
- xml.classpathentry :kind=>'src', :path=>path, :excluding=>excludes
97
- end
98
-
99
- # Main resources implicitly copied into project.compile.target
100
- main_resource_sources = project.resources.sources.map { |src| relative[src] }
101
- main_resource_sources.each do |path|
102
- if File.exist? project.path_to(path)
103
- xml.classpathentry :kind=>'src', :path=>path, :excluding=>excludes
104
- end
105
- end
74
+ classpathentry.src project.compile.sources + generated
75
+ classpathentry.src project.resources
106
76
 
107
77
  if project.test.compile.target
108
- # Test classes are generated in a separate output directory
109
- test_sources = project.test.compile.sources.map { |src| relative[src] }
110
- test_sources.each do |paths|
111
- paths.sort.uniq.each do |path|
112
- xml.classpathentry :kind=>'src', :path=>path, :output => relative[project.test.compile.target], :excluding=>excludes
113
- end
114
- end
115
-
116
- # Test resources go in separate output directory as well
117
- project.test.resources.sources.each do |path|
118
- if File.exist? project.path_to(path)
119
- xml.classpathentry :kind=>'src', :path=>relative[path], :output => relative[project.test.compile.target], :excluding=>excludes
120
- end
121
- end
78
+ classpathentry.src project.test.compile
79
+ classpathentry.src project.test.resources
122
80
  end
123
81
 
124
82
  # Classpath elements from other projects
125
- project_libs.map(&:id).sort.uniq.each do |project_id|
126
- xml.classpathentry :kind=>'src', :combineaccessrules=>"false", :path=>"/#{project_id}"
127
- end
83
+ classpathentry.src_projects project_libs
128
84
 
129
- { :output => relative[project.compile.target],
130
- :lib => libs.map(&:to_s),
131
- :var => m2_libs.map { |path| path.to_s.sub(m2repo, 'M2_REPO') }
132
- }.each do |kind, paths|
133
- paths.sort.uniq.each do |path|
134
- xml.classpathentry :kind=>kind, :path=>path
135
- end
136
- end
85
+ classpathentry.output project.compile.target
86
+ classpathentry.lib libs
87
+ classpathentry.var m2_libs, 'M2_REPO', m2repo
137
88
 
138
- xml.classpathentry :kind=>'con', :path=>'org.eclipse.jdt.launching.JRE_CONTAINER'
139
- xml.classpathentry :kind=>'con', :path=>'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER' if scala
89
+ classpathentry.con 'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER' if scala
90
+ classpathentry.con 'org.eclipse.jdt.launching.JRE_CONTAINER'
140
91
  end
141
92
  end
142
93
  end
143
94
 
144
95
  # The only thing we need to look for is a change in the Buildfile.
145
- file(project.path_to(".project")=>sources) do |task|
146
- puts "Writing #{task.name}" if verbose
96
+ file(project.path_to(".project")=>Buildr.application.buildfile) do |task|
97
+ info "Writing #{task.name}"
147
98
  File.open(task.name, "w") do |file|
148
99
  xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)
149
100
  xml.projectDescription do
150
101
  xml.name project.id
151
102
  xml.projects
152
103
  xml.buildSpec do
153
- xml.buildCommand do
154
- xml.name "org.eclipse.jdt.core.javabuilder"
155
- end
156
104
  if scala
157
105
  xml.buildCommand do
158
106
  xml.name "ch.epfl.lamp.sdt.core.scalabuilder"
159
- #xml.name "scala.plugin.scalabuilder"
107
+ end
108
+ else
109
+ xml.buildCommand do
110
+ xml.name "org.eclipse.jdt.core.javabuilder"
160
111
  end
161
112
  end
162
113
  end
163
114
  xml.natures do
164
- xml.nature "org.eclipse.jdt.core.javanature"
165
115
  xml.nature "ch.epfl.lamp.sdt.core.scalanature" if scala
166
- #xml.nature "scala.plugin.scalanature" if scala
116
+ xml.nature "org.eclipse.jdt.core.javanature"
167
117
  end
168
118
  end
169
119
  end
@@ -172,6 +122,87 @@ module Buildr
172
122
 
173
123
  end
174
124
 
125
+ # Writes 'classpathentry' tags in an xml file.
126
+ # It converts tasks to paths.
127
+ # It converts absolute paths to relative paths.
128
+ # It ignores duplicate directories.
129
+ class ClasspathEntryWriter
130
+ def initialize project, target
131
+ @project = project
132
+ @xml = Builder::XmlMarkup.new(:target=>target, :indent=>2)
133
+ @excludes = [ '**/.svn/', '**/CVS/' ].join('|')
134
+ @paths_written = []
135
+ end
136
+
137
+ def write &block
138
+ @xml.classpath &block
139
+ end
140
+
141
+ def con path
142
+ @xml.classpathentry :kind=>'con', :path=>path
143
+ end
144
+
145
+ def lib libs
146
+ libs.map(&:to_s).sort.uniq.each do |path|
147
+ @xml.classpathentry :kind=>'lib', :path=>path
148
+ end
149
+ end
150
+
151
+ # Write a classpathentry of kind 'src'.
152
+ # Accepts an array of absolute paths or a task.
153
+ def src arg
154
+ if [:sources, :target].all? { |message| arg.respond_to?(message) }
155
+ src_from_task arg
156
+ else
157
+ src_from_absolute_paths arg
158
+ end
159
+ end
160
+
161
+ # Write a classpathentry of kind 'src' for dependent projects.
162
+ # Accepts an array of projects.
163
+ def src_projects project_libs
164
+ project_libs.map(&:id).sort.uniq.each do |project_id|
165
+ @xml.classpathentry :kind=>'src', :combineaccessrules=>"false", :path=>"/#{project_id}"
166
+ end
167
+ end
168
+
169
+ def output target
170
+ @xml.classpathentry :kind=>'output', :path=>relative(target)
171
+ end
172
+
173
+ def var libs, var_name, var_value
174
+ libs.map { |lib| lib.to_s.sub(var_value, var_name) }.sort.uniq.each do |path|
175
+ @xml.classpathentry :kind=>'var', :path=>path
176
+ end
177
+ end
178
+
179
+ private
180
+
181
+ # Find a path relative to the project's root directory.
182
+ def relative path
183
+ path or raise "Invalid path '#{path.inspect}'"
184
+ msg = [:to_path, :to_str, :to_s].find { |msg| path.respond_to? msg }
185
+ path = path.__send__(msg)
186
+ Util.relative_path(File.expand_path(path), @project.path_to)
187
+ end
188
+
189
+ def src_from_task task
190
+ src_from_absolute_paths task.sources, task.target
191
+ end
192
+
193
+ def src_from_absolute_paths absolute_paths, output=nil
194
+ relative_paths = absolute_paths.map { |src| relative(src) }
195
+ relative_paths.sort.uniq.each do |path|
196
+ unless @paths_written.include?(path)
197
+ attributes = { :kind=>'src', :path=>path, :excluding=>@excludes }
198
+ attributes[:output] = relative(output) if output
199
+ @xml.classpathentry attributes
200
+ @paths_written << path
201
+ end
202
+ end
203
+ end
204
+ end
205
+
175
206
  end
176
207
  end # module Buildr
177
208
 
@@ -39,12 +39,6 @@ module Buildr
39
39
  idea = project.task("idea")
40
40
  # We need paths relative to the top project's base directory.
41
41
  root_path = lambda { |p| f = lambda { |p| p.parent ? f[p.parent] : p.base_dir }; f[p] }[project]
42
- # We want the Eclipse files changed every time the Buildfile changes, but also anything loaded by
43
- # the Buildfile (buildr.rb, separate file listing dependencies, etc), so we add anything required
44
- # after the Buildfile. So which don't know where Buildr shows up exactly, ignore files that show
45
- # in $LOADED_FEATURES that we cannot resolve.
46
- sources = Buildr.application.build_files.map { |file| File.expand_path(file) }.select { |file| File.exist?(file) }
47
- sources << File.expand_path(Buildr.application.buildfile, root_path) if Buildr.application.buildfile
48
42
 
49
43
  # Find a path relative to the project's root directory.
50
44
  relative = lambda { |path| Util.relative_path(path.to_s, project.path_to) }
@@ -57,8 +51,8 @@ module Buildr
57
51
  idea.enhance [ file(task_name) ]
58
52
 
59
53
  # The only thing we need to look for is a change in the Buildfile.
60
- file(task_name=>sources) do |task|
61
- puts "Writing #{task.name}" if verbose
54
+ file(task_name=>Buildr.application.buildfile) do |task|
55
+ info "Writing #{task.name}"
62
56
 
63
57
  # Idea handles modules slightly differently if they're WARs
64
58
  idea_types = Hash.new("JAVA_MODULE")
@@ -153,8 +147,8 @@ module Buildr
153
147
  task_name = project.path_to("#{project.name.gsub(':', '-')}.ipr")
154
148
  idea.enhance [ file(task_name) ]
155
149
 
156
- file(task_name=>sources) do |task|
157
- puts "Writing #{task.name}" if verbose
150
+ file(task_name=>Buildr.application.buildfile) do |task|
151
+ info "Writing #{task.name}"
158
152
 
159
153
  # Generating just the little stanza that chanages from one project to another
160
154
  partial = StringIO.new
@@ -178,8 +172,9 @@ module Buildr
178
172
  template_xml = REXML::Document.new(File.open(File.dirname(__FILE__)+"/idea.ipr.template"))
179
173
  include_xml = REXML::Document.new(partial.string)
180
174
  template_xml.root.add_element(include_xml.root)
181
- template_xml.write(File.new(task.name, "w"))
182
-
175
+ File.open task.name, 'w' do |file|
176
+ template_xml.write file
177
+ end
183
178
  end
184
179
  end
185
180
 
@@ -49,9 +49,6 @@ module Buildr
49
49
  # We need paths relative to the top project's base directory.
50
50
  root_path = lambda { |p| f = lambda { |p| p.parent ? f[p.parent] : p.base_dir }; f[p] }[project]
51
51
 
52
- sources = Buildr.application.build_files.map { |file| File.expand_path(file) }.select { |file| File.exist?(file) }
53
- sources << File.expand_path(Buildr.application.buildfile, root_path) if Buildr.application.buildfile
54
-
55
52
  # Find a path relative to the project's root directory.
56
53
  relative = lambda { |path| Util.relative_path(File.expand_path(path.to_s), project.path_to) }
57
54
 
@@ -63,7 +60,7 @@ module Buildr
63
60
  idea7x.enhance [ file(task_name) ]
64
61
 
65
62
  # The only thing we need to look for is a change in the Buildfile.
66
- file(task_name=>sources) do |task|
63
+ file(task_name=>Buildr.application.buildfile) do |task|
67
64
  # Note: Use the test classpath since Eclipse compiles both "main" and "test" classes using the same classpath
68
65
  deps = project.test.compile.dependencies.map(&:to_s) - [ project.compile.target.to_s ]
69
66
 
@@ -76,12 +73,9 @@ module Buildr
76
73
  # Separate artifacts from Maven2 repository
77
74
  m2_libs, others = others.partition { |path| path.to_s.index(m2repo) == 0 }
78
75
 
79
- # Generated: classpath elements in the project are assumed to be generated
80
- generated, libs = others.partition { |path| path.to_s.index(project.path_to.to_s) == 0 }
81
-
82
76
  # Project type is going to be the first package type
83
77
  if package = project.packages.first
84
- puts "Writing #{task.name}" if verbose
78
+ info "Writing #{task.name}"
85
79
  File.open(task.name, "w") do |file|
86
80
  xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)
87
81
  xml.module(:version=>"4", :relativePaths=>"true", :type=>"JAVA_MODULE") do
@@ -89,13 +83,15 @@ module Buildr
89
83
 
90
84
  Buildr::Idea7x.generate_compile_output(project, xml, relative)
91
85
 
92
- Buildr::Idea7x.generate_content(project, xml, generated, relative)
86
+ Buildr::Idea7x.generate_content(project, xml, relative)
93
87
 
94
88
  Buildr::Idea7x.generate_order_entries(project_libs, xml)
95
89
 
96
- ext_libs = libs.map {|path| "#{MODULE_DIR}/#{path.to_s}" } + m2_libs.map { |path| path.to_s.sub(m2repo, "$M2_REPO$") }
90
+ ext_libs = m2_libs.map { |path| "jar://#{path.to_s.sub(m2repo, "$M2_REPO$")}!/" }
91
+ ext_libs << "#{MODULE_DIR_URL}/#{relative[project.test.resources.target.to_s]}" if project.test.resources.target
92
+ ext_libs << "#{MODULE_DIR_URL}/#{relative[project.resources.target.to_s]}" if project.resources.target
93
+
97
94
  Buildr::Idea7x.generate_module_libs(xml, ext_libs)
98
-
99
95
  xml.orderEntryProperties
100
96
  end
101
97
  end
@@ -105,7 +101,7 @@ module Buildr
105
101
 
106
102
  # Root project aggregates all the subprojects.
107
103
  if project.parent == nil
108
- Buildr::Idea7x.generate_ipr(project, idea7x, sources)
104
+ Buildr::Idea7x.generate_ipr(project, idea7x, Buildr.application.buildfile)
109
105
  end
110
106
 
111
107
  end # after_define
@@ -124,13 +120,14 @@ module Buildr
124
120
 
125
121
  def generate_compile_output(project, xml, relative)
126
122
  xml.output(:url=>"#{MODULE_DIR_URL}/#{relative[project.compile.target.to_s]}") if project.compile.target
127
- xml.tag!("output-test", :url=>"#{MODULE_DIR_URL}/#{relative[project.test.compile.target.to_s]}") if project.test.compile.target
123
+ xml.tag!("output-test", :url=>"#{MODULE_DIR_URL}/#{relative[project.test.compile.target.to_s]}") if project.test.compile.target
124
+ xml.tag!("exclude-output")
128
125
  end
129
126
 
130
- def generate_content(project, xml, generated, relative)
127
+ def generate_content(project, xml, relative)
131
128
  xml.content(:url=>"#{MODULE_DIR_URL}") do
132
129
  unless project.compile.sources.empty?
133
- srcs = project.compile.sources.map { |src| relative[src.to_s] } + generated.map { |src| relative[src.to_s] }
130
+ srcs = project.compile.sources.map { |src| relative[src.to_s] }
134
131
  srcs.sort.uniq.each do |path|
135
132
  xml.sourceFolder :url=>"#{MODULE_DIR_URL}/#{path}", :isTestSource=>"false"
136
133
  end
@@ -142,7 +139,7 @@ module Buildr
142
139
  xml.sourceFolder :url=>"#{MODULE_DIR_URL}/#{path}", :isTestSource=>"true"
143
140
  end
144
141
  end
145
- end
142
+ end
146
143
  [project.resources=>false, project.test.resources=>true].each do |resources, test|
147
144
  resources.each do |path|
148
145
  path[0].sources.each do |srcpath|
@@ -150,7 +147,8 @@ module Buildr
150
147
  end
151
148
  end
152
149
  end
153
- xml.excludeFolder :url=>"#{MODULE_DIR_URL}/#{relative[project.compile.target.to_s]}" if project.compile.target
150
+ xml.excludeFolder :url=>"#{MODULE_DIR_URL}/#{relative[project.resources.target.to_s]}" if project.resources.target
151
+ xml.excludeFolder :url=>"#{MODULE_DIR_URL}/#{relative[project.test.resources.target.to_s]}" if project.test.resources.target
154
152
  end
155
153
  end
156
154
 
@@ -159,7 +157,7 @@ module Buildr
159
157
  xml.orderEntry :type=>"module-library" do
160
158
  xml.library do
161
159
  xml.CLASSES do
162
- xml.root :url=>"jar://#{path}!/"
160
+ xml.root :url=> path
163
161
  end
164
162
  xml.JAVADOC
165
163
  xml.SOURCES
@@ -172,7 +170,7 @@ module Buildr
172
170
  task_name = project.path_to("#{project.name.gsub(':', '-')}-7x.ipr")
173
171
  idea7x.enhance [ file(task_name) ]
174
172
  file(task_name=>sources) do |task|
175
- puts "Writing #{task.name}" if verbose
173
+ info "Writing #{task.name}"
176
174
 
177
175
  # Generating just the little stanza that chanages from one project to another
178
176
  partial = StringIO.new
@@ -196,7 +194,9 @@ module Buildr
196
194
  template_xml = REXML::Document.new(File.open(File.join(File.dirname(__FILE__), IPR_TEMPLATE)))
197
195
  include_xml = REXML::Document.new(partial.string)
198
196
  template_xml.root.add_element(include_xml.root)
199
- template_xml.write(File.new(task.name, "w"))
197
+ File.open task.name, 'w' do |file|
198
+ template_xml.write file
199
+ end
200
200
  end
201
201
  end
202
202
 
@@ -14,13 +14,10 @@
14
14
  # the License.
15
15
 
16
16
 
17
- ENV['JAVA_HOME'] ||= '/System/Library/Frameworks/JavaVM.framework/Home' if Config::CONFIG['host_os'] =~ /darwin/i
18
- require PLATFORM == 'java' ? 'buildr/java/jruby' : 'buildr/java/rjb'
19
-
20
-
21
- require 'buildr/java/compilers'
22
- require 'buildr/java/test_frameworks'
23
- require 'buildr/java/bdd_frameworks'
17
+ require RUBY_PLATFORM == 'java' ? 'buildr/java/jruby' : 'buildr/java/rjb'
18
+ require 'buildr/java/compiler'
19
+ require 'buildr/java/tests'
20
+ require 'buildr/java/bdd'
24
21
  require 'buildr/java/packaging'
25
22
  require 'buildr/java/commands'
26
23
  require 'buildr/java/deprecated'
@@ -23,11 +23,32 @@ module Buildr
23
23
  module Ant
24
24
 
25
25
  # Which version of Ant we're using by default.
26
- VERSION = '1.7.0' unless const_defined?('VERSION')
26
+ VERSION = '1.7.1'
27
+
28
+ class << self
29
+ # Current version of Ant being used.
30
+ def version
31
+ Buildr.settings.build['ant'] || VERSION
32
+ end
33
+
34
+ # Ant classpath dependencies.
35
+ def dependencies
36
+ # Ant-Trax required for running the JUnitReport task, and there's no other place
37
+ # to put it but the root classpath.
38
+ @dependencies ||= ["org.apache.ant:ant:jar:#{version}", "org.apache.ant:ant-launcher:jar:#{version}",
39
+ "org.apache.ant:ant-trax:jar:#{version}"]
40
+ end
41
+
42
+ private
43
+ def const_missing(const)
44
+ return super unless const == :REQUIRES # TODO: remove in 1.5
45
+ Buildr.application.deprecated "Please use Ant.dependencies/.version instead of Ant::REQUIRES/VERSION"
46
+ dependencies
47
+ end
48
+ end
49
+
27
50
 
28
- # Libraries used by Ant.
29
- REQUIRES = [ "org.apache.ant:ant:jar:#{VERSION}", "org.apache.ant:ant-launcher:jar:#{VERSION}", 'xerces:xercesImpl:jar:2.6.2' ]
30
- Java.classpath << REQUIRES
51
+ Java.classpath << lambda { Ant.dependencies }
31
52
 
32
53
  # :call-seq:
33
54
  # ant(name) { |AntProject| ... } => AntProject
@@ -65,7 +86,7 @@ module Buildr
65
86
 
66
87
  Buildr.help do
67
88
  Java.load
68
- "\nUsing Java #{ENV_JAVA['java.version']}, Ant #{Ant::VERSION}."
89
+ "\nUsing Java #{ENV_JAVA['java.version']}, Ant #{Ant.version}."
69
90
  end
70
91
 
71
92
  end