buildr 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 1.2.8 (11/1/2007)
2
+ * Added: Resolving Maven snapshots from remote repository (Rhett Sutphin)
3
+ * Changed: scala options.target now takes number, e.g. "1.5" instead of "jvm-1.5" (Nathan Hamblen)
4
+ * Changed: Eclipse task uses updated Scala plugin nature and builder (Alex Boisvert)
5
+ * Fixed: Bringing Buildr back to 1.0.9, XMLBeans fix.
6
+
1
7
  1.2.7 (10/29/2007)
2
8
  * Added: You can create an artifact from a given file using artifact(<spec>).from(<path>). You can then install it into the local repository or upload it to the release server using install(<artifacts>) and upload(<artifacts>). (Idea: Shane Witbeck and Tommy Mason).
3
9
  * Added: ANTLR support.
data/Rakefile CHANGED
@@ -44,7 +44,7 @@ def specify(platform)
44
44
  end
45
45
  end
46
46
 
47
- spec = specify(Gem::Platform::RUBY) { |spec| spec.add_dependency "rjb", "= 1.0.6" }
47
+ spec = specify(Gem::Platform::RUBY) { |spec| spec.add_dependency "rjb", ">= 1.0.9" }
48
48
  jruby_spec = specify('java')
49
49
  package = Rake::GemPackageTask.new(spec) do |pkg|
50
50
  pkg.need_tar = true
@@ -30,7 +30,7 @@ require "builder"
30
30
 
31
31
 
32
32
  module Buildr
33
- VERSION = "1.2.7".freeze # unless const_defined?(:VERSION)
33
+ VERSION = "1.2.8".freeze # unless const_defined?(:VERSION)
34
34
  end
35
35
 
36
36
 
@@ -9,12 +9,12 @@ module Buildr
9
9
 
10
10
  module Scala
11
11
  class << self
12
- def scala_base
13
- ENV["SCALA_HOME"] + "/share/scala"
12
+ def scala_home
13
+ ENV["SCALA_HOME"]
14
14
  end
15
15
 
16
16
  def scala_lib
17
- scala_lib = scala_base + "/lib/scala-library.jar"
17
+ scala_lib = scala_home + "/lib/scala-library.jar"
18
18
  end
19
19
 
20
20
  def scalac(*args)
@@ -32,7 +32,7 @@ module Buildr
32
32
  cmd_args = []
33
33
  use_fsc = !(ENV["USE_FSC"] =~ /^(no|off|false)$/i)
34
34
  classpath = classpath_from(options)
35
- scala_cp = [ classpath, FileList["#{scala_base}/lib/*"] ].flatten.join(File::PATH_SEPARATOR)
35
+ scala_cp = [ classpath, FileList["#{scala_home}/lib/*"] ].flatten.join(File::PATH_SEPARATOR)
36
36
  cmd_args << "-cp" << scala_cp unless scala_cp.empty?
37
37
  cmd_args << "-sourcepath" << options[:sourcepath].join(File::PATH_SEPARATOR) if options[:sourcepath]
38
38
  cmd_args << "-d" << options[:output].to_s if options[:output]
@@ -154,7 +154,7 @@ module Buildr
154
154
  args << "-g" if debug
155
155
  args << "-deprecation" if deprecation
156
156
  args << "-source" << source.to_s if source
157
- args << "-target" << target.to_s if target
157
+ args << "-target:jvm-" + target.to_s if target
158
158
  case lint
159
159
  when Array
160
160
  args << "-Xlint:#{lint.join(',')}"
@@ -6,7 +6,9 @@ module Buildr
6
6
  # Provides XMLBeans schema compiler. Require explicitly using <code>require "buildr/xmlbeans"</code>.
7
7
  module XMLBeans
8
8
 
9
- REQUIRES = [ "xmlbeans:xbean:jar:2.2.0", "stax:stax-api:jar:1.0" ]
9
+ STAX = "stax:stax-api:jar:1.0"
10
+ XMLBEANS = "org.apache.xmlbeans:xmlbeans:jar:2.3.0"
11
+ REQUIRES = [ STAX, XMLBEANS ]
10
12
 
11
13
  class << self
12
14
 
@@ -44,7 +46,7 @@ module Buildr
44
46
  XMLBeans.compile args.flatten, :output=>task.name,
45
47
  :javasource=>compile.options.source, :xsb=>compile.target
