realityforge-buildr 1.5.12 → 1.5.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3774de57cc666c2148d221a1511f0a6ffa4ebbe1567443e121bc900e5e8ee4fb
4
- data.tar.gz: 5d691cfc07a1ceafb83b750158314a51cbb1a810e9566434c1f9a85037f36296
3
+ metadata.gz: 65fb6b6cc188f8b1e7b200f0ad1b56b838d89347c58d9f413d01e233fe96f920
4
+ data.tar.gz: f19e4cd3a75ced32f067d865cd4bb3c96553416f869e0dc9ebacf2012cb26f5a
5
5
  SHA512:
6
- metadata.gz: fb053f6f9851fad7ffe939ad731da43883effac9be2ab8a53da8803e28c0946f104b4cf8d67dca17aef58f04c6da5465f4422927e0198fe5e88f92b9fcfbc6cf
7
- data.tar.gz: 9031da8968321ec54d7acc645cb9f42693b255e9ffe143e07dfdc925e34e1c057e505178e7881316c89df9c718f9253fed85800cfd992a135c4e4bc634d79221
6
+ metadata.gz: ee6bc9306443afd70e60d15cf49646a95c866c18672c064e5613a989277b38ceca892c562135d180920a48fc5cf1486d20ec51436dcef6d64aeef80d6ba4db0c
7
+ data.tar.gz: 5adee0791894e792b062d7488eb0f044b54d380969c5899651691f988af22c09a188ecbfc4d2e719c2f848ce1785531d448ee3c1d2afe620344854d3682f44c6
@@ -0,0 +1,78 @@
1
+ module Buildr
2
+ class ApiDiffTool
3
+ class << self
4
+ def generate_differences_report(artifact_coordinate, old_version, new_version, new_file, output_file, options = {})
5
+ revapi = Buildr.artifact('org.realityforge.revapi.diff:revapi-diff:jar:all:0.08')
6
+ revapi.invoke
7
+
8
+ old_artifact = Buildr.artifact("#{artifact_coordinate}:#{old_version}")
9
+ old_artifact.invoke
10
+
11
+ unless new_file
12
+ new_artifact = Buildr.artifact("#{artifact_coordinate}:#{new_version}")
13
+ new_artifact.invoke
14
+ new_file = new_artifact.to_s
15
+ end
16
+
17
+ FileUtils.mkdir_p File.dirname(output_file)
18
+
19
+ args = []
20
+ args << Java::Commands.path_to_bin('java')
21
+ args << '-jar'
22
+ args << revapi.to_s
23
+ args << '--old-api'
24
+ args << "#{artifact_coordinate}:#{old_version}::#{old_artifact.to_s}"
25
+ if options[:support_libs]
26
+ options[:support_libs].each do |lib|
27
+ args << '--old-api-support'
28
+ args << lib.to_s
29
+ end
30
+ end
31
+ args << '--new-api'
32
+ args << "#{artifact_coordinate}:#{new_version}::#{new_file}"
33
+ if options[:support_libs]
34
+ options[:support_libs].each do |lib|
35
+ args << '--new-api-support'
36
+ args << lib.to_s
37
+ end
38
+ end
39
+ args << '--output-file'
40
+ args << output_file.to_s
41
+
42
+ sh args.join(' ')
43
+ if File.exist?(output_file)
44
+ data = JSON.parse(IO.read(output_file, :encoding => 'UTF-8'))
45
+ FileUtils.rm_f output_file if data.empty?
46
+ end
47
+ end
48
+
49
+ def update_differences_report(artifact_coordinate, old_version, new_version, new_file, output_directory, options = {})
50
+ output_file = "#{output_directory}/#{old_version}-#{new_version}.json"
51
+ generate_differences_report(artifact_coordinate, old_version, new_version, new_file, output_file, options)
52
+ sh "git add #{output_file}" if File.exist?(output_file)
53
+ end
54
+
55
+ def test_differences_report(artifact_coordinate, old_version, new_version, new_file, output_directory, options = {})
56
+ report_file = "#{output_directory}/#{old_version}-#{new_version}.json"
57
+ tmp = nil
58
+ begin
59
+ tmp = Tempfile.open("#{old_version}-#{new_version}.json")
60
+ tmp.close
61
+ generate_differences_report(artifact_coordinate, old_version, new_version, new_file, tmp.path, options)
62
+
63
+ report_content = File.exist?(report_file) ? IO.read(report_file, :encoding => 'UTF-8') : ''
64
+ test_content = File.exist?(tmp.path) ? IO.read(tmp.path, :encoding => 'UTF-8') : ''
65
+ if report_content != test_content
66
+ if File.exist?(report_file)
67
+ raise "Differences report at #{report_file} does not record the correct set differences between #{old_version} and #{new_version} for #{artifact_coordinate}"
68
+ else
69
+ raise "No differences report at #{report_file} but differences exist between #{old_version} and #{new_version} for #{artifact_coordinate}"
70
+ end
71
+ end
72
+ ensure
73
+ tmp.close unless tmp.nil?
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -220,7 +220,7 @@ module Buildr
220
220
  project.task('checkstyle:xml') do
