buildr 1.4.4 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/CHANGELOG +46 -0
  2. data/Rakefile +0 -1
  3. data/addon/buildr/bnd.rb +147 -0
  4. data/addon/buildr/jaxb_xjc.rb +72 -0
  5. data/addon/buildr/protobuf.rb +14 -1
  6. data/buildr.gemspec +6 -2
  7. data/doc/artifacts.textile +6 -0
  8. data/doc/contributing.textile +3 -0
  9. data/doc/download.textile +60 -0
  10. data/doc/index.textile +9 -15
  11. data/doc/installing.textile +23 -6
  12. data/doc/mailing_lists.textile +4 -0
  13. data/doc/more_stuff.textile +333 -6
  14. data/doc/packaging.textile +187 -1
  15. data/lib/buildr.rb +8 -1
  16. data/lib/buildr/clojure.rb +34 -0
  17. data/lib/buildr/clojure/shell.rb +52 -0
  18. data/lib/buildr/core.rb +3 -0
  19. data/lib/buildr/core/#application.rb# +700 -0
  20. data/lib/buildr/core/application.rb +18 -8
  21. data/lib/buildr/core/build.rb +2 -2
  22. data/lib/buildr/core/cc.rb +57 -63
  23. data/lib/buildr/core/checks.rb +4 -5
  24. data/lib/buildr/core/doc.rb +3 -1
  25. data/lib/buildr/core/generate.rb +2 -0
  26. data/lib/buildr/core/jrebel.rb +42 -0
  27. data/lib/buildr/core/linux.rb +30 -0
  28. data/lib/buildr/core/project.rb +9 -8
  29. data/lib/buildr/core/run.rb +3 -3
  30. data/lib/buildr/core/shell.rb +29 -90
  31. data/lib/buildr/core/test.rb +3 -3
  32. data/lib/buildr/core/transports.rb +5 -5
  33. data/lib/buildr/core/util.rb +2 -2
  34. data/lib/buildr/groovy.rb +1 -0
  35. data/lib/buildr/groovy/compiler.rb +12 -1
  36. data/lib/buildr/groovy/doc.rb +76 -0
  37. data/lib/buildr/groovy/shell.rb +24 -15
  38. data/lib/buildr/ide.rb +1 -1
  39. data/lib/buildr/ide/idea.rb +527 -141
  40. data/lib/buildr/java/bdd.rb +18 -13
  41. data/lib/buildr/java/ecj.rb +1 -3
  42. data/lib/buildr/java/jtestr_result.rb +295 -0
  43. data/lib/buildr/java/jtestr_runner.rb.erb +4 -6
  44. data/lib/buildr/java/packaging.rb +14 -3
  45. data/lib/buildr/java/pom.rb +6 -2
  46. data/lib/buildr/java/test_result.rb +15 -243
  47. data/lib/buildr/java/tests.rb +1 -1
  48. data/lib/buildr/packaging.rb +2 -1
  49. data/lib/buildr/packaging/#package.rb.rej# +19 -0
  50. data/lib/buildr/packaging/archive.rb +13 -3
  51. data/lib/buildr/packaging/artifact.rb +11 -12
  52. data/lib/buildr/packaging/tar.rb +4 -1
  53. data/lib/buildr/packaging/zip.rb +106 -1
  54. data/lib/buildr/resources/completed.png +0 -0
  55. data/lib/buildr/resources/failed.png +0 -0
  56. data/lib/buildr/resources/icons-license.txt +17 -0
  57. data/lib/buildr/run.rb +7 -14
  58. data/lib/buildr/scala/#Untitled-2# +7 -0
  59. data/lib/buildr/scala/bdd.rb +1 -1
  60. data/lib/buildr/scala/compiler.rb +1 -1
  61. data/lib/buildr/scala/doc.rb +20 -2
  62. data/lib/buildr/scala/shell.rb +14 -22
  63. data/lib/buildr/scala/tests.rb +2 -2
  64. data/lib/buildr/shell.rb +113 -108
  65. data/lib/buildr/version.rb +1 -1
  66. data/rakelib/checks.rake +9 -7
  67. data/rakelib/doc.rake +10 -0
  68. data/rakelib/release.rake +9 -0
  69. data/rakelib/rspec.rake +27 -28
  70. data/rakelib/setup.rake +1 -1
  71. data/rakelib/stage.rake +2 -2
  72. data/spec/addon/bnd_spec.rb +330 -0
  73. data/spec/addon/jaxb_xjc_spec.rb +125 -0
  74. data/spec/core/application_spec.rb +1 -1
  75. data/spec/core/build_spec.rb +7 -7
  76. data/spec/core/cc_spec.rb +154 -104
  77. data/spec/core/compile_spec.rb +3 -3
  78. data/spec/core/project_spec.rb +10 -0
  79. data/spec/core/run_spec.rb +1 -0
  80. data/spec/core/shell_spec.rb +146 -0
  81. data/spec/groovy/doc_spec.rb +65 -0
  82. data/spec/ide/eclipse_spec.rb +1 -1
  83. data/spec/ide/idea_spec.rb +1145 -0
  84. data/spec/java/bdd_spec.rb +3 -3
  85. data/spec/java/emma_spec.rb +2 -0
  86. data/spec/java/packaging_spec.rb +40 -11
  87. data/spec/java/test_coverage_helper.rb +1 -1
  88. data/spec/packaging/archive_spec.rb +76 -21
  89. data/spec/packaging/artifact_namespace_spec.rb +1 -1
  90. data/spec/packaging/artifact_spec.rb +14 -7
  91. data/spec/sandbox.rb +11 -4
  92. data/spec/scala/bdd_spec.rb +2 -2
  93. data/spec/scala/compiler_spec.rb +2 -2
  94. data/spec/scala/doc_spec.rb +24 -4
  95. data/spec/scala/scala.rb +2 -2
  96. data/spec/scala/tests_spec.rb +2 -2
  97. data/spec/spec_helpers.rb +9 -8
  98. data/spec/xpath_matchers.rb +121 -0
  99. metadata +248 -164
  100. data/lib/buildr/ide/idea.ipr.template +0 -300
  101. data/lib/buildr/ide/idea7x.ipr.template +0 -290
  102. data/lib/buildr/ide/idea7x.rb +0 -231
  103. data/spec/ide/idea7x_spec.rb +0 -96
