buildr 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +24 -1
  3. data/addon/buildr/bnd.rb +7 -5
  4. data/addon/buildr/custom_pom.rb +3 -272
  5. data/addon/buildr/git_auto_version.rb +3 -1
  6. data/addon/buildr/gwt.rb +66 -7
  7. data/addon/buildr/protobuf.rb +5 -8
  8. data/buildr.gemspec +2 -3
  9. data/doc/contributing.textile +3 -20
  10. data/doc/download.textile +6 -6
  11. data/doc/index.textile +7 -0
  12. data/doc/settings_profiles.textile +1 -1
  13. data/lib/buildr.rb +1 -1
  14. data/lib/buildr/core/build.rb +1 -1
  15. data/lib/buildr/core/filter.rb +1 -1
  16. data/lib/buildr/core/project.rb +1 -1
  17. data/lib/buildr/core/transports.rb +1 -1
  18. data/lib/buildr/ide/idea.rb +18 -3
  19. data/lib/buildr/java/custom_pom.rb +265 -0
  20. data/lib/buildr/java/ecj.rb +2 -2
  21. data/lib/buildr/java/jruby.rb +3 -3
  22. data/lib/buildr/java/packaging.rb +6 -4
  23. data/lib/buildr/java/rjb.rb +5 -5
  24. data/lib/buildr/packaging/archive.rb +3 -3
  25. data/lib/buildr/packaging/artifact.rb +30 -24
  26. data/lib/buildr/packaging/package.rb +2 -1
  27. data/lib/buildr/packaging/zip.rb +2 -2
  28. data/lib/buildr/scala/bdd.rb +21 -21
  29. data/lib/buildr/scala/compiler.rb +21 -18
  30. data/lib/buildr/scala/tests.rb +1 -1
  31. data/lib/buildr/version.rb +1 -1
  32. data/rakelib/release.rake +5 -3
  33. data/rakelib/stage.rake +1 -1
  34. data/spec/addon/jaxb_xjc_spec.rb +0 -1
  35. data/spec/core/application_spec.rb +1 -1
  36. data/spec/core/common_spec.rb +1 -1
  37. data/spec/core/project_spec.rb +3 -3
  38. data/spec/core/test_spec.rb +1 -1
  39. data/spec/core/transport_spec.rb +10 -2
  40. data/spec/{addon → java}/custom_pom_spec.rb +3 -16
  41. data/spec/java/ecj_spec.rb +2 -2
  42. data/spec/java/java_spec.rb +1 -1
  43. data/spec/java/tests_spec.rb +1 -1
  44. data/spec/packaging/artifact_spec.rb +23 -15
  45. data/spec/packaging/packaging_spec.rb +10 -2
  46. data/spec/scala/bdd_spec.rb +0 -1
  47. data/spec/scala/compiler_spec.rb +4 -4
  48. data/spec/scala/doc_spec.rb +0 -1
  49. data/spec/scala/tests_spec.rb +2 -3
  50. metadata +18 -36
  51. data/lib/buildr/scala/org/apache/buildr/Specs2Runner.java +0 -37
  52. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  53. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +0 -57
  54. data/lib/buildr/scala/org/apache/buildr/ZincRunner.class +0 -0
  55. data/lib/buildr/scala/org/apache/buildr/ZincRunner.java +0 -37
@@ -17,9 +17,9 @@ module Buildr #:nodoc:
17
17
  module Compiler #:nodoc:
18
18
 
19
19
  class Ecj < Javac
20
-
20
+
21
21
  VERSION = "4.5.1"
22
-
22
+
23
23
  class << self
24
24
  # Current version of ECJ being used.
25
25
  def version
@@ -75,19 +75,19 @@ module Java
75
75
  @classpath ||= begin
76
76
  classpath = []
77
77
  class << classpath
78
-
78
+
79
79
  def new_add(*args)
80
80
  warn 'Java is already loaded' if Java.loaded?
81
81
  send(:old_add, *args)
82
82
  end
