mguymon-buildr 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1291 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +134 -0
- data/Rakefile +44 -0
- data/_buildr +35 -0
- data/_jbuildr +35 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/bnd.rb +147 -0
- data/addon/buildr/cobertura.rb +22 -0
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +22 -0
- data/addon/buildr/hibernate.rb +149 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jaxb_xjc.rb +72 -0
- data/addon/buildr/jdepend.rb +60 -0
- data/addon/buildr/jetty.rb +248 -0
- data/addon/buildr/jibx.rb +86 -0
- data/addon/buildr/nailgun.rb +221 -0
- data/addon/buildr/openjpa.rb +88 -0
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/addon/buildr/protobuf.rb +88 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +19 -0
- data/buildr.buildfile +58 -0
- data/buildr.gemspec +78 -0
- data/doc/_config.yml +1 -0
- data/doc/_layouts/default.html +90 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/artifacts.textile +217 -0
- data/doc/building.textile +276 -0
- data/doc/contributing.textile +268 -0
- data/doc/css/default.css +236 -0
- data/doc/css/print.css +101 -0
- data/doc/css/syntax.css +23 -0
- data/doc/download.textile +151 -0
- data/doc/extending.textile +212 -0
- data/doc/images/1442160941-frontcover.jpg +0 -0
- data/doc/images/asf-logo.gif +0 -0
- data/doc/images/asf-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/index.textile +109 -0
- data/doc/installing.textile +284 -0
- data/doc/languages.textile +599 -0
- data/doc/mailing_lists.textile +29 -0
- data/doc/more_stuff.textile +845 -0
- data/doc/packaging.textile +618 -0
- data/doc/preface.textile +54 -0
- data/doc/projects.textile +276 -0
- data/doc/quick_start.textile +210 -0
- data/doc/releasing.textile +117 -0
- data/doc/scripts/buildr-git.rb +512 -0
- data/doc/scripts/gitflow.rb +296 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +73 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/settings_profiles.textile +287 -0
- data/doc/testing.textile +247 -0
- data/etc/KEYS +189 -0
- data/lib/buildr.rb +44 -0
- data/lib/buildr/clojure.rb +34 -0
- data/lib/buildr/clojure/shell.rb +52 -0
- data/lib/buildr/core.rb +34 -0
- data/lib/buildr/core/application.rb +700 -0
- data/lib/buildr/core/build.rb +516 -0
- data/lib/buildr/core/cc.rb +166 -0
- data/lib/buildr/core/checks.rb +253 -0
- data/lib/buildr/core/common.rb +151 -0
- data/lib/buildr/core/compile.rb +622 -0
- data/lib/buildr/core/doc.rb +276 -0
- data/lib/buildr/core/environment.rb +129 -0
- data/lib/buildr/core/filter.rb +404 -0
- data/lib/buildr/core/generate.rb +197 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/jrebel.rb +42 -0
- data/lib/buildr/core/linux.rb +30 -0
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +161 -0
- data/lib/buildr/core/project.rb +975 -0
- data/lib/buildr/core/run.rb +43 -0
- data/lib/buildr/core/shell.rb +137 -0
- data/lib/buildr/core/test.rb +843 -0
- data/lib/buildr/core/transports.rb +575 -0
- data/lib/buildr/core/util.rb +537 -0
- data/lib/buildr/groovy.rb +20 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +153 -0
- data/lib/buildr/groovy/doc.rb +76 -0
- data/lib/buildr/groovy/shell.rb +57 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/ide/eclipse.rb +427 -0
- data/lib/buildr/ide/eclipse/java.rb +53 -0
- data/lib/buildr/ide/eclipse/plugin.rb +71 -0
- data/lib/buildr/ide/eclipse/scala.rb +68 -0
- data/lib/buildr/ide/idea.rb +576 -0
- data/lib/buildr/java.rb +25 -0
- data/lib/buildr/java/ant.rb +94 -0
- data/lib/buildr/java/bdd.rb +460 -0
- data/lib/buildr/java/cobertura.rb +297 -0
- data/lib/buildr/java/commands.rb +223 -0
- data/lib/buildr/java/compiler.rb +135 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/doc.rb +86 -0
- data/lib/buildr/java/ecj.rb +69 -0
- data/lib/buildr/java/emma.rb +244 -0
- data/lib/buildr/java/external.rb +73 -0
- data/lib/buildr/java/jruby.rb +122 -0
- data/lib/buildr/java/jtestr_result.rb +295 -0
- data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
- data/lib/buildr/java/packaging.rb +734 -0
- data/lib/buildr/java/pom.rb +178 -0
- data/lib/buildr/java/rjb.rb +154 -0
- data/lib/buildr/java/test_result.rb +101 -0
- data/lib/buildr/java/tests.rb +362 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +25 -0
- data/lib/buildr/packaging/archive.rb +535 -0
- data/lib/buildr/packaging/artifact.rb +904 -0
- data/lib/buildr/packaging/artifact_namespace.rb +984 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +105 -0
- data/lib/buildr/packaging/package.rb +249 -0
- data/lib/buildr/packaging/repository_array.rb +108 -0
- data/lib/buildr/packaging/tar.rb +189 -0
- data/lib/buildr/packaging/version_requirement.rb +192 -0
- data/lib/buildr/packaging/zip.rb +178 -0
- data/lib/buildr/packaging/ziptask.rb +356 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/resources/completed.png +0 -0
- data/lib/buildr/resources/failed.png +0 -0
- data/lib/buildr/resources/icons-license.txt +17 -0
- data/lib/buildr/run.rb +195 -0
- data/lib/buildr/scala.rb +26 -0
- data/lib/buildr/scala/bdd.rb +118 -0
- data/lib/buildr/scala/compiler.rb +242 -0
- data/lib/buildr/scala/doc.rb +142 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/lib/buildr/scala/shell.rb +52 -0
- data/lib/buildr/scala/tests.rb +171 -0
- data/lib/buildr/shell.rb +185 -0
- data/lib/buildr/version.rb +18 -0
- data/rakelib/all-in-one.rake +113 -0
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +137 -0
- data/rakelib/metrics.rake +39 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +160 -0
- data/rakelib/rspec.rake +91 -0
- data/rakelib/setup.rake +66 -0
- data/rakelib/stage.rake +220 -0
- data/spec/addon/bnd_spec.rb +330 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/addon/jaxb_xjc_spec.rb +125 -0
- data/spec/core/application_spec.rb +631 -0
- data/spec/core/build_spec.rb +837 -0
- data/spec/core/cc_spec.rb +224 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +725 -0
- data/spec/core/compile_spec.rb +658 -0
- data/spec/core/doc_spec.rb +195 -0
- data/spec/core/extension_spec.rb +201 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +772 -0
- data/spec/core/run_spec.rb +93 -0
- data/spec/core/shell_spec.rb +146 -0
- data/spec/core/test_spec.rb +1320 -0
- data/spec/core/transport_spec.rb +544 -0
- data/spec/core/util_spec.rb +141 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +251 -0
- data/spec/groovy/doc_spec.rb +65 -0
- data/spec/ide/eclipse_spec.rb +739 -0
- data/spec/ide/idea_spec.rb +1145 -0
- data/spec/java/ant_spec.rb +37 -0
- data/spec/java/bdd_spec.rb +374 -0
- data/spec/java/cobertura_spec.rb +112 -0
- data/spec/java/commands_spec.rb +93 -0
- data/spec/java/compiler_spec.rb +252 -0
- data/spec/java/doc_spec.rb +56 -0
- data/spec/java/ecj_spec.rb +115 -0
- data/spec/java/emma_spec.rb +121 -0
- data/spec/java/external_spec.rb +56 -0
- data/spec/java/java_spec.rb +132 -0
- data/spec/java/packaging_spec.rb +1266 -0
- data/spec/java/run_spec.rb +78 -0
- data/spec/java/test_coverage_helper.rb +257 -0
- data/spec/java/tests_spec.rb +497 -0
- data/spec/packaging/archive_spec.rb +775 -0
- data/spec/packaging/artifact_namespace_spec.rb +743 -0
- data/spec/packaging/artifact_spec.rb +1074 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +719 -0
- data/spec/packaging/repository_array_spec.rb +109 -0
- data/spec/sandbox.rb +165 -0
- data/spec/scala/bdd_spec.rb +124 -0
- data/spec/scala/compiler_spec.rb +289 -0
- data/spec/scala/doc_spec.rb +88 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +283 -0
- data/spec/spec_helpers.rb +369 -0
- data/spec/version_requirement_spec.rb +143 -0
- data/spec/xpath_matchers.rb +121 -0
- metadata +649 -0
@@ -0,0 +1,1145 @@
|
|
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
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'xpath_matchers'))
|
19
|
+
|
20
|
+
describe Buildr::IntellijIdea do
|
21
|
+
|
22
|
+
def invoke_generate_task
|
23
|
+
task('idea:generate').invoke
|
24
|
+
end
|
25
|
+
|
26
|
+
def invoke_clean_task
|
27
|
+
task('idea:clean').invoke
|
28
|
+
end
|
29
|
+
|
30
|
+
def root_project_filename(project)
|
31
|
+
project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.ipr")
|
32
|
+
end
|
33
|
+
|
34
|
+
def root_project_xml(project)
|
35
|
+
xml_document(root_project_filename(project))
|
36
|
+
end
|
37
|
+
|
38
|
+
def root_module_filename(project)
|
39
|
+
project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
|
40
|
+
end
|
41
|
+
|
42
|
+
def root_module_xml(project)
|
43
|
+
xml_document(root_module_filename(project))
|
44
|
+
end
|
45
|
+
|
46
|
+
def subproject_module_filename(project, sub_project_name)
|
47
|
+
project._("#{sub_project_name}/#{sub_project_name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
|
48
|
+
end
|
49
|
+
|
50
|
+
def subproject_module_xml(project, sub_project_name)
|
51
|
+
xml_document(subproject_module_filename(project, sub_project_name))
|
52
|
+
end
|
53
|
+
|
54
|
+
def xml_document(filename)
|
55
|
+
File.should be_exist(filename)
|
56
|
+
REXML::Document.new(File.read(filename))
|
57
|
+
end
|
58
|
+
|
59
|
+
def xpath_to_module
|
60
|
+
"/project/component[@name='ProjectModuleManager']/modules/module"
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "idea:clean" do
|
64
|
+
before do
|
65
|
+
write "foo.ipr"
|
66
|
+
write "foo.iml"
|
67
|
+
write "other.ipr"
|
68
|
+
write "other.iml"
|
69
|
+
mkdir_p 'bar'
|
70
|
+
write "bar/bar.iml"
|
71
|
+
write "bar/other.ipr"
|
72
|
+
write "bar/other.iml"
|
73
|
+
|
74
|
+
@foo = define "foo" do
|
75
|
+
define "bar"
|
76
|
+
end
|
77
|
+
invoke_clean_task
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should remove the ipr file" do
|
81
|
+
File.exists?("foo.ipr").should be_false
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should remove the project iml file" do
|
85
|
+
File.exists?("foo.iml").should be_false
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should remove the subproject iml file" do
|
89
|
+
File.exists?("foo.iml").should be_false
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should not remove other iml and ipr files" do
|
93
|
+
File.exists?("other.ipr").should be_true
|
94
|
+
File.exists?("other.iml").should be_true
|
95
|
+
File.exists?("bar/other.ipr").should be_true
|
96
|
+
File.exists?("bar/other.iml").should be_true
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe "idea:generate" do
|
101
|
+
|
102
|
+
def order_entry_xpath
|
103
|
+
"/module/component[@name='NewModuleRootManager']/orderEntry"
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "with a single dependency" do
|
107
|
+
describe "of type compile" do
|
108
|
+
before do
|
109
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
110
|
+
@foo = define "foo" do
|
111
|
+
compile.with 'group:id:jar:1.0'
|
112
|
+
end
|
113
|
+
invoke_generate_task
|
114
|
+
end
|
115
|
+
|
116
|
+
it "generates one exported 'module-library' orderEntry in IML" do
|
117
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library', @exported='']/library/CLASSES/root", 1)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe "with iml.main_dependencies override" do
|
122
|
+
before do
|
123
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
124
|
+
@foo = define "foo" do
|
125
|
+
iml.main_dependencies << 'group:id:jar:1.0'
|
126
|
+
end
|
127
|
+
invoke_generate_task
|
128
|
+
end
|
129
|
+
|
130
|
+
it "generates one exported 'module-library' orderEntry in IML" do
|
131
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library', @exported='']/library/CLASSES/root", 1)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "of type test" do
|
136
|
+
before do
|
137
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
138
|
+
@foo = define "foo" do
|
139
|
+
test.with 'group:id:jar:1.0'
|
140
|
+
end
|
141
|
+
invoke_generate_task
|
142
|
+
end
|
143
|
+
|
144
|
+
it "generates one non-exported 'module-library' orderEntry in IML" do
|
145
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @exported]/library/CLASSES/root", 0)
|
146
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library']/library/CLASSES/root", 1)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe "with iml.test_dependencies override" do
|
151
|
+
before do
|
152
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
153
|
+
@foo = define "foo" do
|
154
|
+
iml.test_dependencies << 'group:id:jar:1.0'
|
155
|
+
end
|
156
|
+
invoke_generate_task
|
157
|
+
end
|
158
|
+
|
159
|
+
it "generates one non-exported 'module-library' orderEntry in IML" do
|
160
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @exported]/library/CLASSES/root", 0)
|
161
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library']/library/CLASSES/root", 1)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe "with sources artifact present" do
|
166
|
+
before do
|
167
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
168
|
+
artifact('group:id:jar:sources:1.0') { |t| write t.to_s }
|
169
|
+
@foo = define "foo" do
|
170
|
+
compile.with 'group:id:jar:1.0'
|
171
|
+
end
|
172
|
+
invoke_generate_task
|
173
|
+
end
|
174
|
+
|
175
|
+
it "generates 'module-library' orderEntry in IML with SOURCES specified" do
|
176
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library', @exported='']/library/SOURCES/root", 1)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe "with local_repository_env_override set to nil" do
|
181
|
+
before do
|
182
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
183
|
+
@foo = define "foo" do
|
184
|
+
iml.local_repository_env_override = nil
|
185
|
+
compile.with 'group:id:jar:1.0'
|
186
|
+
end
|
187
|
+
invoke_generate_task
|
188
|
+
end
|
189
|
+
|
190
|
+
it "generates orderEntry with absolute path for classes jar" do
|
191
|
+
root_module_xml(@foo).should match_xpath("#{order_entry_xpath}/library/CLASSES/root/@url",
|
192
|
+
"jar://$MODULE_DIR$/home/.m2/repository/group/id/1.0/id-1.0.jar!/")
|
193
|
+
end
|
194
|
+
end
|
195
|
+
describe "with local_repository_env_override set to MAVEN_REPOSITORY" do
|
196
|
+
before do
|
197
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
198
|
+
@foo = define "foo" do
|
199
|
+
iml.local_repository_env_override = 'MAVEN_REPOSITORY'
|
200
|
+
compile.with 'group:id:jar:1.0'
|
201
|
+
end
|
202
|
+
invoke_generate_task
|
203
|
+
end
|
204
|
+
|
205
|
+
it "generates orderEntry with absolute path for classes jar" do
|
206
|
+
root_module_xml(@foo).should match_xpath("#{order_entry_xpath}/library/CLASSES/root/@url",
|
207
|
+
"jar://$MAVEN_REPOSITORY$/group/id/1.0/id-1.0.jar!/")
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe "with multiple dependencies" do
|
213
|
+
before do
|
214
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
215
|
+
artifact('group:id2:jar:1.0') { |t| write t.to_s }
|
216
|
+
@foo = define "foo" do
|
217
|
+
compile.with 'group:id:jar:1.0', 'group:id2:jar:1.0'
|
218
|
+
end
|
219
|
+
invoke_generate_task
|
220
|
+
end
|
221
|
+
|
222
|
+
it "generates multiple 'module-library' orderEntry in IML" do
|
223
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library']", 2)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
describe "with a single non artifact dependency" do
|
228
|
+
before do
|
229
|
+
@foo = define "foo" do
|
230
|
+
filename = _("foo-dep.jar")
|
231
|
+
File.open(filename, "wb") { |t| write "Hello" }
|
232
|
+
compile.with filename
|
233
|
+
end
|
234
|
+
invoke_generate_task
|
235
|
+
end
|
236
|
+
|
237
|
+
it "generates one exported 'module-library' orderEntry in IML" do
|
238
|
+
root_module_xml(@foo).should match_xpath("#{order_entry_xpath}/library/CLASSES/root/@url",
|
239
|
+
"jar://$MODULE_DIR$/foo-dep.jar!/")
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
describe "with extra_modules specified" do
|
244
|
+
before do
|
245
|
+
@foo = define "foo" do
|
246
|
+
ipr.extra_modules << 'other.iml'
|
247
|
+
ipr.extra_modules << 'other_other.iml'
|
248
|
+
end
|
249
|
+
invoke_generate_task
|
250
|
+
end
|
251
|
+
|
252
|
+
it "generate an IPR with extra modules specified" do
|
253
|
+
doc = xml_document(@foo._("foo.ipr"))
|
254
|
+
doc.should have_nodes("#{xpath_to_module}", 3)
|
255
|
+
module_ref = "$PROJECT_DIR$/foo.iml"
|
256
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
|
257
|
+
module_ref = "$PROJECT_DIR$/other.iml"
|
258
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
|
259
|
+
module_ref = "$PROJECT_DIR$/other_other.iml"
|
260
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
describe "with web and webservice facet added to root project" do
|
265
|
+
before do
|
266
|
+
@foo = define "foo" do
|
267
|
+
iml.add_facet("Web", "web") do |facet|
|
268
|
+
facet.configuration do |conf|
|
269
|
+
conf.descriptors do |desc|
|
270
|
+
desc.deploymentDescriptor :name => 'web.xml',
|
271
|
+
:url => "file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml",
|
272
|
+
:optional => "false", :version => "2.4"
|
273
|
+
end
|
274
|
+
conf.webroots do |webroots|
|
275
|
+
webroots.root :url => "file://$MODULE_DIR$/src/main/webapp", :relative => "/"
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
iml.add_facet("WebServices Client", "WebServicesClient") do |facet|
|
280
|
+
facet.configuration "ws.engine" => "Glassfish / JAX-WS 2.X RI / Metro 1.X / JWSDP 2.0"
|
281
|
+
end
|
282
|
+
define 'bar'
|
283
|
+
end
|
284
|
+
invoke_generate_task
|
285
|
+
end
|
286
|
+
|
287
|
+
it "generates an IML for root project with a web and webservice facet" do
|
288
|
+
doc = xml_document(@foo._("foo.iml"))
|
289
|
+
facet_xpath = "/module/component[@name='FacetManager']/facet"
|
290
|
+
doc.should have_nodes(facet_xpath, 2)
|
291
|
+
doc.should have_xpath("#{facet_xpath}[@type='web', @name='Web']")
|
292
|
+
doc.should have_xpath("#{facet_xpath}[@type='WebServicesClient', @name='WebServices Client']")
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
describe "with iml.group specified" do
|
297
|
+
before do
|
298
|
+
@foo = define "foo" do
|
299
|
+
iml.group = true
|
300
|
+
define 'bar' do
|
301
|
+
define 'baz' do
|
302
|
+
|
303
|
+
end
|
304
|
+
end
|
305
|
+
define 'rab' do
|
306
|
+
iml.group = "MyGroup"
|
307
|
+
end
|
308
|
+
end
|
309
|
+
invoke_generate_task
|
310
|
+
end
|
311
|
+
|
312
|
+
it "generate an IPR with correct group references" do
|
313
|
+
doc = xml_document(@foo._("foo.ipr"))
|
314
|
+
doc.should have_nodes("#{xpath_to_module}", 4)
|
315
|
+
module_ref = "$PROJECT_DIR$/foo.iml"
|
316
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
|
317
|
+
module_ref = "$PROJECT_DIR$/rab/rab.iml"
|
318
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}' @group = 'MyGroup']")
|
319
|
+
module_ref = "$PROJECT_DIR$/bar/bar.iml"
|
320
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}' @group = 'foo']")
|
321
|
+
module_ref = "$PROJECT_DIR$/bar/baz/baz.iml"
|
322
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}' @group = 'foo/bar']")
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
describe "with a single project definition" do
|
327
|
+
describe "and default naming" do
|
328
|
+
before do
|
329
|
+
@foo = define "foo"
|
330
|
+
invoke_generate_task
|
331
|
+
end
|
332
|
+
|
333
|
+
it "generates a single IPR" do
|
334
|
+
Dir[@foo._("**/*.ipr")].should have(1).entry
|
335
|
+
end
|
336
|
+
|
337
|
+
it "generate an IPR in the root directory" do
|
338
|
+
File.should be_exist(@foo._("foo.ipr"))
|
339
|
+
end
|
340
|
+
|
341
|
+
it "generates a single IML" do
|
342
|
+
Dir[@foo._("**/*.iml")].should have(1).entry
|
343
|
+
end
|
344
|
+
|
345
|
+
it "generates an IML in the root directory" do
|
346
|
+
File.should be_exist(@foo._("foo.iml"))
|
347
|
+
end
|
348
|
+
|
349
|
+
it "generate an IPR with the reference to correct module file" do
|
350
|
+
File.should be_exist(@foo._("foo.ipr"))
|
351
|
+
doc = xml_document(@foo._("foo.ipr"))
|
352
|
+
module_ref = "$PROJECT_DIR$/foo.iml"
|
353
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']", 1)
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
describe "with no_iml generation disabled" do
|
358
|
+
before do
|
359
|
+
@foo = define "foo" do
|
360
|
+
project.no_iml
|
361
|
+
end
|
362
|
+
invoke_generate_task
|
363
|
+
end
|
364
|
+
|
365
|
+
it "generates no IML" do
|
366
|
+
Dir[@foo._("**/*.iml")].should have(0).entry
|
367
|
+
end
|
368
|
+
|
369
|
+
it "generate an IPR with no references" do
|
370
|
+
File.should be_exist(@foo._("foo.ipr"))
|
371
|
+
doc = xml_document(@foo._("foo.ipr"))
|
372
|
+
doc.should have_nodes("#{xpath_to_module}", 0)
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
describe "with ipr generation disabled" do
|
377
|
+
before do
|
378
|
+
@foo = define "foo" do
|
379
|
+
project.no_ipr
|
380
|
+
end
|
381
|
+
invoke_generate_task
|
382
|
+
end
|
383
|
+
|
384
|
+
it "generates a single IML" do
|
385
|
+
Dir[@foo._("**/*.iml")].should have(1).entry
|
386
|
+
end
|
387
|
+
|
388
|
+
it "generate no IPR" do
|
389
|
+
File.should_not be_exist(@foo._("foo.ipr"))
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
describe "and id overrides" do
|
394
|
+
before do
|
395
|
+
@foo = define "foo" do
|
396
|
+
ipr.id = 'fooble'
|
397
|
+
iml.id = 'feap'
|
398
|
+
define "bar" do
|
399
|
+
iml.id = "baz"
|
400
|
+
end
|
401
|
+
end
|
402
|
+
invoke_generate_task
|
403
|
+
end
|
404
|
+
|
405
|
+
it "generate an IPR in the root directory" do
|
406
|
+
File.should be_exist(@foo._("fooble.ipr"))
|
407
|
+
end
|
408
|
+
|
409
|
+
it "generates an IML in the root directory" do
|
410
|
+
File.should be_exist(@foo._("feap.iml"))
|
411
|
+
end
|
412
|
+
|
413
|
+
it "generates an IML in the subproject directory" do
|
414
|
+
File.should be_exist(@foo._("bar/baz.iml"))
|
415
|
+
end
|
416
|
+
|
417
|
+
it "generate an IPR with the reference to correct module file" do
|
418
|
+
File.should be_exist(@foo._("fooble.ipr"))
|
419
|
+
doc = xml_document(@foo._("fooble.ipr"))
|
420
|
+
module_ref = "$PROJECT_DIR$/feap.iml"
|
421
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']", 1)
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
describe "and a suffix defined" do
|
426
|
+
before do
|
427
|
+
@foo = define "foo" do
|
428
|
+
ipr.suffix = '-ipr-suffix'
|
429
|
+
iml.suffix = '-iml-suffix'
|
430
|
+
end
|
431
|
+
invoke_generate_task
|
432
|
+
end
|
433
|
+
|
434
|
+
it "generate an IPR in the root directory" do
|
435
|
+
File.should be_exist(@foo._("foo-ipr-suffix.ipr"))
|
436
|
+
end
|
437
|
+
|
438
|
+
it "generates an IML in the root directory" do
|
439
|
+
File.should be_exist(@foo._("foo-iml-suffix.iml"))
|
440
|
+
end
|
441
|
+
|
442
|
+
it "generate an IPR with the reference to correct module file" do
|
443
|
+
File.should be_exist(@foo._("foo-ipr-suffix.ipr"))
|
444
|
+
doc = xml_document(@foo._("foo-ipr-suffix.ipr"))
|
445
|
+
doc.should have_nodes("#{xpath_to_module}", 1)
|
446
|
+
module_ref = "$PROJECT_DIR$/foo-iml-suffix.iml"
|
447
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']", 1)
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
451
|
+
|
452
|
+
describe "with a subproject" do
|
453
|
+
before do
|
454
|
+
@foo = define "foo" do
|
455
|
+
define 'bar'
|
456
|
+
end
|
457
|
+
invoke_generate_task
|
458
|
+
end
|
459
|
+
|
460
|
+
it "creates the subproject directory" do
|
461
|
+
File.should be_exist(@foo._("bar"))
|
462
|
+
end
|
463
|
+
|
464
|
+
it "generates an IML in the subproject directory" do
|
465
|
+
File.should be_exist(@foo._("bar/bar.iml"))
|
466
|
+
end
|
467
|
+
|
468
|
+
it "generate an IPR with the reference to correct module file" do
|
469
|
+
File.should be_exist(@foo._("foo.ipr"))
|
470
|
+
doc = xml_document(@foo._("foo.ipr"))
|
471
|
+
doc.should have_nodes("#{xpath_to_module}", 2)
|
472
|
+
module_ref = "$PROJECT_DIR$/foo.iml"
|
473
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']", 1)
|
474
|
+
module_ref = "$PROJECT_DIR$/bar/bar.iml"
|
475
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']", 1)
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
479
|
+
describe "with base_dir specified" do
|
480
|
+
before do
|
481
|
+
@foo = define "foo" do
|
482
|
+
define('bar', :base_dir => 'fe') do
|
483
|
+
define('baz', :base_dir => 'fi') do
|
484
|
+
define('foe')
|
485
|
+
end
|
486
|
+
define('fum')
|
487
|
+
end
|
488
|
+
end
|
489
|
+
invoke_generate_task
|
490
|
+
end
|
491
|
+
|
492
|
+
it "generates a subproject IML in the specified directory" do
|
493
|
+
File.should be_exist(@foo._("fe/bar.iml"))
|
494
|
+
end
|
495
|
+
|
496
|
+
it "generates a sub-subproject IML in the specified directory" do
|
497
|
+
File.should be_exist(@foo._("fi/baz.iml"))
|
498
|
+
end
|
499
|
+
|
500
|
+
it "generates a sub-sub-subproject IML that inherits the specified directory" do
|
501
|
+
File.should be_exist(@foo._("fi/foe/foe.iml"))
|
502
|
+
end
|
503
|
+
|
504
|
+
it "generates a sub-subproject IML that inherits the specified directory" do
|
505
|
+
File.should be_exist(@foo._("fe/fum/fum.iml"))
|
506
|
+
end
|
507
|
+
|
508
|
+
it "generate an IPR with the references to correct module files" do
|
509
|
+
doc = xml_document(@foo._("foo.ipr"))
|
510
|
+
doc.should have_nodes("#{xpath_to_module}", 5)
|
511
|
+
["foo.iml", "fe/bar.iml", "fi/baz.iml", "fi/foe/foe.iml", "fe/fum/fum.iml"].each do |module_ref|
|
512
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://$PROJECT_DIR$/#{module_ref}', @filepath='$PROJECT_DIR$/#{module_ref}']", 1)
|
513
|
+
end
|
514
|
+
end
|
515
|
+
end
|
516
|
+
|
517
|
+
describe "with extensive intermodule dependencies" do
|
518
|
+
before do
|
519
|
+
mkdir_p 'foo/src/main/resources'
|
520
|
+
mkdir_p 'foo/src/main/java/foo'
|
521
|
+
touch 'foo/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
522
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
523
|
+
define "root" do
|
524
|
+
repositories.remote << 'http://mirrors.ibiblio.org/pub/mirrors/maven2/'
|
525
|
+
project.version = "2.5.2"
|
526
|
+
define 'foo' do
|
527
|
+
resources.from _(:source, :main, :resources)
|
528
|
+
compile.with 'group:id:jar:1.0'
|
529
|
+
test.using(:junit)
|
530
|
+
package(:jar)
|
531
|
+
end
|
532
|
+
|
533
|
+
define 'bar' do
|
534
|
+
# internally transitive dependencies on foo, both runtime and test
|
535
|
+
compile.with project('root:foo'), project('root:foo').compile.dependencies
|
536
|
+
test.using(:junit).with [project('root:foo').test.compile.target,
|
537
|
+
project('root:foo').test.resources.target,
|
538
|
+
project('root:foo').test.compile.dependencies].compact
|
539
|
+
package(:jar)
|
540
|
+
end
|
541
|
+
end
|
542
|
+
|
543
|
+
invoke_generate_task
|
544
|
+
@bar_iml = xml_document(project('root:bar')._('bar.iml'))
|
545
|
+
@bar_lib_urls = @bar_iml.get_elements("//orderEntry[@type='module-library']/library/CLASSES/root").collect do |root|
|
546
|
+
root.attribute('url').to_s
|
547
|
+
end
|
548
|
+
end
|
549
|
+
|
550
|
+
it "depends on the associated module exactly once" do
|
551
|
+
@bar_iml.should have_nodes("//orderEntry[@type='module', @module-name='foo']", 1)
|
552
|
+
end
|
553
|
+
|
554
|
+
it "does not depend on the other project's packaged JAR" do
|
555
|
+
@bar_lib_urls.grep(%r{#{project('root:foo').packages.first}}).should == []
|
556
|
+
end
|
557
|
+
|
558
|
+
it "does not depend on the the other project's target/classes directory" do
|
559
|
+
@bar_lib_urls.grep(%r{foo/target/classes}).should == []
|
560
|
+
end
|
561
|
+
|
562
|
+
it "does not depend on the the other project's target/resources directory" do
|
563
|
+
@bar_lib_urls.grep(%r{file://\$MODULE_DIR\$/../foo/target/resources}).size.should == 0
|
564
|
+
end
|
565
|
+
end
|
566
|
+
|
567
|
+
describe "with a single project definition" do
|
568
|
+
before do
|
569
|
+
@foo = define "foo"
|
570
|
+
end
|
571
|
+
|
572
|
+
it "informs the user about generating IPR" do
|
573
|
+
lambda { invoke_generate_task }.should show_info(/Writing (.+)\/foo\.ipr/)
|
574
|
+
end
|
575
|
+
|
576
|
+
it "informs the user about generating IML" do
|
577
|
+
lambda { invoke_generate_task }.should show_info(/Writing (.+)\/foo\.iml/)
|
578
|
+
end
|
579
|
+
end
|
580
|
+
describe "with a subproject" do
|
581
|
+
before do
|
582
|
+
@foo = define "foo" do
|
583
|
+
define 'bar'
|
584
|
+
end
|
585
|
+
end
|
586
|
+
|
587
|
+
it "informs the user about generating subporoject IML" do
|
588
|
+
lambda { invoke_generate_task }.should show_info(/Writing (.+)\/bar\/bar\.iml/)
|
589
|
+
end
|
590
|
+
end
|
591
|
+
|
592
|
+
describe "with compile.options.source = '1.6'" do
|
593
|
+
|
594
|
+
before do
|
595
|
+
@foo = define "foo" do
|
596
|
+
compile.options.source = '1.5'
|
597
|
+
end
|
598
|
+
invoke_generate_task
|
599
|
+
end
|
600
|
+
|
601
|
+
it "generate an ProjectRootManager with 1.5 jdk specified" do
|
602
|
+
#raise File.read(@foo._("foo.ipr"))
|
603
|
+
xml_document(@foo._("foo.ipr")).
|
604
|
+
should have_xpath("/project/component[@name='ProjectRootManager' and @project-jdk-name = '1.5' and @languageLevel = 'JDK_1_5']")
|
605
|
+
end
|
606
|
+
|
607
|
+
it "generates a ProjectDetails component with the projectName option set" do
|
608
|
+
xml_document(@foo._("foo.ipr")).
|
609
|
+
should have_xpath("/project/component[@name='ProjectDetails']/option[@name = 'projectName' and @value = 'foo']")
|
610
|
+
end
|
611
|
+
end
|
612
|
+
|
613
|
+
describe "with compile.options.source = '1.6'" do
|
614
|
+
before do
|
615
|
+
@foo = define "foo" do
|
616
|
+
compile.options.source = '1.6'
|
617
|
+
end
|
618
|
+
invoke_generate_task
|
619
|
+
end
|
620
|
+
|
621
|
+
it "generate an ProjectRootManager with 1.6 jdk specified" do
|
622
|
+
xml_document(@foo._("foo.ipr")).
|
623
|
+
should have_xpath("/project/component[@name='ProjectRootManager' and @project-jdk-name = '1.6' and @languageLevel = 'JDK_1_6']")
|
624
|
+
end
|
625
|
+
end
|
626
|
+
|
627
|
+
describe "with iml.skip_content! specified" do
|
628
|
+
before do
|
629
|
+
@foo = define "foo" do
|
630
|
+
iml.skip_content!
|
631
|
+
end
|
632
|
+
invoke_generate_task
|
633
|
+
end
|
634
|
+
|
635
|
+
it "generate an IML with no content section" do
|
636
|
+
doc = xml_document(@foo._(root_module_filename(@foo)))
|
637
|
+
doc.should_not have_xpath("/module/component[@name='NewModuleRootManager']/content")
|
638
|
+
end
|
639
|
+
end
|
640
|
+
|
641
|
+
describe "with iml.skip_content! not specified and standard layout" do
|
642
|
+
before do
|
643
|
+
@foo = define "foo" do
|
644
|
+
end
|
645
|
+
invoke_generate_task
|
646
|
+
end
|
647
|
+
|
648
|
+
it "generate an IML with content section" do
|
649
|
+
root_module_xml(@foo).should have_xpath("/module/component[@name='NewModuleRootManager']/content")
|
650
|
+
end
|
651
|
+
|
652
|
+
it "generate an exclude in content section for reports" do
|
653
|
+
root_module_xml(@foo).should have_xpath("/module/component[@name='NewModuleRootManager']/content/excludeFolder[@url='file://$MODULE_DIR$/reports']")
|
654
|
+
end
|
655
|
+
|
656
|
+
it "generate an exclude in content section for target" do
|
657
|
+
root_module_xml(@foo).should have_xpath("/module/component[@name='NewModuleRootManager']/content/excludeFolder[@url='file://$MODULE_DIR$/target']")
|
658
|
+
end
|
659
|
+
end
|
660
|
+
|
661
|
+
describe "with subprojects" do
|
662
|
+
before do
|
663
|
+
@foo = define "foo" do
|
664
|
+
define "bar" do
|
665
|
+
compile.from _(:source, :main, :bar)
|
666
|
+
end
|
667
|
+
end
|
668
|
+
invoke_generate_task
|
669
|
+
@bar_doc = xml_document(project('foo:bar')._('bar.iml'))
|
670
|
+
end
|
671
|
+
|
672
|
+
it "generates the correct source directories" do
|
673
|
+
@bar_doc.should have_xpath("//content/sourceFolder[@url='file://$MODULE_DIR$/src/main/bar']")
|
674
|
+
end
|
675
|
+
|
676
|
+
it "generates the correct exclude directories" do
|
677
|
+
@bar_doc.should have_xpath("//content/excludeFolder[@url='file://$MODULE_DIR$/target']")
|
678
|
+
end
|
679
|
+
end
|
680
|
+
|
681
|
+
describe "with overrides" do
|
682
|
+
before do
|
683
|
+
@foo = define "foo" do
|
684
|
+
compile.from _(:source, :main, :bar)
|
685
|
+
iml.main_source_directories << _(:source, :main, :baz)
|
686
|
+
iml.test_source_directories << _(:source, :test, :foo)
|
687
|
+
end
|
688
|
+
invoke_generate_task
|
689
|
+
end
|
690
|
+
|
691
|
+
it "generates the correct main source directories" do
|
692
|
+
root_module_xml(@foo).should have_xpath("//content/sourceFolder[@url='file://$MODULE_DIR$/src/main/baz' and @isTestSource='false']")
|
693
|
+
end
|
694
|
+
|
695
|
+
it "generates the correct test source directories" do
|
696
|
+
root_module_xml(@foo).should have_xpath("//content/sourceFolder[@url='file://$MODULE_DIR$/src/test/foo' and @isTestSource='true']")
|
697
|
+
end
|
698
|
+
end
|
699
|
+
|
700
|
+
describe "with report dir outside content" do
|
701
|
+
before do
|
702
|
+
layout = Layout::Default.new
|
703
|
+
layout[:reports] = "../reports"
|
704
|
+
|
705
|
+
@foo = define "foo", :layout => layout do
|
706
|
+
end
|
707
|
+
invoke_generate_task
|
708
|
+
end
|
709
|
+
|
710
|
+
it "generate an exclude in content section for target" do
|
711
|
+
root_module_xml(@foo).should have_xpath("/module/component[@name='NewModuleRootManager']/content/excludeFolder[@url='file://$MODULE_DIR$/target']")
|
712
|
+
end
|
713
|
+
|
714
|
+
it "generates an content section without an exclude for report dir" do
|
715
|
+
root_module_xml(@foo).should have_nodes("/module/component[@name='NewModuleRootManager']/content/excludeFolder", 1)
|
716
|
+
end
|
717
|
+
end
|
718
|
+
|
719
|
+
describe "with target dir outside content" do
|
720
|
+
before do
|
721
|
+
layout = Layout::Default.new
|
722
|
+
layout[:target] = "../target"
|
723
|
+
layout[:target, :main] = "../target"
|
724
|
+
|
725
|
+
@foo = define "foo", :layout => layout do
|
726
|
+
end
|
727
|
+
invoke_generate_task
|
728
|
+
end
|
729
|
+
|
730
|
+
it "generate an exclude in content section for reports" do
|
731
|
+
root_module_xml(@foo).should have_xpath("/module/component[@name='NewModuleRootManager']/content/excludeFolder[@url='file://$MODULE_DIR$/reports']")
|
732
|
+
end
|
733
|
+
|
734
|
+
it "generates an content section without an exclude for target dir" do
|
735
|
+
root_module_xml(@foo).should have_nodes("/module/component[@name='NewModuleRootManager']/content/excludeFolder", 1)
|
736
|
+
end
|
737
|
+
end
|
738
|
+
|
739
|
+
describe "templates" do
|
740
|
+
|
741
|
+
def ipr_template
|
742
|
+
return <<PROJECT_XML
|
743
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
744
|
+
<project version="4">
|
745
|
+
<component name="SvnBranchConfigurationManager">
|
746
|
+
<option name="mySupportsUserInfoFilter" value="false" />
|
747
|
+
</component>
|
748
|
+
</project>
|
749
|
+
PROJECT_XML
|
750
|
+
end
|
751
|
+
|
752
|
+
def ipr_existing
|
753
|
+
return <<PROJECT_XML
|
754
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
755
|
+
<project version="4">
|
756
|
+
<component name="AntConfiguration">
|
757
|
+
<defaultAnt bundledAnt="true" />
|
758
|
+
</component>
|
759
|
+
<component name="SvnBranchConfigurationManager">
|
760
|
+
<option name="mySupportsUserInfoFilter" value="true" />
|
761
|
+
</component>
|
762
|
+
<component name="ProjectModuleManager">
|
763
|
+
<modules>
|
764
|
+
<module fileurl="file://$PROJECT_DIR$/existing.iml" filepath="$PROJECT_DIR$/existing.iml" />
|
765
|
+
</modules>
|
766
|
+
</component>
|
767
|
+
</project>
|
768
|
+
PROJECT_XML
|
769
|
+
end
|
770
|
+
|
771
|
+
def ipr_from_template_xpath
|
772
|
+
"/project/component[@name='SvnBranchConfigurationManager']/option[@name = 'mySupportsUserInfoFilter' and @value = 'false']"
|
773
|
+
end
|
774
|
+
|
775
|
+
def ipr_from_existing_xpath
|
776
|
+
"/project/component[@name='AntConfiguration']"
|
777
|
+
end
|
778
|
+
|
779
|
+
def ipr_from_existing_shadowing_template_xpath
|
780
|
+
"/project/component[@name='SvnBranchConfigurationManager']/option[@name = 'mySupportsUserInfoFilter' and @value = 'true']"
|
781
|
+
end
|
782
|
+
|
783
|
+
def ipr_from_existing_shadowing_generated_xpath
|
784
|
+
"/project/component[@name='ProjectModuleManager']/modules/module[@fileurl = 'file://$PROJECT_DIR$/existing.iml']"
|
785
|
+
end
|
786
|
+
|
787
|
+
def ipr_from_generated_xpath
|
788
|
+
"/project/component[@name='ProjectModuleManager']/modules/module[@fileurl = 'file://$PROJECT_DIR$/foo.iml']"
|
789
|
+
end
|
790
|
+
|
791
|
+
def iml_template
|
792
|
+
return <<PROJECT_XML
|
793
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
794
|
+
<module type="JAVA_MODULE" version="4">
|
795
|
+
<component name="FacetManager">
|
796
|
+
<facet type="JRUBY" name="JRuby">
|
797
|
+
<configuration number="0">
|
798
|
+
<JRUBY_FACET_CONFIG_ID NAME="JRUBY_SDK_NAME" VALUE="JRuby SDK 1.4.0RC1" />
|
799
|
+
</configuration>
|
800
|
+
</facet>
|
801
|
+
</component>
|
802
|
+
</module>
|
803
|
+
PROJECT_XML
|
804
|
+
end
|
805
|
+
|
806
|
+
def iml_existing
|
807
|
+
return <<PROJECT_XML
|
808
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
809
|
+
<module type="JAVA_MODULE" version="4">
|
810
|
+
<component name="FunkyPlugin"/>
|
811
|
+
<component name="FacetManager">
|
812
|
+
<facet type="SCALA" name="Scala"/>
|
813
|
+
</component>
|
814
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
815
|
+
<exclude-output />
|
816
|
+
<content url="file://$MODULE_DIR$"/>
|
817
|
+
<orderEntry type="inheritedJdk" />
|
818
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
819
|
+
<orderEntry type="module" module-name="buildr-bnd" exported="" />
|
820
|
+
</component>
|
821
|
+
</module>
|
822
|
+
PROJECT_XML
|
823
|
+
end
|
824
|
+
|
825
|
+
def iml_from_template_xpath
|
826
|
+
"/module/component[@name='FacetManager']/facet[@type = 'JRUBY']"
|
827
|
+
end
|
828
|
+
|
829
|
+
def iml_from_existing_xpath
|
830
|
+
"/module/component[@name='FunkyPlugin']"
|
831
|
+
end
|
832
|
+
|
833
|
+
def iml_from_existing_shadowing_template_xpath
|
834
|
+
"/module/component[@name='FacetManager']/facet[@type = 'SCALA']"
|
835
|
+
end
|
836
|
+
|
837
|
+
def iml_from_existing_shadowing_generated_xpath
|
838
|
+
"/module/component[@name='NewModuleRootManager']/orderEntry[@module-name = 'buildr-bnd']"
|
839
|
+
end
|
840
|
+
|
841
|
+
def iml_from_generated_xpath
|
842
|
+
"/module/component[@name='NewModuleRootManager']/orderEntry[@type = 'module-library']"
|
843
|
+
end
|
844
|
+
|
845
|
+
describe "with existing project files" do
|
846
|
+
before do
|
847
|
+
write "foo.ipr", ipr_existing
|
848
|
+
write "foo.iml", iml_existing
|
849
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
850
|
+
@foo = define "foo" do
|
851
|
+
ipr.template = nil
|
852
|
+
iml.template = nil
|
853
|
+
compile.with 'group:id:jar:1.0'
|
854
|
+
end
|
855
|
+
invoke_generate_task
|
856
|
+
end
|
857
|
+
|
858
|
+
it "replaces ProjectModuleManager component in existing ipr file" do
|
859
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_generated_xpath)
|
860
|
+
xml_document(@foo._("foo.ipr")).should_not have_xpath(ipr_from_existing_shadowing_generated_xpath)
|
861
|
+
end
|
862
|
+
|
863
|
+
it "merges component in existing ipr file" do
|
864
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_existing_xpath)
|
865
|
+
end
|
866
|
+
|
867
|
+
def iml_from_generated_xpath
|
868
|
+
"/module/component[@name='NewModuleRootManager']/orderEntry[@type = 'module-library']"
|
869
|
+
end
|
870
|
+
|
871
|
+
it "replaces NewModuleRootManager component in existing iml file" do
|
872
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_generated_xpath)
|
873
|
+
xml_document(@foo._("foo.iml")).should_not have_xpath(iml_from_existing_shadowing_generated_xpath)
|
874
|
+
end
|
875
|
+
|
876
|
+
it "merges component in existing iml file" do
|
877
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_existing_xpath)
|
878
|
+
end
|
879
|
+
end
|
880
|
+
|
881
|
+
describe "with an iml template" do
|
882
|
+
before do
|
883
|
+
write "module.template.iml", iml_template
|
884
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
885
|
+
@foo = define "foo" do
|
886
|
+
ipr.template = nil
|
887
|
+
iml.template = "module.template.iml"
|
888
|
+
compile.with 'group:id:jar:1.0'
|
889
|
+
end
|
890
|
+
invoke_generate_task
|
891
|
+
end
|
892
|
+
|
893
|
+
it "replaces generated components" do
|
894
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_generated_xpath)
|
895
|
+
end
|
896
|
+
|
897
|
+
it "merges component in iml template" do
|
898
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_template_xpath)
|
899
|
+
end
|
900
|
+
end
|
901
|
+
|
902
|
+
describe "with an iml template and existing iml" do
|
903
|
+
before do
|
904
|
+
write "module.template.iml", iml_template
|
905
|
+
write "foo.iml", iml_existing
|
906
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
907
|
+
@foo = define "foo" do
|
908
|
+
ipr.template = nil
|
909
|
+
iml.template = "module.template.iml"
|
910
|
+
compile.with 'group:id:jar:1.0'
|
911
|
+
end
|
912
|
+
invoke_generate_task
|
913
|
+
end
|
914
|
+
|
915
|
+
it "replaces generated components" do
|
916
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_generated_xpath)
|
917
|
+
end
|
918
|
+
|
919
|
+
it "merges component in iml template" do
|
920
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_template_xpath)
|
921
|
+
end
|
922
|
+
|
923
|
+
it "merges components not in iml template and not generated by task" do
|
924
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_existing_xpath)
|
925
|
+
xml_document(@foo._("foo.iml")).should_not have_xpath(iml_from_existing_shadowing_template_xpath)
|
926
|
+
xml_document(@foo._("foo.iml")).should_not have_xpath(iml_from_existing_shadowing_generated_xpath)
|
927
|
+
end
|
928
|
+
end
|
929
|
+
|
930
|
+
describe "with an ipr template" do
|
931
|
+
before do
|
932
|
+
write "project.template.iml", ipr_template
|
933
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
934
|
+
@foo = define "foo" do
|
935
|
+
ipr.template = "project.template.iml"
|
936
|
+
iml.template = nil
|
937
|
+
compile.with 'group:id:jar:1.0'
|
938
|
+
end
|
939
|
+
invoke_generate_task
|
940
|
+
end
|
941
|
+
|
942
|
+
it "replaces generated component in ipr template" do
|
943
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_generated_xpath)
|
944
|
+
end
|
945
|
+
|
946
|
+
it "merges component in ipr template" do
|
947
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_template_xpath)
|
948
|
+
end
|
949
|
+
end
|
950
|
+
|
951
|
+
describe "with an ipr template and existing ipr" do
|
952
|
+
before do
|
953
|
+
write "project.template.iml", ipr_template
|
954
|
+
write "foo.ipr", ipr_existing
|
955
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
956
|
+
@foo = define "foo" do
|
957
|
+
ipr.template = "project.template.iml"
|
958
|
+
iml.template = nil
|
959
|
+
compile.with 'group:id:jar:1.0'
|
960
|
+
end
|
961
|
+
invoke_generate_task
|
962
|
+
end
|
963
|
+
|
964
|
+
it "replaces generated component in ipr template" do
|
965
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_generated_xpath)
|
966
|
+
end
|
967
|
+
|
968
|
+
it "merges component in ipr template" do
|
969
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_template_xpath)
|
970
|
+
end
|
971
|
+
|
972
|
+
it "merges components not in ipr template and not generated by task" do
|
973
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_existing_xpath)
|
974
|
+
xml_document(@foo._("foo.ipr")).should_not have_xpath(ipr_from_existing_shadowing_generated_xpath)
|
975
|
+
xml_document(@foo._("foo.ipr")).should_not have_xpath(ipr_from_existing_shadowing_template_xpath)
|
976
|
+
end
|
977
|
+
end
|
978
|
+
end
|
979
|
+
end
|
980
|
+
|
981
|
+
describe "Buildr::IntellijIdea::IdeaModule" do
|
982
|
+
|
983
|
+
describe "with no settings" do
|
984
|
+
before do
|
985
|
+
@foo = define "foo"
|
986
|
+
end
|
987
|
+
|
988
|
+
it "has correct default iml.type setting" do
|
989
|
+
@foo.iml.type.should == "JAVA_MODULE"
|
990
|
+
end
|
991
|
+
|
992
|
+
it "has correct default iml.local_repository_env_override setting" do
|
993
|
+
@foo.iml.local_repository_env_override.should == "MAVEN_REPOSITORY"
|
994
|
+
end
|
995
|
+
end
|
996
|
+
|
997
|
+
describe "settings inherited in subprojects" do
|
998
|
+
before do
|
999
|
+
mkdir_p 'bar'
|
1000
|
+
@foo = define "foo" do
|
1001
|
+
iml.type = "FOO_MODULE_TYPE"
|
1002
|
+
define 'bar'
|
1003
|
+
end
|
1004
|
+
invoke_generate_task
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
it "generates root IML with specified type" do
|
1008
|
+
module_file = root_module_filename(@foo)
|
1009
|
+
File.should be_exist(module_file)
|
1010
|
+
File.read(module_file).should =~ /FOO_MODULE_TYPE/
|
1011
|
+
end
|
1012
|
+
|
1013
|
+
it "generates subproject IML with inherited type" do
|
1014
|
+
module_file = subproject_module_filename(@foo, "bar")
|
1015
|
+
File.should be_exist(module_file)
|
1016
|
+
File.read(module_file).should =~ /FOO_MODULE_TYPE/
|
1017
|
+
end
|
1018
|
+
|
1019
|
+
end
|
1020
|
+
|
1021
|
+
describe "with local_repository_env_override = nil" do
|
1022
|
+
if Buildr::Util.win_os?
|
1023
|
+
describe "base_directory on different drive on windows" do
|
1024
|
+
before do
|
1025
|
+
@foo = define "foo", :base_dir => "C:/bar" do
|
1026
|
+
iml.local_repository_env_override = nil
|
1027
|
+
end
|
1028
|
+
end
|
1029
|
+
|
1030
|
+
it "generates relative paths correctly" do
|
1031
|
+
@foo.iml.send(:resolve_path, "E:/foo").should eql('E:/foo')
|
1032
|
+
end
|
1033
|
+
end
|
1034
|
+
|
1035
|
+
describe "base_directory on same drive on windows" do
|
1036
|
+
before do
|
1037
|
+
@foo = define "foo", :base_dir => "C:/bar" do
|
1038
|
+
iml.local_repository_env_override = nil
|
1039
|
+
end
|
1040
|
+
end
|
1041
|
+
|
1042
|
+
it "generates relative paths correctly" do
|
1043
|
+
@foo.iml.send(:resolve_path, "C:/foo").should eql('$MODULE_DIR$/../foo')
|
1044
|
+
end
|
1045
|
+
end
|
1046
|
+
end
|
1047
|
+
end
|
1048
|
+
end
|
1049
|
+
|
1050
|
+
describe "project extension" do
|
1051
|
+
it "provides an 'idea:generate' task" do
|
1052
|
+
Rake::Task.tasks.detect { |task| task.to_s == "idea:generate" }.should_not be_nil
|
1053
|
+
end
|
1054
|
+
|
1055
|
+
it "documents the 'idea:generate' task" do
|
1056
|
+
Rake::Task.tasks.detect { |task| task.to_s == "idea:generate" }.comment.should_not be_nil
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
it "provides an 'idea:clean' task" do
|
1060
|
+
Rake::Task.tasks.detect { |task| task.to_s == "idea:clean" }.should_not be_nil
|
1061
|
+
end
|
1062
|
+
|
1063
|
+
it "documents the 'idea:clean' task" do
|
1064
|
+
Rake::Task.tasks.detect { |task| task.to_s == "idea:clean" }.comment.should_not be_nil
|
1065
|
+
end
|
1066
|
+
|
1067
|
+
it "removes the 'idea' task" do
|
1068
|
+
Rake::Task.tasks.detect { |task| task.to_s == "idea" }.should be_nil
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
it "removes the 'idea7x' task" do
|
1072
|
+
Rake::Task.tasks.detect { |task| task.to_s == "idea7x" }.should be_nil
|
1073
|
+
end
|
1074
|
+
|
1075
|
+
it "removes the 'idea7x:clean' task" do
|
1076
|
+
Rake::Task.tasks.detect { |task| task.to_s == "idea7x:clean" }.should be_nil
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
describe "#no_iml" do
|
1080
|
+
it "makes #iml? false" do
|
1081
|
+
@foo = define "foo" do
|
1082
|
+
project.no_iml
|
1083
|
+
end
|
1084
|
+
@foo.iml?.should be_false
|
1085
|
+
end
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
describe "#iml" do
|
1089
|
+
before do
|
1090
|
+
define "foo" do
|
1091
|
+
iml.suffix = "-top"
|
1092
|
+
|
1093
|
+
define "bar" do
|
1094
|
+
iml.suffix = "-mid"
|
1095
|
+
|
1096
|
+
define "baz" do
|
1097
|
+
end
|
1098
|
+
end
|
1099
|
+
end
|
1100
|
+
end
|
1101
|
+
|
1102
|
+
it "inherits the direct parent's IML settings" do
|
1103
|
+
project('foo:bar:baz').iml.suffix.should == "-mid"
|
1104
|
+
end
|
1105
|
+
|
1106
|
+
it "does not modify the parent's IML settings" do
|
1107
|
+
project('foo').iml.suffix.should == "-top"
|
1108
|
+
end
|
1109
|
+
|
1110
|
+
it "works even when the parent has no IML" do
|
1111
|
+
lambda {
|
1112
|
+
define "a" do
|
1113
|
+
project.no_iml
|
1114
|
+
define "b" do
|
1115
|
+
iml.suffix = "-alone"
|
1116
|
+
end
|
1117
|
+
end
|
1118
|
+
}.should_not raise_error
|
1119
|
+
end
|
1120
|
+
|
1121
|
+
it "inherits from the first ancestor which has an IML" do
|
1122
|
+
define "a" do
|
1123
|
+
iml.suffix = "-a"
|
1124
|
+
define "b" do
|
1125
|
+
iml.suffix = "-b"
|
1126
|
+
define "c" do
|
1127
|
+
project.no_iml
|
1128
|
+
define "d" do
|
1129
|
+
project.no_iml
|
1130
|
+
define "e" do
|
1131
|
+
project.no_iml
|
1132
|
+
define "f" do
|
1133
|
+
end
|
1134
|
+
end
|
1135
|
+
end
|
1136
|
+
end
|
1137
|
+
end
|
1138
|
+
end
|
1139
|
+
|
1140
|
+
project("a:b:c:d:e:f").iml.suffix.should == "-b"
|
1141
|
+
end
|
1142
|
+
end
|
1143
|
+
end
|
1144
|
+
|
1145
|
+
end
|