46
48
  end
47
- compile.from(generated).with(JAVAX.stream, XMLBEANS)
49
+ compile.from(generated).with(STAX, XMLBEANS)
48
50
  # Once compiled, we need to copy the generated XSB/XSD and one (magical?) class file
49
51
  # into the target directory, or the rest is useless.
50
52
  compile do |task|
@@ -37,6 +37,10 @@ module Buildr
37
37
  # Optional artifact classifier.
38
38
  attr_reader :classifier
39
39
 
40
+ def snapshot?
41
+ version =~ /-SNAPSHOT$/
42
+ end
43
+
40
44
  # :call-seq:
41
45
  # to_spec_hash() => Hash
42
46
  #
@@ -127,6 +131,10 @@ module Buildr
127
131
  ARTIFACT_ATTRIBUTES.each { |key| instance_variable_set("@#{key}", spec[key]) }
128
132
  self
129
133
  end
134
+
135
+ def group_path
136
+ group.gsub(".", "/")
137
+ end
130
138
 
131
139
  end
132
140
 
@@ -295,13 +303,12 @@ module Buildr
295
303
  # which they are returned from #remote, until successful. It always downloads the POM first.
296
304
  def download()
297
305
  puts "Downloading #{to_spec}" if Rake.application.options.trace
298
- remote = Buildr.repositories.remote
306
+ remote = Buildr.repositories.remote.map { |repo_url| URI === repo_url ? repo_url : URI.parse(repo_url) }
307
+ remote = remote.each { |repo_url| repo_url.path += "/" unless repo_url.path[-1] == "/" }
299
308
  fail "No remote repositories defined!" if remote.empty?
300
- remote.find do |repo_url|
301
- repo_url = URI.parse(repo_url) unless URI === repo_url
302
- repo_url.path += "/" unless repo_url.path[-1] == "/"
309
+ exact_success = remote.find do |repo_url|
303
310
  begin
304
- path = group.gsub(".", "/") + "/#{id}/#{version}/#{File.basename(name)}"
311
+ path = "#{group_path}/#{id}/#{version}/#{File.basename(name)}"
305
312
  mkpath File.dirname(name), :verbose=>false
306
313
  URI.download repo_url + path, name
307
314
  true
@@ -312,9 +319,50 @@ module Buildr
312
319
  puts error.backtrace.join("\n") if Rake.application.options.trace
313
320
  false
314
321
  end
315
- end or fail "Failed to download #{to_spec}, tried the following repositories:\n#{remote.join("\n")}"
322
+ end
323
+
324
+ if exact_success
325
+ return
326
+ elsif snapshot?
327
+ download_m2_snapshot(remote)
328
+ else
329
+ fail_download(remote)
330
+ end
316
331
  end
317
332
 
333
+ def download_m2_snapshot(remote_uris)
334
+ remote_uris.find do |repo_url|
335
+ snapshot_url = current_snapshot_repo_url(repo_url)
336
+ if snapshot_url
337
+ begin
338
+ URI.download snapshot_url, name
339
+ rescue URI::NotFoundError
340
+ false
341
+ end
342
+ else
343
+ false
344
+ end
345
+ end or fail_download(remote_uris)
346
+ end
347
+
348
+ def current_snapshot_repo_url(repo_url)
349
+ begin
350
+ metadata_path = "#{group_path}/#{id}/#{version}/maven-metadata.xml"
351
+ metadata_xml = StringIO.new
352
+ URI.download repo_url + metadata_path, metadata_xml
353
+ metadata = REXML::Document.new(metadata_xml.string).root
354
+ timestamp = REXML::XPath.first(metadata, "//timestamp").text
355
+ build_number = REXML::XPath.first(metadata, "//buildNumber").text
356
+ snapshot_of = version[0, version.size - 9]
357
+ repo_url + "#{group_path}/#{id}/#{version}/#{id}-#{snapshot_of}-#{timestamp}-#{build_number}.#{type}"
358
+ rescue URI::NotFoundError
359
+ nil
360
+ end
361
+ end
362
+
363
+ def fail_download(remote_uris)
364
+ fail "Failed to download #{to_spec}, tried the following repositories:\n#{remote_uris.join("\n")}"
365
+ end
318
366
  end
319
367
 
320
368
 
@@ -15,6 +15,7 @@ module Buildr
15
15
 
