buildr 1.4.25-java → 1.5.0.dev2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +50 -0
- data/NOTICE +1 -1
- data/README.rdoc +1 -1
- data/addon/buildr/bnd.rb +0 -6
- data/addon/buildr/custom_pom.rb +6 -0
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/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/wsgen.rb +27 -27
- data/buildr.buildfile +1 -1
- data/buildr.gemspec +13 -9
- data/doc/_config.yml +3 -1
- data/doc/_layouts/default.html +1 -1
- data/doc/artifacts.textile +42 -0
- data/doc/download.textile +18 -6
- data/doc/languages.textile +15 -1
- data/doc/packaging.textile +1 -1
- data/doc/preface.textile +1 -1
- data/doc/projects.textile +13 -0
- data/doc/releasing.textile +14 -0
- data/doc/settings_profiles.textile +4 -0
- data/lib/buildr.rb +1 -0
- data/lib/buildr/core/application.rb +2 -3
- data/lib/buildr/core/build.rb +21 -34
- data/lib/buildr/core/compile.rb +0 -12
- data/lib/buildr/core/filter.rb +7 -0
- data/lib/buildr/core/generate.rb +1 -0
- data/lib/buildr/core/project.rb +14 -4
- data/lib/buildr/core/test.rb +2 -4
- data/lib/buildr/core/transports.rb +2 -0
- data/lib/buildr/groovy/bdd.rb +0 -7
- data/lib/buildr/ide/eclipse.rb +3 -3
- data/lib/buildr/java/ant.rb +0 -6
- data/lib/buildr/java/bdd.rb +0 -7
- data/lib/buildr/java/commands.rb +1 -1
- data/lib/buildr/java/deprecated.rb +0 -60
- data/lib/buildr/java/ecj.rb +16 -3
- data/lib/buildr/java/jruby.rb +19 -1
- data/lib/buildr/java/packaging.rb +4 -8
- data/lib/buildr/java/pom.rb +17 -12
- data/lib/buildr/java/rjb.rb +21 -3
- data/lib/buildr/java/tests.rb +0 -21
- data/lib/buildr/packaging/archive.rb +1 -1
- data/lib/buildr/packaging/artifact.rb +132 -3
- data/lib/buildr/packaging/zip.rb +32 -29
- data/lib/buildr/packaging/ziptask.rb +7 -5
- data/lib/buildr/scala.rb +0 -1
- data/lib/buildr/scala/bdd.rb +28 -122
- data/lib/buildr/scala/compiler.rb +24 -10
- data/lib/buildr/scala/doc.rb +0 -1
- data/lib/buildr/scala/org/apache/buildr/Specs2Runner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/Specs2Runner.java +4 -3
- data/lib/buildr/scala/org/apache/buildr/ZincRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/ZincRunner.java +37 -0
- data/lib/buildr/scala/tests.rb +18 -26
- data/lib/buildr/version.rb +1 -1
- data/spec/addon/bnd_spec.rb +5 -5
- data/spec/addon/custom_pom_spec.rb +38 -32
- data/spec/addon/jaxb_xjc_spec.rb +0 -4
- data/spec/core/application_spec.rb +4 -5
- data/spec/core/build_spec.rb +10 -51
- data/spec/core/common_spec.rb +7 -0
- data/spec/core/compile_spec.rb +0 -6
- data/spec/core/console_spec.rb +1 -1
- data/spec/core/generate_from_eclipse_spec.rb +22 -8
- data/spec/core/project_spec.rb +34 -70
- data/spec/core/test_spec.rb +6 -9
- data/spec/core/transport_spec.rb +16 -7
- data/spec/groovy/compiler_spec.rb +2 -2
- data/spec/java/ant_spec.rb +0 -5
- data/spec/java/compiler_spec.rb +4 -4
- data/spec/java/ecj_spec.rb +244 -45
- data/spec/java/java_spec.rb +7 -9
- data/spec/java/packaging_spec.rb +23 -23
- data/spec/java/pom_spec.rb +37 -0
- data/spec/java/tests_spec.rb +0 -5
- data/spec/packaging/archive_spec.rb +1 -1
- data/spec/packaging/artifact_spec.rb +129 -7
- data/spec/packaging/packaging_spec.rb +1 -1
- data/spec/sandbox.rb +2 -2
- data/spec/scala/bdd_spec.rb +0 -101
- data/spec/scala/compiler_spec.rb +20 -16
- data/spec/scala/doc_spec.rb +0 -11
- data/spec/scala/tests_spec.rb +6 -15
- data/spec/spec_helpers.rb +1 -1
- data/spec/xpath_matchers.rb +2 -1
- metadata +30 -16
- data/addon/buildr/cobertura.rb +0 -21
- data/addon/buildr/emma.rb +0 -21
data/lib/buildr/packaging/zip.rb
CHANGED
@@ -13,6 +13,8 @@
|
|
13
13
|
# License for the specific language governing permissions and limitations under
|
14
14
|
# the License.
|
15
15
|
|
16
|
+
require 'zip'
|
17
|
+
|
16
18
|
if RUBY_VERSION >= '1.9.0' # Required to properly load RubyZip under Ruby 1.9
|
17
19
|
$LOADED_FEATURES.unshift 'ftools'
|
18
20
|
require 'fileutils'
|
@@ -26,29 +28,39 @@ if RUBY_VERSION >= '1.9.0' # Required to properly load RubyZip under Ruby 1.9
|
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
|
-
require 'zip/zip'
|
30
|
-
require 'zip/zipfilesystem'
|
31
|
-
|
32
31
|
module Zip #:nodoc:
|
33
32
|
|
34
|
-
class
|
33
|
+
class CentralDirectory #:nodoc:
|
35
34
|
# Patch to add entries in alphabetical order.
|
36
35
|
def write_to_stream(io)
|
37
36
|
offset = io.tell
|
38
|
-
@
|
39
|
-
|
37
|
+
@entry_set.sort { |a,b| a.name <=> b.name }.each { |entry| entry.write_c_dir_entry(io) }
|
38
|
+
eocd_offset = io.tell
|
39
|
+
cdir_size = eocd_offset - offset
|
40
|
+
write_e_o_c_d(io, offset, cdir_size)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class File
|
45
|
+
|
46
|
+
# :call-seq:
|
47
|
+
# exist() => boolean
|
48
|
+
#
|
49
|
+
# Returns true if this entry exists.
|
50
|
+
def exist?(entry_name)
|
51
|
+
!!find_entry(entry_name)
|
40
52
|
end
|
41
53
|
end
|
42
54
|
|
43
55
|
|
44
|
-
class
|
56
|
+
class Entry
|
45
57
|
|
46
58
|
# :call-seq:
|
47
59
|
# exist() => boolean
|
48
60
|
#
|
49
61
|
# Returns true if this entry exists.
|
50
62
|
def exist?()
|
51
|
-
|
63
|
+
File.open(zipfile) { |zip| zip.exist?(@name) }
|
52
64
|
end
|
53
65
|
|
54
66
|
# :call-seq:
|
@@ -56,7 +68,7 @@ module Zip #:nodoc:
|
|
56
68
|
#
|
57
69
|
# Returns true if this entry is empty.
|
58
70
|
def empty?()
|
59
|
-
|
71
|
+
File.open(zipfile) { |zip| zip.read(@name) }.empty?
|
60
72
|
end
|
61
73
|
|
62
74
|
# :call-seq:
|
@@ -65,7 +77,7 @@ module Zip #:nodoc:
|
|
65
77
|
# Returns true if this ZIP file entry matches against all the arguments. An argument may be
|
66
78
|
# a string or regular expression.
|
67
79
|
def contain?(*patterns)
|
68
|
-
content =
|
80
|
+
content = File.open(zipfile) { |zip| zip.read(@name) }
|
69
81
|
patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }.
|
70
82
|
all? { |pattern| content =~ pattern }
|
71
83
|
end
|
@@ -89,7 +101,7 @@ module Zip #:nodoc:
|
|
89
101
|
raise ZipInternalError, "unknown file type #{self.inspect}"
|
90
102
|
end
|
91
103
|
|
92
|
-
@
|
104
|
+
@external_file_attributes = (ft << 12 | (@unix_perms & 07777)) << 16
|
93
105
|
end
|
94
106
|
|
95
107
|
io <<
|
@@ -105,12 +117,12 @@ module Zip #:nodoc:
|
|
105
117
|
@compressed_size,
|
106
118
|
@size,
|
107
119
|
@name ? @name.length : 0,
|
108
|
-
@extra ? @extra.
|
120
|
+
@extra ? @extra.c_dir_size : 0,
|
109
121
|
@comment ? comment.to_s.length : 0,
|
110
122
|
0, # disk number start
|
111
|
-
@
|
112
|
-
@
|
113
|
-
@
|
123
|
+
@internal_file_attributes, # file type (binary=0, text=1)
|
124
|
+
@external_file_attributes, # native filesystem attributes
|
125
|
+
@local_header_offset,
|
114
126
|
@name,
|
115
127
|
@extra,
|
116
128
|
@comment
|
@@ -142,7 +154,7 @@ module Zip #:nodoc:
|
|
142
154
|
raise ZipInternalError, "unknown file type #{self.inspect}"
|
143
155
|
end
|
144
156
|
|
145
|
-
@
|
157
|
+
@external_file_attributes = (ft << 12 | (@unix_perms & 07777)) << 16
|
146
158
|
end
|
147
159
|
|
148
160
|
io <<
|
@@ -158,12 +170,12 @@ module Zip #:nodoc:
|
|
158
170
|
@compressed_size,
|
159
171
|
@size,
|
160
172
|
@name ? @name.length : 0,
|
161
|
-
@extra ? @extra.
|
173
|
+
@extra ? @extra.c_dir_size : 0,
|
162
174
|
@comment ? @comment.length : 0,
|
163
175
|
0, # disk number start
|
164
|
-
@
|
165
|
-
@
|
166
|
-
@
|
176
|
+
@internal_file_attributes, # file type (binary=0, text=1)
|
177
|
+
@external_file_attributes, # native filesystem attributes
|
178
|
+
@local_header_offset,
|
167
179
|
@name,
|
168
180
|
@extra,
|
169
181
|
@comment].pack('VCCvvvvvVVVvvvvvVV')
|
@@ -174,13 +186,4 @@ module Zip #:nodoc:
|
|
174
186
|
|
175
187
|
end
|
176
188
|
end
|
177
|
-
|
178
|
-
class ZipEntrySet
|
179
|
-
alias_method :original_push, :"<<"
|
180
|
-
alias_method :push, :"<<"
|
181
|
-
|
182
|
-
def <<(entry)
|
183
|
-
original_push(entry) if entry != nil
|
184
|
-
end
|
185
|
-
end
|
186
189
|
end
|
@@ -42,17 +42,17 @@ module Buildr #:nodoc:
|
|
42
42
|
# for example:
|
43
43
|
# package(:jar).entry("META-INF/LICENSE").should contain(/Apache Software License/)
|
44
44
|
def entry(entry_name)
|
45
|
-
::Zip::
|
45
|
+
::Zip::Entry.new(name, entry_name)
|
46
46
|
end
|
47
47
|
|
48
48
|
def entries #:nodoc:
|
49
|
-
@entries ||= Zip::
|
49
|
+
@entries ||= Zip::File.open(name) { |zip| zip.entries }
|
50
50
|
end
|
51
51
|
|
52
52
|
private
|
53
53
|
|
54
54
|
def create_from(file_map)
|
55
|
-
Zip::
|
55
|
+
Zip::OutputStream.open name do |zip|
|
56
56
|
seen = {}
|
57
57
|
mkpath = lambda do |dir|
|
58
58
|
dirname = (dir[-1..-1] =~ /\/$/) ? dir : dir + '/'
|
@@ -63,7 +63,9 @@ module Buildr #:nodoc:
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
file_map.
|
66
|
+
paths = file_map.keys.sort
|
67
|
+
paths.each do |path|
|
68
|
+
content = file_map[path]
|
67
69
|
warn "Warning: Path in zipfile #{name} contains backslash: #{path}" if path =~ /\\/
|
68
70
|
mkpath.call File.dirname(path)
|
69
71
|
if content.respond_to?(:call)
|
@@ -166,7 +168,7 @@ module Buildr #:nodoc:
|
|
166
168
|
end
|
167
169
|
}
|
168
170
|
else
|
169
|
-
Zip::
|
171
|
+
Zip::File.open(zip_file.to_s) do |zip|
|
170
172
|
entries = zip.collect
|
171
173
|
@paths.each do |path, patterns|
|
172
174
|
patterns.map(entries).each do |dest, entry|
|
data/lib/buildr/scala.rb
CHANGED
@@ -15,7 +15,6 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
ENV['SCALA_HOME'] ||= '/opt/local/share/scala/' if File.exist?('/opt/local/share/scala/lib/scala-compiler.jar')
|
18
|
-
Buildr.repositories.remote << 'http://oss.sonatype.org/content/repositories/releases'
|
19
18
|
|
20
19
|
require 'buildr/scala/compiler'
|
21
20
|
require 'buildr/scala/tests'
|
data/lib/buildr/scala/bdd.rb
CHANGED
@@ -15,118 +15,6 @@
|
|
15
15
|
|
16
16
|
module Buildr::Scala #:nodoc:
|
17
17
|
|
18
|
-
# Specs is a Scala based BDD framework.
|
19
|
-
# To use in your project:
|
20
|
-
#
|
21
|
-
# test.using :specs
|
22
|
-
#
|
23
|
-
# This framework will search in your project for:
|
24
|
-
# src/spec/scala/**/*.scala
|
25
|
-
class Specs < Buildr::TestFramework::JavaBDD
|
26
|
-
@lang = :scala
|
27
|
-
@bdd_dir = :spec
|
28
|
-
|
29
|
-
VERSION = case
|
30
|
-
when Buildr::Scala.version?("2.8.0")
|
31
|
-
'1.6.5'
|
32
|
-
when Buildr::Scala.version?("2.8.1"), Buildr::Scala.version?("2.8.2"), Buildr::Scala.version?("2.9.0")
|
33
|
-
'1.6.8'
|
34
|
-
else
|
35
|
-
'1.6.9'
|
36
|
-
end
|
37
|
-
|
38
|
-
class << self
|
39
|
-
def version
|
40
|
-
custom = Buildr.settings.build['scala.specs']
|
41
|
-
(custom =~ /:/) ? Buildr.artifact(custom).version : VERSION
|
42
|
-
end
|
43
|
-
|
44
|
-
def specs
|
45
|
-
custom = Buildr.settings.build['scala.specs']
|
46
|
-
[ (custom =~ /:/) ? custom : "org.scala-tools.testing:#{artifact}:jar:#{version}" ]
|
47
|
-
end
|
48
|
-
|
49
|
-
def artifact
|
50
|
-
Buildr.settings.build['scala.specs.artifact'] || "specs_#{Buildr::Scala.version_without_build}"
|
51
|
-
end
|
52
|
-
|
53
|
-
def dependencies
|
54
|
-
unless @dependencies
|
55
|
-
super
|
56
|
-
# Add utility classes (e.g. SpecsSingletonRunner) and other dependencies
|
57
|
-
@dependencies |= [ File.join(File.dirname(__FILE__)) ] +
|
58
|
-
specs +
|
59
|
-
Check.dependencies + JUnit.dependencies + Scalac.dependencies
|
60
|
-
end
|
61
|
-
@dependencies
|
62
|
-
end
|
63
|
-
|
64
|
-
def applies_to?(project) #:nodoc:
|
65
|
-
scala_files = Dir[project.path_to(:source, bdd_dir, lang, '**/*.scala')]
|
66
|
-
return false if scala_files.empty?
|
67
|
-
scala_files.detect { |f| find(f, /\s+(org\.specs\.)/) }
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
def const_missing(const)
|
72
|
-
return super unless const == :REQUIRES # TODO: remove in 1.5
|
73
|
-
Buildr.application.deprecated "Please use Scala::Specs.dependencies/.version instead of ScalaSpecs::REQUIRES/VERSION"
|
74
|
-
dependencies
|
75
|
-
end
|
76
|
-
|
77
|
-
def find(file, pattern)
|
78
|
-
File.open(file, "r") do |infile|
|
79
|
-
while (line = infile.gets)
|
80
|
-
return true if line.match(pattern)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
false
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def initialize(task, options) #:nodoc:
|
88
|
-
super
|
89
|
-
|
90
|
-
specs = task.project.path_to(:source, :spec, :scala)
|
91
|
-
task.compile.from specs if File.directory?(specs)
|
92
|
-
|
93
|
-
resources = task.project.path_to(:source, :spec, :resources)
|
94
|
-
task.resources.from resources if File.directory?(resources)
|
95
|
-
end
|
96
|
-
|
97
|
-
def tests(dependencies)
|
98
|
-
candidates = filter_classes(dependencies, :interfaces => ['org.specs.Specification'])
|
99
|
-
|
100
|
-
Java.load # Java is already loaded, but just in case
|
101
|
-
|
102
|
-
filter = Java.org.apache.buildr.JavaTestFilter.new(dependencies.to_java(Java.java.lang.String))
|
103
|
-
filter.add_fields ['MODULE$'].to_java(Java.java.lang.String)
|
104
|
-
filter.filter(candidates.to_java(Java.java.lang.String)).map { |s| s[0..(s.size - 2)] }
|
105
|
-
end
|
106
|
-
|
107
|
-
def run(specs, dependencies) #:nodoc:
|
108
|
-
cmd_options = { :properties => options[:properties],
|
109
|
-
:java_args => options[:java_args],
|
110
|
-
:classpath => dependencies,
|
111
|
-
:name => false }
|
112
|
-
|
113
|
-
runner = 'org.apache.buildr.SpecsSingletonRunner'
|
114
|
-
specs.inject [] do |passed, spec|
|
115
|
-
begin
|
116
|
-
unless Util.win_os?
|
117
|
-
Java::Commands.java(runner, task.compile.target.to_s, '-c', spec + '$', cmd_options)
|
118
|
-
else
|
119
|
-
Java::Commands.java(runner, task.compile.target.to_s, spec + '$', cmd_options)
|
120
|
-
end
|
121
|
-
rescue => e
|
122
|
-
passed
|
123
|
-
else
|
124
|
-
passed << spec
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
18
|
class Specs2 < Buildr::TestFramework::JavaBDD
|
131
19
|
@lang = :scala
|
132
20
|
@bdd_dir = :spec
|
@@ -136,8 +24,10 @@ module Buildr::Scala #:nodoc:
|
|
136
24
|
'1.5'
|
137
25
|
when Buildr::Scala.version?("2.9")
|
138
26
|
'1.11'
|
27
|
+
when Buildr::Scala.version?("2.10")
|
28
|
+
'1.12.3'
|
139
29
|
else
|
140
|
-
'
|
30
|
+
'3.7' # default for Scala 2.11 and beyond
|
141
31
|
end
|
142
32
|
|
143
33
|
class << self
|
@@ -148,7 +38,7 @@ module Buildr::Scala #:nodoc:
|
|
148
38
|
|
149
39
|
def specs
|
150
40
|
custom = Buildr.settings.build['scala.specs2']
|
151
|
-
[ (custom =~ /:/) ? custom : "org.specs2:#{artifact}:
|
41
|
+
[ (custom =~ /:/) ? custom : "org.specs2:#{artifact}:pom:#{version}" ]
|
152
42
|
end
|
153
43
|
|
154
44
|
def artifact
|
@@ -156,14 +46,26 @@ module Buildr::Scala #:nodoc:
|
|
156
46
|
when Buildr.settings.build['scala.specs2.artifact']
|
157
47
|
Buildr.settings.build['scala.specs2.artifact']
|
158
48
|
else
|
159
|
-
|
49
|
+
if Buildr::Scala.version < "2.11"
|
50
|
+
"specs2_#{Buildr::Scala.version_without_build_number}"
|
51
|
+
else
|
52
|
+
"specs2_#{Buildr::Scala.version_major_minor}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def type
|
58
|
+
if Buildr::Scala.version < "2.11"
|
59
|
+
"jar"
|
60
|
+
else
|
61
|
+
"pom"
|
160
62
|
end
|
161
63
|
end
|
162
64
|
|
163
65
|
def scalaz_dependencies
|
164
66
|
if Buildr::Scala.version?("2.8")
|
165
67
|
[]
|
166
|
-
|
68
|
+
elsif Buildr::Scala.version < "2.11"
|
167
69
|
default_version = "6.0.1"
|
168
70
|
custom_version = Buildr.settings.build['scala.specs2-scalaz']
|
169
71
|
version = (custom_version =~ /:/) ? Buildr.artifact(custom_version).version : default_version
|
@@ -173,6 +75,16 @@ module Buildr::Scala #:nodoc:
|
|
173
75
|
custom_spec = Buildr.settings.build['scala.specs2-scalaz']
|
174
76
|
spec = [ (custom_spec =~ /:/) ? custom_spec : "org.specs2:#{artifact}:jar:#{version}" ]
|
175
77
|
Buildr.transitive(spec, :scopes => [nil, "compile", "runtime", "provided", "optional"], :optional => true)
|
78
|
+
else
|
79
|
+
default_version = "7.2.2"
|
80
|
+
custom_version = Buildr.settings.build['scala.specs2-scalaz']
|
81
|
+
version = (custom_version =~ /:/) ? Buildr.artifact(custom_version).version : default_version
|
82
|
+
|
83
|
+
artifact = Buildr.settings.build['scala.specs2-scalaz.artifact'] || "scalaz-core_#{Buildr::Scala.version_major_minor}"
|
84
|
+
|
85
|
+
custom_spec = Buildr.settings.build['scala.specs2-scalaz']
|
86
|
+
spec = [ (custom_spec =~ /:/) ? custom_spec : "org.scalaz:#{artifact}:jar:#{version}" ]
|
87
|
+
[Buildr.transitive(spec, :scopes => [nil, "compile", "runtime", "provided", "optional"], :optional => true), "org.scala-lang.modules:scala-xml_2.11:jar:1.0.1"]
|
176
88
|
end
|
177
89
|
end
|
178
90
|
|
@@ -246,10 +158,4 @@ module Buildr::Scala #:nodoc:
|
|
246
158
|
end
|
247
159
|
end
|
248
160
|
|
249
|
-
# Backwards compatibility stuff. Remove in 1.5.
|
250
|
-
module Buildr #:nodoc:
|
251
|
-
ScalaSpecs = Scala::Specs
|
252
|
-
end
|
253
|
-
|
254
|
-
Buildr::TestFramework << Buildr::Scala::Specs
|
255
161
|
Buildr::TestFramework << Buildr::Scala::Specs2
|
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
# The Scala Module
|
17
17
|
module Buildr::Scala
|
18
|
-
DEFAULT_VERSION = '2.
|
18
|
+
DEFAULT_VERSION = '2.11.8'
|
19
19
|
|
20
20
|
class << self
|
21
21
|
|
@@ -29,7 +29,7 @@ module Buildr::Scala
|
|
29
29
|
@installed_version = if Scalac.installed?
|
30
30
|
begin
|
31
31
|
# try to read the value from the properties file
|
32
|
-
props = Zip::
|
32
|
+
props = Zip::File.open(File.expand_path('lib/scala-library.jar', Scalac.scala_home)) do |zipfile|
|
33
33
|
zipfile.read 'library.properties'
|
34
34
|
end
|
35
35
|
|
@@ -65,6 +65,12 @@ module Buildr::Scala
|
|
65
65
|
def version_without_build
|
66
66
|
version.split('-')[0]
|
67
67
|
end
|
68
|
+
|
69
|
+
# returns Scala version without tiny number.
|
70
|
+
# e.g. "2.11.8" => "2.11"
|
71
|
+
def version_major_minor
|
72
|
+
version.split('.')[0..1].join('.')
|
73
|
+
end
|
68
74
|
end
|
69
75
|
|
70
76
|
# Scalac compiler:
|
@@ -81,9 +87,9 @@ module Buildr::Scala
|
|
81
87
|
# * :other -- Array of options to pass to the Scalac compiler as is, e.g. -Xprint-types
|
82
88
|
class Scalac < Buildr::Compiler::Base
|
83
89
|
|
84
|
-
DEFAULT_ZINC_VERSION = '0.
|
85
|
-
DEFAULT_SBT_VERSION = '0.12
|
86
|
-
DEFAULT_JLINE_VERSION = '
|
90
|
+
DEFAULT_ZINC_VERSION = '0.3.12'
|
91
|
+
DEFAULT_SBT_VERSION = '0.13.12'
|
92
|
+
DEFAULT_JLINE_VERSION = '2.14.2'
|
87
93
|
|
88
94
|
class << self
|
89
95
|
def scala_home
|
@@ -148,6 +154,9 @@ module Buildr::Scala
|
|
148
154
|
# added in Scala 2.10
|
149
155
|
ns.reflect! 'org.scala-lang:scala-reflect:jar:>=' + version
|
150
156
|
ns.actors! 'org.scala-lang:scala-actors:jar:>=' + version
|
157
|
+
ns.xml! 'org.scala-lang.modules:scala-xml_2.11:jar:1.0.5'
|
158
|
+
ns.parser_combinators! 'org.scala-lang.modules:scala-parser-combinators_2.11:jar:1.0.4'
|
159
|
+
|
151
160
|
end
|
152
161
|
end
|
153
162
|
|
@@ -174,12 +183,17 @@ module Buildr::Scala
|
|
174
183
|
|
175
184
|
def initialize(project, options) #:nodoc:
|
176
185
|
super
|
186
|
+
# use common options also for javac
|
187
|
+
|
188
|
+
options[:javac] ||= Buildr::Compiler::Javac::OPTIONS.inject({}) do |hash, option|
|
189
|
+
hash[option] = options[option]
|
190
|
+
hash
|
191
|
+
end
|
177
192
|
options[:debug] = Buildr.options.debug if options[:debug].nil?
|
178
193
|
options[:warnings] = verbose if options[:warnings].nil?
|
179
194
|
options[:deprecation] ||= false
|
180
195
|
options[:optimise] ||= false
|
181
196
|
options[:make] ||= :transitivenocp if Scala.version? 2.8
|
182
|
-
options[:javac] ||= {}
|
183
197
|
@java = Javac.new(project, options[:javac])
|
184
198
|
end
|
185
199
|
|
@@ -252,7 +266,8 @@ module Buildr::Scala
|
|
252
266
|
cmd_args << '-compiler-interface' << REQUIRES.compiler_interface_sources.artifact
|
253
267
|
cmd_args << '-scala-library' << dependencies.find { |d| d =~ /scala-library/ }
|
254
268
|
cmd_args << '-scala-compiler' << dependencies.find { |d| d =~ /scala-compiler/ }
|
255
|
-
cmd_args << '-
|
269
|
+
cmd_args << '-scala-extra' << dependencies.find { |d| d =~ /scala-reflect/ }
|
270
|
+
cmd_args << '-classpath' << (dependencies + [ File.join(File.dirname(__FILE__)) ]).join(File::PATH_SEPARATOR)
|
256
271
|
source_paths = sources.select { |source| File.directory?(source) }
|
257
272
|
cmd_args << '-Ssourcepath' << ("-S" + source_paths.join(File::PATH_SEPARATOR)) unless source_paths.empty?
|
258
273
|
cmd_args << '-d' << File.expand_path(target)
|
@@ -264,10 +279,9 @@ module Buildr::Scala
|
|
264
279
|
cmd_args += files_from_sources(sources)
|
265
280
|
|
266
281
|
unless Buildr.application.options.dryrun
|
267
|
-
trace((['
|
268
|
-
|
282
|
+
trace((['org.apache.buildr.ZincRunner'] + cmd_args).join(' '))
|
269
283
|
begin
|
270
|
-
Java::Commands.java '
|
284
|
+
Java::Commands.java 'org.apache.buildr.ZincRunner', *(cmd_args + [{ :classpath => Scalac.dependencies + [ File.join(File.dirname(__FILE__)) ]}])
|
271
285
|
rescue => e
|
272
286
|
fail "Zinc compiler crashed:\n#{e.inspect}\n#{e.backtrace.join("\n")}"
|
273
287
|
end
|