realityforge-buildr 1.5.15 → 1.5.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8fa34dd92a2579440a4004d0b4a90d43e0cba4302d19e2f7d983db46984123d
4
- data.tar.gz: 1b3adb97db7e6bd180232bd89a97d177c3701423a37eee8711e1e14c6b87b00e
3
+ metadata.gz: 1932d8782ef4f08cac42f5941f4f98922ea4a5323ead460b1cfe429447a920b6
4
+ data.tar.gz: cfac26c31803f3579cef1876d48969c0c0166107636d107b851b34b2142d436b
5
5
  SHA512:
6
- metadata.gz: 97881c109b09796e52353d719ba96ea0efc7277f5ce8f6f80c30e12109ebd202e6b97aae56f1833f3d09d12ec870cd906ac90183174d3b881b3903d5c638c385
7
- data.tar.gz: 4ff07b06229fe1cbcdbf0e47028e8ac8758c408f0929a7a5397edf05d6653fb54866e433b5970f0acc14fe611b42ec0e100aa25aac0db639fe3d8975aa4ded88
6
+ metadata.gz: fc78f9279e57e8fbbad90e9bc7e0d60cc755f02d573a8a13f87986535549ece7c76597b6be505b54c6f8491ba6677dc267d949aebcf5304c1b5077a3de119404
7
+ data.tar.gz: 222f81cd3439630178a37adf725b1879946b3aa9eab171a1dce2dd996439aee8046992e9e95de2520bfb002aea535b70f9f8f3fb047044efcc0b9761ec9a60d8
@@ -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
@@ -22,8 +22,7 @@ module Buildr
22
22
  unless project.version
23
23
  version_suffix = ENV['BUILD_NUMBER'] ? "-#{ENV['BUILD_NUMBER']}" : ''
24
24
  version_prefix = ENV['VERSION_PREFIX'] ? "#{ENV['VERSION_PREFIX']}-" : ''
25
- git_version = `git describe --tags --always`.strip
26
- git_version = git_version.gsub(/^v([0-9])/, '\1')
25
+ git_version = `git describe --always`.strip
27
26
  project.version = version_prefix + git_version + version_suffix
28
27
  end
29
28
  end
data/addon/buildr/gwt.rb CHANGED
@@ -266,10 +266,6 @@ module Buildr
266
266
  args << '-XenableClosureCompiler'
267
267
  end
268
268
 
269
- if options[:js_exports]
270
- args << '-generateJsInteropExports'
271
- end
272
-
273
269
  args += modules
274
270
 