16
16
  # We need paths relative to the top project's base directory.
17
17
  root_path = lambda { |p| f = lambda { |p| p.parent ? f[p.parent] : p.base_dir } ; f[p] }[project]
18
+
18
19
  # We want the Eclipse files changed every time the Buildfile changes, but also anything loaded by
19
20
  # the Buildfile (buildr.rb, separate file listing dependencies, etc), so we add anything required
20
21
  # after the Buildfile. So which don't know where Buildr shows up exactly, ignore files that show
@@ -22,6 +23,9 @@ module Buildr
22
23
  sources = Buildr.build_files.map { |file| File.expand_path(file) }.select { |file| File.exist?(file) }
23
24
  sources << File.expand_path(Rake.application.rakefile, root_path) if Rake.application.rakefile
24
25
 
26
+ # Check if project has scala facet
27
+ scala = project.task("scalac") if Rake::Task.task_defined?(project.name+":"+"scalac")
28
+
25
29
  # Only for projects that are Eclipse packagable.
26
30
  if project.packages.detect { |pkg| pkg.type.to_s =~ /(jar)|(war)|(rar)|(mar)|(aar)/ }
27
31
  eclipse.enhance [ file(project.path_to(".classpath")), file(project.path_to(".project")) ]
@@ -45,6 +49,8 @@ module Buildr
45
49
  xml.classpath do
46
50
  # Note: Use the test classpath since Eclipse compiles both "main" and "test" classes using the same classpath
47
51
  cp = project.test.compile.classpath.map(&:to_s) - [ project.compile.target.to_s ]
52
+ cp += scala.classpath.map(&:to_s) if scala
53
+ cp = cp.uniq
48
54
 
49
55
  # Convert classpath elements into applicable Project objects
50
56
  cp.collect! { |path| projects.detect { |prj| prj.packages.detect { |pkg| pkg.to_s == path } } || path }
@@ -59,8 +65,17 @@ module Buildr
59
65
  generated, libs = others.partition { |path| path.to_s.index(project.path_to.to_s) == 0 }
60
66
 
61
67
  xml.classpathentry :kind=>'con', :path=>'org.eclipse.jdt.launching.JRE_CONTAINER'
62
-
63
- srcs = project.compile.sources.map { |src| relative[src] } + generated.map { |src| relative[src] }
68
+ xml.classpathentry :kind=>'con', :path=>'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER' if scala
69
+
70
+ srcs = project.compile.sources
71
+ srcs << scala.sources if scala
72
+
73
+ # hack until we have sunit task
74
+ project.path_to("src/test/scala").tap do |dir|
75
+ srcs += dir if scala and File.exist?(dir)
76
+ end
77
+
78
+ srcs = srcs.map { |src| relative[src] } + generated.map { |src| relative[src] }
64
79
  srcs.sort.uniq.each do |path|
65
80
  xml.classpathentry :kind=>'src', :path=>path, :excluding=>excludes
66
81
  end
@@ -118,9 +133,17 @@ module Buildr
118
133
  xml.buildCommand do
119
134
  xml.name "org.eclipse.jdt.core.javabuilder"
120
135
  end
136
+ if scala
137
+ xml.buildCommand do
138
+ #xml.name "ch.epfl.lamp.sdt.core.scalabuilder"
139
+ xml.name "scala.plugin.scalabuilder"
140
+ end
141
+ end
121
142
  end
122
143
  xml.natures do
123
144
  xml.nature "org.eclipse.jdt.core.javanature"
145
+ #xml.nature "ch.epfl.lamp.sdt.core.scalanature" if scala
146
+ xml.nature "scala.plugin.scalanature" if scala
124
147
  end
125
148
  end
126
149
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: buildr
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.2.7
7
- date: 2007-10-29 00:00:00 -07:00
6
+ version: 1.2.8
7
+ date: 2007-11-01 00:00:00 -07:00
8
8
  summary: A build system that doesn't suck
9
9
  require_paths:
10
10
  - lib
@@ -198,7 +198,7 @@ dependencies:
198
198
  version_requirement:
199
199
  version_requirements: !ruby/object:Gem::Version::Requirement
200
200
  requirements:
201
- - - "="
201
+ - - ">="
202
202
  - !ruby/object:Gem::Version
203
- version: 1.0.6
203
+ version: 1.0.9
204
204
  version: