drake 0.8.1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/CHANGES +386 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +396 -0
  4. data/Rakefile +505 -0
  5. data/TODO +20 -0
  6. data/bin/drake +31 -0
  7. data/bin/rake +31 -0
  8. data/doc/example/Rakefile1 +38 -0
  9. data/doc/example/Rakefile2 +35 -0
  10. data/doc/example/a.c +6 -0
  11. data/doc/example/b.c +6 -0
  12. data/doc/example/main.c +11 -0
  13. data/doc/glossary.rdoc +51 -0
  14. data/doc/jamis.rb +591 -0
  15. data/doc/proto_rake.rdoc +127 -0
  16. data/doc/rake.1.gz +0 -0
  17. data/doc/rakefile.rdoc +534 -0
  18. data/doc/rational.rdoc +151 -0
  19. data/doc/release_notes/rake-0.4.14.rdoc +23 -0
  20. data/doc/release_notes/rake-0.4.15.rdoc +35 -0
  21. data/doc/release_notes/rake-0.5.0.rdoc +53 -0
  22. data/doc/release_notes/rake-0.5.3.rdoc +78 -0
  23. data/doc/release_notes/rake-0.5.4.rdoc +46 -0
  24. data/doc/release_notes/rake-0.6.0.rdoc +141 -0
  25. data/doc/release_notes/rake-0.7.0.rdoc +119 -0
  26. data/doc/release_notes/rake-0.7.1.rdoc +59 -0
  27. data/doc/release_notes/rake-0.7.2.rdoc +121 -0
  28. data/doc/release_notes/rake-0.7.3.rdoc +47 -0
  29. data/doc/release_notes/rake-0.8.0.rdoc +114 -0
  30. data/doc/release_notes/rake-0.8.2.rdoc +163 -0
  31. data/install.rb +88 -0
  32. data/lib/rake.rb +2538 -0
  33. data/lib/rake/classic_namespace.rb +8 -0
  34. data/lib/rake/clean.rb +33 -0
  35. data/lib/rake/comp_tree/algorithm.rb +234 -0
  36. data/lib/rake/comp_tree/bucket_ipc.rb +175 -0
  37. data/lib/rake/comp_tree/driver.rb +291 -0
  38. data/lib/rake/comp_tree/error.rb +51 -0
  39. data/lib/rake/comp_tree/node.rb +189 -0
  40. data/lib/rake/comp_tree/quix/builtin/kernel/tap.rb +57 -0
  41. data/lib/rake/comp_tree/quix/diagnostic.rb +92 -0
  42. data/lib/rake/comp_tree/quix/kernel.rb +109 -0
  43. data/lib/rake/comp_tree/retriable_fork.rb +66 -0
  44. data/lib/rake/comp_tree/task_node.rb +46 -0
  45. data/lib/rake/contrib/compositepublisher.rb +24 -0
  46. data/lib/rake/contrib/ftptools.rb +153 -0
  47. data/lib/rake/contrib/publisher.rb +75 -0
  48. data/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  49. data/lib/rake/contrib/sshpublisher.rb +47 -0
  50. data/lib/rake/contrib/sys.rb +209 -0
  51. data/lib/rake/gempackagetask.rb +103 -0
  52. data/lib/rake/loaders/makefile.rb +35 -0
  53. data/lib/rake/packagetask.rb +185 -0
  54. data/lib/rake/parallel.rb +54 -0
  55. data/lib/rake/rake_test_loader.rb +5 -0
  56. data/lib/rake/rdoctask.rb +147 -0
  57. data/lib/rake/ruby182_test_unit_fix.rb +23 -0
  58. data/lib/rake/runtest.rb +23 -0
  59. data/lib/rake/tasklib.rb +23 -0
  60. data/lib/rake/testtask.rb +161 -0
  61. data/test/capture_stdout.rb +26 -0
  62. data/test/check_expansion.rb +5 -0
  63. data/test/contrib/test_sys.rb +47 -0
  64. data/test/data/chains/Rakefile +15 -0
  65. data/test/data/default/Rakefile +19 -0
  66. data/test/data/dryrun/Rakefile +22 -0
  67. data/test/data/file_creation_task/Rakefile +33 -0
  68. data/test/data/imports/Rakefile +19 -0
  69. data/test/data/imports/deps.mf +1 -0
  70. data/test/data/multidesc/Rakefile +17 -0
  71. data/test/data/namespace/Rakefile +57 -0
  72. data/test/data/rakelib/test1.rb +3 -0
  73. data/test/data/rbext/rakefile.rb +3 -0
  74. data/test/data/sample.mf +12 -0
  75. data/test/data/statusreturn/Rakefile +8 -0
  76. data/test/data/unittest/Rakefile +1 -0
  77. data/test/filecreation.rb +32 -0
  78. data/test/functional.rb +15 -0
  79. data/test/in_environment.rb +30 -0
  80. data/test/parallel.rb +3 -0
  81. data/test/rake_test_setup.rb +5 -0
  82. data/test/reqfile.rb +3 -0
  83. data/test/reqfile2.rb +3 -0
  84. data/test/session_functional.rb +324 -0
  85. data/test/shellcommand.rb +3 -0
  86. data/test/single_threaded.rb +2 -0
  87. data/test/test_application.rb +714 -0
  88. data/test/test_clean.rb +14 -0
  89. data/test/test_definitions.rb +82 -0
  90. data/test/test_earlytime.rb +35 -0
  91. data/test/test_extension.rb +63 -0
  92. data/test/test_file_creation_task.rb +62 -0
  93. data/test/test_file_task.rb +139 -0
  94. data/test/test_filelist.rb +618 -0
  95. data/test/test_fileutils.rb +250 -0
  96. data/test/test_ftp.rb +59 -0
  97. data/test/test_invocation_chain.rb +75 -0
  98. data/test/test_makefile_loader.rb +25 -0
  99. data/test/test_namespace.rb +36 -0
  100. data/test/test_package_task.rb +116 -0
  101. data/test/test_parallel.rb +47 -0
  102. data/test/test_pathmap.rb +209 -0
  103. data/test/test_rake.rb +41 -0
  104. data/test/test_require.rb +33 -0
  105. data/test/test_rules.rb +348 -0
  106. data/test/test_task_arguments.rb +89 -0
  107. data/test/test_task_manager.rb +172 -0
  108. data/test/test_tasklib.rb +12 -0
  109. data/test/test_tasks.rb +373 -0
  110. data/test/test_test_task.rb +75 -0
  111. data/test/test_top_level_functions.rb +84 -0
  112. metadata +190 -0
