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/sandbox.rb
DELETED
@@ -1,139 +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
|
-
# The local repository we use for testing is void of any artifacts, which will break given
|
18
|
-
# that the code requires several artifacts. So we establish them first using the real local
|
19
|
-
# repository and cache these across test cases.
|
20
|
-
Buildr.application.instance_eval { @rakefile = File.expand_path('buildfile') }
|
21
|
-
repositories.remote << 'http://repo1.maven.org/maven2'
|
22
|
-
repositories.remote << 'http://scala-tools.org/repo-releases'
|
23
|
-
|
24
|
-
# Add a 'require' here only for optional extensions, not for extensions that should be loaded by default.
|
25
|
-
require 'buildr/groovy'
|
26
|
-
|
27
|
-
Java.load # Anything added to the classpath.
|
28
|
-
artifacts(TestFramework.frameworks.map(&:dependencies).flatten, JUnit.ant_taskdef).each do |path|
|
29
|
-
file(path).invoke
|
30
|
-
end
|
31
|
-
|
32
|
-
ENV['HOME'] = File.expand_path('tmp/home')
|
33
|
-
|
34
|
-
# We need to run all tests inside a _sandbox, tacking a snapshot of Buildr before the test,
|
35
|
-
# and restoring everything to its previous state after the test. Damn state changes.
|
36
|
-
module Sandbox
|
37
|
-
|
38
|
-
class << self
|
39
|
-
attr_reader :tasks, :rules
|
40
|
-
|
41
|
-
def included(spec)
|
42
|
-
spec.before(:each) { sandbox }
|
43
|
-
spec.after(:each) { reset }
|
44
|
-
end
|
45
|
-
|
46
|
-
# Require an optional extension without letting its callbacks pollute the Project class.
|
47
|
-
def require_optional_extension(extension_require_path)
|
48
|
-
project_callbacks_without_extension = Project.class_eval { @callbacks }.dup
|
49
|
-
begin
|
50
|
-
require extension_require_path
|
51
|
-
ensure
|
52
|
-
Project.class_eval { @callbacks = project_callbacks_without_extension }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
@tasks = Buildr.application.tasks.collect do |original|
|
58
|
-
prerequisites = original.send(:prerequisites).map(&:to_s)
|
59
|
-
actions = original.instance_eval { @actions }.clone
|
60
|
-
lambda do
|
61
|
-
original.class.send(:define_task, original.name=>prerequisites).tap do |task|
|
62
|
-
task.comment = original.comment
|
63
|
-
actions.each { |action| task.enhance &action }
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
@rules = Buildr.application.instance_variable_get(:@rules)
|
68
|
-
|
69
|
-
def sandbox
|
70
|
-
@_sandbox = {}
|
71
|
-
|
72
|
-
# Create a temporary directory where we can create files, e.g,
|
73
|
-
# for projects, compilation. We need a place that does not depend
|
74
|
-
# on the current directory.
|
75
|
-
@_sandbox[:original_dir] = Dir.pwd
|
76
|
-
@temp = File.join(File.dirname(__FILE__), '../tmp')
|
77
|
-
FileUtils.mkpath @temp
|
78
|
-
Dir.chdir @temp
|
79
|
-
|
80
|
-
ARGV.clear
|
81
|
-
Buildr.application = Buildr::Application.new
|
82
|
-
Sandbox.tasks.each { |block| block.call }
|
83
|
-
Buildr.application.instance_variable_set :@rules, Sandbox.rules.clone
|
84
|
-
Buildr.application.instance_eval { @rakefile = File.expand_path('buildfile') }
|
85
|
-
|
86
|
-
@_sandbox[:load_path] = $LOAD_PATH.clone
|
87
|
-
#@_sandbox[:loaded_features] = $LOADED_FEATURES.clone
|
88
|
-
|
89
|
-
# Later on we'll want to lose all the on_define created during the test.
|
90
|
-
@_sandbox[:on_define] = Project.class_eval { (@on_define || []).dup }
|
91
|
-
@_sandbox[:callbacks] = Project.class_eval { (@callbacks || []).dup }
|
92
|
-
@_sandbox[:layout] = Layout.default.clone
|
93
|
-
|
94
|
-
# Create a local repository we can play with. However, our local repository will be void
|
95
|
-
# of some essential artifacts (e.g. JUnit artifacts required by build task), so we create
|
96
|
-
# these first (see above) and keep them across test cases.
|
97
|
-
@_sandbox[:artifacts] = Artifact.class_eval { @artifacts }.clone
|
98
|
-
Buildr.repositories.local = File.expand_path('repository')
|
99
|
-
ENV['HOME'] = File.expand_path('home')
|
100
|
-
ENV['BUILDR_ENV'] = 'development'
|
101
|
-
|
102
|
-
@_sandbox[:env_keys] = ENV.keys
|
103
|
-
['DEBUG', 'TEST', 'HTTP_PROXY', 'USER'].each { |k| ENV.delete(k) ; ENV.delete(k.downcase) }
|
104
|
-
|
105
|
-
# Remove testing local repository, and reset all repository settings.
|
106
|
-
Buildr.repositories.instance_eval do
|
107
|
-
@local = @remote = @release_to = nil
|
108
|
-
end
|
109
|
-
Buildr.options.proxy.http = nil
|
110
|
-
|
111
|
-
# Don't output crap to the console.
|
112
|
-
trace false
|
113
|
-
verbose false
|
114
|
-
end
|
115
|
-
|
116
|
-
# Call this from teardown.
|
117
|
-
def reset
|
118
|
-
# Get rid of all the projects and the on_define blocks we used.
|
119
|
-
Project.clear
|
120
|
-
on_define = @_sandbox[:on_define]
|
121
|
-
Project.class_eval { @on_define = on_define }
|
122
|
-
callbacks = @_sandbox[:callbacks]
|
123
|
-
Project.class_eval { @callbacks = callbacks }
|
124
|
-
Layout.default = @_sandbox[:layout].clone
|
125
|
-
|
126
|
-
$LOAD_PATH.replace @_sandbox[:load_path]
|
127
|
-
FileUtils.rm_rf @temp
|
128
|
-
|
129
|
-
# Get rid of all artifacts.
|
130
|
-
@_sandbox[:artifacts].tap { |artifacts| Artifact.class_eval { @artifacts = artifacts } }
|
131
|
-
|
132
|
-
# Restore options.
|
133
|
-
Buildr.options.test = nil
|
134
|
-
(ENV.keys - @_sandbox[:env_keys]).each { |key| ENV.delete key }
|
135
|
-
|
136
|
-
Dir.chdir @_sandbox[:original_dir]
|
137
|
-
end
|
138
|
-
|
139
|
-
end
|
data/spec/scala/compiler_spec.rb
DELETED
@@ -1,228 +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
|
-
|
19
|
-
|
20
|
-
describe 'scalac compiler' do
|
21
|
-
it 'should identify itself from source directories' do
|
22
|
-
write 'src/main/scala/com/example/Test.scala', 'package com.example; class Test { val i = 1 }'
|
23
|
-
define('foo').compile.compiler.should eql(:scalac)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should report the language as :scala' do
|
27
|
-
define('foo').compile.using(:scalac).language.should eql(:scala)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should set the target directory to target/classes' do
|
31
|
-
define 'foo' do
|
32
|
-
lambda { compile.using(:scalac) }.should change { compile.target.to_s }.to(File.expand_path('target/classes'))
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should not override existing target directory' do
|
37
|
-
define 'foo' do
|
38
|
-
compile.into('classes')
|
39
|
-
lambda { compile.using(:scalac) }.should_not change { compile.target }
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should not change existing list of sources' do
|
44
|
-
define 'foo' do
|
45
|
-
compile.from('sources')
|
46
|
-
lambda { compile.using(:scalac) }.should_not change { compile.sources }
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should include as classpath dependency' do
|
51
|
-
write 'src/dependency/Dependency.scala', 'class Dependency {}'
|
52
|
-
define 'dependency', :version=>'1.0' do
|
53
|
-
compile.from('src/dependency').into('target/dependency')
|
54
|
-
package(:jar)
|
55
|
-
end
|
56
|
-
write 'src/test/DependencyTest.scala', 'class DependencyTest { var d: Dependency = _ }'
|
57
|
-
lambda { define('foo').compile.from('src/test').with(project('dependency')).invoke }.should run_task('foo:compile')
|
58
|
-
file('target/classes/DependencyTest.class').should exist
|
59
|
-
end
|
60
|
-
|
61
|
-
def define_test1_project
|
62
|
-
write 'src/main/scala/com/example/Test1.scala', 'package com.example; class Test1 { val i = 1 }'
|
63
|
-
define 'test1', :version=>'1.0' do
|
64
|
-
package(:jar)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'should compile a simple .scala file into a .class file' do
|
69
|
-
define_test1_project
|
70
|
-
task('test1:compile').invoke
|
71
|
-
file('target/classes/com/example/Test1.class').should exist
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'should package .class into a .jar file' do
|
75
|
-
define_test1_project
|
76
|
-
task('test1:package').invoke
|
77
|
-
file('target/test1-1.0.jar').should exist
|
78
|
-
Zip::ZipFile.open(project('test1').package(:jar).to_s) do |zip|
|
79
|
-
zip.file.exist?('com/example/Test1.class').should be_true
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
|
86
|
-
describe 'scalac compiler options' do
|
87
|
-
def compile_task
|
88
|
-
@compile_task ||= define('foo').compile.using(:scalac)
|
89
|
-
end
|
90
|
-
|
91
|
-
def scalac_args
|
92
|
-
compile_task.instance_eval { @compiler }.send(:scalac_args)
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'should set warnings option to false by default' do
|
96
|
-
compile_task.options.warnings.should be_false
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'should set wranings option to true when running with --verbose option' do
|
100
|
-
verbose true
|
101
|
-
compile_task.options.warnings.should be_true
|
102
|
-
end
|
103
|
-
|
104
|
-
it 'should use -nowarn argument when warnings is false' do
|
105
|
-
compile_task.using(:warnings=>false)
|
106
|
-
scalac_args.should include('-nowarn')
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'should not use -nowarn argument when warnings is true' do
|
110
|
-
compile_task.using(:warnings=>true)
|
111
|
-
scalac_args.should_not include('-nowarn')
|
112
|
-
end
|
113
|
-
|
114
|
-
it 'should not use -verbose argument by default' do
|
115
|
-
scalac_args.should_not include('-verbose')
|
116
|
-
end
|
117
|
-
|
118
|
-
it 'should use -verbose argument when running with --trace option' do
|
119
|
-
trace true
|
120
|
-
scalac_args.should include('-verbose')
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'should set debug option to true by default' do
|
124
|
-
compile_task.options.debug.should be_true
|
125
|
-
end
|
126
|
-
|
127
|
-
it 'should set debug option to false based on Buildr.options' do
|
128
|
-
Buildr.options.debug = false
|
129
|
-
compile_task.options.debug.should be_false
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'should set debug option to false based on debug environment variable' do
|
133
|
-
ENV['debug'] = 'no'
|
134
|
-
compile_task.options.debug.should be_false
|
135
|
-
end
|
136
|
-
|
137
|
-
it 'should set debug option to false based on DEBUG environment variable' do
|
138
|
-
ENV['DEBUG'] = 'no'
|
139
|
-
compile_task.options.debug.should be_false
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'should use -g argument when debug option is true' do
|
143
|
-
compile_task.using(:debug=>true)
|
144
|
-
scalac_args.should include('-g')
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'should not use -g argument when debug option is false' do
|
148
|
-
compile_task.using(:debug=>false)
|
149
|
-
scalac_args.should_not include('-g')
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'should set deprecation option to false by default' do
|
153
|
-
compile_task.options.deprecation.should be_false
|
154
|
-
end
|
155
|
-
|
156
|
-
it 'should use -deprecation argument when deprecation is true' do
|
157
|
-
compile_task.using(:deprecation=>true)
|
158
|
-
scalac_args.should include('-deprecation')
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'should not use -deprecation argument when deprecation is false' do
|
162
|
-
compile_task.using(:deprecation=>false)
|
163
|
-
scalac_args.should_not include('-deprecation')
|
164
|
-
end
|
165
|
-
|
166
|
-
it 'should set optimise option to false by default' do
|
167
|
-
compile_task.options.optimise.should be_false
|
168
|
-
end
|
169
|
-
|
170
|
-
it 'should use -optimise argument when deprecation is true' do
|
171
|
-
compile_task.using(:optimise=>true)
|
172
|
-
scalac_args.should include('-optimise')
|
173
|
-
end
|
174
|
-
|
175
|
-
it 'should not use -optimise argument when deprecation is false' do
|
176
|
-
compile_task.using(:optimise=>false)
|
177
|
-
scalac_args.should_not include('-optimise')
|
178
|
-
end
|
179
|
-
|
180
|
-
it 'should not set target option by default' do
|
181
|
-
compile_task.options.target.should be_nil
|
182
|
-
scalac_args.should_not include('-target')
|
183
|
-
end
|
184
|
-
|
185
|
-
it 'should use -target:xxx argument if target option set' do
|
186
|
-
compile_task.using(:target=>'1.5')
|
187
|
-
scalac_args.should include('-target:jvm-1.5')
|
188
|
-
end
|
189
|
-
|
190
|
-
it 'should not set other option by default' do
|
191
|
-
compile_task.options.other.should be_nil
|
192
|
-
end
|
193
|
-
|
194
|
-
it 'should pass other argument if other option is string' do
|
195
|
-
compile_task.using(:other=>'-unchecked')
|
196
|
-
scalac_args.should include('-unchecked')
|
197
|
-
end
|
198
|
-
|
199
|
-
it 'should pass other argument if other option is array' do
|
200
|
-
compile_task.using(:other=>['-unchecked', '-Xprint-types'])
|
201
|
-
scalac_args.should include('-unchecked', '-Xprint-types')
|
202
|
-
end
|
203
|
-
|
204
|
-
it 'should complain about options it doesn\'t know' do
|
205
|
-
write 'source/Test.scala', 'class Test {}'
|
206
|
-
compile_task.using(:unknown=>'option')
|
207
|
-
lambda { compile_task.from('source').invoke }.should raise_error(ArgumentError, /no such option/i)
|
208
|
-
end
|
209
|
-
|
210
|
-
it 'should inherit options from parent' do
|
211
|
-
define 'foo' do
|
212
|
-
compile.using(:warnings=>true, :debug=>true, :deprecation=>true, :target=>'1.4')
|
213
|
-
define 'bar' do
|
214
|
-
compile.using(:scalac)
|
215
|
-
compile.options.warnings.should be_true
|
216
|
-
compile.options.debug.should be_true
|
217
|
-
compile.options.deprecation.should be_true
|
218
|
-
compile.options.target.should eql('1.4')
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
after do
|
224
|
-
Buildr.options.debug = nil
|
225
|
-
ENV.delete "debug"
|
226
|
-
ENV.delete "DEBUG"
|
227
|
-
end
|
228
|
-
end
|
data/spec/scala/tests_spec.rb
DELETED
@@ -1,215 +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
|
-
|
19
|
-
# TODO's
|
20
|
-
# -test w/ Specs
|
21
|
-
# -test w/ ScalaCheck
|
22
|
-
# -failing test
|
23
|
-
# -test passing System props
|
24
|
-
# -test passing ENV variables
|
25
|
-
# -test exclude group
|
26
|
-
# -test include Suite's
|
27
|
-
# -test exclude Suite's
|
28
|
-
|
29
|
-
|
30
|
-
describe Buildr::Scala::ScalaTest do
|
31
|
-
it 'should be the default test framework when test cases are in Scala' do
|
32
|
-
write 'src/test/scala/com/example/MySuite.scala', <<-SCALA
|
33
|
-
package com.example
|
34
|
-
import org.scalatest.FunSuite
|
35
|
-
class MySuite extends FunSuite {
|
36
|
-
test("addition") {
|
37
|
-
val sum = 1 + 1
|
38
|
-
assert(sum === 2)
|
39
|
-
}
|
40
|
-
}
|
41
|
-
SCALA
|
42
|
-
define 'foo'
|
43
|
-
project('foo').test.framework.should eql(:scalatest)
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'should be picked if the test language is Scala' do
|
47
|
-
define 'foo' do
|
48
|
-
test.compile.using(:scalac)
|
49
|
-
test.framework.should eql(:scalatest)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should include Scalatest dependencies' do
|
54
|
-
define('foo') { test.using(:scalatest) }
|
55
|
-
project('foo').test.compile.dependencies.should include(*artifacts(Scala::ScalaTest.dependencies))
|
56
|
-
project('foo').test.dependencies.should include(*artifacts(Scala::ScalaTest.dependencies))
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'should include JMock dependencies' do
|
60
|
-
define('foo') { test.using(:scalatest) }
|
61
|
-
project('foo').test.compile.dependencies.should include(*artifacts(JMock.dependencies))
|
62
|
-
project('foo').test.dependencies.should include(*artifacts(JMock.dependencies))
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'should include Specs dependencies' do
|
66
|
-
define('foo') { test.using(:scalatest) }
|
67
|
-
project('foo').test.compile.dependencies.should include(*artifacts(Scala::ScalaSpecs.dependencies))
|
68
|
-
project('foo').test.dependencies.should include(*artifacts(Scala::ScalaSpecs.dependencies))
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'should include ScalaCheck dependencies' do
|
72
|
-
define('foo') { test.using(:scalatest) }
|
73
|
-
project('foo').test.compile.dependencies.should include(*artifacts(Scala::ScalaCheck.dependencies))
|
74
|
-
project('foo').test.dependencies.should include(*artifacts(Scala::ScalaCheck.dependencies))
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'should include public classes extending org.scalatest.FunSuite' do
|
78
|
-
write 'src/test/scala/com/example/MySuite.scala', <<-SCALA
|
79
|
-
package com.example
|
80
|
-
import org.scalatest.FunSuite
|
81
|
-
class MySuite extends FunSuite {
|
82
|
-
test("addition") {
|
83
|
-
val sum = 1 + 1
|
84
|
-
assert(sum === 2)
|
85
|
-
}
|
86
|
-
}
|
87
|
-
SCALA
|
88
|
-
define('foo').test.invoke
|
89
|
-
project('foo').test.tests.should include('com.example.MySuite')
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'should ignore classes not extending org.scalatest.FunSuite' do
|
93
|
-
write 'src/test/scala/com/example/NotASuite.scala', <<-SCALA
|
94
|
-
package com.example
|
95
|
-
class Another {
|
96
|
-
}
|
97
|
-
SCALA
|
98
|
-
define('foo').test.invoke
|
99
|
-
project('foo').test.tests.should be_empty
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'should ignore inner classes' do
|
103
|
-
write 'src/test/scala/com/example/InnerClassTest.scala', <<-SCALA
|
104
|
-
package com.example
|
105
|
-
import org.scalatest.FunSuite
|
106
|
-
class InnerClassTest extends FunSuite {
|
107
|
-
test("addition") {
|
108
|
-
val sum = 1 + 1
|
109
|
-
assert(sum === 2)
|
110
|
-
}
|
111
|
-
|
112
|
-
class InnerSuite extends FunSuite {
|
113
|
-
test("addition") {
|
114
|
-
val sum = 1 + 1
|
115
|
-
assert(sum === 2)
|
116
|
-
}
|
117
|
-
}
|
118
|
-
}
|
119
|
-
SCALA
|
120
|
-
define('foo').test.invoke
|
121
|
-
project('foo').test.tests.should eql(['com.example.InnerClassTest'])
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'should pass when ScalaTest test case passes' do
|
125
|
-
write 'src/test/scala/PassingSuite.scala', <<-SCALA
|
126
|
-
class PassingSuite extends org.scalatest.FunSuite {
|
127
|
-
test("addition") {
|
128
|
-
val sum = 1 + 1
|
129
|
-
assert(sum === 2)
|
130
|
-
}
|
131
|
-
}
|
132
|
-
SCALA
|
133
|
-
lambda { define('foo').test.invoke }.should_not raise_error
|
134
|
-
end
|
135
|
-
|
136
|
-
it 'should fail when ScalaTest test case fails' do
|
137
|
-
write 'src/test/scala/FailingSuite.scala', <<-SCALA
|
138
|
-
class FailingSuite extends org.scalatest.FunSuite {
|
139
|
-
test("failing") {
|
140
|
-
assert(false)
|
141
|
-
}
|
142
|
-
}
|
143
|
-
SCALA
|
144
|
-
lambda { define('foo').test.invoke }.should raise_error(RuntimeError, /Tests failed/) rescue nil
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'should report failed test names' do
|
148
|
-
write 'src/test/scala/FailingSuite.scala', <<-SCALA
|
149
|
-
class FailingSuite extends org.scalatest.FunSuite {
|
150
|
-
test("failing") {
|
151
|
-
assert(false)
|
152
|
-
}
|
153
|
-
}
|
154
|
-
SCALA
|
155
|
-
define('foo').test.invoke rescue
|
156
|
-
project('foo').test.failed_tests.should include('FailingSuite')
|
157
|
-
end
|
158
|
-
|
159
|
-
it 'should report to reports/scalatest/TEST-TestSuiteName.txt' do
|
160
|
-
write 'src/test/scala/PassingSuite.scala', <<-SCALA
|
161
|
-
class PassingSuite extends org.scalatest.FunSuite {
|
162
|
-
test("passing") {
|
163
|
-
assert(true)
|
164
|
-
}
|
165
|
-
}
|
166
|
-
SCALA
|
167
|
-
define 'foo' do
|
168
|
-
test.report_to.should be(file('reports/scalatest'))
|
169
|
-
end
|
170
|
-
project('foo').test.invoke
|
171
|
-
project('foo').file('reports/scalatest/TEST-PassingSuite.txt').should exist
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'should pass properties to Suite' do
|
175
|
-
write 'src/test/scala/PropertyTestSuite.scala', <<-SCALA
|
176
|
-
import org.scalatest._
|
177
|
-
class PropertyTestSuite extends FunSuite {
|
178
|
-
var properties = Map[String, Any]()
|
179
|
-
test("testProperty") {
|
180
|
-
assert(properties("name") === "value")
|
181
|
-
}
|
182
|
-
|
183
|
-
protected override def runTests(testName: Option[String], reporter: Reporter, stopper: Stopper,
|
184
|
-
includes: Set[String], excludes: Set[String], properties: Map[String, Any]) {
|
185
|
-
this.properties = properties;
|
186
|
-
super.runTests(testName, reporter, stopper, includes, excludes, properties)
|
187
|
-
}
|
188
|
-
}
|
189
|
-
SCALA
|
190
|
-
define('foo').test.using :properties=>{ 'name'=>'value' }
|
191
|
-
project('foo').test.invoke
|
192
|
-
end
|
193
|
-
|
194
|
-
it 'should set current directory' do
|
195
|
-
mkpath 'baz'
|
196
|
-
expected = File.expand_path('baz')
|
197
|
-
expected.gsub!('/', '\\') if expected =~ /^[A-Z]:/ # Java returns back slashed paths for windows
|
198
|
-
write 'baz/src/test/scala/CurrentDirectoryTestSuite.scala', <<-SCALA
|
199
|
-
class CurrentDirectoryTestSuite extends org.scalatest.FunSuite {
|
200
|
-
test("testCurrentDirectory") {
|
201
|
-
assert("value" === System.getenv("NAME"))
|
202
|
-
assert(#{expected.inspect} === new java.io.File(".").getCanonicalPath())
|
203
|
-
}
|
204
|
-
}
|
205
|
-
SCALA
|
206
|
-
define 'bar' do
|
207
|
-
define 'baz' do
|
208
|
-
test.include 'CurrentDirectoryTest'
|
209
|
-
end
|
210
|
-
end
|
211
|
-
project('bar:baz').test.invoke
|
212
|
-
end
|
213
|
-
|
214
|
-
end
|
215
|
-
|