83
-
83
+
84
84
  alias_method :old_add, :<<
85
85
  alias_method :<<, :new_add
86
86
  end
87
87
  classpath
88
88
  end
89
89
  end
90
-
90
+
91
91
  # Returns true if the JVM is loaded with all the libraries loaded on the classpath.
92
92
  def loaded?
93
93
  @loaded
@@ -210,6 +210,9 @@ module Buildr #:nodoc:
210
210
 
211
211
  def initialize(*args) #:nodoc:
212
212
  super
213
+ enhance do
214
+ pom.invoke rescue nil if pom && pom != self && classifier.nil?
215
+ end
213
216
  end
214
217
 
215
218
  # :call-seq:
@@ -223,11 +226,10 @@ module Buildr #:nodoc:
223
226
  # package(:jar).with(:manifest=>'MANIFEST_MF')
224
227
  def with(*args)
225
228
  super args.pop if Hash === args.last
226
- fail "package.with() should not contain nil values" if args.include? nil
229
+ fail 'package.with() should not contain nil values' if args.include? nil
227
230
  include :from=>args if args.size > 0
228
231
  self
229
232
  end
230
-
231
233
  end
232
234
 
233
235
 
@@ -521,8 +523,8 @@ module Buildr #:nodoc:
521
523
  buffer = ""
522
524
  xml = Builder::XmlMarkup.new(:target=>buffer, :indent => 2)
523
525
  xml.declare! :DOCTYPE, :application, :PUBLIC,
524
- "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN",
525
- "http://java.sun.com/j2ee/dtds/application_1_2.dtd"
526
+ '-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN',
527
+ 'http://java.sun.com/j2ee/dtds/application_1_2.dtd'
526
528
  xml.application do
527
529
  xml.tag! 'display-name', display_name
528
530
  desc = self.description || @project.comment
@@ -65,7 +65,7 @@ ENV_JAVA = {}
65
65
  # with a partial classpath, or before all remote repositories are listed.
66
66
  # 4. Check on a clean build with empty local repository.
67
67
  module Java
68
-
68
+
69
69
  module Package #:nodoc:
70
70
 
71
71
  def method_missing(sym, *args, &block)
@@ -78,7 +78,7 @@ module Java
78
78
  end
79
79
 
80
80
  class << self
81
-
81
+
82
82
  # Returns the classpath, an array listing directories, JAR files and
83
83
  # artifacts. Use when loading the extension to add any additional
84
84
  # libraries used by that extension.
@@ -89,19 +89,19 @@ module Java
89
89
  @classpath ||= begin
90
90
  classpath = []
91
91
  class << classpath
92
-
92
+
93
93
  def new_add(*args)
94
94
  warn 'Java is already loaded' if Java.loaded?
95
95
  send(:old_add, *args)
96
96
  end
97
-
97
+
98
98
  alias_method :old_add, :<<
99
99
  alias_method :<<, :new_add
100
100
  end
101
101
  classpath
102
102
  end
103
103
  end
104
-
104
+
105
105
  # Returns true if the JVM is loaded with all the libraries loaded on the classpath.
106
106
  def loaded?
107
107
  @loaded
@@ -327,7 +327,7 @@ module Buildr #:nodoc:
327
327
 
328
328
  # Make sure we're the last enhancements, so other enhancements can add content.
329
329
  enhance do
330
- @file_map = OrderedHash.new
330
+ @file_map = {}
331
331
  enhance do
332
332
  send 'create' if respond_to?(:create)
333
333
  # We're here because the archive file does not exist, or one of the files is newer than the archive contents;
@@ -360,7 +360,7 @@ module Buildr #:nodoc:
360
360
  #
361
361
  # package(:jar).clean.include path_to('desired/content')
362
362
  def clean
363
- @paths = OrderedHash.new
363
+ @paths = {}
364
364
  @paths[''] = Path.new(self, '')
365
365
  @prepares = []
366
366
  self