@@ -0,0 +1,8 @@
1
+ # The following classes used to be in the top level namespace.
2
+ # Loading this file enables compatibility with older Rakefile that
3
+ # referenced Task from the top level.
4
+
5
+ Task = Rake::Task
6
+ FileTask = Rake::FileTask
7
+ FileCreationTask = Rake::FileCreationTask
8
+ RakeApp = Rake::Application
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # The 'rake/clean' file defines two file lists (CLEAN and CLOBBER) and
4
+ # two rake tasks (:clean and :clobber).
5
+ #
6
+ # [:clean] Clean up the project by deleting scratch files and backup
7
+ # files. Add files to the CLEAN file list to have the :clean
8
+ # target handle them.
9
+ #
10
+ # [:clobber] Clobber all generated and non-source files in a project.
11
+ # The task depends on :clean, so all the clean files will
12
+ # be deleted as well as files in the CLOBBER file list.
13
+ # The intent of this task is to return a project to its
14
+ # pristine, just unpacked state.
15
+
16
+ require 'rake'
17
+
18
+ CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
19
+ CLEAN.clear_exclude.exclude { |fn|
20
+ fn.pathmap("%f") == 'core' && File.directory?(fn)
21
+ }
22
+
23
+ desc "Remove any temporary products."
24
+ task :clean do
25
+ CLEAN.each { |fn| rm_r fn rescue nil }
26
+ end
27
+
28
+ CLOBBER = Rake::FileList.new
29
+
30
+ desc "Remove any generated file."
31
+ task :clobber => [:clean] do
32
+ CLOBBER.each { |fn| rm_r fn rescue nil }
33
+ end
@@ -0,0 +1,234 @@
1
+
2
+
3
+
4
+ ######################################################
5
+ #
6
+ # **** DO NOT EDIT ****
7
+ #
8
+ # **** THIS IS A GENERATED FILE *****
9
+ #
10
+ ######################################################
11
+
12
+
13
+
14
+ require 'rake/comp_tree/quix/diagnostic'
15
+ require 'rake/comp_tree/retriable_fork'
16
+
17
+ module Rake::CompTree
18
+ module Algorithm
19
+ include Quix::Diagnostic
20
+
21
+ def compute_multithreaded(root, num_threads, use_fork, buckets)
22
+ trace "Computing #{root.name} with #{num_threads} threads"
23
+ result = nil
24
+ mutex = Mutex.new
25
+ node_finished_condition = ConditionVariable.new
26
+ thread_wake_condition = ConditionVariable.new
27
+ threads = []
28
+
29
+ # workaround: jruby gives "run" status for waiting on
30
+ # condition variable
31
+ num_threads_ready = 0
32
+
33
+ num_threads.times { |thread_index|
34
+ threads << Thread.new {
35
+ #
36
+ # wait for main thread
37
+ #
38
+ mutex.synchronize {
39
+ trace "Thread #{thread_index} waiting to start"
40
+ num_threads_ready += 1
41
+ thread_wake_condition.wait(mutex)
42
+ }
43
+
44
+ while true
45
+ trace "Thread #{thread_index} node search"
46
+
47
+ #
48
+ # Done! Thread will exit.
49
+ #
50
+ break if mutex.synchronize {
51
+ result
52
+ }
53
+
54
+ #
55
+ # Lock the tree and find a node. The node we
56
+ # obtain, if any, is already locked.
57
+ #
58
+ node = mutex.synchronize {
59
+ find_node(root)
60
+ }
61
+
62
+ if node
63
+ trace "Thread #{thread_index} found node #{node.name}"
64
+
65
+ node_result =
66
+ compute_node(
67
+ node,
68
+ use_fork,
69
+ buckets ? buckets[thread_index] : nil)
70
+
71
+ mutex.synchronize {
72
+ node.result = node_result
73
+ }
74
+
75
+ #
76
+ # remove locks for this node (shared lock and own lock)
77
+ #
78
+ mutex.synchronize {
79
+ node.unlock
80
+ if node == root
81
+ #
82
+ # Root node was computed; we are done.
83
+ #
84
+ trace "Thread #{thread_index} got final answer"
85
+ result = root.result
86
+ end
87
+ node_finished_condition.signal
88
+ }
89
+ else
90
+ trace "Thread #{thread_index}: no node found; sleeping."
91
+ mutex.synchronize {
92
+ thread_wake_condition.wait(mutex)
93
+ }
94
+ end
95
+ end
96
+ trace "Thread #{thread_index} exiting"
97
+ }
98
+ }
99
+
100
+ trace "Main: waiting for threads to launch and block."
101
+ while true
102
+ break if mutex.synchronize {
103
+ num_threads_ready == num_threads
104
+ }
105
+ Thread.pass
106
+ end
107
+
108
+ trace "Main: entering main loop"
109
+ mutex.synchronize {
110
+ while true
111
+ trace "Main: waking threads"
112
+ thread_wake_condition.broadcast
113
+
114
+ if result
115
+ trace "Main: detected finish."
116
+ break
117
+ end
118
+
119
+ trace "Main: waiting for a node"
120
+ node_finished_condition.wait(mutex)
121
+ trace "Main: got a node"
122
+ end
123
+ }
124
+
125
+ trace "Main: waiting for threads to finish."
126
+ catch(:done) {
127
+ while true
128
+ mutex.synchronize {
129
+ throw :done if threads.all? { |thread|
130
+ thread.status == false
131
+ }
132
+ thread_wake_condition.broadcast
133
+ }
134
+ Thread.pass
135
+ end
136
+ }
137
+
138
+ trace "Main: computation done."
139
+ result
140
+ end
141
+
142
+ def find_node(node)
143
+ # --- only called inside mutex
144
+ trace "Looking for a node, starting with #{node.name}"
145
+ if node.result
146
+ #
147
+ # already computed
148
+ #
149
+ trace "#{node.name} has been computed"
150
+ nil
151
+ elsif node.children_results and node.try_lock
152
+ #
153
+ # Node is not computed and its children are computed;
154
+ # and we have the lock. Ready to compute.
155
+ #
156
+ node
157
+ else
158
+ #
159
+ # locked or children not computed; recurse to children
160
+ #
161
+ trace "Checking #{node.name}'s children"
162
+ node.each_child { |child|
163
+ if next_node = find_node(child)
164
+ return next_node
165
+ end
166
+ }
167
+ nil
168
+ end
169
+ end
170
+
171
+ def compute_node(node, use_fork, bucket)
172
+ if use_fork
173
+ trace "About to fork for node #{node.name}"
174
+ if bucket
175
+ #
176
+ # Use our assigned bucket to transfer the result.
177
+ #
178
+ fork_node(node) {
179
+ node.trace_compute
180
+ bucket.contents = node.compute
181
+ }
182
+ bucket.contents
183
+ else
184
+ #
185
+ # No bucket -- discarding result
186
+ #
187
+ fork_node(node) {
188
+ node.trace_compute
189
+ node.compute
190
+ }
191
+ true
192
+ end
193
+ else
194
+ #
195
+ # No fork
196
+ #
197
+ node.trace_compute
198
+ node.compute
199
+ end
200
+ end
201
+
202
+ def fork_node(node)
203
+ trace "About to fork for node #{node.name}"
204
+ process_id = RetriableFork.fork {
205
+ trace "Fork: process #{Process.pid}"
206
+ node.trace_compute
207
+ yield
208
+ trace "Fork: computation done"
209
+ }
210
+ trace "Waiting for process #{process_id}"
211
+ Process.wait(process_id)
212
+ trace "Process #{process_id} finished"
213
+ exitstatus = $?.exitstatus
214
+ if exitstatus != 0
215
+ trace "Process #{process_id} returned #{exitstatus}; exiting."
216
+ exit(1)
217
+ end
218
+ end
219
+
220
+ extend self
221
+ end
222
+ end
223
+
224
+
225
+
226
+ ######################################################
227
+ #
228
+ # **** DO NOT EDIT ****
229
+ #
230
+ # **** THIS IS A GENERATED FILE *****
231
+ #
232
+ ######################################################
233
+
234
+
@@ -0,0 +1,175 @@
1
+
2
+
3
+
4
+ ######################################################
5
+ #
6
+ # **** DO NOT EDIT ****
7
+ #
8
+ # **** THIS IS A GENERATED FILE *****
9
+ #
10
+ ######################################################
11
+
12
+
13
+
14
+ require 'drb'
15
+ require 'thread'
16
+
17
+ require 'rake/comp_tree/retriable_fork'
18
+ require 'rake/comp_tree/quix/diagnostic'
19
+ require 'rake/comp_tree/quix/builtin/kernel/tap'
20
+
21
+ module Rake::CompTree
22
+ module BucketIPC
23
+ class Bucket
24
+ include Quix::Diagnostic
25
+ include RetriableFork
26
+
27
+ def initialize(address, timeout, wait_interval)
28
+ trace "Making bucket with address #{address}"
29
+
30
+ @remote_pid = fork {
31
+ own_object = Class.new {
32
+ attr_accessor(:contents)
33
+ }.new
34
+ server = DRb.start_service(address, own_object)
35
+ debug {
36
+ server.verbose = true
37
+ }
38
+ DRb.thread.join
39
+ }
40
+
41
+ @remote_object = DRbObject.new_with_uri(address)
42
+ @address = address
43
+ @timeout = timeout
44
+ @wait_interval = wait_interval
45
+ end
46
+
47
+ attr_accessor(:timeout, :wait_interval)
48
+ attr_reader(:address)
49
+
50
+ def contents=(new_contents)
51
+ connect {
52
+ @remote_object.contents = new_contents
53
+ }
54
+ end
55
+
56
+ def contents
57
+ connect {
58
+ @remote_object.contents
59
+ }
60
+ end
61
+
62
+ def stop
63
+ Process.kill("TERM", @remote_pid)
64
+ end
65
+
66
+ private
67
+
68
+ def connect
69
+ begin
70
+ return yield
71
+ rescue DRb::DRbConnError
72
+ start = Time.now
73
+ begin
74
+ Kernel.sleep(@wait_interval)
75
+ return yield
76
+ rescue DRb::DRbConnError
77
+ if Time.now - start > @timeout
78
+ raise
79
+ end
80
+ retry
81
+ end
82
+ end
83
+ end
84
+ end
85
+
86
+ class DriverBase
87
+ def initialize(addresses, timeout, wait_interval)
88
+ begin
89
+ @buckets = addresses.map { |address|
90
+ Bucket.new(address, timeout, wait_interval)
91
+ }
92
+ if block_given?
93
+ yield @buckets
94
+ end
95
+ ensure
96
+ if block_given?
97
+ stop
98
+ end
99
+ end
100
+ end
101
+
102
+ def stop
103
+ if defined?(@buckets)
104
+ @buckets.each { |bucket|
105
+ bucket.stop
106
+ }
107
+ end
108
+ end
109
+ end
110
+
111
+ class Driver < DriverBase
112
+ DEFAULTS = {
113
+ :timeout => 0.5,
114
+ :wait_interval => 0.05,
115
+ :port_start => 18181,
116
+ }
117
+
118
+ module BucketCounter
119
+ @mutex = Mutex.new
120
+ @count = 0
121
+ class << self
122
+ def increment_count
123
+ @mutex.synchronize {
124
+ @count += 1
125
+ }
126
+ end
127
+
128
+ def map_indexes(num_buckets)
129
+ Array.new.tap { |result|
130
+ num_buckets.times {
131
+ result << yield(increment_count)
132
+ }
133
+ }
134
+ end
135
+ end
136
+ end
137
+
138
+ def initialize(num_buckets, opts_in = {})
139
+ opts = DEFAULTS.merge(opts_in)
140
+
141
+ addresses =
142
+ if RetriableFork::HAVE_FORK
143
+ #
144
+ # Assume the existence of fork implies a unix machine.
145
+ #
146
+ require 'drb/unix'
147
+ basename = "drbunix://#{Dir.tmpdir}/bucket.#{Process.pid}.#{rand}"
148
+ BucketCounter.map_indexes(num_buckets) { |index|
149
+ "#{basename}.#{index}"
150
+ }
151
+ else
152
+ #
153
+ # Fallback: use the default socket.
154
+ #
155
+ BucketCounter.map_indexes(num_buckets) { |index|
156
+ "druby://localhost:#{opts[:port_start] + index}"
157
+ }
158
+ end
159
+ super(addresses, opts[:timeout], opts[:wait_interval])
160
+ end
161
+ end
162
+ end
163
+ end
164
+
165
+
166
+
167
+ ######################################################
168
+ #
169
+ # **** DO NOT EDIT ****
170
+ #
171
+ # **** THIS IS A GENERATED FILE *****
172
+ #
173
+ ######################################################
174
+
175
+