275
271
  properties = options[:properties] ? options[:properties].dup : {}
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,289 @@
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
+ release_notes_file = options[:release_notes_summary_file]
152
+ if release_notes_file && File.exist?(release_notes_file)
153
+ summary_content = IO.read(release_notes_file).strip
154
+ unless summary_content.empty?
155
+ header += summary_content + "\n"
156
+ IO.write(release_notes_file, "\n")
157
+ end
158
+ end
159
+
160
+ header += <<CONTENT
161
+
162
+ Changes in this release:
163
+ CONTENT
164
+
165
+ IO.write('CHANGELOG.md', changelog.gsub("### Unreleased\n", header))
166
+
167
+ sh 'git reset 2>&1 1> /dev/null'
168
+ sh "git add #{release_notes_file}" if File.exist?(release_notes_file)
169
+ sh 'git add CHANGELOG.md'
170
+ sh 'git commit -m "Update CHANGELOG.md in preparation for release"'
171
+ end
172
+ end
173
+
174
+ def patch_maven_version_in_readme
175
+ stage('PatchReadme', 'Patch the README to update from previous release') do
176
+ contents = IO.read('README.md')
177
+ contents = contents.
178
+ gsub("<version>#{ENV['PREVIOUS_PRODUCT_VERSION']}</version>", "<version>#{ENV['PRODUCT_VERSION']}</version>").
179
+ gsub("/#{ENV['PREVIOUS_PRODUCT_VERSION']}/", "/#{ENV['PRODUCT_VERSION']}/").
180
+ gsub("-#{ENV['PREVIOUS_PRODUCT_VERSION']}-", "-#{ENV['PRODUCT_VERSION']}-")
181
+ IO.write('README.md', contents)
182
+
183
+ sh 'git reset 2>&1 1> /dev/null'
184
+ sh 'git add README.md'
185
+ sh 'git commit -m "Update README.md in preparation for release"'
186
+ end
187
+ end
188
+
189
+ def tag_project
190
+ stage('TagProject', 'Tag the project') do
191
+ sh "git tag v#{ENV['PRODUCT_VERSION']}"
192
+ end
193
+ end
194
+
195
+ def stage_release(options = {})
196
+ release_to = options[:release_to] || (raise "StageRelease stage must specify :release_to configuration")
197
+ stage('StageRelease', 'Stage the release') do
198
+ IO.write('_buildr.rb', "repositories.release_to = #{release_to.inspect}")
199
+ sh 'bundle exec buildr clean upload TEST=no GWT=no'
200
+ sh 'rm -f _buildr.rb'
201
+ end
202
+ end
203
+
204
+ def maven_central_publish(options = {})
205
+ additional_tasks = options[:additional_tasks] || ''
206
+ stage('MavenCentralPublish', 'Publish artifacts to Maven Central') do
207
+ sh "bundle exec buildr clean mcrt:publish_if_tagged #{additional_tasks} TEST=no GWT=no"
208
+ end
209
+ end
210
+
211
+ def patch_changelog_post_release
212
+ stage('PatchChangelogPostRelease', 'Patch the changelog post release to prepare for next development iteration') do
213
+ changelog = IO.read('CHANGELOG.md')
214
+ changelog = changelog.gsub("# Change Log\n", <<HEADER)
215
+ # Change Log
216
+
217
+ ### Unreleased
218
+ HEADER
219
+ IO.write('CHANGELOG.md', changelog)
220
+
221
+ `bundle exec zapwhite`
222
+ sh 'git add CHANGELOG.md'
223
+ sh 'git commit -m "Update CHANGELOG.md in preparation for next development iteration"'
224
+ end
225
+ end
226
+
227
+ def push_changes
228
+ stage('PushChanges', 'Push changes to git repository') do
229
+ sh 'git push'
230
+ sh 'git push --tags'
231
+ end
232
+ end
233
+
234
+ def github_release(repository_name)
235
+ stage('GithubRelease', 'Create a Release on GitHub') do
236
+ changelog = IO.read('CHANGELOG.md')
237
+ start = changelog.index("### [v#{ENV['PRODUCT_VERSION']}]")
238
+ raise "Unable to locate version #{ENV['PRODUCT_VERSION']} in change log" if -1 == start
239
+ start = changelog.index("\n", start)
240
+ start = changelog.index("\n", start + 1)
241
+
242
+ end_index = changelog.index('### [v', start)
243
+ end_index = changelog.length if end_index.nil?
244
+
245
+ changes = changelog[start, end_index - start]
246
+
247
+ changes = changes.strip
248
+
249
+ tag = "v#{ENV['PRODUCT_VERSION']}"
250
+
251
+ version_parts = ENV['PRODUCT_VERSION'].split('.')
252
+ prerelease = '0' == version_parts[0]
253
+
254
+ require 'octokit'
255
+
256
+ client = Octokit::Client.new(:netrc => true, :auto_paginate => true)
257
+ client.login
258
+ client.create_release(repository_name, tag, :name => tag, :body => changes, :draft => false, :prerelease => prerelease)
259
+
260
+ candidates = client.list_milestones(repository_name).select { |m| m[:title].to_s == tag }
261
+ unless candidates.empty?
262
+ milestone = candidates[0]
263
+ unless milestone[:state] == 'closed'
264
+ client.update_milestone(repository_name, milestone[:number], :state => 'closed')
265
+ end
266
+ end
267
+ end
268
+ end
269
+
270
+ def stage(stage_name, description, options = {})
271
+ if ENV['STAGE'].nil? || ENV['STAGE'] == stage_name || options[:always_run]
272
+ puts "🚀 Release Stage: #{stage_name} - #{description}"
273
+ begin
274
+ yield
275
+ rescue Exception => e
276
+ puts '💣 Error completing stage.'
277
+ 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']}" : ''}"
278
+ raise e
279
+ end
280
+ ENV['STAGE'] = nil unless options[:always_run]
281
+ elsif !ENV['STAGE'].nil?
282
+ puts "Skipping Stage: #{stage_name} - #{description}"
283
+ end
284
+ if ENV['LAST_STAGE'] == stage_name
285
+ ENV['STAGE'] = ENV['LAST_STAGE']
286
+ end
287
+ end
288
+ end
289
+ end
@@ -431,40 +431,6 @@ module Buildr #:nodoc:
431
431
  end
