buildr 1.4.7-x86-mswin32 → 1.4.8-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/CHANGELOG +41 -0
  2. data/Rakefile +0 -6
  3. data/addon/buildr/bnd.rb +13 -3
  4. data/addon/buildr/checkstyle.rb +1 -1
  5. data/addon/buildr/git_auto_version.rb +33 -0
  6. data/addon/buildr/{gwt.rake → gwt.rb} +0 -0
  7. data/addon/buildr/jacoco.rb +194 -0
  8. data/buildr.buildfile +1 -1
  9. data/buildr.gemspec +23 -16
  10. data/doc/_layouts/default.html +0 -2
  11. data/doc/contributing.textile +47 -0
  12. data/doc/download.textile +24 -0
  13. data/doc/index.textile +43 -23
  14. data/doc/languages.textile +65 -6
  15. data/doc/more_stuff.textile +12 -0
  16. data/doc/packaging.textile +2 -0
  17. data/doc/settings_profiles.textile +1 -1
  18. data/lib/buildr.rb +0 -4
  19. data/lib/buildr/core/application.rb +41 -8
  20. data/lib/buildr/core/build.rb +102 -1
  21. data/lib/buildr/core/cc.rb +14 -8
  22. data/lib/buildr/core/generate.rb +148 -7
  23. data/lib/buildr/core/util.rb +3 -3
  24. data/lib/buildr/ide/eclipse.rb +114 -0
  25. data/lib/buildr/ide/idea.rb +95 -1
  26. data/lib/buildr/java/commands.rb +1 -1
  27. data/lib/buildr/java/rjb.rb +5 -4
  28. data/lib/buildr/packaging/artifact.rb +1 -1
  29. data/lib/buildr/packaging/ziptask.rb +2 -2
  30. data/lib/buildr/scala.rb +1 -1
  31. data/lib/buildr/scala/bdd.rb +9 -2
  32. data/lib/buildr/scala/compiler.rb +94 -4
  33. data/lib/buildr/scala/doc.rb +17 -5
  34. data/lib/buildr/scala/tests.rb +15 -4
  35. data/lib/buildr/version.rb +1 -1
  36. data/rakelib/all-in-one.rake +50 -47
  37. data/rakelib/checks.rake +4 -4
  38. data/rakelib/doc.rake +85 -88
  39. data/rakelib/metrics.rake +9 -9
  40. data/rakelib/package.rake +13 -34
  41. data/rakelib/release.rake +11 -12
  42. data/rakelib/rspec.rake +71 -76
  43. data/rakelib/stage.rake +25 -51
  44. data/spec/addon/bnd_spec.rb +61 -7
  45. data/spec/core/build_spec.rb +117 -0
  46. data/spec/core/cc_spec.rb +36 -22
  47. data/spec/core/common_spec.rb +3 -2
  48. data/spec/core/compile_spec.rb +3 -3
  49. data/spec/core/generate_from_eclipse_spec.rb +280 -0
  50. data/spec/java/bdd_spec.rb +2 -2
  51. data/spec/java/packaging_spec.rb +2 -1
  52. data/spec/packaging/archive_spec.rb +25 -2
  53. data/spec/packaging/artifact_spec.rb +2 -2
  54. data/spec/sandbox.rb +3 -2
  55. data/spec/scala/compiler_spec.rb +41 -0
  56. data/spec/scala/doc_spec.rb +22 -3
  57. data/spec/scala/scala.rb +2 -2
  58. data/spec/scala/tests_spec.rb +2 -2
  59. metadata +223 -194
  60. data/addon/buildr/jdepend.rb.orig +0 -178
  61. data/doc/installing.textile.orig +0 -282
  62. data/doc/more_stuff.textile.orig +0 -1004
  63. data/lib/buildr/ide/eclipse/java.rb +0 -49
  64. data/lib/buildr/ide/eclipse/plugin.rb +0 -67
  65. data/lib/buildr/ide/eclipse/scala.rb +0 -64
data/doc/download.textile CHANGED
@@ -20,6 +20,30 @@ The source code is included in both source and binary distribution, the Gem dist
20
20
 