221
221
  puts 'Checkstyle: Analyzing source code...'
222
222
  mkdir_p File.dirname(project.checkstyle.xml_output_file)
223
- source_paths = project.checkstyle.complete_source_paths.select{|p| !p.start_with?(project._(:generated).to_s)}
223
+ source_paths = project.checkstyle.complete_source_paths.select{|p| !p.start_with?(project._(:target, :generated).to_s)}
224
224
  source_paths = source_paths.collect{|p|::Buildr::Util.relative_path(File.expand_path(p.to_s), project.base_dir)}
225
225
  Buildr::Checkstyle.checkstyle(project.checkstyle.configuration_file,
226
226
  project.checkstyle.format,
data/addon/buildr/pmd.rb CHANGED
@@ -126,7 +126,7 @@ module Buildr
126
126
 
127
127
  # An array of paths that should be excluded no matter how they are added to pmd
128
128
  def exclude_paths
129
- @source_paths ||= []
129
+ @exclude_paths ||= []
130
130
  end
131
131
 
132
132
  # An array of additional projects to scan for main and test sources
@@ -0,0 +1,279 @@
1
+ #
2
+ # Licensed under the Apache License, Version 2.0 (the "License");
3
+ # you may not use this file except in compliance with the License.
4
+ # You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+ #
14
+
15
+ module Buildr
16
+ class ReleaseTool
17
+ class << self
18
+ def define_release_task(options = {})
19
+ task_name = options[:task_name] || 'perform_release'
20
+ description = options[:description] || 'Perform a release'
21
+ workspace_dir = options[:workspace_dir] || File.dirname(Buildr.application.buildfile.to_s)
22
+
23
+ ENV['PREVIOUS_PRODUCT_VERSION'] = nil if ENV['PREVIOUS_PRODUCT_VERSION'].to_s == ''
24
+ ENV['PRODUCT_VERSION'] = nil if ENV['PRODUCT_VERSION'].to_s == ''
25
+
26
+ desc description
27
+ task task_name do
28
+ in_dir(workspace_dir) do
29
+ yield ReleaseTool.new
30
+ end
31
+ if ENV['STAGE']
32
+ if ENV['LAST_STAGE'] == ENV['STAGE']
33
+ puts "LAST_STAGE specified '#{ENV['LAST_STAGE']}', later stages were skipped"
34
+ else
35
+ raise "Invalid STAGE specified '#{ENV['STAGE']}' that did not match any stage"
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ def derive_versions_from_changelog(options = {})
42
+ ENV['PREVIOUS_PRODUCT_VERSION'] ||= IO.read('CHANGELOG.md')[/^### \[v(\d+\.\d+(\.\d+)?)\]/, 1] || '0.00'
43
+ ENV['PRODUCT_VERSION'] ||= derive_next_version(ENV['PREVIOUS_PRODUCT_VERSION'], options)
44
+ end
45
+
46
+ def derive_next_version(current_version, options = {})
47
+ return options[:next_version_action].call(current_version) if options[:next_version_action]
48
+ version_parts = current_version.split('.')
49
+ "#{version_parts[0]}.#{sprintf('%02d', version_parts[1].to_i + 1)}#{version_parts.length > 2 ? ".#{version_parts[2]}" : ''}"
50
+ end
51
+
52
+ private
53
+
54
+ def in_dir(dir)
55
+ current = Dir.pwd
56
+ begin
57
+ Dir.chdir(dir)
58
+ yield
59
+ ensure
60
+ Dir.chdir(current)
61
+ end
62
+ end
63
+ end
64
+
65
+ def extract_version_from_changelog(options = {})
66
+ stage('ExtractVersion', 'Extract the last version from CHANGELOG.md and derive next version unless specified', :always_run => true) do
67
+ Buildr::ReleaseTool.derive_versions_from_changelog(options)
68
+ # Also initialize release date if required
69
+ ENV['RELEASE_DATE'] ||= Time.now.strftime('%Y-%m-%d')
70
+ end
71
+ end
72
+
73
+ def zapwhite
74
+ stage('ZapWhite', 'Ensure that zapwhite produces no changes') do
75
+ sh 'bundle exec zapwhite'
76
+ end
77
+ end
78
+
79
+ def ensure_git_clean
80
+ stage('GitClean', 'Ensure there is nothing to commit and the working tree is clean') do
81
+ status_output = `git status -s 2>&1`.strip
82
+ raise 'Uncommitted changes in git repository. Please commit them prior to release.' if 0 != status_output.size
83
+ end
84
+ end
85
+
86
+ def verify_no_todo
87
+ stage('TodoScan', 'Verify that there are no TODO notes in codebase') do
88
+ task('todos:scan').invoke
89
+ end
90
+ end
91
+
92
+ def cleanup_staging
93
+ stage('StagingCleanup', 'Remove artifacts from staging repository') do
94
+ task('staging:cleanup').invoke
95
+ end
96
+ end
97
+
98
+ def build(options = {})
99
+ additional_tasks = options[:additional_tasks] || ''
100
+ stage('Build', 'Build the project to ensure that the tests pass') do
101
+ sh "bundle exec buildr clean package #{additional_tasks} install PRODUCT_VERSION=#{ENV['PRODUCT_VERSION']}#{ENV['TEST'].nil? ? '' : " TEST=#{ENV['TEST']}"}#{Buildr.application.options.trace ? ' --trace' : ''}"
102
+ end
103
+ end
104
+
105
+ def patch_changelog(repository_name, options = {})
106
+ stage('PatchChangelog', 'Patch the changelog to update from previous release') do
107
+ changelog = IO.read('CHANGELOG.md')
108
+ from = '0.00' == ENV['PREVIOUS_PRODUCT_VERSION'] ? `git rev-list --max-parents=0 HEAD`.strip : "v#{ENV['PREVIOUS_PRODUCT_VERSION']}"
109
+
110
+ header = "### [v#{ENV['PRODUCT_VERSION']}](https://github.com/#{repository_name}/tree/v#{ENV['PRODUCT_VERSION']}) (#{ENV['RELEASE_DATE']}) · [Full Changelog](https://github.com/spritz/spritz/compare/#{from}...v#{ENV['PRODUCT_VERSION']})"
111
+
112
+ sub_header_text = ''
113
+
114
+ api_diff_directory = options[:api_diff_directory]
115
+ api_diff_filename = api_diff_directory ? "#{api_diff_directory}/#{ENV['PREVIOUS_PRODUCT_VERSION']}-#{ENV['PRODUCT_VERSION']}.json" : nil
116
+ if api_diff_filename && File.exist?(api_diff_filename)
117
+
118
+ api_diff_site = options[:api_diff_website]
119
+ if api_diff_site
120
+ header += " · [API Differences](#{api_diff_site}old=#{ENV['PREVIOUS_PRODUCT_VERSION']}&new=#{ENV['PRODUCT_VERSION']})"
121
+ end
122
+
123
+ changes = JSON.parse(IO.read(api_diff_filename))
124
+ non_breaking_changes = changes.select { |j| j['classification']['SOURCE'] == 'NON_BREAKING' }.size
125
+ potentially_breaking_changes = changes.select { |j| j['classification']['SOURCE'] == 'POTENTIALLY_BREAKING' }.size
126
+ breaking_changes = changes.select { |j| j['classification']['SOURCE'] == 'BREAKING' }.size
127
+ change_descriptions = []
128
+ change_descriptions << "#{non_breaking_changes} non breaking API change#{1 == non_breaking_changes ? '' : 's'}" unless 0 == non_breaking_changes
129
+ change_descriptions << "#{potentially_breaking_changes} potentially breaking API change#{1 == potentially_breaking_changes ? '' : 's'}" unless 0 == potentially_breaking_changes
130
+ change_descriptions << "#{breaking_changes} breaking API change#{1 == breaking_changes ? '' : 's'}" unless 0 == breaking_changes
131
+
132
+ if change_descriptions.size > 0
133
+ description = "The release includes "
134
+ if 1 == change_descriptions.size
135
+ description += "#{change_descriptions[0]}."
136
+ elsif 2 == change_descriptions.size
137
+ description += "#{change_descriptions[0]} and #{change_descriptions[1]}."
138
+ else
139
+ description += "#{change_descriptions[0]}, #{change_descriptions[1]} and #{change_descriptions[2]}."
140
+ end
141
+
142
+ sub_header_text = description
143
+ end
144
+ end
145
+
146
+ header_suffix = options[:header_suffix]
147
+ header += header_suffix if header_suffix
148
+ header += "\n\n#{sub_header_text}" unless sub_header_text.empty?
149
+ header += "\n"
150
+
151
+ header += <<CONTENT
152
+
153
+ Changes in this release:
154
+ CONTENT
155
+
156
+ IO.write('CHANGELOG.md', changelog.gsub("### Unreleased\n", header))
157
+
158
+ sh 'git reset 2>&1 1> /dev/null'
159
+ sh 'git add CHANGELOG.md'
160
+ sh 'git commit -m "Update CHANGELOG.md in preparation for release"'
161
+ end
162
+ end
163
+
164
+ def patch_maven_version_in_readme
165
+ stage('PatchReadme', 'Patch the README to update from previous release') do
166
+ contents = IO.read('README.md')
167
+ contents = contents.
168
+ gsub("<version>#{ENV['PREVIOUS_PRODUCT_VERSION']}</version>", "<version>#{ENV['PRODUCT_VERSION']}</version>").
169
+ gsub("/#{ENV['PREVIOUS_PRODUCT_VERSION']}/", "/#{ENV['PRODUCT_VERSION']}/").
170
+ gsub("-#{ENV['PREVIOUS_PRODUCT_VERSION']}-", "-#{ENV['PRODUCT_VERSION']}-")
171
+ IO.write('README.md', contents)
172
+
173
+ sh 'git reset 2>&1 1> /dev/null'
174
+ sh 'git add README.md'
175
+ sh 'git commit -m "Update README.md in preparation for release"'
176
+ end
177
+ end
178
+
179
+ def tag_project
180
+ stage('TagProject', 'Tag the project') do
181
+ sh "git tag v#{ENV['PRODUCT_VERSION']}"
182
+ end
183
+ end
184
+
185
+ def stage_release(options = {})
186
+ release_to = options[:release_to] || (raise "StageRelease stage must specify :release_to configuration")
187
+ stage('StageRelease', 'Stage the release') do
188
+ IO.write('_buildr.rb', "repositories.release_to = #{release_to.inspect}")
189
+ sh 'bundle exec buildr clean upload TEST=no GWT=no'
190
+ sh 'rm -f _buildr.rb'
191
+ end
192
+ end
193
+
194
+ def maven_central_publish(options = {})
195
+ additional_tasks = options[:additional_tasks] || ''
196
+ stage('MavenCentralPublish', 'Publish artifacts to Maven Central') do
197
+ sh "bundle exec buildr clean mcrt:publish_if_tagged #{additional_tasks} TEST=no GWT=no"
198
+ end
199
+ end
200
+
201
+ def patch_changelog_post_release
202
+ stage('PatchChangelogPostRelease', 'Patch the changelog post release to prepare for next development iteration') do
203
+ changelog = IO.read('CHANGELOG.md')
204
+ changelog = changelog.gsub("# Change Log\n", <<HEADER)
205
+ # Change Log
206
+
207
+ ### Unreleased
208
+ HEADER
209
+ IO.write('CHANGELOG.md', changelog)
210
+
211
+ `bundle exec zapwhite`
212
+ sh 'git add CHANGELOG.md'
213
+ sh 'git commit -m "Update CHANGELOG.md in preparation for next development iteration"'
214
+ end
215
+ end
216
+
217
+ def push_changes
218
+ stage('PushChanges', 'Push changes to git repository') do
219
+ sh 'git push'
220
+ sh 'git push --tags'
221
+ end
222
+ end
223
+
224
+ def github_release(repository_name)
225
+ stage('GithubRelease', 'Create a Release on GitHub') do
226
+ changelog = IO.read('CHANGELOG.md')
227
+ start = changelog.index("### [v#{ENV['PRODUCT_VERSION']}]")
228
+ raise "Unable to locate version #{ENV['PRODUCT_VERSION']} in change log" if -1 == start
229
+ start = changelog.index("\n", start)
230
+ start = changelog.index("\n", start + 1)
231
+
232
+ end_index = changelog.index('### [v', start)
233
+ end_index = changelog.length if end_index.nil?
234
+
235
+ changes = changelog[start, end_index - start]
236
+
237
+ changes = changes.strip
238
+
239
+ tag = "v#{ENV['PRODUCT_VERSION']}"
240
+
241
+ version_parts = ENV['PRODUCT_VERSION'].split('.')
242
+ prerelease = '0' == version_parts[0]
243
+
244
+ require 'octokit'
245
+
246
+ client = Octokit::Client.new(:netrc => true, :auto_paginate => true)
247
+ client.login
248
+ client.create_release(repository_name, tag, :name => tag, :body => changes, :draft => false, :prerelease => prerelease)
249
+
250
+ candidates = client.list_milestones(repository_name).select { |m| m[:title].to_s == tag }
251
+ unless candidates.empty?
252
+ milestone = candidates[0]
253
+ unless milestone[:state] == 'closed'
254
+ client.update_milestone(repository_name, milestone[:number], :state => 'closed')
255
+ end
256
+ end
257
+ end
258
+ end
259
+
260
+ def stage(stage_name, description, options = {})
261
+ if ENV['STAGE'].nil? || ENV['STAGE'] == stage_name || options[:always_run]
262
+ puts "🚀 Release Stage: #{stage_name} - #{description}"
263
+ begin
264
+ yield
265
+ rescue Exception => e
266
+ puts '💣 Error completing stage.'
267
+ puts "Fix the error and re-run release process passing: STAGE=#{stage_name}#{ ENV['PREVIOUS_PRODUCT_VERSION'] ? " PREVIOUS_PRODUCT_VERSION=#{ENV['PREVIOUS_PRODUCT_VERSION']}" : ''}#{ ENV['PREVIOUS_PRODUCT_VERSION'] ? " PRODUCT_VERSION=#{ENV['PRODUCT_VERSION']}" : ''}"
268
+ raise e
269
+ end
270
+ ENV['STAGE'] = nil unless options[:always_run]
271
+ elsif !ENV['STAGE'].nil?
272
+ puts "Skipping Stage: #{stage_name} - #{description}"
273
+ end
274
+ if ENV['LAST_STAGE'] == stage_name
275
+ ENV['STAGE'] = ENV['LAST_STAGE']
276
+ end
277
+ end
278
+ end
279
+ end
@@ -15,27 +15,7 @@
15
15
  module Buildr
16
16
  # Provides the shade method.
17
17
  module Shade
18
-
19
18
  class << self
20
-
21
- # The specs for requirements
22
- def dependencies
23
- %w(
24
- net.sourceforge.pmd:pmd-core:jar:6.11.0
25
- net.sourceforge.pmd:pmd-java:jar:6.11.0
26
- net.sourceforge.pmd:pmd-java8:jar:6.11.0
27
- jaxen:jaxen:jar:1.1.6
28
- commons-io:commons-io:jar:2.6
29
- com.beust:jcommander:jar:1.72
30
- org.ow2.asm:asm:jar:7.1
31
- com.google.code.gson:gson:jar:2.8.5
32
- net.java.dev.javacc:javacc:jar:5.0
33
- net.sourceforge.saxon:saxon:jar:9.1.0.8
34
- org.apache.commons:commons-lang3:jar:3.8.1
35
- org.antlr:antlr4-runtime:jar:4.7
36
- )
37
- end
38
-
39
19
  def shade(input_jar, output_jar, relocations = {})
40
20
 
41
21
  shaded_jar = (input_jar.to_s + '-shaded')
@@ -51,7 +31,7 @@ module Buildr
51
31
  args << '--output'
52
32
  args << shaded_jar.to_s
53
33
  relocations.each_pair do |k, v|
54
- args << "-r#{k}#{v}"
34
+ args << "-r#{k}=#{v}"
55
35
  end
56
36
 
57
37
  sh args.join(' ')
@@ -117,7 +117,7 @@ module Buildr #:nodoc:
117
117
 
118
118
  def create_component(name, attrs = {})
119
119
  target = StringIO.new
120
- Builder::XmlMarkup.new(:target => target, :indent => 2).component({:name => name}.merge(attrs)) do |xml|
120
+ Builder::XmlMarkup.new(:target => target, :indent => 2).component({ :name => name }.merge(attrs)) do |xml|
121
121
  yield xml if block_given?
122
122
  end
123
123
  Buildr::IntellijIdea.new_document(target.string).root
@@ -219,7 +219,7 @@ module Buildr #:nodoc:
219
219
  end
220
220
 
221
221
  def annotation_paths
222
- @annotation_paths ||= [buildr_project._(:source, :main, :annotations)].select {|p| File.exist?(p)}
222
+ @annotation_paths ||= [buildr_project._(:source, :main, :annotations)].select { |p| File.exist?(p) }
223
223
  end
224
224
 
225
225
  def main_source_directories
@@ -349,7 +349,7 @@ module Buildr #:nodoc:
349
349
  name = options[:name] || 'Web'
350
350
  default_webroots = {}
351
351
  default_webroots[buildr_project._(:source, :main, :webapp)] = '/' if File.exist?(buildr_project._(:source, :main, :webapp))
352
- buildr_project.assets.paths.each {|p| default_webroots[p] = '/' }
352
+ buildr_project.assets.paths.each { |p| default_webroots[p] = '/' }
353
353
  webroots = options[:webroots] || default_webroots
354
354
  default_deployment_descriptors = []
355
355
  %w(web.xml sun-web.xml glassfish-web.xml jetty-web.xml geronimo-web.xml context.xml weblogic.xml jboss-deployment-structure.xml jboss-web.xml ibm-web-bnd.xml ibm-web-ext.xml ibm-web-ext-pme.xml).
@@ -375,7 +375,7 @@ module Buildr #:nodoc:
375
375
  end
376
376
  end
377
377
  end
378
- default_enable_jsf = webroots.keys.any?{|webroot| File.exist?("#{webroot}/WEB-INF/faces-config.xml")}
378
+ default_enable_jsf = webroots.keys.any? { |webroot| File.exist?("#{webroot}/WEB-INF/faces-config.xml") }
379
379
  enable_jsf = options[:enable_jsf].nil? ? default_enable_jsf : options[:enable_jsf]
380
380
  enable_jsf = false if buildr_project.root_project.ipr? && buildr_project.root_project.ipr.version >= '13'
381
381
  f.facet(:type => 'jsf', :name => 'JSF') do |jsf|
@@ -404,8 +404,8 @@ module Buildr #:nodoc:
404
404
  provider = options[:provider_enabled]
405
405
  else
406
406
  provider = nil
407
- {'org.hibernate.ejb.HibernatePersistence' => 'Hibernate',
408
- 'org.eclipse.persistence.jpa.PersistenceProvider' => 'EclipseLink'}.
407
+ { 'org.hibernate.ejb.HibernatePersistence' => 'Hibernate',
408
+ 'org.eclipse.persistence.jpa.PersistenceProvider' => 'EclipseLink' }.
409
409
  each_pair do |match, candidate_provider|
410
410
  deployment_descriptors.each do |descriptor|
411
411
  if File.exist?(descriptor) && /#{Regexp.escape(match)}/ =~ IO.read(descriptor)
@@ -608,7 +608,7 @@ module Buildr #:nodoc:
608
608
  unless paths.empty?
609
609
  xml.tag!('annotation-paths') do |xml|
610
610
  paths.each do |path|
611
- xml.root(:url=> file_path(path))
611
+ xml.root(:url => file_path(path))
612
612
  end
613
613
  end
614
614
  end
@@ -618,14 +618,14 @@ module Buildr #:nodoc:
618
618
  xml.content(:url => 'file://$MODULE_DIR$') do
619
619
  # Source folders
620
620
  [
621
- {:dirs => (self.main_source_directories.dup - self.main_generated_source_directories)},
622
- {:dirs => self.main_generated_source_directories, :generated => true},
623
- {:type => 'resource', :dirs => (self.main_resource_directories.dup - self.main_generated_resource_directories)},
624
- {:type => 'resource', :dirs => self.main_generated_resource_directories, :generated => true},
625
- {:test => true, :dirs => (self.test_source_directories - self.test_generated_source_directories)},
626
- {:test => true, :dirs => self.test_generated_source_directories, :generated => true},
627
- {:test => true, :type => 'resource', :dirs => (self.test_resource_directories - self.test_generated_resource_directories)},
628
- {:test => true, :type => 'resource', :dirs => self.test_generated_resource_directories, :generated => true},
621
+ { :dirs => (self.main_source_directories.dup - self.main_generated_source_directories) },
622
+ { :dirs => self.main_generated_source_directories, :generated => true },
623
+ { :type => 'resource', :dirs => (self.main_resource_directories.dup - self.main_generated_resource_directories) },
624
+ { :type => 'resource', :dirs => self.main_generated_resource_directories, :generated => true },
625
+ { :test => true, :dirs => (self.test_source_directories - self.test_generated_source_directories) },
626
+ { :test => true, :dirs => self.test_generated_source_directories, :generated => true },
627
+ { :test => true, :type => 'resource', :dirs => (self.test_resource_directories - self.test_generated_resource_directories) },
628
+ { :test => true, :type => 'resource', :dirs => self.test_generated_resource_directories, :generated => true },
629
629
  ].each do |content|
630
630
  content[:dirs].map { |dir| dir.to_s }.compact.sort.uniq.each do |dir|
631
631
  options = {}
@@ -658,14 +658,14 @@ module Buildr #:nodoc:
658
658
  end
659
659
 
660
660
  def generate_project_dependency(xml, other_project, export, test = false)
661
- attribs = {:type => 'module', 'module-name' => other_project}
661
+ attribs = { :type => 'module', 'module-name' => other_project }
662
662
  attribs[:exported] = '' if export
663
663
  attribs[:scope] = 'TEST' if test
664
664
  xml.orderEntry attribs
665
665
  end
666
666
 
667
667
  def generate_module_lib(xml, path, export, source_path, annotations_path, test = false)
668
- attribs = {:type => 'module-library'}
668
+ attribs = { :type => 'module-library' }
669
669
  attribs[:exported] = '' if export
670
670
  attribs[:scope] = 'TEST' if test
671
671
  xml.orderEntry attribs do
@@ -691,7 +691,7 @@ module Buildr #:nodoc:
691
691
  net = []
692
692
  all = self.excluded_directories.map { |dir| buildr_project._(dir.to_s) }.sort_by { |d| d.size }
693
693
  all.each_with_index do |dir, i|
694
- unless all[0 ... i].find { |other| dir =~ /^#{other}/ }
694
+ unless all[0...i].find { |other| dir =~ /^#{other}/ }
695
695
  net << dir
696
696
  end
697
697
  end
@@ -725,6 +725,10 @@ module Buildr #:nodoc:
725
725
  @jdk_version ||= buildr_project.compile.options.source || '1.7'
726
726
  end
727
727
 
728
+ def compiler_configuration_options
729
+ @compiler_configuration_options ||= {}
730
+ end
731
+
728
732
  def nonnull_assertions?
729
733
  @nonnull_assertions.nil? ? true : !!@nonnull_assertions
730
734
  end
@@ -781,7 +785,7 @@ module Buildr #:nodoc:
781
785
 
782
786
  def add_postgres_data_source(name, options = {})
783
787
  if options[:url].nil? && options[:database]
784
- default_url = "jdbc:postgresql://#{(options[:host] || '127.0.0.1')}:#{(options[:port] || '5432')}/#{options[:database]}"
788
+ default_url = "jdbc:postgresql://#{(options[:host] || '127.0.0.1')}:#{(options[:port] || '5432')}/#{options[:database]}"
785
789
  end
786
790
 
787
791
  params = {
@@ -901,7 +905,7 @@ module Buildr #:nodoc:
901
905
  }
902
906
  classpath = options[:classpath] || []
903
907
  xml.tag!('data-source', data_source_options) do |xml|
904
- xml.tag!('synchronize', (options[:synchronize]||'true'))
908
+ xml.tag!('synchronize', (options[:synchronize] || 'true'))
905
909
  xml.tag!('jdbc-driver', options[:driver]) if options[:driver]
906
910
  xml.tag!('jdbc-url', options[:url]) if options[:url]
907
911
  xml.tag!('user-name', options[:username]) if options[:username]
@@ -1002,7 +1006,7 @@ module Buildr #:nodoc:
1002
1006
  end
1003
1007
  end
1004
1008
 
1005
- def add_exploded_ear_artifact(project, options ={})
1009
+ def add_exploded_ear_artifact(project, options = {})
1006
1010
  artifact_name = to_artifact_name(project, options)
1007
1011
 
1008
1012
  add_artifact(artifact_name, 'exploded-ear', build_on_make(options)) do |xml|
@@ -1478,7 +1482,7 @@ module Buildr #:nodoc:
1478
1482
  buildr_project.projects.select { |subp| subp.iml? }.each do |subproject|
1479
1483
  module_path = subproject.base_dir.gsub(/^#{buildr_project.base_dir}\//, '')
1480
1484
  path = "#{module_path}/#{subproject.iml.name}.iml"
1481
- attribs = {:fileurl => "file://$PROJECT_DIR$/#{path}", :filepath => "$PROJECT_DIR$/#{path}"}
1485
+ attribs = { :fileurl => "file://$PROJECT_DIR$/#{path}", :filepath => "$PROJECT_DIR$/#{path}" }
1482
1486
  if subproject.iml.group == true
1483
1487
  attribs[:group] = subproject.parent.name.gsub(':', '/')
1484
1488
  elsif !subproject.iml.group.nil?
@@ -1528,7 +1532,7 @@ module Buildr #:nodoc:
1528
1532
  end
1529
1533
 
1530
1534
  def data_sources_component
1531
- create_composite_component('DataSourceManagerImpl', {:format => 'xml', :hash => '3208837817'}, self.data_sources)
1535
+ create_composite_component('DataSourceManagerImpl', { :format => 'xml', :hash => '3208837817' }, self.data_sources)
1532
1536
  end
1533
1537
 
1534
1538
  def artifacts_component
@@ -1538,6 +1542,9 @@ module Buildr #:nodoc:
1538
1542
  def compiler_configuration_component
1539
1543
  lambda do
1540
1544
  create_component('CompilerConfiguration') do |component|
1545
+ compiler_configuration_options.each_pair do |k, v|
1546
+ component.option :name => k, :value => v
1547
+ end
1541
1548
  component.addNotNullAssertions :enabled => 'false' unless nonnull_assertions?
1542
1549
  component.wildcardResourcePatterns do |xml|
1543
1550
  wildcard_resource_patterns.each do |pattern|
@@ -1554,8 +1561,8 @@ module Buildr #:nodoc:
1554
1561
  disabled = []
1555
1562
  Buildr.projects.each do |prj|
1556
1563
  next unless prj.iml?
1557
- main_processor = !!prj.compile.options[:processor] || prj.compile.options[:processor].nil?
1558
- test_processor = !!prj.test.compile.options[:processor] || prj.test.compile.options[:processor].nil?
1564
+ main_processor = !!prj.compile.options[:processor] || (prj.compile.options[:processor].nil? && !(prj.compile.options[:processor_path] || []).empty?)
1565
+ test_processor = !!prj.test.compile.options[:processor] || (prj.test.compile.options[:processor].nil? && !(prj.test.compile.options[:processor_path] || []).empty?)
1559
1566
  if main_processor || test_processor
1560
1567
  xml.profile(:name => "#{prj.name}", :enabled => true) do
1561
1568
  xml.sourceOutputDir :name => 'generated/processors/main/java' if main_processor
@@ -1597,7 +1604,7 @@ module Buildr #:nodoc:
1597
1604
  resolve_path_from_base(path, '$PROJECT_DIR$')
1598
1605
  end
1599
1606
 
1600
- private
1607
+ private
1601
1608
 
1602
1609
  def default_code_sight_excludes
1603
1610
  %w(
@@ -1717,7 +1724,7 @@ module Buildr #:nodoc:
1717
1724
  ].compact
1718
1725
 
1719
1726
  files.each do |ideafile|
1720
- module_dir = File.dirname(ideafile.filename)
1727
+ module_dir = File.dirname(ideafile.filename)
1721
1728
  idea.enhance do |task|
1722
1729
  mkdir_p module_dir
1723
1730
  info "Writing #{ideafile.filename}"
@@ -70,7 +70,7 @@ module Java
70
70
  paths = cp.map do |c|
71
71
  File.directory?(c) && !c.end_with?('/') ? "#{c}/" : c.to_s
72
72
  end
73
- manifest = Buildr::Packaging::Java::Manifest.new([{'Class-Path' => paths.map{|p| URI.encode(p)}.join(" ")}])
73
+ manifest = Buildr::Packaging::Java::Manifest.new([{'Class-Path' => paths.map{|p| CGI.escape(p)}.join(" ")}])
74
74
  tjar = Tempfile.new(%w[javacmd .jar])
75
75
  Zip::OutputStream.open(tjar.path) do |zos|
76
76
  zos.put_next_entry('META-INF/MANIFEST.MF')
@@ -274,7 +274,7 @@ module Buildr #:nodoc:
274
274
  include Extension
275
275
 
276
276
  before_define(:package => :build) do |project|
277
- if project.parent && project.parent.manifest
277
+ if project.parent&.manifest
278
278
  project.manifest = project.parent.manifest.dup
279
279
  else
280
280
  project.manifest = {
@@ -282,7 +282,7 @@ module Buildr #:nodoc:
282
282
  'Implementation-Title'=>project.comment || project.name,
283
283
  'Implementation-Version'=>project.version }
284
284
  end
285
- if project.parent && project.parent.meta_inf
285
+ if project.parent&.meta_inf
286
286
  project.meta_inf = project.parent.meta_inf.dup
287
287
  else
288
288
  project.meta_inf = [project.file('LICENSE')].select { |file| File.exist?(file.to_s) }
@@ -246,9 +246,8 @@ module Buildr #:nodoc:
246
246
  # Username/password may be part of URI, or separate entities.
247
247
  uri = URI.parse(upload_to[:url].clone)
248
248
  uri.path = uri.path + '/' unless uri.path[-1] == '/'
249
- to_escape = "!\"\#$%&'()*+,-./:;<=>?@{}|~`'"
250
- uri.user = URI.encode(upload_to[:username], to_escape) if upload_to[:username]
251
- uri.password = URI.encode(upload_to[:password], to_escape) if upload_to[:password]
249
+ uri.user = CGI.escape(upload_to[:username]) if upload_to[:username]
250
+ uri.password = CGI.escape(upload_to[:password]) if upload_to[:password]
252
251
 
253
252
  path = group.gsub('.', '/') + "/#{id}/#{version}/#{upload_name}"
254
253
 
@@ -14,5 +14,5 @@
14
14
  # the License.
15
15
 
16
16
  module Buildr #:nodoc:
17
- VERSION = '1.5.12'.freeze
17
+ VERSION = '1.5.17'.freeze
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: realityforge-buildr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.12
4
+ version: 1.5.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apache Buildr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-20 00:00:00.000000000 Z
11
+ date: 2021-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -182,6 +182,7 @@ files:
182
182
  - NOTICE
183
183
  - README.md
184
184
  - Rakefile
185
+ - addon/buildr/api_diff_tool.rb
185
186
  - addon/buildr/checkstyle-report.xsl
186
187
  - addon/buildr/checkstyle.rb
187
188
  - addon/buildr/git_auto_version.rb
@@ -189,6 +190,7 @@ files:
189
190
  - addon/buildr/gwt.rb
190
191
  - addon/buildr/jacoco.rb
191
192
  - addon/buildr/pmd.rb
193
+ - addon/buildr/release_tool.rb
192
194
  - addon/buildr/shade.rb
193
195
  - addon/buildr/single_intermediate_layout.rb
194
196
  - addon/buildr/spotbugs.rb