@@ -485,7 +485,7 @@ module Buildr #:nodoc:
485
485
  @prepares.each { |prepare| prepare.call(self) }
486
486
  @prepares.clear
487
487
 
488
- file_map = OrderedHash.new
488
+ file_map = {}
489
489
  @paths.each do |name, path|
490
490
  path.add_files(file_map)
491
491
  end
@@ -35,7 +35,7 @@ module Buildr #:nodoc:
35
35
  module ActsAsArtifact
36
36
 
37
37
  ARTIFACT_ATTRIBUTES = [:group, :id, :type, :classifier, :version]
38
- MAVEN_METADATA = "maven_metadata.xml"
38
+ MAVEN_METADATA = 'maven-metadata.xml'
39
39
 
40
40
  class << self
41
41
  private
@@ -73,10 +73,12 @@ module Buildr #:nodoc:
73
73
  # Optional artifact classifier.
74
74
  attr_reader :classifier
75
75
 
76
+ attr_accessor :buildr_project
77
+
76
78
  def snapshot?
77
79
  version =~ /-SNAPSHOT$/
78
80
  end
79
-
81
+
80
82
  def final_version
81
83
  return version unless snapshot?
82
84
  Time.now.strftime("%Y%m%d.%H%M%S")
@@ -145,19 +147,23 @@ module Buildr #:nodoc:
145
147
  #
146
148
  # Creates POM XML for this artifact.
147
149
  def pom_xml
148
- Proc.new do
149
- xml = Builder::XmlMarkup.new(:indent=>2)
150
- xml.instruct!
151
- xml.project do
152
- xml.modelVersion '4.0.0'
153
- xml.groupId group
154
- xml.artifactId id
155
- xml.version version
156
- xml.classifier classifier if classifier
150
+ if self.buildr_project
151
+ Buildr::CustomPom.pom_xml(self.buildr_project, self)
152
+ else
153
+ Proc.new do
154
+ xml = Builder::XmlMarkup.new(:indent => 2)
155
+ xml.instruct!
156
+ xml.project do
157
+ xml.modelVersion '4.0.0'
158
+ xml.groupId group
159
+ xml.artifactId id
160
+ xml.version version
161
+ xml.classifier classifier if classifier
162
+ end
157
163
  end
158
164
  end
159
165
  end
160
-
166
+
161
167
  # :call-seq:
162
168
  # maven_metadata_xml => string
163
169
  #
@@ -260,12 +266,12 @@ module Buildr #:nodoc:
260
266
  def group_path
261
267
  group.gsub('.', '/')
262
268
  end
263
-
269
+
264
270
  def upload_name
265
271
  return File.basename(name) unless snapshot?
266
272
  return File.basename(name).gsub(/SNAPSHOT/, "#{final_version}-1")
267
273
  end
268
-
274
+
269
275
  def extract_type(type)
270
276
  return :jar if type == :bundle
271
277
  type
@@ -664,7 +670,7 @@ module Buildr #:nodoc:
664
670
  spec = Artifact.to_hash(spec)
665
671
  File.join(local, spec[:group].split('.'), spec[:id], spec[:version], Artifact.hash_to_file_name(spec))
666
672
  end
667
-
673
+
668
674
  # :call-seq:
669
675
  # mirrors => Array
670
676
  #
@@ -684,7 +690,7 @@ module Buildr #:nodoc:
684
690
  end
685
691
  @mirrors
686
692
  end
687
-
693
+
688
694
  # :call-seq:
689
695
  # remote = Array
690
696
  # remote = url
@@ -733,20 +739,20 @@ module Buildr #:nodoc:
733
739
  end
734
740
  @remote
735
741
  end
736
-
742
+
737
743
  # :call-seq:
738
744
  # remote_uri => Array
739
745
  #
740
746
  # Returns an array of all the remote repositories as instances of URI
741
747
  #
742
- # Supports
748
+ # Supports
743
749
  # * String urls: "http://example.com/repo"
744
750
  # * URI: URI.parse( "http://example.com/repo" )