21
21
  h2(#dist). Binaries and Source Code
22
22
 
23
+ h3. buildr 1.4.8 (2012-11-01)
24
+
25
+ |_. Package |_. MD5 Checksum |_. PGP |
26
+ | "buildr-1.4.8-java.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.4.8/buildr-1.4.8-java.gem | "68679f89f7e0f90bb4446965d1184e0a":http://www.apache.org/dist/buildr/1.4.8/buildr-1.4.8-java.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.8/buildr-1.4.8-java.gem.asc |
27
+ | "buildr-1.4.8-x86-mswin32.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.4.8/buildr-1.4.8-x86-mswin32.gem | "40abdb4c2ff2bb7232822198e6882ee0":http://www.apache.org/dist/buildr/1.4.8/buildr-1.4.8-x86-mswin32.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.8/buildr-1.4.8-x86-mswin32.gem.asc |
28
+ | "buildr-1.4.8.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.4.8/buildr-1.4.8.gem | "0e92c281a59d3fc475f1a0184200a70f":http://www.apache.org/dist/buildr/1.4.8/buildr-1.4.8.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.8/buildr-1.4.8.gem.asc |
29
+ | "buildr-1.4.8.tgz":http://www.apache.org/dyn/closer.cgi/buildr/1.4.8/buildr-1.4.8.tgz | "f19029a7dba62917978b42652328bf6c":http://www.apache.org/dist/buildr/1.4.8/buildr-1.4.8.tgz.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.8/buildr-1.4.8.tgz.asc |
30
+ | "buildr-1.4.8.zip":http://www.apache.org/dyn/closer.cgi/buildr/1.4.8/buildr-1.4.8.zip | "8a484f5ec930eba0b93fe9079fd41079":http://www.apache.org/dist/buildr/1.4.8/buildr-1.4.8.zip.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.8/buildr-1.4.8.zip.asc |
31
+
32
+ p>. ("Release signing keys":http://www.apache.org/dist/buildr/1.4.8/KEYS)
33
+
34
+
35
+ h3. buildr 1.4.7 (2012-05-29)
36
+
37
+ |_. Package |_. MD5 Checksum |_. PGP |
38
+ | "buildr-1.4.7-x86-mswin32.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.4.7/buildr-1.4.7-x86-mswin32.gem | "062031b8890b489673be814ca08598cb":http://www.apache.org/dist/buildr/1.4.7/buildr-1.4.7-x86-mswin32.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.7/buildr-1.4.7-x86-mswin32.gem.asc |
39
+ | "buildr-1.4.7-java.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.4.7/buildr-1.4.7-java.gem | "a7cfac76a53fb6deaac0b12acc02a82c":http://www.apache.org/dist/buildr/1.4.7/buildr-1.4.7-java.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.7/buildr-1.4.7-java.gem.asc |
40
+ | "buildr-1.4.7.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.4.7/buildr-1.4.7.gem | "85a8ddb9ae752e04c0416e2f1d30d064":http://www.apache.org/dist/buildr/1.4.7/buildr-1.4.7.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.7/buildr-1.4.7.gem.asc |
41
+ | "buildr-1.4.7.tgz":http://www.apache.org/dyn/closer.cgi/buildr/1.4.7/buildr-1.4.7.tgz | "576789cb7d10216cc3b7383441fd2596":http://www.apache.org/dist/buildr/1.4.7/buildr-1.4.7.tgz.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.7/buildr-1.4.7.tgz.asc |
42
+ | "buildr-1.4.7.zip":http://www.apache.org/dyn/closer.cgi/buildr/1.4.7/buildr-1.4.7.zip | "e414f72706885a695a380693e9c530c7":http://www.apache.org/dist/buildr/1.4.7/buildr-1.4.7.zip.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.7/buildr-1.4.7.zip.asc |
43
+
44
+ p>. ("Release signing keys":http://www.apache.org/dist/buildr/1.4.7/KEYS)
45
+
46
+
23
47
  h3. buildr 1.4.6 (2011-06-22)
24
48
 
25
49
  |_. Package |_. MD5 Checksum |_. PGP |
data/doc/index.textile CHANGED
@@ -46,29 +46,49 @@ So let's get started. You can "read the documentation online":quick_start.html,
46
46
 
47
47
  h2(#news). What's New
48
48
 
49
- New in Buildr 1.4.6 (June 24th, 2011)
50
-
51
- * Added: Support for Scala 2.9.0+ (with help of Alexis Midon)
52
- * Added: BUILDR-592 Allow Users to Specify SSH Options for Deployment (Marc-André Laverdière)
53
- * Fixed: BUILDR-591 IntelliJ Sort modules in iml files generated by idea task to ensure main_dependencies are exported
54
- * Fixed: BUILDR-583 Update jruby install to use jruby version 1.6.1 (Alexis Midon)
55
- * Fixed: BUILDR-582 Revert the name change for the task to generate Intellij project files to 'idea'
56
- * Change: BUILDR-579 Format generated IDEA project files to look more like what IntelliJ generates (Peter Royal)
57
- * Change: BUILDR-574 Enhance idea task to generate test resources with test scope (Jean-Philippe Caruana)
58
- * Change: BUILDR-576 Upgrade to JUnit 4.8.2
59
- * Change: Upgrade to JRuby 1.6.2
60
- * Change: Scala 2.9.0-1 is now default, along with ScalaCheck 1.9, ScalaTest 1.6.1 and Specs 1.6.8.
61
- * Change: ScalaCheck, ScalaTest and Specs now default to sane versions when using older Scala versions.
62
- * Fixed: BUILDR-571 Generated IDEA projects include resources multiple times (Peter Royal)
63
- * Fixed: BUILDR-573 HTTP upload PUT request with incorrect Content-Type (Mathias Doenitz)
64
- * Fixed: BUILDR-578 Tar task does not preserve uid/gid on folders (Jean-Philippe Caruana)
65
- * Fixed: BUILDR-251 Classifier not handled when downloading snapshot artifacts (Ryan Fowler)
66
- * Fixed: BUILDR-585 "TypeError : can't dup NilClass" when merging jars
67
- * Fixed: BUILDR-586 ScalaTest uses deprecated ant task (Martin Partel)
68
- * Fixed: BUILDR-584 eclipse plugin should use absolute path
69
- * Fixed: BUILDR-587 ScalaTest uses deprecated reporter parameters
70
-
71
- See the "CHANGELOG":CHANGELOG for full details.
49
+ Highlights from Buildr 1.4.8 (Nov 11th, 2012)
50
+
51
+ * Change: Revert to importing non-verbose FileUtils utility methods to match buildr 1.4.6 release and earlier.
52
+ * Added: Experimental support for jacoco code coverage tool.
53
+ * Fixed: BUILDR-655 - Support JDK1.7 under OSX
54
+ * Change: Updated dependency versions;
55
+ - builder (3.1.3)
56
+ - rubyforge (2.0.4)
57
+ - net-ssh (2.6.0)
58
+ - hoe (3.1.0)
59
+ - rjb (1.4.2)
60
+ - rdoc (3.12)
61
+ - xml-simple (1.1.1)
62
+ - rspec-expectations (2.11.3)
63
+ - rspec-mocks (2.11.3)
64
+ - rspec-core (2.11.1)
65
+ - rspec (2.11.0)
66
+ - rubyzip (0.9.9)
67
+ * Added: BUILDR-652 Generate buildfile from Eclipse workspace. (Niklaus Giger)
68
+ * Fixed: BUILDR-627 Support explicitly listed source files in buildr cc task. (Christopher Tiwald)
69
+ * Fixed: BUILDR-606 Transitive artifact resolution should not include artifacts in 'provided' scope in poms to
70
+ match maven behaviour. (Julio Arias)
71
+ * Change: BUILDR-640 Enable building jekyll and rdoc under more rubies. (Niklaus Giger)
72
+ * Change: Mark Buildr:Bnd.remote_repository as deprecated as dependencies appear in maven central.
73
+ * Added: BUILDR-654 Add the ability to configure the version of BND used by bnd addon. (Niklaus Giger)
74
+ * Added: Create the git_auto_version addon that automatically specifies a version for a git project based
75
+ on git describe.
76
+ * Added: Integrate with Zinc (incremental compilation wrapper for scalac 2.9+)
77
+ * Change: Default to Scala 2.9.2, ScalaTest 1.8, Scala Specs2 1.11,
78
+ ScalaCheck 1.10.0.
79
+ * Change: Scala artifact repository changed to
80
+ http://oss.sonatype.org/content/repositories/releases
81
+ * Added: BUILDR-645 Support Mercurial as a version control system (Tan Quach)
82
+ * Fixed: BUILDR-646 TGZ files do not keep their permissions when extracted
83
+ via Buildr::Unzip#extract
84
+ * Added: Add add_exploded_ear_artifact and add_exploded_ejb_artifact to the idea project extension.
85
+ * Change: Default to using Checkstyle 5.5 in the checkstyle addon.
86
+ * Fixed: Fix the add_exploded_war_artifact method on the idea project by adding in missing method
87
+ `partition_dependencies`.
88
+ * Fixed: Fix the extension of the gwt plugin so that it can be required as an addon.
89
+ * Fixed: Fix the undefined default_web_xml variable in the add_web_facet method on the idea project.
90
+
91
+ This is a partial list -- see the "CHANGELOG":CHANGELOG for full details.
72
92
 
73
93
  h2(#notices). Credits & Notices
74
94
 
@@ -189,7 +189,7 @@ You may also determine the version in use by querying the @Scala.version@ attrib
189
189
  Scala.version # => '2.8.0'
190
190
  {% endhighlight %}
191
191
 
192
- Regardless of how the Scala version is determined, if you have the same Scala version installed on your system and the SCALA_HOME environment variable points to it, then your local installation will be used. Otherwise, Buildr will download it from the "Scala Tools repository":http://scala-tools.org/ which is automatically enlisted when you @require@ Scala. The only drawback if you don't have a local installation is the FSC compiler won't be available.
192
+ Regardless of how the Scala version is determined, if you have the same Scala version installed on your system and the SCALA_HOME environment variable points to it, then your local installation will be used. Otherwise, Buildr will download it from the "Sonatype repository":http://oss.sonatype.org/content/repositories/releases which is automatically enlisted when you @require@ Scala. The only drawback if you don't have a local installation is the FSC compiler won't be available.
193
193
 
194
194
  p(tip). For Mac users, if you have installed Scala via "MacPorts":http://www.macports.org/ Buildr will look in the
195
195
  @/opt/local/share/scala/@ directory if you have not set @SCALA_HOME@.
@@ -202,7 +202,7 @@ The Scala compiler looks for source files in the project's @src/main/scala@ dir
202
202
  Any Java source files found in the @src/main/java@ directory will be compiled using the Scala/Java joint compiler into the @target/classes@ directory. Both the Java and the Scala sources are compiled with an inclusive classpath, meaning that you may have a Java class which depends upon a Scala class which depends upon a Java class, all within the same project. The Java sources will be compiled with the same dependencies as the Scala sources with the addition of the @scala-library.jar@ file as required for Scala interop.
203
203
 
204
204
  Note that you cannot use the Groovy *and* the Scala joint compilers in the same project. If both are required, the Groovy joint compiler will take precedence.
205
- +
205
+
206
206
  If you point the @compile@ task at any other source directory, it will use the Scala compiler if any of these directories contains files with the extension @.scala@. The joint compilation of Java sources may only be pointed at an alternative directory using the feature to redefine the @_(:src, :main, :java)@ path.
207
207
 
208
208
  When using the Scala compiler, if you don't specify the packaging type, it defaults to JAR.
@@ -218,18 +218,25 @@ The Scala compiler supports the following options:
218
218
  | @:target@ | Bytecode compatibility (e.g. '1.4'). |
219
219
  | @:warnings@ | Issue warnings when compiling. True when running in verbose mode. |
220
220
  | @:javac@ | A hash of options passed to the @javac@ compiler verbatim. |
221
+ | @:incremental@ | If true, enables incremental compilation using Zinc. |
221
222
 
222
223
  h4. Fast Scala Compiler
223
224
 
224
225
  You may use @fsc@, the Fast Scala Compiler, which submits compilation jobs to a compilation daemon, by setting the environment variable @USE_FSC@ to @yes@. Note that @fsc@ _may_ cache class libraries -- don't forget to run @fsc -reset@ if you upgrade a library.
225
226
 
227
+ (Note @fsc@ is not compatible with @zinc@ incremental compilation.)
228
+
226
229
  h4. Rebuild detection
227
230
 
231
+ *Scala 2.7*
232
+
228
233
  The Scala 2.7 compiler task assumes that each @.scala@ source file generates a corresponding @.class@ file under @target/classes@ (or @target/test/classses@ for tests). The source may generate more @.class@ files if it contains more than one class, object, trait or for anonymous functions and closures.
229
234
 
230
235
  For example, @src/main/scala/com/example/MyClass.scala@ should generate at least @target/classes/com/example/MyClass.class@. If that it not the case, Buildr will always recompile your sources because it will assume this is a new source file that has never been compiled before.
231
236
 
232
- Fortunately, Scala 2.8 provides a substantially better interface for implementing change detection. Whenever you use Scala 2.8 (see below), Buildr will auto-detect the version and enable this feature dynamically. After the @compile@ task runs, the relevant target directory will contain a @.scala-deps@ file, generated by the Scala compiler. The manner in which this file is used can be configured using the @:make@ compiler option. The following values are available:
237
+ *Scala 2.8*
238
+
239
+ Scala 2.8 provides a substantially better interface for implementing change detection. Whenever you use Scala 2.8 (see below), Buildr will auto-detect the version and enable this feature dynamically. After the @compile@ task runs, the relevant target directory will contain a @.scala-deps@ file, generated by the Scala compiler. The manner in which this file is used can be configured using the @:make@ compiler option. The following values are available:
233
240
 
234
241
  * @:all@ - Disables compiler-level change detection
235
242
  * @:changed@ - Only build changed files without considering file dependencies
@@ -247,11 +254,49 @@ Effectively, this is telling the Scala compiler to ignore the information it has
247
254
 
248
255
  To avoid unusual behavior, compiler-level change detection is disabled whenever the joint Scala-Java compiler is used. Thus, any @.java@ files in a project handled by the Scala compiler will cause the @:make@ option to be ignored and revert to the exclusive use of Buildr's change detection mechanism (as described above).
249
256
 
250
- h4. Scala 2.8
257
+ *Scala 2.9 and later*
258
+
259
+ Starting with Buildr 1.4.8, Buildr integrates with the "Zinc":https://github.com/typesafehub/zinc incremental compilation wrapper for @scalac@. Incremental compilation can be enabled 3 ways,
260
+
261
+ 1) By setting the compiler's option directly,
262
+
263
+ {% highlight ruby %}
264
+ compile.using :incremental => true
265
+
266
+ compile.options.incremental = true # same as above
267
+ {% endhighlight %}
251
268
 
252
- As of version 1.4, Buildr has *non-default* support for Scala 2.8. If your @SCALA_HOME@ environment variable is pointing to an installation of Scala 2.8, then Buildr will use that compiler and enable 2.8-specific features.
269
+ Note that this won't enable incremental compilation for both @compile@ and @test.compile@, you would have to set options on both. For this reason, it's recommended that you set the option on the project instead (see below).
253
270
 
254
- As Scala 2.8 is currently pre-release, it is often desirable to maintain an installation of Scala 2.7 concurrently with Scala 2.8, defaulting to the former with the option to select the latter on a project-by-project basis. This is most easily accomplished by setting @SCALA_HOME@ to point to the Scala 2.7 installation and @SCALA28_HOME@ to point to the Scala 2.8 installation. With this configuration in place, Scala 2.8 can be selected for a specific project by dynamically reassigning @SCALA_HOME@ at the top of the buildfile (*before* @require 'buildr/scala'@):
271
+ 2) By setting the project's @scalac_options.incremental@,
272
+
273
+ {% highlight ruby %}
274
+ project.scalac_options.incremental = true
275
+ {% endhighlight %}
276
+
277
+ 3) By setting the global @scalac.incremental@ option,
278
+
279
+ in your @buildfile@:
280
+
281
+ {% highlight ruby %}
282
+ Buildr.settings.build['scalac.incremental'] = true
283
+ {% endhighlight %}
284
+
285
+ or in your @build.yaml@:
286
+
287
+ {% highlight yaml %}
288
+ scalac.incremental: true
289
+ {% endhighlight %}
290
+
291
+ h4. Support for different Scala versions
292
+
293
+ Buildr defaults to the latest stable Scala version available at the time of the release if neither @SCALA_HOME@ nor the @scala.version@ build property are set.
294
+
295
+ If your @SCALA_HOME@ environment variable points to an installation of Scala (2.7, 2.8, 2.9, ...), then Buildr will use that compiler and enable version-specific features.
296
+
297
+ You may select the Scala version by dynamically in different ways,
298
+
299
+ 1) By reassigning @SCALA_HOME@ at the top of the buildfile (*before* @require 'buildr/scala'@):
255
300
 
256
301
  {% highlight ruby %}
257
302
  ENV['SCALA_HOME'] = ENV['SCALA28_HOME']
@@ -260,6 +305,20 @@ require 'buildr/scala'
260
305
  ...
261
306
  {% endhighlight %}
262
307
 
308
+ 2) By setting the @scala.version@ build property in your build.yaml file:
309
+
310
+ {% highlight yaml %}
311
+ scala.version: 2.9.1.RC1
312
+ {% endhighlight %}
313
+
314
+ 3) By setting the @scala.version@ build property in your buildfile:
315
+
316
+ {% highlight ruby %}
317
+ require 'buildr/scala'
318
+ ...
319
+ Buildr.settings.build['scala.version'] = '2.10-M6'
320
+ {% endhighlight %}
321
+
263
322
  h3. Testing with Scala
