rake 12.0.0.beta1 → 13.0.0.pre.1
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 +5 -5
- data/.github/workflows/macos.yml +22 -0
- data/.github/workflows/ubuntu-rvm.yml +28 -0
- data/.github/workflows/ubuntu.yml +20 -0
- data/.github/workflows/windows.yml +20 -0
- data/CONTRIBUTING.rdoc +11 -4
- data/Gemfile +7 -0
- data/History.rdoc +124 -11
- data/README.rdoc +7 -8
- data/Rakefile +7 -4
- data/bin/bundle +105 -0
- data/bin/rake +29 -0
- data/bin/rdoc +29 -0
- data/bin/rubocop +29 -0
- data/doc/jamis.rb +1 -0
- data/doc/rakefile.rdoc +1 -1
- data/lib/rake.rb +1 -0
- data/lib/rake/application.rb +54 -15
- data/lib/rake/backtrace.rb +1 -0
- data/lib/rake/clean.rb +4 -3
- data/lib/rake/cloneable.rb +1 -0
- data/lib/rake/cpu_counter.rb +2 -1
- data/lib/rake/default_loader.rb +1 -0
- data/lib/rake/dsl_definition.rb +4 -3
- data/lib/rake/early_time.rb +1 -0
- data/lib/rake/ext/core.rb +1 -0
- data/lib/rake/ext/string.rb +2 -1
- data/lib/rake/file_creation_task.rb +2 -1
- data/lib/rake/file_list.rb +5 -4
- data/lib/rake/file_task.rb +11 -3
- data/lib/rake/file_utils.rb +10 -12
- data/lib/rake/file_utils_ext.rb +7 -17
- data/lib/rake/invocation_chain.rb +1 -0
- data/lib/rake/invocation_exception_mixin.rb +1 -0
- data/lib/rake/late_time.rb +1 -0
- data/lib/rake/linked_list.rb +1 -0
- data/lib/rake/loaders/makefile.rb +1 -0
- data/lib/rake/multi_task.rb +2 -37
- data/lib/rake/name_space.rb +1 -0
- data/lib/rake/packagetask.rb +18 -6
- data/lib/rake/phony.rb +1 -0
- data/lib/rake/private_reader.rb +1 -0
- data/lib/rake/promise.rb +3 -2
- data/lib/rake/pseudo_status.rb +1 -0
- data/lib/rake/rake_module.rb +29 -0
- data/lib/rake/rake_test_loader.rb +17 -11
- data/lib/rake/rule_recursion_overflow_error.rb +1 -0
- data/lib/rake/scope.rb +2 -1
- data/lib/rake/task.rb +59 -16
- data/lib/rake/task_argument_error.rb +1 -0
- data/lib/rake/task_arguments.rb +2 -0
- data/lib/rake/task_manager.rb +42 -17
- data/lib/rake/tasklib.rb +1 -0
- data/lib/rake/testtask.rb +3 -1
- data/lib/rake/thread_history_display.rb +1 -0
- data/lib/rake/thread_pool.rb +1 -0
- data/lib/rake/trace_output.rb +1 -0
- data/lib/rake/version.rb +2 -1
- data/lib/rake/win32.rb +1 -0
- data/rake.gemspec +4 -7
- metadata +13 -52
- data/.gitignore +0 -14
- data/.rubocop.yml +0 -57
- data/.travis.yml +0 -21
- data/appveyor.yml +0 -21
data/lib/rake/file_utils_ext.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "rake/file_utils"
|
2
3
|
|
3
4
|
module Rake
|
@@ -22,19 +23,18 @@ module Rake
|
|
22
23
|
opts = FileUtils.options_of name
|
23
24
|
default_options = []
|
24
25
|
if opts.include?("verbose")
|
25
|
-
default_options << ":
|
26
|
+
default_options << "verbose: FileUtilsExt.verbose_flag"
|
26
27
|
end
|
27
28
|
if opts.include?("noop")
|
28
|
-
default_options << ":
|
29
|
+
default_options << "noop: FileUtilsExt.nowrite_flag"
|
29
30
|
end
|
30
31
|
|
31
32
|
next if default_options.empty?
|
32
33
|
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
33
|
-
def #{name}(
|
34
|
-
super(
|
35
|
-
|
36
|
-
|
37
|
-
), &block)
|
34
|
+
def #{name}(*args, **options, &block)
|
35
|
+
super(*args,
|
36
|
+
#{default_options.join(', ')},
|
37
|
+
**options, &block)
|
38
38
|
end
|
39
39
|
EOS
|
40
40
|
end
|
@@ -112,16 +112,6 @@ module Rake
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
-
# Merge the given options with the default values.
|
116
|
-
def rake_merge_option(args, defaults)
|
117
|
-
if Hash === args.last
|
118
|
-
defaults.update(args.last)
|
119
|
-
args.pop
|
120
|
-
end
|
121
|
-
args.push defaults
|
122
|
-
args
|
123
|
-
end
|
124
|
-
|
125
115
|
# Send the message to the default rake output (which is $stderr).
|
126
116
|
def rake_output_message(message)
|
127
117
|
$stderr.puts(message)
|
data/lib/rake/late_time.rb
CHANGED
data/lib/rake/linked_list.rb
CHANGED
data/lib/rake/multi_task.rb
CHANGED
@@ -1,49 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Rake
|
2
3
|
|
3
4
|
# Same as a regular task, but the immediate prerequisites are done in
|
4
5
|
# parallel using Ruby threads.
|
5
6
|
#
|
6
7
|
class MultiTask < Task
|
7
|
-
|
8
|
-
# Same as invoke, but explicitly pass a call chain to detect
|
9
|
-
# circular dependencies. This is largely copied from Rake::Task
|
10
|
-
# but has been updated such that if multiple tasks depend on this
|
11
|
-
# one in parallel, they will all fail if the first execution of
|
12
|
-
# this task fails.
|
13
|
-
def invoke_with_call_chain(task_args, invocation_chain)
|
14
|
-
new_chain = Rake::InvocationChain.append(self, invocation_chain)
|
15
|
-
@lock.synchronize do
|
16
|
-
begin
|
17
|
-
if @already_invoked
|
18
|
-
if @invocation_exception
|
19
|
-
if application.options.trace
|
20
|
-
application.trace "** Previous invocation of #{name} failed #{format_trace_flags}"
|
21
|
-
end
|
22
|
-
raise @invocation_exception
|
23
|
-
else
|
24
|
-
return
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
if application.options.trace
|
29
|
-
application.trace "** Invoke #{name} #{format_trace_flags}"
|
30
|
-
end
|
31
|
-
@already_invoked = true
|
32
|
-
|
33
|
-
invoke_prerequisites(task_args, new_chain)
|
34
|
-
execute(task_args) if needed?
|
35
|
-
rescue Exception => ex
|
36
|
-
add_chain_to(ex, new_chain)
|
37
|
-
@invocation_exception = ex
|
38
|
-
raise
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
8
|
private
|
9
|
+
|
44
10
|
def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
|
45
11
|
invoke_prerequisites_concurrently(task_args, invocation_chain)
|
46
12
|
end
|
47
13
|
end
|
48
|
-
|
49
14
|
end
|
data/lib/rake/name_space.rb
CHANGED
data/lib/rake/packagetask.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Define a package task library to aid in the definition of
|
2
3
|
# redistributable package files.
|
3
4
|
|
@@ -78,6 +79,9 @@ module Rake
|
|
78
79
|
# Zip command for zipped archives. The default is 'zip'.
|
79
80
|
attr_accessor :zip_command
|
80
81
|
|
82
|
+
# True if parent directory should be omited (default is false)
|
83
|
+
attr_accessor :without_parent_dir
|
84
|
+
|
81
85
|
# Create a Package Task with the given name and version. Use +:noversion+
|
82
86
|
# as the version to build a package without a version or to provide a
|
83
87
|
# fully-versioned package name.
|
@@ -101,6 +105,7 @@ module Rake
|
|
101
105
|
@need_zip = false
|
102
106
|
@tar_command = "tar"
|
103
107
|
@zip_command = "zip"
|
108
|
+
@without_parent_dir = false
|
104
109
|
end
|
105
110
|
|
106
111
|
# Create the tasks defined by this task library.
|
@@ -131,9 +136,8 @@ module Rake
|
|
131
136
|
task package: ["#{package_dir}/#{file}"]
|
132
137
|
file "#{package_dir}/#{file}" =>
|
133
138
|
[package_dir_path] + package_files do
|
134
|
-
chdir(
|
135
|
-
|
136
|
-
end
|
139
|
+
chdir(working_dir) { sh @tar_command, "#{flag}cvf", file, target_dir }
|
140
|
+
mv "#{package_dir_path}/#{target_dir}", package_dir if without_parent_dir
|
137
141
|
end
|
138
142
|
end
|
139
143
|
end
|
@@ -142,9 +146,8 @@ module Rake
|
|
142
146
|
task package: ["#{package_dir}/#{zip_file}"]
|
143
147
|
file "#{package_dir}/#{zip_file}" =>
|
144
148
|
[package_dir_path] + package_files do
|
145
|
-
chdir(
|
146
|
-
|
147
|
-
end
|
149
|
+
chdir(working_dir) { sh @zip_command, "-r", zip_file, target_dir }
|
150
|
+
mv "#{package_dir_path}/#{zip_file}", package_dir if without_parent_dir
|
148
151
|
end
|
149
152
|
end
|
150
153
|
|
@@ -205,6 +208,15 @@ module Rake
|
|
205
208
|
def zip_file
|
206
209
|
"#{package_name}.zip"
|
207
210
|
end
|
211
|
+
|
212
|
+
def working_dir
|
213
|
+
without_parent_dir ? package_dir_path : package_dir
|
214
|
+
end
|
215
|
+
|
216
|
+
# target directory relative to working_dir
|
217
|
+
def target_dir
|
218
|
+
without_parent_dir ? "." : package_name
|
219
|
+
end
|
208
220
|
end
|
209
221
|
|
210
222
|
end
|
data/lib/rake/phony.rb
CHANGED
data/lib/rake/private_reader.rb
CHANGED
data/lib/rake/promise.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Rake
|
2
3
|
|
3
4
|
# A Promise object represents a promise to do work (a chore) in the
|
@@ -70,12 +71,12 @@ module Rake
|
|
70
71
|
|
71
72
|
# Do we have a result for the promise
|
72
73
|
def result?
|
73
|
-
|
74
|
+
!@result.equal?(NOT_SET)
|
74
75
|
end
|
75
76
|
|
76
77
|
# Did the promise throw an error
|
77
78
|
def error?
|
78
|
-
|
79
|
+
!@error.equal?(NOT_SET)
|
79
80
|
end
|
80
81
|
|
81
82
|
# Are we done with the promise
|
data/lib/rake/pseudo_status.rb
CHANGED
data/lib/rake/rake_module.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "rake/application"
|
2
3
|
|
3
4
|
module Rake
|
@@ -33,6 +34,34 @@ module Rake
|
|
33
34
|
application.options.rakelib ||= []
|
34
35
|
application.options.rakelib.concat(files)
|
35
36
|
end
|
37
|
+
|
38
|
+
# Make +block_application+ the default rake application inside a block so
|
39
|
+
# you can load rakefiles into a different application.
|
40
|
+
#
|
41
|
+
# This is useful when you want to run rake tasks inside a library without
|
42
|
+
# running rake in a sub-shell.
|
43
|
+
#
|
44
|
+
# Example:
|
45
|
+
#
|
46
|
+
# Dir.chdir 'other/directory'
|
47
|
+
#
|
48
|
+
# other_rake = Rake.with_application do |rake|
|
49
|
+
# rake.load_rakefile
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# puts other_rake.tasks
|
53
|
+
|
54
|
+
def with_application(block_application = Rake::Application.new)
|
55
|
+
orig_application = Rake.application
|
56
|
+
|
57
|
+
Rake.application = block_application
|
58
|
+
|
59
|
+
yield block_application
|
60
|
+
|
61
|
+
block_application
|
62
|
+
ensure
|
63
|
+
Rake.application = orig_application
|
64
|
+
end
|
36
65
|
end
|
37
66
|
|
38
67
|
end
|
@@ -1,20 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "rake"
|
2
3
|
|
3
4
|
# Load the test files from the command line.
|
4
5
|
argv = ARGV.select do |argument|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
begin
|
7
|
+
case argument
|
8
|
+
when /^-/ then
|
9
|
+
argument
|
10
|
+
when /\*/ then
|
11
|
+
FileList[argument].to_a.each do |file|
|
12
|
+
require File.expand_path file
|
13
|
+
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
false
|
16
|
+
else
|
17
|
+
require File.expand_path argument
|
16
18
|
|
17
|
-
|
19
|
+
false
|
20
|
+
end
|
21
|
+
rescue LoadError => e
|
22
|
+
raise unless e.path
|
23
|
+
abort "\nFile does not exist: #{e.path}\n\n"
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
data/lib/rake/scope.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Rake
|
2
3
|
class Scope < LinkedList # :nodoc: all
|
3
4
|
|
@@ -15,7 +16,7 @@ module Rake
|
|
15
16
|
# this trim beyond the toplevel scope.
|
16
17
|
def trim(n)
|
17
18
|
result = self
|
18
|
-
while n > 0 && !
|
19
|
+
while n > 0 && !result.empty?
|
19
20
|
result = result.tail
|
20
21
|
n -= 1
|
21
22
|
end
|
data/lib/rake/task.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "rake/invocation_exception_mixin"
|
2
3
|
|
3
4
|
module Rake
|
@@ -14,6 +15,10 @@ module Rake
|
|
14
15
|
class Task
|
15
16
|
# List of prerequisites for a task.
|
16
17
|
attr_reader :prerequisites
|
18
|
+
alias prereqs prerequisites
|
19
|
+
|
20
|
+
# List of order only prerequisites for a task.
|
21
|
+
attr_reader :order_only_prerequisites
|
17
22
|
|
18
23
|
# List of actions attached to a task.
|
19
24
|
attr_reader :actions
|
@@ -54,7 +59,7 @@ module Rake
|
|
54
59
|
|
55
60
|
# List of prerequisite tasks
|
56
61
|
def prerequisite_tasks
|
57
|
-
prerequisites.map { |pre| lookup_prerequisite(pre) }
|
62
|
+
(prerequisites + order_only_prerequisites).map { |pre| lookup_prerequisite(pre) }
|
58
63
|
end
|
59
64
|
|
60
65
|
def lookup_prerequisite(prerequisite_name) # :nodoc:
|
@@ -102,6 +107,8 @@ module Rake
|
|
102
107
|
@scope = app.current_scope
|
103
108
|
@arg_names = nil
|
104
109
|
@locations = []
|
110
|
+
@invocation_exception = nil
|
111
|
+
@order_only_prerequisites = []
|
105
112
|
end
|
106
113
|
|
107
114
|
# Enhance a task with prerequisites or actions. Returns self.
|
@@ -182,20 +189,39 @@ module Rake
|
|
182
189
|
|
183
190
|
# Same as invoke, but explicitly pass a call chain to detect
|
184
191
|
# circular dependencies.
|
185
|
-
|
186
|
-
|
192
|
+
#
|
193
|
+
# If multiple tasks depend on this
|
194
|
+
# one in parallel, they will all fail if the first execution of
|
195
|
+
# this task fails.
|
196
|
+
def invoke_with_call_chain(task_args, invocation_chain)
|
197
|
+
new_chain = Rake::InvocationChain.append(self, invocation_chain)
|
187
198
|
@lock.synchronize do
|
188
|
-
|
189
|
-
application.trace
|
199
|
+
begin
|
200
|
+
if application.options.trace
|
201
|
+
application.trace "** Invoke #{name} #{format_trace_flags}"
|
202
|
+
end
|
203
|
+
|
204
|
+
if @already_invoked
|
205
|
+
if @invocation_exception
|
206
|
+
if application.options.trace
|
207
|
+
application.trace "** Previous invocation of #{name} failed #{format_trace_flags}"
|
208
|
+
end
|
209
|
+
raise @invocation_exception
|
210
|
+
else
|
211
|
+
return
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
@already_invoked = true
|
216
|
+
|
217
|
+
invoke_prerequisites(task_args, new_chain)
|
218
|
+
execute(task_args) if needed?
|
219
|
+
rescue Exception => ex
|
220
|
+
add_chain_to(ex, new_chain)
|
221
|
+
@invocation_exception = ex
|
222
|
+
raise ex
|
190
223
|
end
|
191
|
-
return if @already_invoked
|
192
|
-
@already_invoked = true
|
193
|
-
invoke_prerequisites(task_args, new_chain)
|
194
|
-
execute(task_args) if needed?
|
195
224
|
end
|
196
|
-
rescue Exception => ex
|
197
|
-
add_chain_to(ex, new_chain)
|
198
|
-
raise ex
|
199
225
|
end
|
200
226
|
protected :invoke_with_call_chain
|
201
227
|
|
@@ -226,7 +252,8 @@ module Rake
|
|
226
252
|
r.invoke_with_call_chain(prereq_args, invocation_chain)
|
227
253
|
end
|
228
254
|
end
|
229
|
-
|
255
|
+
# Iterate in reverse to improve performance related to thread waiting and switching
|
256
|
+
futures.reverse_each(&:value)
|
230
257
|
end
|
231
258
|
|
232
259
|
# Format the trace flags for display.
|
@@ -247,7 +274,11 @@ module Rake
|
|
247
274
|
end
|
248
275
|
application.trace "** Execute #{name}" if application.options.trace
|
249
276
|
application.enhance_with_matching_rule(name) if @actions.empty?
|
250
|
-
|
277
|
+
if opts = Hash.try_convert(args) and !opts.empty?
|
278
|
+
@actions.each { |act| act.call(self, args, **opts)}
|
279
|
+
else
|
280
|
+
@actions.each { |act| act.call(self, args)}
|
281
|
+
end
|
251
282
|
end
|
252
283
|
|
253
284
|
# Is this task needed?
|
@@ -266,7 +297,7 @@ module Rake
|
|
266
297
|
def add_description(description)
|
267
298
|
return unless description
|
268
299
|
comment = description.strip
|
269
|
-
add_comment(comment) if comment && !
|
300
|
+
add_comment(comment) if comment && !comment.empty?
|
270
301
|
end
|
271
302
|
|
272
303
|
def comment=(comment) # :nodoc:
|
@@ -320,7 +351,7 @@ module Rake
|
|
320
351
|
# Return a string describing the internal state of a task. Useful for
|
321
352
|
# debugging.
|
322
353
|
def investigation
|
323
|
-
result = "------------------------------\n"
|
354
|
+
result = "------------------------------\n".dup
|
324
355
|
result << "Investigating #{name}\n"
|
325
356
|
result << "class: #{self.class}\n"
|
326
357
|
result << "task needed: #{needed?}\n"
|
@@ -337,6 +368,18 @@ module Rake
|
|
337
368
|
return result
|
338
369
|
end
|
339
370
|
|
371
|
+
# Format dependencies parameter to pass to task.
|
372
|
+
def self.format_deps(deps)
|
373
|
+
deps = [deps] unless deps.respond_to?(:to_ary)
|
374
|
+
deps.map { |d| Rake.from_pathname(d).to_s }
|
375
|
+
end
|
376
|
+
|
377
|
+
# Add order only dependencies.
|
378
|
+
def |(deps)
|
379
|
+
@order_only_prerequisites |= Task.format_deps(deps) - @prerequisites
|
380
|
+
self
|
381
|
+
end
|
382
|
+
|
340
383
|
# ----------------------------------------------------------------
|
341
384
|
# Rake Module Methods
|
342
385
|
#
|