745
751
  # * Hash: { :url => "http://example.com/repo", :user => "user", :pass => "pass" }
746
752
  #
747
753
  def remote_uri
748
754
  remote
749
-
755
+
750
756
  uris = []
751
757
  @remote.each do |repo|
752
758
  case repo
@@ -761,7 +767,7 @@ module Buildr #:nodoc:
761
767
  if ( username = (repo[:username] || repo['username'] || repo[:user] || repo['user']) )
762
768
  uri.user = username
763
769
  end
764
-
770
+
765
771
  if ( password = (repo[:password] || repo['password'] || repo[:pass] || repo['pass']) )
766
772
  uri.password = password
767
773
  end
@@ -769,14 +775,14 @@ module Buildr #:nodoc:
769
775
  else
770
776
  fail( "Repository Hash format missing url: #{repo}" )
771
777
  end
772
-
773
- when String then
778
+
779
+ when String then
774
780
  uris << URI.parse(repo)
775
- else
781
+ else
776
782
  fail( "Unsupported Repository format: #{repo}" )
777
783
  end
778
784
  end
779
-
785
+
780
786
  uris
781
787
  end
782
788
 
@@ -168,6 +168,7 @@ module Buildr #:nodoc:
168
168
  else
169
169
  # Make it an artifact using the specifications, and tell it how to create a POM.
170
170
  package.extend ActsAsArtifact
171
+ package.buildr_project = self
171
172
  package.send :apply_spec, spec.only(*Artifact::ARTIFACT_ATTRIBUTES)
172
173
 
173
174
  # Create pom associated with package
@@ -177,7 +178,7 @@ module Buildr #:nodoc:
177
178
  pom_filename = Util.replace_extension(self.name, 'pom')
178
179
  spec = {:group=>group, :id=>id, :version=>version, :type=>:pom}
179
180
  @pom = Buildr.artifact(spec, pom_filename)
180
- @pom.content @pom.pom_xml
181
+ @pom.content Buildr::CustomPom.pom_xml(self.buildr_project, self)
181
182
  end
182
183
  @pom
183
184
  end
@@ -40,9 +40,9 @@ module Zip #:nodoc:
40
40
  write_e_o_c_d(io, offset, cdir_size)
41
41
  end
42
42
  end
43
-
43
+
44
44
  class File
45
-
45
+
46
46
  # :call-seq:
47
47
  # exist() => boolean
48
48
  #
@@ -20,11 +20,11 @@ module Buildr::Scala #:nodoc:
20
20
  @bdd_dir = :spec
21
21
 
22
22
  VERSION = case
23
- when Buildr::Scala.version?("2.8.0"), Buildr::Scala.version?("2.8.1"), Buildr::Scala.version?("2.8.2")
23
+ when Buildr::Scala.version?('2.8.0'), Buildr::Scala.version?('2.8.1'), Buildr::Scala.version?('2.8.2')
24
24
  '1.5'
25
- when Buildr::Scala.version?("2.9")
25
+ when Buildr::Scala.version?('2.9')
26
26
  '1.11'
27
- when Buildr::Scala.version?("2.10")
27
+ when Buildr::Scala.version?('2.10')
28
28
  '1.12.3'
29
29
  else
30
30
  '3.7' # default for Scala 2.11 and beyond
@@ -46,27 +46,27 @@ module Buildr::Scala #:nodoc:
46
46
  when Buildr.settings.build['scala.specs2.artifact']
47
47
  Buildr.settings.build['scala.specs2.artifact']
48
48
  else
49
- if Buildr::Scala.version < "2.11"
49
+ if Buildr::Scala.version < '2.11'
50
50
  "specs2_#{Buildr::Scala.version_without_build_number}"
51
51
  else
52
52
  "specs2_#{Buildr::Scala.version_major_minor}"
53
53
  end
54
54
  end
55
55
  end
56
-
56
+
57
57
  def type
58
- if Buildr::Scala.version < "2.11"
59
- "jar"
58
+ if Buildr::Scala.version < '2.11'
59
+ 'jar'
60
60
  else
