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
@@ -23,10 +23,11 @@ module Buildr
23
23
  #
24
24
  # protoc _("path/to/proto/files")
25
25
  #
26
- # and also supports two options,
26
+ # and also supports three options,
27
27
  #
28
- # :output => "target/generated/protoc" # this is the default
29
- # :lang => "java" # defaults to compile.language
28
+ # :include => ["path/to/proto", "src/main/resources/proto" # the directories in which to search for imports
29
+ # :output => "target/generated/protoc" # this is the default
30
+ # :lang => "java" # defaults to compile.language
30
31
  #
31
32
  module Protobuf
32
33
  class << self
@@ -42,7 +43,7 @@ module Buildr
42
43
 
43
44
  command_line << "--#{options[:lang]}_out=#{options[:output]}" if options[:output]
44
45
 
45
- (paths_from_sources(*args) + options[:include]).each { |i| command_line << "-I#{i}" }
46
+ options[:include].each { |i| command_line << "-I#{i}" }
46
47
 
47
48
  command_line += files_from_sources(*args)
48
49
 
@@ -58,10 +59,6 @@ module Buildr
58
59
  def files_from_sources(*args)
59
60
  args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "/**/*.proto"] : f }.flatten
60
61
  end
61
-
62
- def paths_from_sources(*args)
63
- args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? f : File.dirname(f) }
64
- end
65
62
  end
66
63
 
67
64
  def protoc(*args)
data/buildr.gemspec CHANGED
@@ -65,15 +65,13 @@ for those one-off tasks, with a language that's a joy to use.
65
65
  spec.add_dependency 'jruby-pageant', '1.1.1' if $platform.to_s == 'java'
66
66
  spec.add_dependency 'rubyzip', '1.2.0'
67
67
  spec.add_dependency 'json_pure', '1.8.3'
68
- spec.add_dependency 'hoe', '3.15.0'
69
68
  spec.add_dependency 'rjb', '1.5.4' if ($platform.to_s == 'x86-mswin32' || $platform.to_s == 'ruby')
70
69
  spec.add_dependency 'atoulme-Antwrap', '0.7.5'
71
70
  spec.add_dependency 'diff-lcs', '1.2.5'
72
71
  spec.add_dependency 'xml-simple', '1.1.5'
73
72
  spec.add_dependency 'minitar', '0.5.4'
74
- spec.add_dependency 'jruby-openssl', '~> 0.9.16' if $platform.to_s == 'java'
73
+ spec.add_dependency 'jruby-openssl', '~> 0.9.17' if $platform.to_s == 'java'
75
74
  spec.add_dependency 'bundler'
76
- spec.add_dependency 'orderedhash', '0.0.6'
77
75
  spec.add_dependency 'win32console' '1.3.2' if $platform.to_s == 'x86-mswin32'
78
76
 
79
77
  # Unable to get this consistently working under jruby on windows
@@ -86,6 +84,7 @@ for those one-off tasks, with a language that's a joy to use.
86
84
  spec.add_development_dependency 'jekyll-textile-converter', '0.1.0'
87
85
  end
88
86
 
87
+ spec.add_development_dependency 'hoe', '3.15.1'
89
88
  spec.add_development_dependency 'rspec-expectations', '2.14.3'
90
89
  spec.add_development_dependency 'rspec-mocks', '2.14.3'
91
90
  spec.add_development_dependency 'rspec-core', '2.14.5'
@@ -12,7 +12,7 @@ All our discussions are done in the open, over "email":mailing_lists.html, and t
12
12
 