432
432
  end
433
433
 
434
- def add_ejb_facet(options = {})
435
- name = options[:name] || 'EJB'
436
-
437
- default_ejb_roots = [buildr_project.iml.main_source_directories, buildr_project.compile.sources, buildr_project.resources.sources].flatten.compact
438
- ejb_roots = options[:ejb_roots] || default_ejb_roots
439
-
440
- default_deployment_descriptors = []
441
- %w(ejb-jar.xml glassfish-ejb-jar.xml ibm-ejb-jar-bnd.xml ibm-ejb-jar-ext-pme.xml ibm-ejb-jar-ext.xml jboss.xml jbosscmp-jdbc.xml openejb-jar.xml sun-cmp-mapping.xml sun-ejb-jar.xml weblogic-cmp-rdbms-jar.xml weblogic-ejb-jar.xml).
442
- each do |descriptor|
443
- ejb_roots.each do |path|
444
- d = "#{path}/WEB-INF/#{descriptor}"
445
- default_deployment_descriptors << d if File.exist?(d)
446
- d = "#{path}/META-INF/#{descriptor}"
447
- default_deployment_descriptors << d if File.exist?(d)
448
- end
449
- end
450
- deployment_descriptors = options[:deployment_descriptors] || default_deployment_descriptors
451
-
452
- add_facet(name, 'ejb') do |facet|
453
- facet.configuration do |c|
454
- c.descriptors do |d|
455
- deployment_descriptors.each do |deployment_descriptor|
456
- d.deploymentDescriptor :name => File.basename(deployment_descriptor), :url => file_path(deployment_descriptor)
457
- end
458
- end
459
- c.ejbRoots do |e|
460
- ejb_roots.each do |ejb_root|
461
- e.root :url => file_path(ejb_root)
462
- end
463
- end
464
- end
465
- end
466
- end
467
-
468
434
  protected
469
435
 
470
436
  def main_dependency_details
@@ -850,14 +816,16 @@ module Buildr #:nodoc:
850
816
  value.list :size => '2' do |list|
851
817
  list.item :index => '0', :class => 'java.lang.String', :itemvalue => 'org.jetbrains.annotations.Nullable'
852
818
  list.item :index => '1', :class => 'java.lang.String', :itemvalue => 'javax.annotation.Nullable'
819
+ list.item :index => '2', :class => 'java.lang.String', :itemvalue => 'jsinterop.annotations.JsNullable'
853
820
  end
854
821
  end
855
822
  end
856
823
  component.option :name => 'myNotNulls' do |option|
857
824
  option.value do |value|
858
- value.list :size => '2' do |list|
825
+ value.list :size => '3' do |list|
859
826
  list.item :index => '0', :class => 'java.lang.String', :itemvalue => 'org.jetbrains.annotations.NotNull'
860
827
  list.item :index => '1', :class => 'java.lang.String', :itemvalue => 'javax.annotation.Nonnull'
828
+ list.item :index => '2', :class => 'java.lang.String', :itemvalue => 'jsinterop.annotations.JsNonNull'
861
829
  end
862
830
  end
863
831
  end