61
- "pom"
61
+ 'pom'
62
62
  end
63
63
  end
64
64
 
65
65
  def scalaz_dependencies
66
- if Buildr::Scala.version?("2.8")
66
+ if Buildr::Scala.version?('2.8')
67
67
  []
68
- elsif Buildr::Scala.version < "2.11"
69
- default_version = "6.0.1"
68
+ elsif Buildr::Scala.version < '2.11'
69
+ default_version = '6.0.1'
70
70
  custom_version = Buildr.settings.build['scala.specs2-scalaz']
71
71
  version = (custom_version =~ /:/) ? Buildr.artifact(custom_version).version : default_version
72
72
 
@@ -74,9 +74,9 @@ module Buildr::Scala #:nodoc:
74
74
 
75
75
  custom_spec = Buildr.settings.build['scala.specs2-scalaz']
76
76
  spec = [ (custom_spec =~ /:/) ? custom_spec : "org.specs2:#{artifact}:jar:#{version}" ]
77
- Buildr.transitive(spec, :scopes => [nil, "compile", "runtime", "provided", "optional"], :optional => true)
77
+ Buildr.transitive(spec, :scopes => [nil, 'compile', 'runtime', 'provided', 'optional'], :optional => true)
78
78
  else
79
- default_version = "7.2.2"
79
+ default_version = '7.2.2'
80
80
  custom_version = Buildr.settings.build['scala.specs2-scalaz']
81
81
  version = (custom_version =~ /:/) ? Buildr.artifact(custom_version).version : default_version
82
82
 
@@ -84,7 +84,7 @@ module Buildr::Scala #:nodoc:
84
84
 
85
85
  custom_spec = Buildr.settings.build['scala.specs2-scalaz']
86
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"]
87
+ [Buildr.transitive(spec, :scopes => [nil, 'compile', 'runtime', 'provided', 'optional'], :optional => true), 'org.scala-lang.modules:scala-xml_2.11:jar:1.0.1']
88
88
  end
89
89
  end
90
90
 
@@ -92,9 +92,9 @@ module Buildr::Scala #:nodoc:
92
92
  unless @dependencies
93
93
  super
94
94
 
95
- # Add utility classes (e.g. SpecsSingletonRunner) and other dependencies
95
+ # Add utility classes and other dependencies
96
96
  options = {
97
- :scopes => [nil, "compile", "runtime", "provided", "optional"],
97
+ :scopes => [nil, 'compile', 'runtime', 'provided', 'optional'],
98
98
  :optional => true
99
99
  }
100
100
  @dependencies |= [ File.join(File.dirname(__FILE__)) ] + Buildr.transitive(specs, options) +
@@ -113,7 +113,7 @@ module Buildr::Scala #:nodoc:
113
113
  private
114
114
 
115
115
  def find(file, pattern)
116
- File.open(file, "r") do |infile|
116
+ File.open(file, 'r') do |infile|
117
117
  while (line = infile.gets)
118
118
  return true if line.match(pattern)
119
119
  end
@@ -133,21 +133,21 @@ module Buildr::Scala #:nodoc:
133
133
  end
134
134
 
135
135
  def tests(dependencies)
136
- filter_classes(dependencies, :interfaces => ['org.specs2.Specification', 'org.specs2.mutable.Specification'])
136
+ filter_classes(dependencies, :interfaces => %w(org.specs2.Specification org.specs2.mutable.Specification))
137
137
  end
138
138
 
139
139
  def run(specs, dependencies) #:nodoc:
140
- properties = { "specs2.outDir" => task.compile.target.to_s }
140
+ properties = {'specs2.outDir' => task.compile.target.to_s }
141
141
 
142
142
  cmd_options = { :properties => options[:properties].merge(properties),
143
143
  :java_args => options[:java_args],
144
144
  :classpath => dependencies,
145
145
  :name => false }
146
146
 
