ittayd-buildr 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +62 -9
- data/NOTICE +1 -1
- data/README.rdoc +9 -21
- data/Rakefile +20 -39
- data/_buildr +1 -0
- data/{spec/java/ant.rb → _jbuildr} +11 -15
- metadata +30 -210
- data/DISCLAIMER +0 -7
- data/addon/buildr/antlr.rb +0 -65
- data/addon/buildr/cobertura.rb +0 -22
- data/addon/buildr/drb.rb +0 -281
- data/addon/buildr/emma.rb +0 -22
- data/addon/buildr/hibernate.rb +0 -142
- data/addon/buildr/javacc.rb +0 -85
- data/addon/buildr/jdepend.rb +0 -60
- data/addon/buildr/jetty.rb +0 -248
- data/addon/buildr/jibx.rb +0 -86
- data/addon/buildr/nailgun.rb +0 -221
- data/addon/buildr/openjpa.rb +0 -90
- 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 +0 -41
- 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 +0 -144
- data/addon/buildr/path.rb +0 -136
- data/addon/buildr/xmlbeans.rb +0 -93
- data/buildr.buildfile +0 -53
- data/buildr.gemspec +0 -58
- data/doc/css/default.css +0 -228
- data/doc/css/print.css +0 -100
- data/doc/css/syntax.css +0 -52
- data/doc/images/apache-incubator-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.tif +0 -0
- data/doc/pages/artifacts.textile +0 -207
- data/doc/pages/building.textile +0 -240
- data/doc/pages/contributing.textile +0 -208
- data/doc/pages/download.textile +0 -62
- data/doc/pages/extending.textile +0 -175
- data/doc/pages/getting_started.textile +0 -273
- data/doc/pages/index.textile +0 -42
- data/doc/pages/languages.textile +0 -407
- data/doc/pages/mailing_lists.textile +0 -17
- data/doc/pages/more_stuff.textile +0 -314
- data/doc/pages/packaging.textile +0 -427
- data/doc/pages/projects.textile +0 -274
- data/doc/pages/recipes.textile +0 -103
- data/doc/pages/settings_profiles.textile +0 -274
- data/doc/pages/testing.textile +0 -212
- data/doc/pages/troubleshooting.textile +0 -103
- data/doc/pages/whats_new.textile +0 -323
- data/doc/print.haml +0 -51
- data/doc/print.toc.yaml +0 -29
- data/doc/scripts/buildr-git.rb +0 -412
- data/doc/scripts/install-jruby.sh +0 -44
- data/doc/scripts/install-linux.sh +0 -64
- data/doc/scripts/install-osx.sh +0 -52
- data/doc/site.haml +0 -56
- data/doc/site.toc.yaml +0 -47
- data/etc/KEYS +0 -151
- data/etc/git-svn-authors +0 -16
- data/lib/buildr.rb +0 -33
- data/lib/buildr/core.rb +0 -29
- data/lib/buildr/core/application.rb +0 -665
- data/lib/buildr/core/build.rb +0 -311
- data/lib/buildr/core/checks.rb +0 -254
- data/lib/buildr/core/common.rb +0 -150
- data/lib/buildr/core/compile.rb +0 -590
- data/lib/buildr/core/environment.rb +0 -117
- data/lib/buildr/core/filter.rb +0 -366
- data/lib/buildr/core/generate.rb +0 -195
- data/lib/buildr/core/help.rb +0 -119
- data/lib/buildr/core/osx.rb +0 -49
- data/lib/buildr/core/progressbar.rb +0 -156
- data/lib/buildr/core/project.rb +0 -923
- data/lib/buildr/core/test.rb +0 -715
- data/lib/buildr/core/transports.rb +0 -560
- data/lib/buildr/core/util.rb +0 -294
- data/lib/buildr/groovy.rb +0 -18
- data/lib/buildr/groovy/bdd.rb +0 -106
- data/lib/buildr/groovy/compiler.rb +0 -138
- data/lib/buildr/ide.rb +0 -19
- data/lib/buildr/ide/eclipse.rb +0 -222
- data/lib/buildr/ide/idea.ipr.template +0 -300
- data/lib/buildr/ide/idea.rb +0 -190
- data/lib/buildr/ide/idea7x.ipr.template +0 -290
- data/lib/buildr/ide/idea7x.rb +0 -212
- data/lib/buildr/java.rb +0 -23
- data/lib/buildr/java/ant.rb +0 -92
- data/lib/buildr/java/bdd.rb +0 -451
- data/lib/buildr/java/cobertura.rb +0 -236
- data/lib/buildr/java/commands.rb +0 -211
- data/lib/buildr/java/compiler.rb +0 -348
- data/lib/buildr/java/deprecated.rb +0 -141
- data/lib/buildr/java/emma.rb +0 -238
- data/lib/buildr/java/jruby.rb +0 -117
- data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +0 -119
- data/lib/buildr/java/packaging.rb +0 -717
- data/lib/buildr/java/pom.rb +0 -174
- data/lib/buildr/java/rjb.rb +0 -155
- data/lib/buildr/java/test_result.rb +0 -307
- data/lib/buildr/java/tests.rb +0 -329
- data/lib/buildr/java/version_requirement.rb +0 -172
- data/lib/buildr/packaging.rb +0 -24
- data/lib/buildr/packaging/archive.rb +0 -488
- data/lib/buildr/packaging/artifact.rb +0 -759
- data/lib/buildr/packaging/artifact_namespace.rb +0 -972
- data/lib/buildr/packaging/artifact_search.rb +0 -140
- data/lib/buildr/packaging/gems.rb +0 -102
- data/lib/buildr/packaging/package.rb +0 -233
- data/lib/buildr/packaging/tar.rb +0 -186
- data/lib/buildr/packaging/version_requirement.rb +0 -172
- data/lib/buildr/packaging/zip.rb +0 -64
- data/lib/buildr/packaging/ziptask.rb +0 -313
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala.rb +0 -19
- data/lib/buildr/scala/compiler.rb +0 -109
- data/lib/buildr/scala/tests.rb +0 -203
- data/rakelib/apache.rake +0 -191
- data/rakelib/changelog.rake +0 -57
- data/rakelib/doc.rake +0 -103
- data/rakelib/package.rake +0 -76
- data/rakelib/release.rake +0 -65
- data/rakelib/rspec.rake +0 -83
- data/rakelib/rubyforge.rake +0 -56
- data/rakelib/scm.rake +0 -49
- data/rakelib/setup.rake +0 -81
- data/rakelib/stage.rake +0 -48
- data/spec/addon/drb_spec.rb +0 -328
- data/spec/core/application_spec.rb +0 -419
- data/spec/core/build_spec.rb +0 -423
- data/spec/core/checks_spec.rb +0 -519
- data/spec/core/common_spec.rb +0 -670
- data/spec/core/compile_spec.rb +0 -582
- data/spec/core/generate_spec.rb +0 -33
- data/spec/core/project_spec.rb +0 -776
- data/spec/core/test_spec.rb +0 -1098
- data/spec/core/transport_spec.rb +0 -500
- data/spec/groovy/bdd_spec.rb +0 -80
- data/spec/groovy/compiler_spec.rb +0 -239
- data/spec/ide/eclipse_spec.rb +0 -311
- data/spec/java/bdd_spec.rb +0 -358
- data/spec/java/cobertura_spec.rb +0 -77
- data/spec/java/compiler_spec.rb +0 -446
- data/spec/java/emma_spec.rb +0 -120
- data/spec/java/java_spec.rb +0 -96
- data/spec/java/packaging_spec.rb +0 -1120
- data/spec/java/test_coverage_spec.rb +0 -255
- data/spec/java/tests_spec.rb +0 -471
- data/spec/packaging/archive_spec.rb +0 -503
- data/spec/packaging/artifact_namespace_spec.rb +0 -646
- data/spec/packaging/artifact_spec.rb +0 -795
- data/spec/packaging/packaging_helper.rb +0 -63
- data/spec/packaging/packaging_spec.rb +0 -589
- data/spec/sandbox.rb +0 -139
- data/spec/scala/compiler_spec.rb +0 -228
- data/spec/scala/tests_spec.rb +0 -215
- data/spec/spec_helpers.rb +0 -327
- data/spec/version_requirement_spec.rb +0 -123
data/spec/java/emma_spec.rb
DELETED
@@ -1,120 +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.join(File.dirname(__FILE__), 'test_coverage_spec')
|
18
|
-
Sandbox.require_optional_extension 'buildr/java/emma'
|
19
|
-
|
20
|
-
|
21
|
-
Buildr::Emma::requires
|
22
|
-
|
23
|
-
|
24
|
-
describe Buildr::Emma do
|
25
|
-
before do
|
26
|
-
# Reloading the extension because the sandbox removes all its actions
|
27
|
-
load File.expand_path('../lib/buildr/java/emma.rb')
|
28
|
-
@tool_module = Buildr::Emma
|
29
|
-
end
|
30
|
-
|
31
|
-
it_should_behave_like 'test coverage tool'
|
32
|
-
|
33
|
-
describe 'project-specific' do
|
34
|
-
describe 'metadata file' do
|
35
|
-
it 'should have a default value' do
|
36
|
-
define('foo').emma.metadata_file.should point_to_path('reports/emma/coverage.em')
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should be overridable' do
|
40
|
-
define('foo') { emma.metadata_file = path_to('target/metadata.emma') }
|
41
|
-
project('foo').emma.metadata_file.should point_to_path('target/metadata.emma')
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should be created during instrumentation' do
|
45
|
-
write 'src/main/java/Foo.java', 'public class Foo {}'
|
46
|
-
define('foo')
|
47
|
-
task('foo:emma:instrument').invoke
|
48
|
-
file(project('foo').emma.metadata_file).should exist
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe 'coverage file' do
|
53
|
-
it 'should have a default value' do
|
54
|
-
define('foo').emma.coverage_file.should point_to_path('reports/emma/coverage.ec')
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'should be overridable' do
|
58
|
-
define('foo') { emma.coverage_file = path_to('target/coverage.emma') }
|
59
|
-
project('foo').emma.coverage_file.should point_to_path('target/coverage.emma')
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'should be created during test' do
|
63
|
-
write 'src/main/java/Foo.java', 'public class Foo {}'
|
64
|
-
write_test :for=>'Foo', :in=>'src/test/java'
|
65
|
-
define('foo')
|
66
|
-
task('foo:test').invoke
|
67
|
-
file(project('foo').emma.coverage_file).should exist
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe 'instrumentation' do
|
72
|
-
before do
|
73
|
-
['Foo', 'Bar'].each { |cls| write File.join('src/main/java', "#{cls}.java"), "public class #{cls} {}" }
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'should instrument only included classes' do
|
77
|
-
define('foo') { emma.include 'Foo' }
|
78
|
-
task("foo:emma:instrument").invoke
|
79
|
-
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Foo.class'] }
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'should not instrument excluded classes' do
|
83
|
-
define('foo') { emma.exclude 'Foo' }
|
84
|
-
task("foo:emma:instrument").invoke
|
85
|
-
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Bar.class'] }
|
86
|
-
end
|
87
|
-
|
88
|
-
it 'should instrument classes that are included but not excluded' do
|
89
|
-
write 'src/main/java/Baz.java', 'public class Baz {}'
|
90
|
-
define('foo') { emma.include('Ba*').exclude('*ar') }
|
91
|
-
task("foo:emma:instrument").invoke
|
92
|
-
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Baz.class'] }
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe 'reports' do
|
97
|
-
before do
|
98
|
-
write 'src/main/java/Foo.java', 'public class Foo {}'
|
99
|
-
write_test :for=>'Foo', :in=>'src/test/java'
|
100
|
-
end
|
101
|
-
|
102
|
-
describe 'in html' do
|
103
|
-
it 'should inform the user if no coverage data' do
|
104
|
-
rm 'src/test/java/FooTest.java'
|
105
|
-
define('foo')
|
106
|
-
lambda { task('foo:emma:html').invoke }.
|
107
|
-
should show_info(/No test coverage report for foo. Missing: #{project('foo').emma.coverage_file}/)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe 'in xml' do
|
112
|
-
it 'should have an xml file' do
|
113
|
-
define('foo')
|
114
|
-
task('foo:emma:xml').invoke
|
115
|
-
file(File.join(project('foo').emma.report_dir, 'coverage.xml')).should exist
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
data/spec/java/java_spec.rb
DELETED
@@ -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
|
-
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
17
|
-
|
18
|
-
unless RUBY_PLATFORM =~ /java/
|
19
|
-
describe ENV, 'JAVA_HOME on OS X' do
|
20
|
-
before do
|
21
|
-
@old_home, ENV['JAVA_HOME'] = ENV['JAVA_HOME'], nil
|
22
|
-
@old_env_java = ENV_JAVA
|
23
|
-
Config::CONFIG.should_receive(:[]).with('host_os').and_return('darwin0.9')
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should point to default JVM' do
|
27
|
-
load File.expand_path('../lib/buildr/java/rjb.rb')
|
28
|
-
ENV['JAVA_HOME'].should == '/System/Library/Frameworks/JavaVM.framework/Home'
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should use value of environment variable if specified' do
|
32
|
-
ENV['JAVA_HOME'] = '/System/Library/Frameworks/JavaVM.specified'
|
33
|
-
load File.expand_path('../lib/buildr/java/rjb.rb')
|
34
|
-
ENV['JAVA_HOME'].should == '/System/Library/Frameworks/JavaVM.specified'
|
35
|
-
end
|
36
|
-
|
37
|
-
after do
|
38
|
-
ENV['JAVA_HOME'] = @old_home
|
39
|
-
ENV_JAVA.replace @old_env_java
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
describe Java, '#tools_jar' do
|
46
|
-
before do
|
47
|
-
@old_home = ENV['JAVA_HOME']
|
48
|
-
end
|
49
|
-
|
50
|
-
describe 'when JAVA_HOME points to a JDK' do
|
51
|
-
before do
|
52
|
-
Java.instance_eval { @tools_jar = nil }
|
53
|
-
write 'jdk/lib/tools.jar'
|
54
|
-
ENV['JAVA_HOME'] = File.expand_path('jdk')
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'should return the path to tools.jar' do
|
58
|
-
Java.tools_jar.should point_to_path('jdk/lib/tools.jar')
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe 'when JAVA_HOME points to a JRE inside a JDK' do
|
63
|
-
before do
|
64
|
-
Java.instance_eval { @tools_jar = nil }
|
65
|
-
write 'jdk/lib/tools.jar'
|
66
|
-
ENV['JAVA_HOME'] = File.expand_path('jdk/jre')
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'should return the path to tools.jar' do
|
70
|
-
Java.tools_jar.should point_to_path('jdk/lib/tools.jar')
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe 'when there is no tools.jar' do
|
75
|
-
before do
|
76
|
-
Java.instance_eval { @tools_jar = nil }
|
77
|
-
ENV['JAVA_HOME'] = File.expand_path('jdk')
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'should return nil' do
|
81
|
-
Java.tools_jar.should be_nil
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
after do
|
86
|
-
ENV['JAVA_HOME'] = @old_home
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
describe Java::JavaWrapper do
|
92
|
-
it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
|
93
|
-
Buildr::VERSION.should < '1.5'
|
94
|
-
lambda { Java::JavaWrapper }.should_not raise_error
|
95
|
-
end
|
96
|
-
end
|
data/spec/java/packaging_spec.rb
DELETED
@@ -1,1120 +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.join(File.dirname(__FILE__), '../spec_helpers')
|
18
|
-
require File.join(File.dirname(__FILE__), '../packaging/packaging_helper')
|
19
|
-
|
20
|
-
|
21
|
-
describe Project, '#manifest' do
|
22
|
-
it 'should include user name' do
|
23
|
-
ENV['USER'] = 'MysteriousJoe'
|
24
|
-
define('foo').manifest['Build-By'].should eql('MysteriousJoe')
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should include JDK version' do
|
28
|
-
define('foo').manifest['Build-Jdk'].should =~ /^1\.\d+\.\w+$/
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should include project comment' do
|
32
|
-
desc 'My Project'
|
33
|
-
define('foo').manifest['Implementation-Title'].should eql('My Project')
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should include project name if no comment' do
|
37
|
-
define('foo').manifest['Implementation-Title'].should eql('foo')
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'should include project version' do
|
41
|
-
define('foo', :version=>'2.1').manifest['Implementation-Version'].should eql('2.1')
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should not include project version unless specified' do
|
45
|
-
define('foo').manifest['Implementation-Version'].should be_nil
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'should inherit from parent project' do
|
49
|
-
define('foo', :version=>'2.1') { define 'bar' }
|
50
|
-
project('foo:bar').manifest['Implementation-Version'].should eql('2.1')
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
shared_examples_for 'package with manifest' do
|
57
|
-
before do
|
58
|
-
@long_line = 'No line may be longer than 72 bytes (not characters), in its UTF8-encoded form. If a value would make the initial line longer than this, it should be continued on extra lines (each starting with a single SPACE).'
|
59
|
-
end
|
60
|
-
|
61
|
-
def package_with_manifest(manifest = nil)
|
62
|
-
packaging = @packaging
|
63
|
-
@project = define('foo', :version=>'1.2') do
|
64
|
-
package packaging
|
65
|
-
package(packaging).with(:manifest=>manifest) unless manifest.nil?
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def inspect_manifest(package = nil)
|
70
|
-
package ||= project('foo').package(@packaging)
|
71
|
-
package.invoke
|
72
|
-
yield Buildr::Packaging::Java::Manifest.from_zip(package)
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'should include default header when no options specified' do
|
76
|
-
ENV['USER'] = 'MysteriousJoe'
|
77
|
-
package_with_manifest # Nothing for default.
|
78
|
-
inspect_manifest do |manifest|
|
79
|
-
manifest.sections.size.should be(1)
|
80
|
-
manifest.main.should == {
|
81
|
-
'Manifest-Version' =>'1.0',
|
82
|
-
'Created-By' =>'Buildr',
|
83
|
-
'Implementation-Title' =>@project.name,
|
84
|
-
'Implementation-Version' =>'1.2',
|
85
|
-
'Build-Jdk' =>ENV_JAVA['java.version'],
|
86
|
-
'Build-By' =>'MysteriousJoe'
|
87
|
-
}
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'should not exist when manifest=false' do
|
92
|
-
package_with_manifest false
|
93
|
-
@project.package(@packaging).invoke
|
94
|
-
Zip::ZipFile.open(@project.package(@packaging).to_s) do |zip|
|
95
|
-
zip.file.exist?('META-INF/MANIFEST.MF').should be_false
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'should map manifest from hash' do
|
100
|
-
package_with_manifest 'Foo'=>1, :bar=>'Bar'
|
101
|
-
inspect_manifest do |manifest|
|
102
|
-
manifest.sections.size.should be(1)
|
103
|
-
manifest.main['Manifest-Version'].should eql('1.0')
|
104
|
-
manifest.main['Created-By'].should eql('Buildr')
|
105
|
-
manifest.main['Foo'].should eql('1')
|
106
|
-
manifest.main['bar'].should eql('Bar')
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
it 'should end hash manifest with EOL' do
|
111
|
-
package_with_manifest 'Foo'=>1, :bar=>'Bar'
|
112
|
-
package = project('foo').package(@packaging)
|
113
|
-
package.invoke
|
114
|
-
Zip::ZipFile.open(package.to_s) { |zip| zip.file.read('META-INF/MANIFEST.MF').should =~ /#{Buildr::Packaging::Java::Manifest::LINE_SEPARATOR}$/ }
|
115
|
-
end
|
116
|
-
|
117
|
-
it 'should break hash manifest lines longer than 72 characters using continuations' do
|
118
|
-
package_with_manifest 'foo'=>@long_line
|
119
|
-
package = project('foo').package(@packaging)
|
120
|
-
inspect_manifest do |manifest|
|
121
|
-
manifest.main['foo'].should == @long_line
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
it 'should map manifest from array' do
|
126
|
-
package_with_manifest [ { :foo=>'first' }, { :bar=>'second' } ]
|
127
|
-
inspect_manifest do |manifest|
|
128
|
-
manifest.sections.size.should be(2)
|
129
|
-
manifest.main['Manifest-Version'].should eql('1.0')
|
130
|
-
manifest.main['foo'].should eql('first')
|
131
|
-
manifest.sections.last['bar'].should eql('second')
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
it 'should end array manifest with EOL' do
|
136
|
-
package_with_manifest [ { :foo=>'first' }, { :bar=>'second' } ]
|
137
|
-
package = project('foo').package(@packaging)
|
138
|
-
package.invoke
|
139
|
-
Zip::ZipFile.open(package.to_s) { |zip| zip.file.read('META-INF/MANIFEST.MF')[-1].should == ?\n }
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'should break array manifest lines longer than 72 characters using continuations' do
|
143
|
-
package_with_manifest ['foo'=>@long_line]
|
144
|
-
package = project('foo').package(@packaging)
|
145
|
-
inspect_manifest do |manifest|
|
146
|
-
manifest.main['foo'].should == @long_line
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
it 'should put Name: at beginning of section' do
|
151
|
-
package_with_manifest [ {}, { 'Name'=>'first', :Foo=>'first', :bar=>'second' } ]
|
152
|
-
package = project('foo').package(@packaging)
|
153
|
-
package.invoke
|
154
|
-
inspect_manifest do |manifest|
|
155
|
-
manifest.sections[1]["Name"].should == "first"
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
it 'should create manifest from proc' do
|
160
|
-
package_with_manifest lambda { 'Meta: data' }
|
161
|
-
inspect_manifest do |manifest|
|
162
|
-
manifest.sections.size.should be(1)
|
163
|
-
manifest.main['Manifest-Version'].should eql('1.0')
|
164
|
-
manifest.main['Meta'].should eql('data')
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
it 'should create manifest from file' do
|
169
|
-
write 'MANIFEST.MF', 'Meta: data'
|
170
|
-
package_with_manifest 'MANIFEST.MF'
|
171
|
-
inspect_manifest do |manifest|
|
172
|
-
manifest.sections.size.should be(1)
|
173
|
-
manifest.main['Meta'].should eql('data')
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
it 'should not add manifest version twice' do
|
178
|
-
write 'MANIFEST.MF', 'Manifest-Version: 1.9'
|
179
|
-
package_with_manifest 'MANIFEST.MF'
|
180
|
-
package ||= project('foo').package(@packaging)
|
181
|
-
package.invoke
|
182
|
-
Zip::ZipFile.open(package.to_s) do |zip|
|
183
|
-
zip.read('META-INF/MANIFEST.MF').scan(/(Manifest-Version)/m).size.should == 1
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
it 'should give precedence to version specified in manifest file' do
|
188
|
-
write 'MANIFEST.MF', 'Manifest-Version: 1.9'
|
189
|
-
package_with_manifest 'MANIFEST.MF'
|
190
|
-
inspect_manifest do |manifest|
|
191
|
-
manifest.main['Manifest-Version'].should == '1.9'
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
it 'should create manifest from task' do
|
196
|
-
file 'MANIFEST.MF' do |task|
|
197
|
-
write task.to_s, 'Meta: data'
|
198
|
-
end
|
199
|
-
package_with_manifest 'MANIFEST.MF'
|
200
|
-
inspect_manifest do |manifest|
|
201
|
-
manifest.sections.size.should be(1)
|
202
|
-
manifest.main['Manifest-Version'].should eql('1.0')
|
203
|
-
manifest.main['Meta'].should eql('data')
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
it 'should respond to with() and accept manifest' do
|
208
|
-
write 'DISCLAIMER'
|
209
|
-
mkpath 'target/classes'
|
210
|
-
packaging = @packaging
|
211
|
-
define('foo', :version=>'1.0') { package(packaging).with :manifest=>{'Foo'=>'data'} }
|
212
|
-
inspect_manifest { |manifest| manifest.main['Foo'].should eql('data') }
|
213
|
-
end
|
214
|
-
|
215
|
-
it 'should include META-INF directory' do
|
216
|
-
packaging = @packaging
|
217
|
-
package = define('foo', :version=>'1.0') { package(packaging) }.packages.first
|
218
|
-
package.invoke
|
219
|
-
Zip::ZipFile.open(package.to_s) do |zip|
|
220
|
-
zip.entries.map(&:to_s).should include('META-INF/')
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
it 'should inherit manifest from parent project' do
|
225
|
-
packaging = @packaging
|
226
|
-
package = nil
|
227
|
-
define('foo', :version => '1.0') do
|
228
|
-
manifest['Foo'] = '1'
|
229
|
-
package(packaging)
|
230
|
-
define('bar', :version => '1.0') do
|
231
|
-
manifest['bar'] = 'Bar'
|
232
|
-
package(:jar)
|
233
|
-
package = packages.first
|
234
|
-
end
|
235
|
-
end
|
236
|
-
inspect_manifest(package) do |manifest|
|
237
|
-
manifest.sections.size.should be(1)
|
238
|
-
manifest.main['Manifest-Version'].should eql('1.0')
|
239
|
-
manifest.main['Created-By'].should eql('Buildr')
|
240
|
-
manifest.main['Foo'].should eql('1')
|
241
|
-
manifest.main['bar'].should eql('Bar')
|
242
|
-
end
|
243
|
-
end
|
244
|
-
|
245
|
-
it 'should not modify manifest of parent project' do
|
246
|
-
packaging = @packaging
|
247
|
-
define('foo', :version => '1.0') do
|
248
|
-
manifest['Foo'] = '1'
|
249
|
-
package(packaging)
|
250
|
-
define('bar', :version => '1.0') do
|
251
|
-
manifest['bar'] = 'Bar'
|
252
|
-
package(:jar)
|
253
|
-
end
|
254
|
-
define('baz', :version => '1.0') do
|
255
|
-
manifest['baz'] = 'Baz'
|
256
|
-
package(:jar)
|
257
|
-
end
|
258
|
-
end
|
259
|
-
inspect_manifest(project('foo').packages.first) do |manifest|
|
260
|
-
manifest.sections.size.should be(1)
|
261
|
-
manifest.main['Manifest-Version'].should eql('1.0')
|
262
|
-
manifest.main['Created-By'].should eql('Buildr')
|
263
|
-
manifest.main['Foo'].should eql('1')
|
264
|
-
manifest.main['bar'].should be_nil
|
265
|
-
manifest.main['baz'].should be_nil
|
266
|
-
end
|
267
|
-
inspect_manifest(project('foo:bar').packages.first) do |manifest|
|
268
|
-
manifest.sections.size.should be(1)
|
269
|
-
manifest.main['Manifest-Version'].should eql('1.0')
|
270
|
-
manifest.main['Created-By'].should eql('Buildr')
|
271
|
-
manifest.main['Foo'].should eql('1')
|
272
|
-
manifest.main['bar'].should eql('Bar')
|
273
|
-
manifest.main['baz'].should be_nil
|
274
|
-
end
|
275
|
-
inspect_manifest(project('foo:baz').packages.first) do |manifest|
|
276
|
-
manifest.sections.size.should be(1)
|
277
|
-
manifest.main['Manifest-Version'].should eql('1.0')
|
278
|
-
manifest.main['Created-By'].should eql('Buildr')
|
279
|
-
manifest.main['Foo'].should eql('1')
|
280
|
-
manifest.main['baz'].should eql('Baz')
|
281
|
-
manifest.main['bar'].should be_nil
|
282
|
-
end
|
283
|
-
end
|
284
|
-
end
|
285
|
-
|
286
|
-
|
287
|
-
describe Project, '#meta_inf' do
|
288
|
-
it 'should by an array' do
|
289
|
-
define('foo').meta_inf.should be_kind_of(Array)
|
290
|
-
end
|
291
|
-
|
292
|
-
it 'should include LICENSE file if found' do
|
293
|
-
write 'LICENSE'
|
294
|
-
define('foo').meta_inf.first.should point_to_path('LICENSE')
|
295
|
-
end
|
296
|
-
|
297
|
-
it 'should be empty unless LICENSE exists' do
|
298
|
-
define('foo').meta_inf.should be_empty
|
299
|
-
end
|
300
|
-
|
301
|
-
it 'should inherit from parent project' do
|
302
|
-
write 'LICENSE'
|
303
|
-
define('foo') { define 'bar' }
|
304
|
-
project('foo:bar').meta_inf.first.should point_to_path('LICENSE')
|
305
|
-
end
|
306
|
-
|
307
|
-
it 'should expect LICENSE file parent project' do
|
308
|
-
write 'bar/LICENSE'
|
309
|
-
define('foo') { define 'bar' }
|
310
|
-
project('foo:bar').meta_inf.should be_empty
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
|
315
|
-
describe 'package with meta_inf', :shared=>true do
|
316
|
-
|
317
|
-
def package_with_meta_inf(meta_inf = nil)
|
318
|
-
packaging = @packaging
|
319
|
-
@project = Buildr.define('foo', :version=>'1.2') do
|
320
|
-
package packaging
|
321
|
-
package(packaging).with(:meta_inf=>meta_inf) if meta_inf
|
322
|
-
end
|
323
|
-
end
|
324
|
-
|
325
|
-
def inspect_meta_inf
|
326
|
-
package = project('foo').package(@packaging)
|
327
|
-
package.invoke
|
328
|
-
assumed = Array(@meta_inf_ignore)
|
329
|
-
Zip::ZipFile.open(package.to_s) do |zip|
|
330
|
-
entries = zip.entries.map(&:to_s).select { |f| File.dirname(f) == 'META-INF' }.map { |f| File.basename(f) }
|
331
|
-
assumed.each { |f| entries.should include(f) }
|
332
|
-
yield entries - assumed if block_given?
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
336
|
-
it 'should default to LICENSE file' do
|
337
|
-
write 'LICENSE'
|
338
|
-
package_with_meta_inf
|
339
|
-
inspect_meta_inf { |files| files.should eql(['LICENSE']) }
|
340
|
-
end
|
341
|
-
|
342
|
-
it 'should be empty if no LICENSE file' do
|
343
|
-
package_with_meta_inf
|
344
|
-
inspect_meta_inf { |files| files.should be_empty }
|
345
|
-
end
|
346
|
-
|
347
|
-
it 'should include file specified by :meta_inf option' do
|
348
|
-
write 'README'
|
349
|
-
package_with_meta_inf 'README'
|
350
|
-
inspect_meta_inf { |files| files.should eql(['README']) }
|
351
|
-
end
|
352
|
-
|
353
|
-
it 'should include files specified by :meta_inf option' do
|
354
|
-
files = ['README', 'DISCLAIMER'].each { |file| write file }
|
355
|
-
package_with_meta_inf files
|
356
|
-
inspect_meta_inf { |files| files.should eql(files) }
|
357
|
-
end
|
358
|
-
|
359
|
-
it 'should include file task specified by :meta_inf option' do
|
360
|
-
file('README') { |task| write task.to_s }
|
361
|
-
package_with_meta_inf file('README')
|
362
|
-
inspect_meta_inf { |files| files.should eql(['README']) }
|
363
|
-
end
|
364
|
-
|
365
|
-
it 'should include file tasks specified by :meta_inf option' do
|
366
|
-
files = ['README', 'DISCLAIMER'].each { |file| file(file) { |task| write task.to_s } }
|
367
|
-
package_with_meta_inf files.map { |f| file(f) }
|
368
|
-
inspect_meta_inf { |files| files.should eql(files) }
|
369
|
-
end
|
370
|
-
|
371
|
-
it 'should complain if cannot find file' do
|
372
|
-
package_with_meta_inf 'README'
|
373
|
-
lambda { inspect_meta_inf }.should raise_error(RuntimeError, /README/)
|
374
|
-
end
|
375
|
-
|
376
|
-
it 'should complain if cannot build task' do
|
377
|
-
file('README') { fail 'Failed' }
|
378
|
-
package_with_meta_inf 'README'
|
379
|
-
lambda { inspect_meta_inf }.should raise_error(RuntimeError, /Failed/)
|
380
|
-
end
|
381
|
-
|
382
|
-
it 'should respond to with() and accept manifest and meta_inf' do
|
383
|
-
write 'DISCLAIMER'
|
384
|
-
mkpath 'target/classes'
|
385
|
-
packaging = @packaging
|
386
|
-
define('foo', :version=>'1.0') { package(packaging).with :meta_inf=>'DISCLAIMER' }
|
387
|
-
inspect_meta_inf { |files| files.should eql(['DISCLAIMER']) }
|
388
|
-
end
|
389
|
-
end
|
390
|
-
|
391
|
-
|
392
|
-
describe Packaging, 'jar' do
|
393
|
-
it_should_behave_like 'packaging'
|
394
|
-
before { @packaging = :jar }
|
395
|
-
it_should_behave_like 'package with manifest'
|
396
|
-
it_should_behave_like 'package with meta_inf'
|
397
|
-
before { @meta_inf_ignore = 'MANIFEST.MF' }
|
398
|
-
|
399
|
-
it 'should use files from compile directory if nothing included' do
|
400
|
-
write 'src/main/java/Test.java', 'class Test {}'
|
401
|
-
define('foo', :version=>'1.0') { package(:jar) }
|
402
|
-
project('foo').package(:jar).invoke
|
403
|
-
Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar|
|
404
|
-
jar.entries.map(&:to_s).sort.should include('META-INF/MANIFEST.MF', 'Test.class')
|
405
|
-
end
|
406
|
-
end
|
407
|
-
|
408
|
-
it 'should use files from resources directory if nothing included' do
|
409
|
-
write 'src/main/resources/test/important.properties'
|
410
|
-
define('foo', :version=>'1.0') { package(:jar) }
|
411
|
-
project('foo').package(:jar).invoke
|
412
|
-
Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar|
|
413
|
-
jar.entries.map(&:to_s).sort.should include('test/important.properties')
|
414
|
-
end
|
415
|
-
end
|
416
|
-
|
417
|
-
it 'should include class directories' do
|
418
|
-
write 'src/main/java/code/Test.java', 'package code ; class Test {}'
|
419
|
-
define('foo', :version=>'1.0') { package(:jar) }
|
420
|
-
project('foo').package(:jar).invoke
|
421
|
-
Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar|
|
422
|
-
jar.entries.map(&:to_s).sort.should include('code/')
|
423
|
-
end
|
424
|
-
end
|
425
|
-
|
426
|
-
it 'should include resource files starting with dot' do
|
427
|
-
write 'src/main/resources/test/.config'
|
428
|
-
define('foo', :version=>'1.0') { package(:jar) }
|
429
|
-
project('foo').package(:jar).invoke
|
430
|
-
Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar|
|
431
|
-
jar.entries.map(&:to_s).sort.should include('test/.config')
|
432
|
-
end
|
433
|
-
end
|
434
|
-
|
435
|
-
it 'should include empty resource directories' do
|
436
|
-
mkpath 'src/main/resources/empty'
|
437
|
-
define('foo', :version=>'1.0') { package(:jar) }
|
438
|
-
project('foo').package(:jar).invoke
|
439
|
-
Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar|
|
440
|
-
jar.entries.map(&:to_s).sort.should include('empty/')
|
441
|
-
end
|
442
|
-
end
|
443
|
-
end
|
444
|
-
|
445
|
-
|
446
|
-
describe Packaging, 'war' do
|
447
|
-
it_should_behave_like 'packaging'
|
448
|
-
before { @packaging = :war }
|
449
|
-
it_should_behave_like 'package with manifest'
|
450
|
-
it_should_behave_like 'package with meta_inf'
|
451
|
-
before { @meta_inf_ignore = 'MANIFEST.MF' }
|
452
|
-
|
453
|
-
def make_jars
|
454
|
-
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
455
|
-
artifact('group:id:jar:2.0') { |t| write t.to_s }
|
456
|
-
end
|
457
|
-
|
458
|
-
def inspect_war
|
459
|
-
project('foo').package(:war).invoke
|
460
|
-
Zip::ZipFile.open(project('foo').package(:war).to_s) do |war|
|
461
|
-
yield war.entries.map(&:to_s).sort
|
462
|
-
end
|
463
|
-
end
|
464
|
-
|
465
|
-
it 'should use files from webapp directory if nothing included' do
|
466
|
-
write 'src/main/webapp/test.html'
|
467
|
-
define('foo', :version=>'1.0') { package(:war) }
|
468
|
-
inspect_war { |files| files.should include('test.html') }
|
469
|
-
end
|
470
|
-
|
471
|
-
it 'should accept files from :classes option' do
|
472
|
-
write 'src/main/java/Test.java', 'class Test {}'
|
473
|
-
write 'classes/test'
|
474
|
-
define('foo', :version=>'1.0') { package(:war).with(:classes=>'classes') }
|
475
|
-
inspect_war { |files| files.should include('WEB-INF/classes/test') }
|
476
|
-
end
|
477
|
-
|
478
|
-
it 'should use files from compile directory if nothing included' do
|
479
|
-
write 'src/main/java/Test.java', 'class Test {}'
|
480
|
-
define('foo', :version=>'1.0') { package(:war) }
|
481
|
-
inspect_war { |files| files.should include('WEB-INF/classes/Test.class') }
|
482
|
-
end
|
483
|
-
|
484
|
-
it 'should ignore compile directory if no source files to compile' do
|
485
|
-
define('foo', :version=>'1.0') { package(:war) }
|
486
|
-
inspect_war { |files| files.should_not include('target/classes') }
|
487
|
-
end
|
488
|
-
|
489
|
-
it 'should include only specified classes directories' do
|
490
|
-
write 'src/main/java'
|
491
|
-
define('foo', :version=>'1.0') { package(:war).with :classes=>_('additional') }
|
492
|
-
project('foo').package(:war).classes.should_not include(project('foo').file('target/classes'))
|
493
|
-
project('foo').package(:war).classes.should include(project('foo').file('additional'))
|
494
|
-
end
|
495
|
-
|
496
|
-
it 'should use files from resources directory if nothing included' do
|
497
|
-
write 'src/main/resources/test/important.properties'
|
498
|
-
define('foo', :version=>'1.0') { package(:war) }
|
499
|
-
inspect_war { |files| files.should include('WEB-INF/classes/test/important.properties') }
|
500
|
-
end
|
501
|
-
|
502
|
-
it 'should include empty resource directories' do
|
503
|
-
mkpath 'src/main/resources/empty'
|
504
|
-
define('foo', :version=>'1.0') { package(:war) }
|
505
|
-
inspect_war { |files| files.should include('WEB-INF/classes/empty/') }
|
506
|
-
end
|
507
|
-
|
508
|
-
it 'should accept file from :libs option' do
|
509
|
-
make_jars
|
510
|
-
define('foo', :version=>'1.0') { package(:war).with(:libs=>'group:id:jar:1.0') }
|
511
|
-
inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar') }
|
512
|
-
end
|
513
|
-
|
514
|
-
it 'should accept file from :libs option' do
|
515
|
-
make_jars
|
516
|
-
define('foo', :version=>'1.0') { package(:war).with(:libs=>['group:id:jar:1.0', 'group:id:jar:2.0']) }
|
517
|
-
inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar', 'WEB-INF/lib/id-2.0.jar') }
|
518
|
-
end
|
519
|
-
|
520
|
-
it 'should use artifacts from compile classpath if no libs specified' do
|
521
|
-
make_jars
|
522
|
-
define('foo', :version=>'1.0') { compile.with 'group:id:jar:1.0', 'group:id:jar:2.0' ; package(:war) }
|
523
|
-
inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar', 'WEB-INF/lib/id-2.0.jar') }
|
524
|
-
end
|
525
|
-
|
526
|
-
it 'should include only specified libraries' do
|
527
|
-
define 'foo', :version=>'1.0' do
|
528
|
-
compile.with 'group:id:jar:1.0'
|
529
|
-
package(:war).with :libs=>'additional:id:jar:1.0'
|
530
|
-
end
|
531
|
-
project('foo').package(:war).libs.should_not include(artifact('group:id:jar:1.0'))
|
532
|
-
project('foo').package(:war).libs.should include(artifact('additional:id:jar:1.0'))
|
533
|
-
end
|
534
|
-
|
535
|
-
end
|
536
|
-
|
537
|
-
|
538
|
-
describe Packaging, 'aar' do
|
539
|
-
it_should_behave_like 'packaging'
|
540
|
-
before { @packaging = :aar }
|
541
|
-
it_should_behave_like 'package with manifest'
|
542
|
-
it_should_behave_like 'package with meta_inf'
|
543
|
-
before do
|
544
|
-
write 'src/main/axis2/services.xml'
|
545
|
-
@meta_inf_ignore = ['MANIFEST.MF', 'services.xml']
|
546
|
-
end
|
547
|
-
|
548
|
-
def make_jars
|
549
|
-
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
550
|
-
artifact('group:id:jar:2.0') { |t| write t.to_s }
|
551
|
-
end
|
552
|
-
|
553
|
-
def inspect_aar
|
554
|
-
project('foo').package(:aar).invoke
|
555
|
-
Zip::ZipFile.open(project('foo').package(:aar).to_s) do |aar|
|
556
|
-
yield aar.entries.map(&:to_s).sort
|
557
|
-
end
|
558
|
-
end
|
559
|
-
|
560
|
-
it 'should automatically include services.xml and any *.wsdl files under src/main/axis2' do
|
561
|
-
write 'src/main/axis2/my-service.wsdl'
|
562
|
-
define('foo', :version=>'1.0') { package(:aar) }
|
563
|
-
inspect_aar { |files| files.should include('META-INF/MANIFEST.MF', 'META-INF/services.xml', 'META-INF/my-service.wsdl') }
|
564
|
-
end
|
565
|
-
|
566
|
-
it 'should accept files from :include option' do
|
567
|
-
write 'test'
|
568
|
-
define('foo', :version=>'1.0') { package(:aar).include 'test' }
|
569
|
-
inspect_aar { |files| files.should include('META-INF/MANIFEST.MF', 'test') }
|
570
|
-
end
|
571
|
-
|
572
|
-
it 'should use files from compile directory if nothing included' do
|
573
|
-
write 'src/main/java/Test.java', 'class Test {}'
|
574
|
-
define('foo', :version=>'1.0') { package(:aar) }
|
575
|
-
inspect_aar { |files| files.should include('Test.class') }
|
576
|
-
end
|
577
|
-
|
578
|
-
it 'should use files from resources directory if nothing included' do
|
579
|
-
write 'src/main/resources/test/important.properties'
|
580
|
-
define('foo', :version=>'1.0') { package(:aar) }
|
581
|
-
inspect_aar { |files| files.should include('test/important.properties') }
|
582
|
-
end
|
583
|
-
|
584
|
-
it 'should include empty resource directories' do
|
585
|
-
mkpath 'src/main/resources/empty'
|
586
|
-
define('foo', :version=>'1.0') { package(:aar) }
|
587
|
-
inspect_aar { |files| files.should include('empty/') }
|
588
|
-
end
|
589
|
-
|
590
|
-
it 'should accept file from :libs option' do
|
591
|
-
make_jars
|
592
|
-
define('foo', :version=>'1.0') { package(:aar).with :libs=>'group:id:jar:1.0' }
|
593
|
-
inspect_aar { |files| files.should include('META-INF/MANIFEST.MF', 'lib/id-1.0.jar') }
|
594
|
-
end
|
595
|
-
|
596
|
-
it 'should accept file from :libs option' do
|
597
|
-
make_jars
|
598
|
-
define('foo', :version=>'1.0') { package(:aar).with :libs=>['group:id:jar:1.0', 'group:id:jar:2.0'] }
|
599
|
-
inspect_aar { |files| files.should include('META-INF/MANIFEST.MF', 'lib/id-1.0.jar', 'lib/id-2.0.jar') }
|
600
|
-
end
|
601
|
-
|
602
|
-
it 'should NOT use artifacts from compile classpath if no libs specified' do
|
603
|
-
make_jars
|
604
|
-
define('foo', :version=>'1.0') { compile.with 'group:id:jar:1.0', 'group:id:jar:2.0' ; package(:aar) }
|
605
|
-
inspect_aar { |files| files.should include('META-INF/MANIFEST.MF') }
|
606
|
-
end
|
607
|
-
|
608
|
-
it 'should return all libraries from libs attribute' do
|
609
|
-
define 'foo', :version=>'1.0' do
|
610
|
-
compile.with 'group:id:jar:1.0'
|
611
|
-
package(:aar).with :libs=>'additional:id:jar:1.0'
|
612
|
-
end
|
613
|
-
project('foo').package(:aar).libs.should_not include(artifact('group:id:jar:1.0'))
|
614
|
-
project('foo').package(:aar).libs.should include(artifact('additional:id:jar:1.0'))
|
615
|
-
end
|
616
|
-
|
617
|
-
end
|
618
|
-
|
619
|
-
|
620
|
-
describe Packaging, 'ear' do
|
621
|
-
it_should_behave_like 'packaging'
|
622
|
-
before { @packaging = :ear }
|
623
|
-
it_should_behave_like 'package with manifest'
|
624
|
-
it_should_behave_like 'package with meta_inf'
|
625
|
-
before { @meta_inf_ignore = ['MANIFEST.MF', 'application.xml'] }
|
626
|
-
|
627
|
-
def inspect_ear
|
628
|
-
project('foo').package(:ear).invoke
|
629
|
-
Zip::ZipFile.open(project('foo').package(:ear).to_s) do |ear|
|
630
|
-
yield ear.entries.map(&:to_s).sort
|
631
|
-
end
|
632
|
-
end
|
633
|
-
|
634
|
-
def inspect_application_xml
|
635
|
-
project('foo').package(:ear).invoke
|
636
|
-
Zip::ZipFile.open(project('foo').package(:ear).to_s) do |ear|
|
637
|
-
yield REXML::Document.new(ear.read('META-INF/application.xml')).root
|
638
|
-
end
|
639
|
-
end
|
640
|
-
|
641
|
-
def inspect_classpath(package)
|
642
|
-
project('foo').package(:ear).invoke
|
643
|
-
Zip::ZipFile.open(project('foo').package(:ear).to_s) do |ear|
|
644
|
-
File.open('tmp.zip', 'wb') do |tmp|
|
645
|
-
tmp.write ear.file.read(package)
|
646
|
-
end
|
647
|
-
manifest = Buildr::Packaging::Java::Manifest.from_zip('tmp.zip')
|
648
|
-
yield manifest.main['Class-Path'].to_s.split(' ')
|
649
|
-
end
|
650
|
-
end
|
651
|
-
|
652
|
-
it 'should set display name from project id' do
|
653
|
-
define 'foo', :version=>'1.0' do
|
654
|
-
package(:ear).display_name.should eql('foo')
|
655
|
-
define 'bar' do
|
656
|
-
package(:ear).display_name.should eql('foo-bar')
|
657
|
-
end
|
658
|
-
end
|
659
|
-
end
|
660
|
-
|
661
|
-
it 'should set display name in application.xml' do
|
662
|
-
define 'foo', :version=>'1.0' do
|
663
|
-
package(:ear)
|
664
|
-
end
|
665
|
-
inspect_application_xml { |xml| xml.get_text('/application/display-name').should == 'foo' }
|
666
|
-
end
|
667
|
-
|
668
|
-
it 'should accept different display name' do
|
669
|
-
define 'foo', :version=>'1.0' do
|
670
|
-
package(:ear).display_name = 'bar'
|
671
|
-
end
|
672
|
-
inspect_application_xml { |xml| xml.get_text('/application/display-name').should == 'bar' }
|
673
|
-
end
|
674
|
-
|
675
|
-
it 'should map WARs to /war directory' do
|
676
|
-
define 'foo', :version=>'1.0' do
|
677
|
-
package(:ear) << package(:war)
|
678
|
-
end
|
679
|
-
inspect_ear { |files| files.should include('war/foo-1.0.war') }
|
680
|
-
end
|
681
|
-
|
682
|
-
it 'should map EJBs to /ejb directory' do
|
683
|
-
define 'foo', :version=>'1.0' do
|
684
|
-
package(:ear).add :ejb=>package(:jar)
|
685
|
-
end
|
686
|
-
inspect_ear { |files| files.should include('ejb/foo-1.0.jar') }
|
687
|
-
end
|
688
|
-
|
689
|
-
it 'should not modify original artifact for its components' do
|
690
|
-
define 'one', :version => '1.0' do
|
691
|
-
write 'src/main/resources/one.txt', '1'
|
692
|
-
package(:jar)
|
693
|
-
end
|
694
|
-
|
695
|
-
define 'two', :version => '1.0' do
|
696
|
-
write 'src/main/resources/two.txt', '2'
|
697
|
-
package(:jar)
|
698
|
-
end
|
699
|
-
|
700
|
-
define 'foo', :version => '1.0' do
|
701
|
-
package(:ear).add project(:one).package(:jar)
|
702
|
-
package(:ear).add :ejb => project(:two).package(:jar)
|
703
|
-
end
|
704
|
-
|
705
|
-
inspect_ear { |files| files.should include('lib/one-1.0.jar', 'ejb/two-1.0.jar') }
|
706
|
-
|
707
|
-
Buildr::Packaging::Java::Manifest.from_zip(project('one').package(:jar)).main['Class-Path'].should be_nil
|
708
|
-
Buildr::Packaging::Java::Manifest.from_zip(project('two').package(:jar)).main['Class-Path'].should be_nil
|
709
|
-
|
710
|
-
inspect_classpath 'ejb/two-1.0.jar' do |classpath|
|
711
|
-
classpath.should include('../lib/one-1.0.jar')
|
712
|
-
end
|
713
|
-
end
|
714
|
-
|
715
|
-
it 'should map JARs to /lib directory' do
|
716
|
-
define 'foo', :version=>'1.0' do
|
717
|
-
package(:ear) << package(:jar)
|
718
|
-
end
|
719
|
-
inspect_ear { |files| files.should include('lib/foo-1.0.jar') }
|
720
|
-
end
|
721
|
-
|
722
|
-
it 'should accept component type with :type option' do
|
723
|
-
define 'foo', :version=>'1.0' do
|
724
|
-
package(:ear).add package(:jar), :type=>:ejb
|
725
|
-
end
|
726
|
-
inspect_ear { |files| files.should include('ejb/foo-1.0.jar') }
|
727
|
-
end
|
728
|
-
|
729
|
-
it 'should accept component and its type as type=>artifact' do
|
730
|
-
define 'foo', :version=>'1.0' do
|
731
|
-
package(:ear).add :ejb=>package(:jar)
|
732
|
-
end
|
733
|
-
inspect_ear { |files| files.should include('ejb/foo-1.0.jar') }
|
734
|
-
end
|
735
|
-
|
736
|
-
it 'should map typed JARs to /jar directory' do
|
737
|
-
define 'foo', :version=>'1.0' do
|
738
|
-
package(:ear).add :jar=>package(:jar)
|
739
|
-
end
|
740
|
-
inspect_ear { |files| files.should include('jar/foo-1.0.jar') }
|
741
|
-
end
|
742
|
-
|
743
|
-
it 'should add multiple components at a time using the type=>component style' do
|
744
|
-
define 'bar', :version => '1.5' do
|
745
|
-
package(:war) # must be added as a webapp
|
746
|
-
package(:jar) # must be added as a shared lib
|
747
|
-
package(:zip) # this one should be excluded
|
748
|
-
end
|
749
|
-
define 'baz', :version => '1.5' do
|
750
|
-
package(:jar, :id => 'one')
|
751
|
-
package(:jar, :id => 'two')
|
752
|
-
end
|
753
|
-
define 'foo', :version => '1.0' do
|
754
|
-
package(:ear).add :lib => project('baz'),
|
755
|
-
:war => project('bar').package(:war),
|
756
|
-
:ejb => project('bar').package(:jar)
|
757
|
-
end
|
758
|
-
inspect_ear do |files|
|
759
|
-
files.should include(*%w{ lib/one-1.5.jar lib/two-1.5.jar war/bar-1.5.war ejb/bar-1.5.jar })
|
760
|
-
files.should_not satisfy { files.any? { |f| f =~ /\.zip$/ } }
|
761
|
-
end
|
762
|
-
end
|
763
|
-
|
764
|
-
it 'should add all EAR supported packages when given a project argument' do
|
765
|
-
define 'bar', :version => '1.5' do
|
766
|
-
package(:war) # must be added as a webapp
|
767
|
-
package(:jar) # must be added as a shared lib
|
768
|
-
package(:zip) # this one should be excluded
|
769
|
-
end
|
770
|
-
define 'baz', :version => '1.5' do
|
771
|
-
package(:war)
|
772
|
-
package(:jar)
|
773
|
-
end
|
774
|
-
define 'foo', :version => '1.0' do
|
775
|
-
package(:ear).add projects(:bar, :baz)
|
776
|
-
end
|
777
|
-
inspect_ear do |files|
|
778
|
-
files.should include('war/bar-1.5.war', 'lib/bar-1.5.jar', 'lib/baz-1.5.jar', 'war/baz-1.5.war')
|
779
|
-
files.should_not satisfy { files.any? { |f| f =~ /\.zip$/ } }
|
780
|
-
end
|
781
|
-
end
|
782
|
-
|
783
|
-
it 'should complain about unknown component type' do
|
784
|
-
define 'foo', :version=>'1.0' do
|
785
|
-
lambda { package(:ear).add package(:zip) }.should raise_error(RuntimeError, /ear component/i)
|
786
|
-
end
|
787
|
-
end
|
788
|
-
|
789
|
-
it 'should allow unknown component types with explicit type' do
|
790
|
-
define 'foo', :version=>'1.0' do
|
791
|
-
package(:ear).add :lib=>package(:zip)
|
792
|
-
end
|
793
|
-
inspect_ear { |files| files.should include('lib/foo-1.0.zip') }
|
794
|
-
end
|
795
|
-
|
796
|
-
it 'should accept alternative directory name' do
|
797
|
-
define 'foo', :version=>'1.0' do
|
798
|
-
package(:ear).add package(:jar), :path=>'trash'
|
799
|
-
end
|
800
|
-
inspect_ear { |files| files.should include('trash/foo-1.0.jar') }
|
801
|
-
end
|
802
|
-
|
803
|
-
it 'should accept customization of directory map' do
|
804
|
-
define 'foo', :version=>'1.0' do
|
805
|
-
package(:ear).dirs[:jar] = 'jarred'
|
806
|
-
package(:ear).add :jar=>package(:jar)
|
807
|
-
end
|
808
|
-
inspect_ear { |files| files.should include('jarred/foo-1.0.jar') }
|
809
|
-
end
|
810
|
-
|
811
|
-
it 'should accept customization of directory map with nil paths in application.xml' do
|
812
|
-
define 'foo', :version=>'1.0' do
|
813
|
-
package(:ear).dirs[:war] = nil
|
814
|
-
package(:ear).add :war=>package(:war)
|
815
|
-
package(:ear).add package(:jar)
|
816
|
-
end
|
817
|
-
inspect_ear { |files| files.should include('foo-1.0.war') }
|
818
|
-
inspect_application_xml do |xml|
|
819
|
-
xml.get_text("/application/module[@id='foo']/web/web-uri").to_s.should eql('foo-1.0.war')
|
820
|
-
end
|
821
|
-
end
|
822
|
-
|
823
|
-
it 'should accept customization of directory map with nil paths in the classpath' do
|
824
|
-
define 'foo', :version=>'1.0' do
|
825
|
-
package(:ear).dirs[:lib] = nil
|
826
|
-
package(:ear).add :war=>package(:war)
|
827
|
-
package(:ear) << package(:jar)
|
828
|
-
end
|
829
|
-
inspect_classpath 'war/foo-1.0.war' do |classpath|
|
830
|
-
classpath.should include('../foo-1.0.jar')
|
831
|
-
end
|
832
|
-
end
|
833
|
-
|
834
|
-
it 'should list WAR components in application.xml' do
|
835
|
-
define 'foo', :version=>'1.0' do
|
836
|
-
package(:ear) << package(:war) << package(:war, :id=>'bar')
|
837
|
-
end
|
838
|
-
inspect_application_xml do |xml|
|
839
|
-
xml.get_elements("/application/module[@id='foo'][web]").should_not be_empty
|
840
|
-
xml.get_elements("/application/module[@id='bar'][web]").should_not be_empty
|
841
|
-
end
|
842
|
-
end
|
843
|
-
|
844
|
-
it 'should specify web-uri for WAR components in application.xml' do
|
845
|
-
define 'foo', :version=>'1.0' do
|
846
|
-
package(:ear) << package(:war)
|
847
|
-
package(:ear).add package(:war, :id=>'bar'), :path=>'ws'
|
848
|
-
end
|
849
|
-
inspect_application_xml do |xml|
|
850
|
-
xml.get_text("/application/module[@id='foo']/web/web-uri").to_s.should eql('war/foo-1.0.war')
|
851
|
-
xml.get_text("/application/module[@id='bar']/web/web-uri").to_s.should eql('ws/bar-1.0.war')
|
852
|
-
end
|
853
|
-
end
|
854
|
-
|
855
|
-
it 'should specify context-root for WAR components in application.xml' do
|
856
|
-
define 'foo', :version=>'1.0' do
|
857
|
-
package(:ear) << package(:war)
|
858
|
-
package(:ear).add package(:war, :id=>'bar')
|
859
|
-
end
|
860
|
-
inspect_application_xml do |xml|
|
861
|
-
xml.get_text("/application/module[@id='foo']/web/context-root").to_s.should eql('/foo')
|
862
|
-
xml.get_text("/application/module[@id='bar']/web/context-root").to_s.should eql('/bar')
|
863
|
-
end
|
864
|
-
end
|
865
|
-
|
866
|
-
it 'should accept context-root for WAR components in application.xml' do
|
867
|
-
define 'foo', :version=>'1.0' do
|
868
|
-
package(:ear).add package(:war), :context_root=>'rooted'
|
869
|
-
end
|
870
|
-
inspect_application_xml do |xml|
|
871
|
-
xml.get_text("/application/module[@id='foo']/web/context-root").to_s.should eql('/rooted')
|
872
|
-
end
|
873
|
-
end
|
874
|
-
|
875
|
-
it 'should allow disabling the context root' do
|
876
|
-
define 'foo', :version=>'1.0' do
|
877
|
-
package(:ear).add package(:war), :context_root=>false
|
878
|
-
end
|
879
|
-
inspect_application_xml do |xml|
|
880
|
-
xml.get_elements("/application/module[@id='foo']/web/context-root").should be_empty
|
881
|
-
end
|
882
|
-
end
|
883
|
-
|
884
|
-
it 'should list EJB components in application.xml' do
|
885
|
-
define 'foo', :version=>'1.0' do
|
886
|
-
package(:ear).add :ejb=>package(:jar)
|
887
|
-
package(:ear).add :ejb=>package(:jar, :id=>'bar')
|
888
|
-
end
|
889
|
-
inspect_application_xml do |xml|
|
890
|
-
xml.get_text("/application/module[@id='foo']/ejb").to_s.should eql('ejb/foo-1.0.jar')
|
891
|
-
xml.get_text("/application/module[@id='bar']/ejb").to_s.should eql('ejb/bar-1.0.jar')
|
892
|
-
end
|
893
|
-
end
|
894
|
-
|
895
|
-
it 'should list JAR components in application.xml' do
|
896
|
-
define 'foo', :version=>'1.0' do
|
897
|
-
package(:ear) << { :jar=>package(:jar) } << { :jar=>package(:jar, :id=>'bar') }
|
898
|
-
end
|
899
|
-
inspect_application_xml do |xml|
|
900
|
-
jars = xml.get_elements('/application/jar').map(&:texts).map(&:to_s)
|
901
|
-
jars.should include('jar/foo-1.0.jar', 'jar/bar-1.0.jar')
|
902
|
-
end
|
903
|
-
end
|
904
|
-
|
905
|
-
it 'should update WAR component classpath to include libraries' do
|
906
|
-
define 'foo', :version=>'1.0' do
|
907
|
-
package(:ear) << package(:jar, :id=>'lib1') << package(:jar, :id=>'lib2')
|
908
|
-
package(:ear).add package(:war)
|
909
|
-
end
|
910
|
-
inspect_classpath 'war/foo-1.0.war' do |classpath|
|
911
|
-
classpath.should include('../lib/lib1-1.0.jar', '../lib/lib2-1.0.jar')
|
912
|
-
end
|
913
|
-
end
|
914
|
-
|
915
|
-
it 'should update WAR component classpath but skip internal libraries' do
|
916
|
-
define 'foo', :version=>'1.0' do
|
917
|
-
package(:ear) << package(:jar, :id=>'lib1') << package(:jar, :id=>'lib2')
|
918
|
-
package(:war).with(:libs=>package(:jar, :id=>'lib1'))
|
919
|
-
package(:ear).add package(:war)
|
920
|
-
end
|
921
|
-
inspect_classpath 'war/foo-1.0.war' do |classpath|
|
922
|
-
classpath.should_not include('../lib/lib1-1.0.jar')
|
923
|
-
classpath.should include('../lib/lib2-1.0.jar')
|
924
|
-
end
|
925
|
-
end
|
926
|
-
|
927
|
-
it 'should update EJB component classpath to include libraries' do
|
928
|
-
define 'foo', :version=>'1.0' do
|
929
|
-
package(:ear) << package(:jar, :id=>'lib1') << package(:jar, :id=>'lib2')
|
930
|
-
package(:ear).add :ejb=>package(:jar)
|
931
|
-
end
|
932
|
-
inspect_classpath 'ejb/foo-1.0.jar' do |classpath|
|
933
|
-
classpath.should include('../lib/lib1-1.0.jar', '../lib/lib2-1.0.jar')
|
934
|
-
end
|
935
|
-
end
|
936
|
-
|
937
|
-
it 'should update JAR component classpath to include libraries' do
|
938
|
-
define 'foo', :version=>'1.0' do
|
939
|
-
package(:ear) << package(:jar, :id=>'lib1') << package(:jar, :id=>'lib2')
|
940
|
-
package(:ear).add :jar=>package(:jar)
|
941
|
-
end
|
942
|
-
inspect_classpath 'jar/foo-1.0.jar' do |classpath|
|
943
|
-
classpath.should include('../lib/lib1-1.0.jar', '../lib/lib2-1.0.jar')
|
944
|
-
end
|
945
|
-
end
|
946
|
-
|
947
|
-
it 'should deal with very long classpaths' do
|
948
|
-
define 'foo', :version=>'1.0' do
|
949
|
-
20.times { |i| package(:ear) << package(:jar, :id=>"lib#{i}") }
|
950
|
-
package(:ear).add :jar=>package(:jar)
|
951
|
-
end
|
952
|
-
inspect_classpath 'jar/foo-1.0.jar' do |classpath|
|
953
|
-
classpath.should include('../lib/lib1-1.0.jar', '../lib/lib2-1.0.jar')
|
954
|
-
end
|
955
|
-
end
|
956
|
-
|
957
|
-
|
958
|
-
it 'should generate relative classpaths for top level EJB' do
|
959
|
-
define 'foo', :version => '1.0' do
|
960
|
-
package(:ear).add package(:jar, :id => 'one'), :path => '.'
|
961
|
-
package(:ear).add package(:jar, :id => 'two'), :path => 'dos'
|
962
|
-
package(:ear).add package(:jar, :id => 'three'), :path => 'tres'
|
963
|
-
package(:ear).add :ejb => package(:jar, :id => 'ejb1'), :path => '.'
|
964
|
-
end
|
965
|
-
inspect_classpath 'ejb1-1.0.jar' do |classpath|
|
966
|
-
classpath.should include(*%w{ one-1.0.jar dos/two-1.0.jar tres/three-1.0.jar })
|
967
|
-
end
|
968
|
-
end
|
969
|
-
|
970
|
-
it 'should generate relative classpaths for second level EJB' do
|
971
|
-
define 'foo', :version => '1.0' do
|
972
|
-
package(:ear).add package(:jar, :id => 'one'), :path => '.'
|
973
|
-
package(:ear).add package(:jar, :id => 'two'), :path => 'dos'
|
974
|
-
package(:ear).add package(:jar, :id => 'three'), :path => 'tres'
|
975
|
-
package(:ear).add :ejb => package(:jar, :id => 'ejb2'), :path => 'dos'
|
976
|
-
end
|
977
|
-
inspect_classpath 'dos/ejb2-1.0.jar' do |classpath|
|
978
|
-
classpath.should include(*%w{ ../one-1.0.jar two-1.0.jar ../tres/three-1.0.jar })
|
979
|
-
end
|
980
|
-
end
|
981
|
-
|
982
|
-
it 'should generate relative classpaths for nested EJB' do
|
983
|
-
define 'foo', :version => '1.0' do
|
984
|
-
package(:ear).add package(:jar, :id => 'one'), :path => '.'
|
985
|
-
package(:ear).add package(:jar, :id => 'two'), :path => 'dos'
|
986
|
-
package(:ear).add package(:jar, :id => 'three'), :path => 'dos/tres'
|
987
|
-
package(:ear).add package(:jar, :id => 'four'), :path => 'dos/cuatro'
|
988
|
-
package(:ear).add :ejb => package(:jar, :id => 'ejb4'), :path => 'dos/cuatro'
|
989
|
-
end
|
990
|
-
inspect_classpath 'dos/cuatro/ejb4-1.0.jar' do |classpath|
|
991
|
-
classpath.should include(*%w{ ../../one-1.0.jar ../two-1.0.jar ../tres/three-1.0.jar four-1.0.jar })
|
992
|
-
end
|
993
|
-
end
|
994
|
-
|
995
|
-
end
|
996
|
-
|
997
|
-
|
998
|
-
describe Packaging, 'sources' do
|
999
|
-
it_should_behave_like 'packaging'
|
1000
|
-
before { @packaging, @package_type = :sources, :zip }
|
1001
|
-
|
1002
|
-
it 'should create package of type :zip and classifier \'sources\'' do
|
1003
|
-
define 'foo', :version=>'1.0' do
|
1004
|
-
package(:sources).type.should eql(:zip)
|
1005
|
-
package(:sources).classifier.should eql('sources')
|
1006
|
-
package(:sources).name.should match(/foo-1.0-sources.zip$/)
|
1007
|
-
end
|
1008
|
-
end
|
1009
|
-
|
1010
|
-
it 'should contain source files' do
|
1011
|
-
write 'src/main/java/Source.java'
|
1012
|
-
define('foo', :version=>'1.0') { package(:sources) }
|
1013
|
-
project('foo').task('package').invoke
|
1014
|
-
project('foo').packages.first.should contain('Source.java')
|
1015
|
-
end
|
1016
|
-
|
1017
|
-
it 'should be a ZipTask' do
|
1018
|
-
define 'foo', :version=>'1.0' do
|
1019
|
-
package(:javadoc).should be_kind_of(ZipTask)
|
1020
|
-
end
|
1021
|
-
end
|
1022
|
-
end
|
1023
|
-
|
1024
|
-
|
1025
|
-
describe Packaging, 'javadoc' do
|
1026
|
-
it_should_behave_like 'packaging'
|
1027
|
-
before { @packaging, @package_type = :javadoc, :zip }
|
1028
|
-
|
1029
|
-
it 'should create package of type :zip and classifier \'javadoc\'' do
|
1030
|
-
define 'foo', :version=>'1.0' do
|
1031
|
-
package(:javadoc).type.should eql(:zip)
|
1032
|
-
package(:javadoc).classifier.should eql('javadoc')
|
1033
|
-
package(:javadoc).name.pathmap('%f').should eql('foo-1.0-javadoc.zip')
|
1034
|
-
end
|
1035
|
-
end
|
1036
|
-
|
1037
|
-
it 'should contain Javadocs' do
|
1038
|
-
write 'src/main/java/Source.java', 'public class Source {}'
|
1039
|
-
define('foo', :version=>'1.0') { package(:javadoc) }
|
1040
|
-
project('foo').task('package').invoke
|
1041
|
-
project('foo').packages.first.should contain('Source.html', 'index.html')
|
1042
|
-
end
|
1043
|
-
|
1044
|
-
it 'should use project description in window title' do
|
1045
|
-
write 'src/main/java/Source.java', 'public class Source {}'
|
1046
|
-
desc 'My Project'
|
1047
|
-
define('foo', :version=>'1.0') { package(:javadoc) }
|
1048
|
-
project('foo').task('package').invoke
|
1049
|
-
project('foo').packages.first.entry('index.html').should contain('My Project')
|
1050
|
-
end
|
1051
|
-
|
1052
|
-
it 'should be a ZipTask' do
|
1053
|
-
define 'foo', :version=>'1.0' do
|
1054
|
-
package(:javadoc).should be_kind_of(ZipTask)
|
1055
|
-
end
|
1056
|
-
end
|
1057
|
-
end
|
1058
|
-
|
1059
|
-
|
1060
|
-
shared_examples_for 'package_with_' do
|
1061
|
-
|
1062
|
-
def prepare(options = {})
|
1063
|
-
packager = "package_with_#{@packaging}"
|
1064
|
-
write 'src/main/java/Source.java'
|
1065
|
-
write 'baz/src/main/java/Source.java'
|
1066
|
-
define 'foo', :version=>'1.0' do
|
1067
|
-
send packager, options
|
1068
|
-
define 'bar' ; define 'baz'
|
1069
|
-
end
|
1070
|
-
end
|
1071
|
-
|
1072
|
-
def applied_to
|
1073
|
-
projects.select { |project| project.packages.first }.map(&:name)
|
1074
|
-
end
|
1075
|
-
|
1076
|
-
it 'should create package of type zip with classifier' do
|
1077
|
-
prepare
|
1078
|
-
project('foo').packages.first.to_s.should =~ /foo-1.0-#{@packaging}.zip/
|
1079
|
-
end
|
1080
|
-
|
1081
|
-
it 'should create package for projects that have source files' do
|
1082
|
-
prepare
|
1083
|
-
applied_to.should include('foo', 'foo:baz')
|
1084
|
-
end
|
1085
|
-
|
1086
|
-
it 'should not create package for projects that have no source files' do
|
1087
|
-
prepare
|
1088
|
-
applied_to.should_not include('foo:bar')
|
1089
|
-
end
|
1090
|
-
|
1091
|
-
it 'should limit to projects specified by :only' do
|
1092
|
-
prepare :only=>'baz'
|
1093
|
-
applied_to.should eql(['foo:baz'])
|
1094
|
-
end
|
1095
|
-
|
1096
|
-
it 'should limit to projects specified by :only array' do
|
1097
|
-
prepare :only=>['baz']
|
1098
|
-
applied_to.should eql(['foo:baz'])
|
1099
|
-
end
|
1100
|
-
|
1101
|
-
it 'should ignore project specified by :except' do
|
1102
|
-
prepare :except=>'baz'
|
1103
|
-
applied_to.should eql(['foo'])
|
1104
|
-
end
|
1105
|
-
|
1106
|
-
it 'should ignore projects specified by :except array' do
|
1107
|
-
prepare :except=>['baz']
|
1108
|
-
applied_to.should eql(['foo'])
|
1109
|
-
end
|
1110
|
-
end
|
1111
|
-
|
1112
|
-
describe 'package_with_sources' do
|
1113
|
-
it_should_behave_like 'package_with_'
|
1114
|
-
before { @packaging = :sources }
|
1115
|
-
end
|
1116
|
-
|
1117
|
-
describe 'package_with_javadoc' do
|
1118
|
-
it_should_behave_like 'package_with_'
|
1119
|
-
before { @packaging = :javadoc }
|
1120
|
-
end
|