@@ -1419,7 +1387,6 @@ module Buildr #:nodoc:
1419
1387
  def artifact_content(xml, project, projects, options)
1420
1388
  emit_module_output(xml, projects)
1421
1389
  emit_jpa_descriptors(xml, project, options)
1422
- emit_ejb_descriptors(xml, project, options)
1423
1390
  end
1424
1391
 
1425
1392
  def extension
@@ -1563,12 +1530,17 @@ module Buildr #:nodoc:
1563
1530
  next unless prj.iml?
1564
1531
  main_processor = !!prj.compile.options[:processor] || (prj.compile.options[:processor].nil? && !(prj.compile.options[:processor_path] || []).empty?)
1565
1532
  test_processor = !!prj.test.compile.options[:processor] || (prj.test.compile.options[:processor].nil? && !(prj.test.compile.options[:processor_path] || []).empty?)
1533
+ processor_options = (prj.compile.options[:processor_options] || {}).merge(prj.test.compile.options[:processor_options] || {})
1566
1534
  if main_processor || test_processor
1567
1535
  xml.profile(:name => "#{prj.name}", :enabled => true) do
1568
1536
  xml.sourceOutputDir :name => 'generated/processors/main/java' if main_processor
1569
1537
  xml.sourceTestOutputDir :name => 'generated/processors/test/java' if test_processor
1570
1538
  xml.outputRelativeToContentRoot :value => true
1571
1539
  xml.module :name => prj.iml.name
1540
+ processor_options.each do |k, v|
1541
+ xml.option :name => k, :value => v
1542
+ end
1543
+
1572
1544
  processor_path = (prj.compile.options[:processor_path] || []) + (prj.test.compile.options[:processor_path] || [])
1573
1545
  if processor_path.empty?
1574
1546
  xml.processorPath :useClasspath => true
@@ -1653,16 +1625,6 @@ module Buildr #:nodoc:
1653
1625
  xml.tag!('output-path', resolve_path(output_dir))
1654
1626
  end
1655
1627
 
1656
- def emit_ejb_descriptors(xml, project, options)
1657
- if options[:enable_ejb] || (options[:ejb_module_names] && options[:ejb_module_names].size > 0)
1658
- module_names = options[:ejb_module_names] || [project.iml.name]
1659
- module_names.each do |module_name|
1660
- facet_name = options[:ejb_facet_name] || 'EJB'
1661
- xml.element :id => 'javaee-facet-resources', :facet => "#{module_name}/ejb/#{facet_name}"
1662
- end
1663
- end
1664
- end
1665
-
1666
1628
  def emit_jpa_descriptors(xml, project, options)
1667
1629
  if options[:enable_jpa] || (options[:jpa_module_names] && options[:jpa_module_names].size > 0)
1668
1630
  module_names = options[:jpa_module_names] || [project.iml.name]
@@ -23,6 +23,9 @@ module Buildr
23
23
  end
24
24
 
25
25
  after_define do |project|
26
+ Buildr.artifacts((project.compile.options[:processor_path] || []) + (project.test.compile.options[:processor_path] || [])).flatten.map(&:to_s).map do |t|
27
+ Rake::Task['rake:artifacts'].enhance([task(t)])
28
+ end
26
29
  if !!project.compile.options[:processor] || (project.compile.options[:processor].nil? && !(project.compile.options[:processor_path] || []).empty?)
27
30
  path = project._(:target, :generated, 'processors/main/java')
28
31
  f = project.file(path) do |t|
@@ -115,13 +115,15 @@ module Java
115
115
  # * :classpath -- One or more file names, tasks or artifact specifications. These are all expanded into artifacts, and all tasks are invoked.
116
116
  # * :sourcepath -- Additional source paths to use.
117
117
  # * :processor_path -- Annotation processor path. These are all expanded into artifacts, and all tasks are invoked.
118
+ # * :processor_options -- Annotation processor options.
118
119
  # * :javac_args -- Any additional arguments to pass (e.g. -extdirs, -encoding)
119
120
  # * :name -- Shows this name, otherwise shows the working directory.