147
- runner = 'org.apache.buildr.Specs2Runner'
147
+ runner = 'org.specs2.runner.ClassRunner'
148
148
  specs.inject [] do |passed, spec|
149
149
  begin
150
- Java::Commands.java(runner, spec, cmd_options)
150
+ Java::Commands.java('io.tmio.scalamain.Main', runner, 'run', spec, cmd_options)
151
151
  rescue => e
152
152
  passed
153
153
  else
@@ -20,7 +20,7 @@ module Buildr::Scala
20
20
  class << self
21
21
 
22
22
  def version_str
23
- warn "Use of Scala.version_str is deprecated. Use Scala.version instead"
23
+ warn 'Use of Scala.version_str is deprecated. Use Scala.version instead'
24
24
  version
25
25
  end
26
26
 
@@ -65,7 +65,7 @@ module Buildr::Scala
65
65
  def version_without_build
66
66
  version.split('-')[0]
67
67
  end
68
-
68
+
69
69
  # returns Scala version without tiny number.
70
70
  # e.g. "2.11.8" => "2.11"
71
71
  def version_major_minor
@@ -90,6 +90,7 @@ module Buildr::Scala
90
90
  DEFAULT_ZINC_VERSION = '0.3.12'
91
91
  DEFAULT_SBT_VERSION = '0.13.12'
92
92
  DEFAULT_JLINE_VERSION = '2.14.2'
93
+ DEFAULT_SCALAMAIN_VERSION = '1.0.3'
93
94
 
94
95
  class << self
95
96
  def scala_home
@@ -116,7 +117,7 @@ module Buildr::Scala
116
117
 
117
118
  def dependencies
118
119
  scala_dependencies = if use_installed?
119
- ['scala-library', 'scala-compiler'].map { |s| File.expand_path("lib/#{s}.jar", scala_home) }
120
+ %w(scala-library scala-compiler).map { |s| File.expand_path("lib/#{s}.jar", scala_home) }
120
121
  else
121
122
  REQUIRES.artifacts.map(&:to_s)
122
123
  end
@@ -127,7 +128,7 @@ module Buildr::Scala
127
128
  end
128
129
 
129
130
  def use_fsc
130
- use_installed? && ENV["USE_FSC"] =~ /^(yes|on|true)$/i
131
+ use_installed? && ENV['USE_FSC'] =~ /^(yes|on|true)$/i
131
132
  end
132
133
 
133
134
  def applies_to?(project, task) #:nodoc:
@@ -164,11 +165,13 @@ module Buildr::Scala
164
165
  zinc_version = Buildr.settings.build['zinc.version'] || DEFAULT_ZINC_VERSION
165
166
  sbt_version = Buildr.settings.build['sbt.version'] || DEFAULT_SBT_VERSION
166
167
  jline_version = Buildr.settings.build['jline.version'] || DEFAULT_JLINE_VERSION
168
+ scalamain_version = Buildr.settings.build['scalamain.version'] || DEFAULT_SCALAMAIN_VERSION
167
169
  ns.zinc! "com.typesafe.zinc:zinc:jar:>=#{zinc_version}"
168
170
  ns.sbt_interface! "com.typesafe.sbt:sbt-interface:jar:>=#{sbt_version}"
169
171
  ns.incremental! "com.typesafe.sbt:incremental-compiler:jar:>=#{sbt_version}"
170
172
  ns.compiler_interface_sources! "com.typesafe.sbt:compiler-interface:jar:sources:>=#{sbt_version}"
171
173
  ns.jline! "jline:jline:jar:>=#{jline_version}"
174
+ ns.scalamain! "io.tmio:scalamain:jar:>=#{scalamain_version}"
172
175
  end
173
176
 
174
177
  Javac = Buildr::Compiler::Javac
@@ -184,7 +187,7 @@ module Buildr::Scala
184
187
  def initialize(project, options) #:nodoc:
185
188
  super
186
189
  # use common options also for javac
187
-
190
+
188
191
  options[:javac] ||= Buildr::Compiler::Javac::OPTIONS.inject({}) do |hash, option|