13
13
  h2(#mailing_lists). Mailing Lists
14
14
 
15
- We run two mailing lists, the "users":http://buildr.markmail.org/search/list:users mailing list for developers working with Buildr, that would be you if you're using Buildr or interested in using it. There's the "dev":http://buildr.markmail.org/search/list:dev mailing list for talking about development of Buildr itself. There's also "commits":http://buildr.markmail.org/search/list:commits mailing list for following SVN commits and JIRA issues.
15
+ We run two mailing lists, the "users":http://buildr.markmail.org/search/list:users mailing list for developers working with Buildr, that would be you if you're using Buildr or interested in using it. There's the "dev":http://buildr.markmail.org/search/list:dev mailing list for talking about development of Buildr itself. There's also "commits":http://buildr.markmail.org/search/list:commits mailing list for following Git commits and JIRA issues.
16
16
 
17
17
  Check the "mailing lists":mailing_lists.html page for more information on subscribing, searching and posting to the mailing list.
18
18
 
@@ -65,35 +65,18 @@ If you want to get your patch accepted quickly:
65
65
 
66
66
  If you don't know how to fix it, but can at least write a spec for the correct behavior (which, obviously would fail), do just that. A spec is preferred to a fix.
67
67
 
68
- h3. Working on a new feature?
69
-
70
- If you want to work on a cool new feature, but not quite ready to submit a patch, there's still a way you can get the Buildr community involved. We're experimenting with using Git for that. You can use Git to maintain a fork of Buildr that can keep up with changes in the main branch (tip: use @git rebase@), while developing your own changes/features on it.
71
-
72
- That way you can get other people involved, checking out the code, and eventually merge it back with the main branch. Check out the "Git section":#git below and the post "Git forking for fun and profit":http://blog.labnotes.org/2008/04/30/git-forking-for-fun-and-profit/.
73
-
74
-
75
68
  h2(#edge). Living on the edge
76
69
 
77
70
  Did we mention Buildr is an open source project? In fact, when you install Buildr you get all the source code, documentation, test case and everything you need to use it, extend it and patch it. Have a look in your Gem directory.
78
71
 
79
72
  h3(#git). GIT
80
73
 
81
- But if you want to work with the latest and greatest, you'll want to check out Buildr from source control. You can use the "official Apache Git clone.":http://git.apache.org This clone is maintained by the ASF and kept in sync with the SVN repository (though, in practice there may be some delay in cloning recent commits). Apache's Git hosting supports both git:// and http:// protocols (you should use git:// if at all possible as it is faster than http://):
74
+ If you want to work with the latest and greatest, you'll want to check out Buildr from source control. You can use the "official Apache Buildr Github clone.":https://github.com/apache/buildr This clone is maintained by Github aand kept in sync with the "ASF Git repository":https://git-wip-us.apache.org/repos/asf?p=buildr.git
82
75
 
83
76
  {% highlight sh %}
84
- $ git clone git://git.apache.org/buildr.git
85
- # or...
86
- $ git clone http://git.apache.org/buildr.git
77
+ $ git clone git@github.com:apache/buildr.git
87
78
  {% endhighlight %}
88
79
 
89
- If you want to learn more about Git, you can start by watching Scott Chacon’s "Git presentation":http://en.oreilly.com/rails2008/public/asset/attachment/2816 (PDF), or any of the "Git screencasts":http://www.gitcasts.com/. For more, there's also the "Git Internals book":http://peepcode.com/products/git-internals-pdf.
90
-
91
- And keep this "Git cheat sheet":http://ktown.kde.org/~zrusin/git/git-cheat-sheet-medium.png close at hand. Very useful.
92
-
93
- h4. GitHub
94
-
95
- You are also welcome to fork or clone the "Buildr repository on GitHub":http://github.com/apache/buildr. This repository is just an exact mirror of the official Apache Git clone referenced above (updated every 30 minutes).
96
-
97
80
  h3. Working with Source Code
98
81
 
99
82
  To install Buildr from the source directory:
data/doc/download.textile CHANGED
@@ -18,14 +18,14 @@ The source code is included in both source and binary distribution, the Gem dist
18
18
 
19
19
  h2(#dist). Binaries and Source Code
20
20
 
21
- h3. buildr 1.5.0 (2016-09-16)
21
+ h3. buildr 1.5.0 (2016-09-23)
22
22
 
23
23
  |_. Package |_. MD5 Checksum |_. PGP |
24
- | "buildr-1.5.0-java.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.5.0/buildr-1.5.0-java.gem | "c3ac21f11a09d6bfc4b390bd20d10ae6":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0-java.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0-java.gem.asc |
25
- | "buildr-1.5.0-x86-mswin32.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.5.0/buildr-1.5.0-x86-mswin32.gem | "8d2e5eebef6aa41f9fd52895a28a1564":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0-x86-mswin32.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0-x86-mswin32.gem.asc |
26
- | "buildr-1.5.0.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.5.0/buildr-1.5.0.gem | "b94e86a215764d66f85d2009258c85d2":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.gem.asc |
27
- | "buildr-1.5.0.tgz":http://www.apache.org/dyn/closer.cgi/buildr/1.5.0/buildr-1.5.0.tgz | "61fbfcbadc43e146a362a581f7e7b8da":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.tgz.md5 | "Sig":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.tgz.asc |
28
- | "buildr-1.5.0.zip":http://www.apache.org/dyn/closer.cgi/buildr/1.5.0/buildr-1.5.0.zip | "efbc527597b143df2415b291b1c17b83":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.zip.md5 | "Sig":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.zip.asc |
24
+ | "buildr-1.5.0-java.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.5.0/buildr-1.5.0-java.gem | "611ad614788f38d15424d6c3a88f3db0":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0-java.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0-java.gem.asc |
25
+ | "buildr-1.5.0-x86-mswin32.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.5.0/buildr-1.5.0-x86-mswin32.gem | "5eabc199bc362bccec939e2d67ef972c":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0-x86-mswin32.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0-x86-mswin32.gem.asc |
26
+ | "buildr-1.5.0.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.5.0/buildr-1.5.0.gem | "075969eb067fa27243a4fd2ae6faf76c":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.gem.asc |
27
+ | "buildr-1.5.0.tgz":http://www.apache.org/dyn/closer.cgi/buildr/1.5.0/buildr-1.5.0.tgz | "83b06ec0597ea888846caf097ac2ece8":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.tgz.md5 | "Sig":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.tgz.asc |
28
+ | "buildr-1.5.0.zip":http://www.apache.org/dyn/closer.cgi/buildr/1.5.0/buildr-1.5.0.zip | "f4eb461c0a4c90ddf464ea529a94cb67":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.zip.md5 | "Sig":http://www.apache.org/dist/buildr/1.5.0/buildr-1.5.0.zip.asc |
29
29
 
30
30
  p>. ("Release signing keys":http://www.apache.org/dist/buildr/1.5.0/KEYS)
31
31
 
data/doc/index.textile CHANGED
@@ -46,6 +46,13 @@ 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
+ Highlights from Buildr 1.5.1 (2017-03-11)
50
+ * Change: Add css2gss task to gwt addon to support conveting from deprecated css syntax to modern gss syntax.
51
+ * Change: Add support for gwt 2.8.0 to gwt addon.
52
+ * Change: Update jruby-openssl to 0.9.17
53
+ * Change: BUILDR-719 Change User-Agent when uploading artifacts
54
+ * Change: BUILDR-709 Integrate `buildr/custom_pom` into core and just make it the default pom generated.
55
+
49
56
  Highlights from Buildr 1.5.0 (2016-09-23)
50
57
  * Change: Move to default on Scala 2.11.
51
58
  * Added: BUILDR-577 Allow remote repo to be added with http basic auth support. Submitted by Michael Guymon.
@@ -81,7 +81,7 @@ repositories:
81
81
  remote:
82
82
  - https://intra.net/maven2
83
83
  - http://example.com
84
-
84
+
85
85
  # specify the corporate mirror
86
86
  mirrors:
87
87
  - http://www.corporateserver001.com/repo
data/lib/buildr.rb CHANGED
@@ -33,7 +33,6 @@ require 'find'
33
33
  require 'uri'
34
34
  require 'stringio'
35
35
  require 'fileutils'
36
- require 'orderedhash'
37
36
  require 'securerandom'
38
37
 
39
38
  require 'buildr/rspec_check'
@@ -85,6 +84,7 @@ require 'buildr/java/packaging'
85
84
  require 'buildr/java/commands'
86
85
  require 'buildr/java/doc'
87
86
  require 'buildr/java/deprecated'
87
+ require 'buildr/java/custom_pom'
88
88
  require 'buildr/ide/idea'
89
89
  require 'buildr/ide/eclipse'
90
90
 
@@ -349,7 +349,7 @@ module Buildr #:nodoc:
349
349
 
350
350
  # the initial value of THIS_VERSION
351
351
  attr_accessor :this_version
352
-
352
+
353
353
  # :call-seq:
354
354
  # version_file()
355
355
  # Provides the file containing the version of the project.
@@ -308,7 +308,7 @@ module Buildr #:nodoc:
308
308
  end
309
309
  self
310
310
  end
311
-
311
+
312
312
  BINARY_FILES = [ '*.png', '*.gif', '*.jpg', '*.jpeg' ]
313
313
 
314
314
  def is_binary?(content, path)
@@ -624,7 +624,7 @@ module Buildr #:nodoc:
624
624
  def define!
625
625
  @defined = true
626
626
  end
627
-
627
+
628
628
 
629
629
  # :call-seq:
630
630
  # base_dir = dir
@@ -332,7 +332,7 @@ module URI
332
332
  while chunk = yield(RW_CHUNK_SIZE)
333
333
  content << chunk
334
334
  end
335
- headers = { 'Content-MD5'=>Digest::MD5.hexdigest(content.string), 'Content-Type'=>'application/octet-stream' }
335
+ headers = { 'Content-MD5'=>Digest::MD5.hexdigest(content.string), 'Content-Type'=>'application/octet-stream', 'User-Agent'=>"Buildr-#{Buildr::VERSION}" }
336
336
  request = Net::HTTP::Put.new(request_uri.empty? ? '/' : request_uri, headers)
337
337
  request.basic_auth self.user, self.password if self.user
338
338
  response = nil
@@ -530,23 +530,37 @@ module Buildr #:nodoc:
530
530
  end
531
531
 
532
532
  def module_root_component
533
- create_component('NewModuleRootManager', 'inherit-compiler-output' => 'false') do |xml|
533
+ options = { 'inherit-compiler-output' => 'false' }
534
+ options['LANGUAGE_LEVEL'] = "JDK_#{jdk_version.gsub(/\./, '_')}" unless jdk_version == buildr_project.root_project.compile.options.source
535
+ create_component('NewModuleRootManager', options) do |xml|
534
536
  generate_compile_output(xml)
535
537
  generate_content(xml) unless skip_content?
536
538
  generate_initial_order_entries(xml)
537
539
  project_dependencies = []
538
540
 
539
-
541
+ # If a project dependency occurs as a main dependency then add it to the list
542
+ # that are excluded from list of test modules
540
543
  self.main_dependency_details.each do |dependency_path, export, source_path|
541
544
  next unless export
542
- generate_lib(xml, dependency_path, export, source_path, project_dependencies)
545
+ project_for_dependency = Buildr.projects.detect do |project|
546
+ [project.packages, project.compile.target, project.resources.target, project.test.compile.target, project.test.resources.target].flatten.
547
+ detect { |artifact| artifact.to_s == dependency_path }
548
+ end
549
+ project_dependencies << project_for_dependency if project_for_dependency
543
550
  end
544
551
 
552
+ main_project_dependencies = project_dependencies.dup
545
553
  self.test_dependency_details.each do |dependency_path, export, source_path|
546
554
  next if export
547
555
  generate_lib(xml, dependency_path, export, source_path, project_dependencies)
548
556
  end
549
557
 
558
+ test_project_dependencies = project_dependencies - main_project_dependencies
559
+ self.main_dependency_details.each do |dependency_path, export, source_path|
560
+ next unless export
561
+ generate_lib(xml, dependency_path, export, source_path, test_project_dependencies)
562
+ end
563
+
550
564
  xml.orderEntryProperties
551
565
  end
552
566
  end
@@ -1081,6 +1095,7 @@ module Buildr #:nodoc:
1081
1095
  add_to_composite_component(self.configurations) do |xml|
1082
1096
  xml.configuration(:name => configuration_name, :type => 'GlassfishConfiguration', :factoryName => 'Remote', :default => false, :APPLICATION_SERVER_NAME => server_name) do |xml|
1083
1097
  xml.option(:name => 'LOCAL', :value => 'false')
1098
+ xml.option(:name => 'OPEN_IN_BROWSER', :value => 'false')
1084
1099
  xml.option(:name => 'UPDATING_POLICY', :value => 'hot-swap-classes')
1085
1100
 
1086
1101
  xml.deployment do |deployment|
@@ -0,0 +1,265 @@
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
+ module Buildr
17
+ class CustomPom
18
+ Developer = Struct.new(:id, :name, :email, :roles)
19
+
20
+ # Specify the name of the project
21
+ attr_writer :name
22
+
23
+ # Retrieve the name of the project, defaulting to the project description or the name if not specified
24
+ def name
25
+ @name || @buildr_project.comment || @buildr_project.name
26
+ end
27
+
28
+ # Specify a project description
29
+ attr_writer :description
30
+
31
+ # Retrieve the project description, defaulting to the name if not specified
32
+ def description
33
+ @description || name
34
+ end
35
+
36
+ # Property for the projects url
37
+ attr_accessor :url
38
+
39
+ # Return the map of licenses for project
40
+ def licenses
41
+ @licenses ||= {}
42
+ end
43
+
44
+ # Add Apache2 to the list of licenses
45
+ def add_apache_v2_license
46
+ self.licenses['The Apache Software License, Version 2.0'] = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
47
+ end
48
+
49
+ def add_bsd_2_license
50
+ self.licenses['The BSD 2-Clause License'] = 'http://opensource.org/licenses/BSD-2-Clause'
51
+ end
52
+
53
+ def add_bsd_3_license
54
+ self.licenses['The BSD 3-Clause License'] = 'http://opensource.org/licenses/BSD-3-Clause'
55
+ end
56
+
57
+ def add_cddl_v1_license
58
+ self.licenses['Common Development and Distribution License (CDDL-1.0)'] = 'http://opensource.org/licenses/CDDL-1.0'
59
+ end
60
+
61
+ def add_epl_v1_license
62
+ self.licenses['Eclipse Public License - v 1.0'] = 'http://www.eclipse.org/legal/epl-v10.html'
63
+ end
64
+
65
+ def add_gpl_v1_license
66
+ self.licenses['GNU General Public License (GPL) version 1.0'] = 'http://www.gnu.org/licenses/gpl-1.0.html'
67
+ end
68
+
69
+ def add_gpl_v2_license
70
+ self.licenses['GNU General Public License (GPL) version 2.0'] = 'http://www.gnu.org/licenses/gpl-2.0.html'
71
+ end
72
+
73
+ def add_gpl_v3_license
74
+ self.licenses['GNU General Public License (GPL) version 3.0'] = 'http://www.gnu.org/licenses/gpl-3.0.html'
75
+ end
76
+
77
+ def add_lgpl_v2_license
78
+ self.licenses['GNU General Lesser Public License (LGPL) version 2.1'] = 'http://www.gnu.org/licenses/lgpl-2.1.html'
79
+ end
80
+
81
+ def add_lgpl_v3_license
82
+ self.licenses['GNU General Lesser Public License (LGPL) version 3.0'] = 'http://www.gnu.org/licenses/lgpl-3.0.html'
83
+ end
84
+
85
+ def add_mit_license
86
+ self.licenses['The MIT License'] = 'http://opensource.org/licenses/MIT'
87
+ end
88
+
89
+ attr_accessor :scm_url
90
+ attr_accessor :scm_connection
91
+ attr_accessor :scm_developer_connection
92
+
93
+ attr_accessor :issues_url
94
+ attr_accessor :issues_system
95
+
96
+ # Add a project like add_github_project('realityforge/gwt-appcache')
97
+ def add_github_project(project_spec)
98
+ git_url = "git@github.com:#{project_spec}.git"
99
+ self.scm_connection = self.scm_developer_connection = "scm:git:#{git_url}"
100
+ self.scm_url = git_url
101
+ web_url = "https://github.com/#{project_spec}"
102
+ self.url = web_url
103
+ self.issues_url = "#{web_url}/issues"
104
+ self.issues_system = 'GitHub Issues'
105
+ end
106
+
107
+ def developers
108
+ @developers ||= []
109
+ end
110
+
111
+ def add_developer(id, name = nil, email = nil, roles = nil)
112
+ self.developers << Developer.new(id, name, email, roles)
113
+ end
114
+
115
+ def provided_dependencies
116
+ @provided_dependencies ||= []
117
+ end
118
+
119
+ def provided_dependencies=(provided_dependencies)
120
+ @provided_dependencies = provided_dependencies
121
+ end
122
+
123
+ def runtime_dependencies
124
+ @runtime_dependencies ||= []
125
+ end
126
+
127
+ def runtime_dependencies=(runtime_dependencies)
128
+ @runtime_dependencies = runtime_dependencies
129
+ end
130
+
131
+ def optional_dependencies
132
+ @optional_dependencies ||= []
133
+ end
134
+
135
+ def optional_dependencies=(optional_dependencies)
136
+ @optional_dependencies = optional_dependencies
137
+ end
138
+
139
+ protected
140
+
141
+ def associate_project(buildr_project)
142
+ @buildr_project = buildr_project
143
+ end
144
+
145
+ def self.pom_xml(project, package)
146
+ Proc.new do
147
+ xml = Builder::XmlMarkup.new(:indent => 2)
148
+ xml.instruct!
149
+ xml.project('xmlns' => 'http://maven.apache.org/POM/4.0.0',
150
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
151
+ 'xsi:schemaLocation' => 'http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd') do
152
+ xml.modelVersion '4.0.0'
153
+ xml.parent do
154
+ xml.groupId 'org.sonatype.oss'
155
+ xml.artifactId 'oss-parent'
156
+ xml.version '7'
157
+ end
158
+ xml.groupId project.group
159
+ xml.artifactId project.id
160
+ xml.version project.version
161
+ candidates = project.packages.select{|p| p.classifier.nil? }.collect{|p|p.type.to_s}
162
+ packaging = !candidates.empty? ? candidates[0] : (project.compile.packaging || :zip).to_s
163
+ xml.packaging packaging
164
+ xml.classifier package.classifier if package.classifier
165
+
166
+ xml.name project.pom.name if project.pom.name
167
+ xml.description project.pom.description if project.pom.description
168
+ xml.url project.pom.url if project.pom.url
169
+
170
+ xml.licenses do
171
+ project.pom.licenses.each_pair do |name, url|
172
+ xml.license do
173
+ xml.name name
174
+ xml.url url
175
+ xml.distribution 'repo'
176
+ end
177
+ end
178
+ end unless project.pom.licenses.empty?
179
+
180
+ if project.pom.scm_url || project.pom.scm_connection || project.pom.scm_developer_connection
181
+ xml.scm do
182
+ xml.connection project.pom.scm_connection if project.pom.scm_connection
183
+ xml.developerConnection project.pom.scm_developer_connection if project.pom.scm_developer_connection
184
+ xml.url project.pom.scm_url if project.pom.scm_url
185
+ end
186
+ end
187
+
188
+ if project.pom.issues_url
189
+ xml.issueManagement do
190
+ xml.url project.pom.issues_url
191
+ xml.system project.pom.issues_system if project.pom.issues_system
192
+ end
193
+ end
194
+
195
+ xml.developers do
196
+ project.pom.developers.each do |developer|
197
+ xml.developer do
198
+ xml.id developer.id
199
+ xml.name developer.name if developer.name
200
+ xml.email developer.email if developer.email
201
+ if developer.roles
202
+ xml.roles do
203
+ developer.roles.each do |role|
204
+ xml.role role
205
+ end
206
+ end
207
+ end
208
+ end
209
+ end
210
+ end unless project.pom.developers.empty?
211
+
212
+ provided_deps = Buildr.artifacts(project.pom.provided_dependencies).collect { |d| d.to_s }
213
+ runtime_deps = Buildr.artifacts(project.pom.runtime_dependencies).collect { |d| d.to_s }
214
+ optional_deps = Buildr.artifacts(project.pom.optional_dependencies).collect { |d| d.to_s }
215
+ deps =
216
+ Buildr.artifacts(project.compile.dependencies).
217
+ select { |d| d.is_a?(ActsAsArtifact) }.
218
+ collect do |d|
219
+ f = d.to_s
220
+ scope = provided_deps.include?(f) ? 'provided' :
221
+ runtime_deps.include?(f) ? 'runtime' :
222
+ 'compile'
223
+ d.to_hash.merge(:scope => scope, :optional => optional_deps.include?(f))
224
+ end + Buildr.artifacts(project.test.compile.dependencies).
225
+ select { |d| d.is_a?(ActsAsArtifact) && !project.compile.dependencies.include?(d) }.collect { |d| d.to_hash.merge(:scope => 'test') }
226
+
227
+ xml.dependencies do
228
+ deps.each do |dependency|
229
+ xml.dependency do
230
+ xml.groupId dependency[:group]
231
+ xml.artifactId dependency[:id]
232
+ xml.version dependency[:version]
233
+ xml.scope dependency[:scope] unless dependency[:scope] == 'compile'
234
+ xml.optional true if dependency[:optional]
235
+ xml.exclusions do
236
+ xml.exclusion do
237
+ xml.groupId '*'
238
+ xml.artifactId '*'
239
+ end
240
+ end
241
+ end
242
+ end
243
+ end unless deps.empty?
244
+ end
245
+ end
246
+ end
247
+ end
248
+ module CPom
249
+ module ProjectExtension
250
+ include Extension
251
+
252
+ def pom
253
+ unless @pom
254
+ @pom = parent ? parent.pom.dup : Buildr::CustomPom.new
255
+ @pom.send :associate_project, self
256
+ end
257
+ @pom
258
+ end
259
+ end
260
+ end
261
+ end
262
+
263
+ class Buildr::Project
264
+ include Buildr::CPom::ProjectExtension
265
+ end