120
121
  def javac(*args, &block)
121
122
  options = Hash === args.last ? args.pop : {}
122
- rake_check_options options, :classpath, :sourcepath, :output, :javac_args, :name, :processor, :processor_path
123
+ rake_check_options options, :classpath, :sourcepath, :output, :javac_args, :name, :processor, :processor_path, :processor_options
123
124
 
124
125
  processor = !!options[:processor]
126
+ processor_options = options[:processor_options] || {}
125
127
 
126
128
  files = args.flatten.each { |f| f.invoke if f.respond_to?(:invoke) }.map(&:to_s).
127
129
  collect { |arg| File.directory?(arg) ? FileList["#{File.expand_path(arg)}/**/*.java"] : File.expand_path(arg) }.flatten
@@ -135,6 +137,9 @@ module Java
135
137
  if processor
136
138
  processor_path = classpath_from(options[:processor_path])
137
139
  cmd_args << '-processorpath' << processor_path.join(File::PATH_SEPARATOR) unless processor_path.empty?
140
+ processor_options.each do |k, v|
141
+ cmd_args << "-A#{k}=#{v}"
142
+ end
138
143
  else
139
144
  cmd_args << '-proc:none'
140
145
  end
@@ -33,7 +33,7 @@ module Buildr #:nodoc:
33
33
  # (e.g. ['-implicit:none', '-encoding', 'iso-8859-1'])
34
34
  class Javac < Base
35
35
 
36
- OPTIONS = [:warnings, :debug, :deprecation, :source, :target, :lint, :other, :processor_path, :processor]
36
+ OPTIONS = [:warnings, :debug, :deprecation, :source, :target, :lint, :other, :processor_path, :processor_options, :processor]
37
37
 
38
38
  specify :language => :java, :target => 'classes', :target_ext => 'class', :packaging => :jar
39
39
 
@@ -45,6 +45,7 @@ module Buildr #:nodoc:
45
45
  options[:lint] ||= false
46
46
  options[:processor] ||= nil
47
47
  options[:processor_path] ||= []
48
+ options[:processor_options] ||= {}
48
49
  end
49
50
 
50
51
  def compile(sources, target, dependencies) #:nodoc:
@@ -76,6 +77,9 @@ module Buildr #:nodoc:
76
77
  args << '-deprecation' if options[:deprecation]
77
78
  args << '-source' << options[:source].to_s if options[:source]
78
79
  args << '-target' << options[:target].to_s if options[:target]
80
+ options[:processor_options].each do |k, v|
81
+ args << "-A#{k}=#{v}"
82
+ end
79
83
  case options[:lint]
80
84
  when Array then args << "-Xlint:#{options[:lint].join(',')}"
81
85
  when String then args << "-Xlint:#{options[:lint]}"
@@ -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) }
@@ -95,10 +95,10 @@ module Buildr #:nodoc:
95
95
  tmp.close unless tmp.nil?
96
96
  end
97
97
  # testng-failed.xml contains the list of failed tests *only*
98
- failed_tests = File.join(task.report_to.to_s, 'testng-failed.xml')
98
+ failed_tests = File.join(task.report_to.to_s, task.project.id.to_s, 'Command line test.xml')
99
99
  if File.exist?(failed_tests)
100
100
  report = File.read(failed_tests)
101
- failed = report.scan(/<class name="(.*?)">/im).flatten
101
+ failed = report.scan(/<testcase [^>]+ classname="([^"]+)">/im).flatten
102
102
  # return the list of passed tests
103
103
  tests - failed
104
104
  else
@@ -14,5 +14,5 @@
14
14
  # the License.
15
15
 
16
16
  module Buildr #:nodoc:
17
- VERSION = '1.5.15'.freeze
17
+ VERSION = '1.5.18'.freeze
18
18
  end
data/rakelib/release.rake CHANGED
@@ -1,5 +1,3 @@
1
- WORKSPACE_DIR = File.expand_path(File.dirname(__FILE__) + '/..')
2
-
3
1
  ENV['PREVIOUS_PRODUCT_VERSION'] = nil if ENV['PREVIOUS_PRODUCT_VERSION'].to_s == ''