189
192
  hash[option] = options[option]
190
193
  hash
@@ -272,16 +275,16 @@ module Buildr::Scala
272
275
  cmd_args << '-Ssourcepath' << ("-S" + source_paths.join(File::PATH_SEPARATOR)) unless source_paths.empty?
273
276
  cmd_args << '-d' << File.expand_path(target)
274
277
  cmd_args += scalac_args
275
- cmd_args << "-debug" if trace?(:scalac)
278
+ cmd_args << '-debug' if trace?(:scalac)
276
279
 
277
280
  cmd_args.map!(&:to_s)
278
281
 
279
282
  cmd_args += files_from_sources(sources)
280
283
 
281
284
  unless Buildr.application.options.dryrun
282
- trace((['org.apache.buildr.ZincRunner'] + cmd_args).join(' '))
285
+ trace((%w(io.tmio.scalamain.Main com.typesafe.zinc.Main main) + cmd_args).join(' '))
283
286
  begin
284
- Java::Commands.java 'org.apache.buildr.ZincRunner', *(cmd_args + [{ :classpath => Scalac.dependencies + [ File.join(File.dirname(__FILE__)) ]}])
287
+ Java::Commands.java 'io.tmio.scalamain.Main', *(%w(com.typesafe.zinc.Main main) + cmd_args + [{:classpath => Scalac.dependencies + [File.join(File.dirname(__FILE__)) ]}])
285
288
  rescue => e
286
289
  fail "Zinc compiler crashed:\n#{e.inspect}\n#{e.backtrace.join("\n")}"
287
290
  end
@@ -303,7 +306,7 @@ module Buildr::Scala
303
306
 
304
307
  sources.each do |source|
305
308
  # try to extract package name from .java or .scala files
306
- if ['.java', '.scala'].include? File.extname(source)
309
+ if %w(.java .scala).include? File.extname(source)
307
310
  name = File.basename(source).split(".")[0]
308
311
  package = findFirst(source, /^\s*package\s+([^\s;]+)\s*;?\s*/)
309
312
  packages = count(source, /^\s*package\s+([^\s;]+)\s*;?\s*/)
@@ -338,7 +341,7 @@ module Buildr::Scala
338
341
 
339
342
  def count(file, pattern)
340
343
  count = 0
341
- File.open(file, "r") do |infile|
344
+ File.open(file, 'r') do |infile|
342
345
  while (line = infile.gets)
343
346
  count += 1 if line.match(pattern)
344
347
  end
@@ -354,19 +357,19 @@ module Buildr::Scala
354
357
  # Returns Scalac command line arguments from the set of options.
355
358
  def scalac_args #:nodoc:
356
359
  args = []
357
- args << "-nowarn" unless options[:warnings]
358
- args << "-verbose" if trace?(:scalac)
359
- if options[:debug] == true
360
- args << (Scala.version?(2.7, 2.8) ? "-g" : "-g:vars")
360
+ args << '-nowarn' unless options[:warnings]
361
+ args << '-verbose' if trace?(:scalac)
362
+ if !!options[:debug]
363
+ args << (Scala.version?(2.7, 2.8) ? '-g' : '-g:vars')
361
364
  elsif options[:debug]
362
365
  args << "-g:#{options[:debug]}"
363
366
  end
364
- args << "-deprecation" if options[:deprecation]
365
- args << "-optimise" if options[:optimise]
366
- args << "-target:jvm-" + options[:target].to_s if options[:target]
367
+ args << '-deprecation' if options[:deprecation]
368
+ args << '-optimise' if options[:optimise]
369
+ args << '-target:jvm-' + options[:target].to_s if options[:target]
367
370
  args += Array(options[:other])
368
371
  if zinc?
369
- args.map { |arg| "-S" + arg } + Array(options[:zinc_options])
372
+ args.map { |arg| '-S' + arg } + Array(options[:zinc_options])
370
373
  else
371
374
  args
372
375
  end