@@ -1,231 +0,0 @@
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/core/project'
18
- require 'buildr/packaging'
19
- require 'stringio'
20
-
21
-
22
- module Buildr
23
- module Idea7x #:nodoc:
24
-
25
- include Extension
26
-
27
- CLASSIFIER = "-7x"
28
- IML_SUFFIX = CLASSIFIER + ".iml"
29
- IPR_TEMPLATE = "idea7x.ipr.template"
30
- MODULE_DIR = "$MODULE_DIR$"
31
- FILE_PATH_PREFIX = "file://"
32
- MODULE_DIR_URL = FILE_PATH_PREFIX + MODULE_DIR
33
- PROJECT_DIR = "$PROJECT_DIR$"
34
- PROJECT_DIR_URL = FILE_PATH_PREFIX + PROJECT_DIR
35
-
36
- first_time do
37
- # Global task "idea" generates artifacts for all projects.
38
- desc "Generate Idea 7.x artifacts for all projects"
39
- Project.local_task "idea7x"=>"artifacts"
40
-
41
- desc "Delete the generated Idea 7.x artifacts for all projects"
42
- Project.local_task "idea7x:clean"
43
- end
44
-
45
- before_define(:idea7x) do |project|
46
- project.recursive_task("idea7x")
47
- project.recursive_task("idea7x:clean")
48
- end
49
-
50
- after_define(:idea7x => :package) do |project|
51
- idea7x = project.task("idea7x")
52
-
53
- # We need paths relative to the top project's base directory.
54
- root_path = lambda { |p| f = lambda { |p| p.parent ? f[p.parent] : p.base_dir }; f[p] }[project]
55
-
56
- # Find a path relative to the project's root directory.
57
- relative = lambda { |path| Util.relative_path(File.expand_path(path.to_s), project.path_to) }
58
-
59
- m2repo = Buildr::Repositories.instance.local
60
- excludes = [ '**/.svn/', '**/CVS/' ].join('|')
61
-
62
- # Only for projects that are packageable.
63
- task_name = project.path_to("#{project.name.gsub(':', '-')}#{IML_SUFFIX}")
64
- idea7x.enhance [ file(task_name) ]
65
-
66
- # The only thing we need to look for is a change in the Buildfile.
67
- file(task_name=>Buildr.application.buildfile) do |task|
68
- # Note: Use the test classpath since Eclipse compiles both "main" and "test" classes using the same classpath
69
- deps = project.test.compile.dependencies.map(&:to_s) - [ project.compile.target.to_s ]
70
-
71
- # Convert classpath elements into applicable Project objects
72
- deps.collect! { |path| Buildr.projects.detect { |prj| prj.packages.detect { |pkg| pkg.to_s == path } } || path }
73
-
74
- # project_libs: artifacts created by other projects
75
- project_libs, others = deps.partition { |path| path.is_a?(Project) }
76
-
77
- # Separate artifacts from Maven2 repository
78
- m2_libs, others = others.partition { |path| path.to_s.index(m2repo) == 0 }
79
-
80
- # Project type is going to be the first package type
81
- if package = project.packages.first
82
- info "Writing #{task.name}"
83
- File.open(task.name, "w") do |file|
84
- xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)
85
- xml.module(:version=>"4", :relativePaths=>"true", :type=>"JAVA_MODULE") do
86
- xml.component(:name=>"NewModuleRootManager", "inherit-compiler-output"=>"false") do
87
-
88
- Buildr::Idea7x.generate_compile_output(project, xml, relative)
89
-
90
- Buildr::Idea7x.generate_content(project, xml, relative)
91
-
92
- Buildr::Idea7x.generate_order_entries(project_libs, xml)
93
-
94
- ext_libs = m2_libs.map { |path| "jar://#{path.to_s.sub(m2repo, "$M2_REPO$")}!/" }
95
- ext_libs << "#{MODULE_DIR_URL}/#{relative[project.test.resources.target.to_s]}" if project.test.resources.target
96
- ext_libs << "#{MODULE_DIR_URL}/#{relative[project.resources.target.to_s]}" if project.resources.target
97
-
98
- Buildr::Idea7x.generate_module_libs(xml, ext_libs)
99
- xml.orderEntryProperties
100
- end
101
- end
102
- end
103
- end
104
- end
105
-
106
- # Add task to remove generated module
107
- project.task("idea7x:clean") do
108
- if File.exist?(task_name)
109
- info "Removing #{task_name}"
110
- rm_rf task_name
111
- end
112
- end
113
-
114
- # Root project aggregates all the subprojects.
115
- if project.parent == nil
116
- Buildr::Idea7x.generate_ipr(project, idea7x, Buildr.application.buildfile)
117
- end
118
- end # after_define
119
-
120
- class << self
121
-
122
- def generate_order_entries(project_libs, xml)
123
- xml.orderEntry :type=>"sourceFolder", :forTests=>"false"
124
- xml.orderEntry :type=>"inheritedJdk"
125
-
126
- # Classpath elements from other projects
127
- project_libs.map(&:id).sort.uniq.each do |project_id|
128
- xml.orderEntry :type=>'module', "module-name"=>"#{project_id}#{CLASSIFIER}"
129
- end
130
- end
131
-
132
- def generate_compile_output(project, xml, relative)
133
- xml.output(:url=>"#{MODULE_DIR_URL}/#{relative[project.compile.target.to_s]}") if project.compile.target
134
- xml.tag!("output-test", :url=>"#{MODULE_DIR_URL}/#{relative[project.test.compile.target.to_s]}") if project.test.compile.target
135
- xml.tag!("exclude-output")
136
- end
137
-
138
- def generate_content(project, xml, relative)
139
- xml.content(:url=>"#{MODULE_DIR_URL}") do
140
- unless project.compile.sources.empty?
141
- srcs = project.compile.sources.map { |src| relative[src.to_s] }
142
- srcs.sort.uniq.each do |path|
143
- xml.sourceFolder :url=>"#{MODULE_DIR_URL}/#{path}", :isTestSource=>"false"
144
- end
145
- end
146
- unless project.test.compile.sources.empty?
147
- test_sources = project.test.compile.sources.map { |src| relative[src.to_s] }
148
- test_sources.each do |paths|
149
- paths.sort.uniq.each do |path|
150
- xml.sourceFolder :url=>"#{MODULE_DIR_URL}/#{path}", :isTestSource=>"true"
151
- end
152
- end
153
- end
154
- [project.resources=>false, project.test.resources=>true].each do |resources, test|
155
- resources.each do |path|
156
- path[0].sources.each do |srcpath|
157
- xml.sourceFolder :url=>"#{FILE_PATH_PREFIX}#{srcpath}", :isTestSource=>path[1].to_s
158
- end
159
- end
160
- end
161
- xml.excludeFolder :url=>"#{MODULE_DIR_URL}/#{relative[project.resources.target.to_s]}" if project.resources.target
162
- xml.excludeFolder :url=>"#{MODULE_DIR_URL}/#{relative[project.test.resources.target.to_s]}" if project.test.resources.target
163
- end
164
- end
165
-
166
- def generate_module_libs(xml, ext_libs)
167
- ext_libs.each do |path|
168
- xml.orderEntry :type=>"module-library" do
169
- xml.library do
170
- xml.CLASSES do
171
- xml.root :url=> path
172
- end
173
- xml.JAVADOC
174
- xml.SOURCES do
175
- xml.root :url=>"jar://#{path.sub(/\.jar$/, "-sources.jar")}!/"
176
- end
177
- end
178
- end
179
- end
180
- end
181
-
182
- def generate_ipr(project, idea7x, sources)
183
- task_name = project.path_to("#{project.name.gsub(':', '-')}-7x.ipr")
184
- idea7x.enhance [ file(task_name) ]
185
- file(task_name=>sources) do |task|
186
- info "Writing #{task.name}"
187
-
188
- # Generating just the little stanza that chanages from one project to another
189
- partial = StringIO.new
190
- xml = Builder::XmlMarkup.new(:target=>partial, :indent=>2)
191
- xml.component(:name=>"ProjectModuleManager") do
192
- xml.modules do
193
- project.projects.each do |subp|
194
- module_name = subp.name.gsub(":", "-")
195
- module_path = subp.base_dir ? subp.base_dir.gsub(/^#{project.base_dir}\//, '') :
196
- subp.name.split(":")[1 .. -1].join(FILE::SEPARATOR)
197
- path = "#{module_path}/#{module_name}#{IML_SUFFIX}"
198
- xml.module :fileurl=>"#{PROJECT_DIR_URL}/#{path}", :filepath=>"#{PROJECT_DIR}/#{path}"
199
- end
200
- if package = project.packages.first
201
- xml.module :fileurl=>"#{PROJECT_DIR_URL}/#{project.name}#{IML_SUFFIX}", :filepath=>"#{PROJECT_DIR}/#{project.name}#{IML_SUFFIX}"
202
- end
203
- end
204
- end
205
-
206
- # Loading the whole fairly constant crap
207
- template_xml = REXML::Document.new(File.open(File.join(File.dirname(__FILE__), IPR_TEMPLATE)))
208
- include_xml = REXML::Document.new(partial.string)
209
- template_xml.root.add_element(include_xml.root)
210
- File.open task.name, 'w' do |file|
211
- template_xml.write file
212
- end
213
- end
214
-
215
- # Add task to remove generated project file
216
- project.task("idea7x:clean") do
217
- if File.exist?(task_name)
218
- info "Removing #{task_name}"
219
- rm_rf task_name
220
- end
221
- end
222
- end
223
-
224
- end
225
-
226
- end # module Idea7x
227
- end # module Buildr
228
-
229
- class Buildr::Project
230
- include Buildr::Idea7x
231
- end
@@ -1,96 +0,0 @@
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
- module Idea7xHelper
21
- def ipr_xml_elements
22
- task('idea7x').invoke
23
- REXML::Document.new(File.read("#{@project_name}-7x.ipr")).root.elements
24
- end
25
-
26
- def ipr_module_elements
27
- ipr_xml_elements.to_a("//component[@name='ProjectModuleManager']/modules/module")
28
- end
29
-
30
- def ipr_module_filepaths
31
- ipr_module_elements.collect { |m| m.attributes['filepath'] }
32
- end
33
-
34
- def ipr_module_fileurls
35
- ipr_module_elements.collect { |m| m.attributes['fileurl'] }
36
- end
37
- end
38
-
39
-
40
- describe Idea7x do
41
- include Idea7xHelper
42
-
43
- describe "the project file" do
44
- before do
45
- @project_name = 'alphabet'
46
- end
47
-
48
- it "includes a module for the root project" do
49
- # Current behavior is to only generate IMLs for packaged projects
50
- define(@project_name) { project.version = '0.0.0'; package(:jar) }
51
- ipr_module_elements.should have(1).element
52
- ipr_module_filepaths.should == ["$PROJECT_DIR$/alphabet-7x.iml"]
53
- ipr_module_fileurls.should == ["file://$PROJECT_DIR$/alphabet-7x.iml"]
54
- end
55
-
56
- it "includes an IML for a subproject" do
57
- mkpath 'h'
58
- define(@project_name) do
59
- project.version = '0.0.0'; package(:jar)
60
- define('h') do
61
- package(:jar)
62
- end
63
- end
64
-
65
- ipr_module_elements.should have(2).elements
66
- ipr_module_filepaths.should include("$PROJECT_DIR$/h/alphabet-h-7x.iml")
67
- ipr_module_fileurls.should include("file://$PROJECT_DIR$/h/alphabet-h-7x.iml")
68
- end
69
-
70
- it "pays attention to the base_dir for a subproject" do
71
- mkpath 'aitch'
72
- define(@project_name) do
73
- project.version = '0.0.0'; package(:jar)
74
- define('h', :base_dir => 'aitch') do
75
- package(:jar)
76
- end
77
- end
78
-
79
- ipr_module_elements.should have(2).elements
80
- ipr_module_filepaths.should include("$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
81
- ipr_module_fileurls.should include("file://$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
82
- end
83
- end
84
-
85
- describe "idea7x:clean" do
86
-
87
- it "should remove the idea7x project" do
88
- write "src/main/java/com/example/Hello.java", ""
89
- write "foo-7x.iml", ""
90
- foo = define("foo")
91
- foo.task("idea7x:clean").invoke
92
- File.exists?("foo-7x.iml").should be_false
93
- end
94
-
95
- end
96
- end