4
2
  ENV['PRODUCT_VERSION'] = nil if ENV['PRODUCT_VERSION'].to_s == ''
5
3
 
@@ -32,7 +30,8 @@ end
32
30
  desc 'Perform a release'
33
31
  task 'perform_release' do
34
32
 
35
- in_dir(WORKSPACE_DIR) do
33
+ base_directory = File.dirname(Buildr.application.buildfile.to_s)
34
+ in_dir(base_directory) do
36
35
  stage('ExtractVersion', 'Extract the version from the version constant', :always_run => true) do
37
36
  ENV['PRODUCT_VERSION'] ||= IO.read('lib/buildr/version.rb')[/VERSION = '(\d+\.\d+\.\d+)(\.dev)?'\.freeze/, 1]
38
37
  raise "Unable to extract version from lib/buildr/version.rb" unless ENV['PRODUCT_VERSION']
@@ -625,74 +625,6 @@ describe Buildr::IntellijIdea do
625
625
  end
626
626
  end
627
627
 
628
- describe "using add_ejb_facet" do
629
- before do
630
- write "src/main/java/com/bin/foo.java"
631
- write "src/main/resources/WEB-INF/ejb-jar.xml"
632
-
633
- @foo = define "foo" do
634
- iml.add_ejb_facet
635
- end
636
- invoke_generate_task
637
- end
638
-
639
- it "generates an ejb facet with appropriate deployment descriptors" do
640
- doc = xml_document(@foo._("foo.iml"))
641
- ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
642
- deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
643
- doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml', url='file://$MODULE_DIR$/src/main/resources/WEB-INF/ejb-jar.xml']")
644
- end
645
-
646
- it "generates an ejb facet with derived ejbRoots" do
647
- doc = xml_document(@foo._("foo.iml"))
648
- ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
649
- doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/src/main/java']")
650
- doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/src/main/resources']")
651
- end
652
- end
653
-
654
- describe "using add_ejb_facet specifying parameters" do
655
- before do
656
- @foo = define "foo" do
657
- iml.add_ejb_facet(:ejb_roots => %w[generated/main/java generated/main/resources],
658
- :deployment_descriptors => ["generated/main/resources/WEB-INF/ejb-jar.xml"])
659
- end
660
- invoke_generate_task
661
- end
662
-
663
- it "generates an ejb facet with appropriate deployment descriptors" do
664
- doc = xml_document(@foo._("foo.iml"))
665
- ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
666
- deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
667
- doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml', url='file://$MODULE_DIR$/generated/main/resources/WEB-INF/ejb-jar.xml']")
668
- end
669
-
670
- it "generates an ejb facet with derived ejbRoots" do
671
- doc = xml_document(@foo._("foo.iml"))
672
- ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
673
- doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/generated/main/java']")
674
- doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/generated/main/resources']")
675
- end
676
- end
677
-
678
- describe "using add_ejb_facet derived from main_source_directories" do
679
- before do
680
- write "src/main/resources2/WEB-INF/ejb-jar.xml"
681
- @foo = define "foo" do
682
- iml.main_source_directories << "src/main/resources2"
683
- iml.add_ejb_facet
684
- end
685
- invoke_generate_task
686
- end
687
-
688
- it "generates an ejb facet with appropriate deployment descriptors" do
689
- doc = xml_document(@foo._("foo.iml"))
690
- ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
691
- deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
692
- doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml', url='file://$MODULE_DIR$/src/main/resources2/WEB-INF/ejb-jar.xml']")
693
- end
694
- end
695
-
696
628
  describe "with add_data_source" do
697
629
  before do
698
630
  artifact("org.postgresql:postgresql:jar:9.not-a-version") { |task| write task.name }
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.15
4
+ version: 1.5.18
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-26 00:00:00.000000000 Z
11
+ date: 2022-04-20 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