264
323
 
265
324
  Buildr supports two main Scala testing frameworks: "ScalaTest":http://www.artima.com/scalatest and "Specs":http://code.google.com/p/specs/. "ScalaCheck":http://code.google.com/p/scalacheck/ is also supported within the confines of either of these two frameworks. Thus, your Specs may use ScalaCheck properties, as may your ScalaTest suites.
@@ -349,6 +349,8 @@ You can place this code inside @buildr.rb@ in the @.buildr@ directory under your
349
349
 
350
350
  h2(#eclipse). Eclipse
351
351
 
352
+ h3. Use Apache Buildr to create Eclipse projects
353
+
352
354
  If you're using Eclipse, you can generate @.classpath@ and @.project@ from your Buildfile and use them to create a project in your workspace:
353
355
 
354
356
  {% highlight sh %}
@@ -379,6 +381,16 @@ end
379
381
 
380
382
  One more thing; these settings are inherited hierarchically so you may set them on a parent project if you want to share them across different projects.
381
383
 
384
+ h3. Use Apache Buildr to create a buildfile from an Eclipse workspace
385
+
386
+ If you're using Eclipse, you can generate a @buildfile@ from a directory which contains one (or more) Eclipse projects somewhere in its sub-directories.
387
+
388
+ {% highlight sh %}
389
+ $ buildr --generate /path/to/my_project
390
+ {% endhighlight %}
391
+
392
+ This creates a basic buildfile with a main project called 'my_project'. The buildfile contains a skeleton for compiling the Eclipse projects. If you want to automate dependency tracking via OSGi have a look at the "buildr4osgi":http://oss.intalio.com/buildr4osgi/ project. Support for building Eclipse RCP applications, running PDE tests and P2-sites is currently lacking in Buildr.
393
+
382
394
  h2(#idea). IntelliJ IDEA
383
395
 
384
396
  If you use IntelliJ IDEA, you can generate project files by issuing:
@@ -347,6 +347,8 @@ The bundle packaging format is included as an addon so the build file must expli
347
347
  require "buildr/bnd"
348
348
 
349
349
  repositories.remote << Buildr::Bnd.remote_repository
350
+ # uncomment the next version to override the version of bnd
351
+ # Buildr::Bnd.version = '0.0.384'
350
352
 
351
353
  define 'myProject' do
352
354
  ...
@@ -166,7 +166,7 @@ Build settings can be retreived using the @Buildr.settings.build@ accessor.
166
166
 
167
167
  h2(#variable). Non constant settings
168
168
 
169
- Before loading the Buildfile, Buildr will attempt to load two other files: the @buildr.rb@ file in the @.buildr@ directory under your home directory, followed by the @buildr.rb@ file it finds in the build directory.
169
+ Before loading the Buildfile, Buildr will attempt to load two other files: the @buildr.rb@ file in the @.buildr@ directory under your home directory, followed by the @_buildr.rb@ (or @.buildr.rb@) file it finds in the build directory.
170
170
 
171
171
  The loading order allows you to place global settings that affect all your builds in your @buildr.rb@, but also over-ride those with settings for a given project.
172
172
 
data/lib/buildr.rb CHANGED
@@ -82,10 +82,6 @@ require 'buildr/java/doc'
82
82
  require 'buildr/java/deprecated'
83
83
  require 'buildr/ide/idea'
84
84
  require 'buildr/ide/eclipse'
85
- # Order is significant for auto-detection, from most specific to least
86
- require 'buildr/ide/eclipse/plugin'
87
- require 'buildr/ide/eclipse/scala'
88
- require 'buildr/ide/eclipse/java'
89
85
 
90
86
  # Methods defined in Buildr are both instance methods (e.g. when included in Project)
91
87
  # and class methods when invoked like Buildr.artifacts().
@@ -387,23 +387,31 @@ module Buildr
387
387
  end
388
388
 
389
389
  def ask_generate_buildfile
390
- source = choose do |menu|
390
+ source, fromEclipse = choose do |menu|
391
391
  menu.header = "To use Buildr you need a buildfile. Do you want me to create one?"
392
- menu.choice("From Maven2 POM file") { 'pom.xml' } if File.exist?('pom.xml')
393
- menu.choice("From directory structure") { Dir.pwd }
394
- menu.choice("Cancel") { }
392
+ menu.choice("From eclipse .project files") { [Dir.pwd, true] } if Generate.has_eclipse_project?
393
+ menu.choice("From Maven2 POM file") { ['pom.xml', false] } if File.exist?('pom.xml')
394
+ menu.choice("From directory structure") { [Dir.pwd, false] }
395
+ menu.choice("Cancel") {}
395
396
  end
396
397
  if source
397
- buildfile = raw_generate_buildfile(source)
398
+ buildfile = raw_generate_buildfile(source, fromEclipse)
398
399
  [buildfile, File.dirname(buildfile)]
399
400
  end
400
401
  end
401
402
 
402
- def raw_generate_buildfile(source)
403
+ def raw_generate_buildfile(source, fromEclipse=Generate.has_eclipse_project?)
403
404
  # We need rakefile to be known, for settings.build to be accessible.
404
405
  @rakefile = File.expand_path(DEFAULT_BUILDFILES.first)
405
406
  fail "Buildfile already exists" if File.exist?(@rakefile) && !(tty_output? && agree('Buildfile exists, overwrite?'))
406
- script = File.directory?(source) ? Generate.from_directory(source) : Generate.from_maven2_pom(source)
407
+ script = nil
408
+ if fromEclipse
409
+ script = Generate.from_eclipse(source)
410
+ elsif File.directory?(source)
411
+ script = Generate.from_directory(source)
412
+ else
413
+ script = Generate.from_maven2_pom(source)
414
+ end
407
415
  File.open @rakefile, 'w' do |file|
408
416
  file.puts script
409
417
  end
@@ -593,7 +601,7 @@ end
593
601
  HighLine.use_color = false
594
602
  if $stdout.isatty
595
603
  begin
596
- require 'Win32/Console/ANSI' if Config::CONFIG['host_os'] =~ /mswin|win32|dos|cygwin|mingw/i
604
+ require 'Win32/Console/ANSI' if RbConfig::CONFIG['host_os'] =~ /mswin|win32|dos|cygwin|mingw/i
597
605
  HighLine.use_color = true
598
606
  rescue LoadError
599
607
  end
@@ -689,3 +697,28 @@ module RakeFileUtils #:nodoc:
689
697
  EOS
690
698
  end
691
699
  end
700
+
701
+
702
+ # It is unclear why this needs to be included on windows but it does seem to be needed.
703
+ # But it can not be included under linux as it rewrites the install command
704
+ if Buildr::Util.win_os?
705
+
706
+ module Rake::DSL #:nodoc:
707
+ FileUtils::OPT_TABLE.each do |name, opts|
708
+ default_options = []
709
+ if opts.include?(:verbose) || opts.include?("verbose")
710
+ default_options << ':verbose => RakeFileUtils.verbose_flag == true'
711
+ end
712
+ next if default_options.empty?
713
+ module_eval(<<-EOS, __FILE__, __LINE__ + 1)
714
+ def #{name}( *args, &block )
715
+ super(
716
+ *rake_merge_option(args,
717
+ #{default_options.join(', ')}
718
+ ), &block)
719
+ end
720
+ EOS
721
+ end
722
+ end
723
+
724
+ end
@@ -100,6 +100,58 @@ module Buildr
100
100
 
101
101
  end
102
102
 
103
+ module Hg #:nodoc:
104
+ module_function
105
+
106
+ # :call-seq:
107
+ # hg(*args)
108
+ #
109
+ # Executes a Mercurial (hg) command passing through the args and returns the output.
110
+ # Throws exception if the exit status is not zero. For example:
111
+ # hg 'commit'
112
+ # hg 'update', 'default'
113
+ def hg(*args)
114
+ cmd = "hg #{args.shift} #{args.map { |arg| arg.inspect }.join(' ')}"
115
+ output = `#{cmd}`
116
+ fail "Mercurial command \"#{cmd}\" failed with status #{$?.exitstatus}\n#{output}" unless $?.exitstatus == 0
117
+ return output
118
+ end
119
+
120
+ # Return a list of uncommitted / untracked files as reported by hg status
121
+ # The codes used to show the status of files are:
122
+ # M = modified
123
+ # A = added
124
+ # R = removed
125
+ # C = clean
126
+ # ! = missing (deleted by non-hg command, but still tracked)
127
+ # ? = not tracked
128
+ # I = ignored
129
+ # = origin of the previous file listed as A (added)
130
+ def uncommitted_files
131
+ `hg status`.scan(/^(A|M|R|!|\?) (\S.*)$/).map{ |match| match.last.split.last }
132
+ end
133
+
134
+ # Commit the given file with a message. The file should already be added to the Mercurial index.
135
+ def commit(file, message)
136
+ hg 'commit', '-m', message, file
137
+ end
138
+
139
+ # Update the remote branch with the local commits
140
+ # This will push the current remote destination and current branch.
141
+ def push
142
+ hg 'push'
143
+ end
144
+
145
+ # Return the name of the current local branch or nil if none.
146
+ def current_branch
147
+ hg('branch').to_s.strip
148
+ end
149
+
150
+ # Return the aliases (if any) of any remote repositories which the current local branch tracks
151
+ def remote
152
+ hg('paths').scan(/^(?:default|default-push)\s+=\s+(\S.*)/).map{ |match| match.last }
153
+ end
154
+ end
103
155
 
104
156
  module Git #:nodoc:
105
157
  module_function
@@ -415,6 +467,54 @@ module Buildr
415
467
  end
416
468
 
417
469
 
470
+ class HgRelease < Release
471
+ class << self
472
+ def applies_to?
473
+ if File.exist? '.hg/requires'
474
+ true
475
+ else
476
+ curr_pwd = Dir.pwd
477
+ Dir.chdir('..') do
478
+ return false if curr_pwd == Dir.pwd # Means going up one level is not possible.
479
+ applies_to?
480
+ end
481
+ end
482
+ end
483
+ end
484
+
485
+ # Fails if one of these 2 conditions are not met:
486
+ # 1. The reository is not 'clean'; no content staged or unstaged
487
+ # 2. The repository is only a local repository and has no remote refs
488
+ def check
489
+ super
490
+ info "Working in branch '#{Hg.current_branch}'"
491
+ uncommitted = Hg.uncommitted_files
492
+ fail "Uncommitted files violate the First Principle Of Release!\n#{uncommitted.join("\n")}" unless uncommitted.empty?
493
+ fail "You are releasing from a local branch that does not track a remote!" if Hg.remote.empty?
494
+ end
495
+
496
+ # Tag this release in Mercurial
497
+ def tag_release(tag)
498
+ unless this_version == extract_version
499
+ info "Committing buildfile with version number #{extract_version}"
500
+ Hg.commit File.basename(Buildr.application.buildfile.to_s), message
501
+ Hg.push if Hg.remote
502
+ end
503
+ info "Tagging release #{tag}"
504
+ Hg.hg 'tag', tag, '-m', "[buildr] Cutting release #{tag}"
505
+ Hg.push if Hg.remote
506
+ end
507
+
508
+ # Update buildfile with next version number
509
+ def update_version_to_next
510
+ super
511
+ info "Current version is now #{extract_version}"
512
+ Hg.commit File.basename(Buildr.application.buildfile.to_s), message
513
+ Hg.push if Hg.remote
514
+ end
515
+ end
516
+
517
+
418
518
  class GitRelease < Release
419
519
  class << self
420
520
  def applies_to?
@@ -430,7 +530,7 @@ module Buildr
430
530
  end
431
531
  end
432
532
 
433
- # Fails if one of theses 2 conditions are not met:
533
+ # Fails if one of these 2 conditions are not met:
434
534
  # 1. the repository is clean: no content staged or unstaged
435
535
  # 2. some remote repositories are defined but the current branch does not track any
436
536
  def check
@@ -491,6 +591,7 @@ module Buildr
491
591
  end
492
592
  end
493
593
 
594
+ Release.add HgRelease
494
595
  Release.add SvnRelease
495
596
  Release.add GitRelease
496
597