build-graph 2.1.0 → 2.2.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/build/graph/edge.rb +9 -20
- data/lib/build/graph/node.rb +15 -21
- data/lib/build/graph/task.rb +20 -20
- data/lib/build/graph/version.rb +7 -20
- data/lib/build/graph/walker.rb +44 -40
- data/lib/build/graph.rb +8 -27
- data/license.md +21 -0
- data/readme.md +37 -0
- data/releases.md +5 -0
- data.tar.gz.sig +0 -0
- metadata +48 -127
- metadata.gz.sig +0 -0
- data/.gitignore +0 -24
- data/.rspec +0 -4
- data/.travis.yml +0 -19
- data/Gemfile +0 -14
- data/README.md +0 -99
- data/Rakefile +0 -6
- data/build-graph.gemspec +0 -35
- data/spec/build/graph/build_test.rb +0 -85
- data/spec/build/graph/edge_spec.rb +0 -39
- data/spec/build/graph/graph_spec.rb +0 -172
- data/spec/build/graph/inherit_spec.rb +0 -51
- data/spec/build/graph/node_spec.rb +0 -80
- data/spec/build/graph/process_graph.rb +0 -89
- data/spec/build/graph/program/Benchmark.cpp +0 -72
- data/spec/build/graph/program/Benchmark.h +0 -65
- data/spec/build/graph/program/DictionarySort.h +0 -270
- data/spec/build/graph/program/ParallelMergeSort.h +0 -278
- data/spec/build/graph/program/main.cpp +0 -131
- data/spec/build/graph/task_spec.rb +0 -69
- data/spec/build/graph/walker_spec.rb +0 -125
- data/spec/spec_helper.rb +0 -13
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env rspec
|
|
2
|
-
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
|
3
|
-
#
|
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
# furnished to do so, subject to the following conditions:
|
|
10
|
-
#
|
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
|
12
|
-
# all copies or substantial portions of the Software.
|
|
13
|
-
#
|
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
-
# THE SOFTWARE.
|
|
21
|
-
|
|
22
|
-
require 'build/graph/node'
|
|
23
|
-
require 'build/graph/walker'
|
|
24
|
-
require 'build/graph/task'
|
|
25
|
-
require 'build/files/glob'
|
|
26
|
-
|
|
27
|
-
require_relative 'process_graph'
|
|
28
|
-
|
|
29
|
-
RSpec.describe Build::Graph::Task do
|
|
30
|
-
it "should wait for children" do
|
|
31
|
-
node_a = Build::Graph::Node.new(Build::Files::Paths::NONE, Build::Files::Paths::NONE)
|
|
32
|
-
node_b = Build::Graph::Node.new(Build::Files::Paths::NONE, :inherit)
|
|
33
|
-
|
|
34
|
-
nodes = Set.new([node_a])
|
|
35
|
-
|
|
36
|
-
sequence = []
|
|
37
|
-
|
|
38
|
-
# A walker runs repeatedly, updating tasks which have been marked as dirty.
|
|
39
|
-
walker = Build::Graph::Walker.new do |walker, node|
|
|
40
|
-
task = Build::Graph::Task.new(walker, node)
|
|
41
|
-
|
|
42
|
-
task.visit do
|
|
43
|
-
sequence << [:entered, node]
|
|
44
|
-
|
|
45
|
-
if node == node_a
|
|
46
|
-
# This will invoke node_b concurrently, but as it is a child, task.visit won't finish until node_b is done.
|
|
47
|
-
task.invoke(node_b)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
sequence << [:exited, node]
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
walker.update(nodes)
|
|
55
|
-
|
|
56
|
-
expect(walker.tasks.count).to be == 2
|
|
57
|
-
expect(walker.failed_tasks.count).to be == 0
|
|
58
|
-
|
|
59
|
-
task_b = walker.tasks[node_b]
|
|
60
|
-
expect(walker.tasks[node_a].children).to be == [task_b]
|
|
61
|
-
|
|
62
|
-
expect(sequence).to be == [
|
|
63
|
-
[:entered, node_a],
|
|
64
|
-
[:entered, node_b],
|
|
65
|
-
[:exited, node_b],
|
|
66
|
-
[:exited, node_a]
|
|
67
|
-
]
|
|
68
|
-
end
|
|
69
|
-
end
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env rspec
|
|
2
|
-
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
|
3
|
-
#
|
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
# furnished to do so, subject to the following conditions:
|
|
10
|
-
#
|
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
|
12
|
-
# all copies or substantial portions of the Software.
|
|
13
|
-
#
|
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
-
# THE SOFTWARE.
|
|
21
|
-
|
|
22
|
-
require 'build/graph/node'
|
|
23
|
-
require 'build/graph/walker'
|
|
24
|
-
require 'build/graph/task'
|
|
25
|
-
require 'build/files/glob'
|
|
26
|
-
|
|
27
|
-
RSpec.describe Build::Graph::Walker do
|
|
28
|
-
it "can generate the same output from multiple tasks" do
|
|
29
|
-
test_glob = Build::Files::Glob.new(__dir__, "*.rb")
|
|
30
|
-
listing_output = Build::Files::Paths.directory(__dir__, ["listing.txt"])
|
|
31
|
-
|
|
32
|
-
node_a = Build::Graph::Node.new(test_glob, listing_output)
|
|
33
|
-
node_b = Build::Graph::Node.new(Build::Files::Paths::NONE, listing_output)
|
|
34
|
-
|
|
35
|
-
sequence = []
|
|
36
|
-
|
|
37
|
-
# A walker runs repeatedly, updating tasks which have been marked as dirty.
|
|
38
|
-
walker = Build::Graph::Walker.new do |walker, node|
|
|
39
|
-
task = Build::Graph::Task.new(walker, node)
|
|
40
|
-
|
|
41
|
-
task.visit do
|
|
42
|
-
if node == node_a
|
|
43
|
-
task.invoke(node_b)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
node.outputs.each do |output|
|
|
47
|
-
output.touch
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
sequence << node
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
edge = double()
|
|
55
|
-
walker.outputs[listing_output.first.to_s] ||= [edge]
|
|
56
|
-
expect(edge).to receive(:traverse)
|
|
57
|
-
|
|
58
|
-
walker.update([node_a, node_a])
|
|
59
|
-
|
|
60
|
-
expect(walker.tasks.count).to be == 2
|
|
61
|
-
expect(walker.failed_tasks.count).to be == 0
|
|
62
|
-
expect(sequence).to be == [node_b, node_a]
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
it "should be unique" do
|
|
66
|
-
test_glob = Build::Files::Glob.new(__dir__, "*.rb")
|
|
67
|
-
listing_output = Build::Files::Paths.directory(__dir__, ["listing.txt"])
|
|
68
|
-
|
|
69
|
-
node_a = Build::Graph::Node.new(test_glob, listing_output)
|
|
70
|
-
node_b = Build::Graph::Node.new(listing_output, Build::Files::Paths::NONE)
|
|
71
|
-
|
|
72
|
-
sequence = []
|
|
73
|
-
|
|
74
|
-
# A walker runs repeatedly, updating tasks which have been marked as dirty.
|
|
75
|
-
walker = Build::Graph::Walker.new do |walker, node|
|
|
76
|
-
task = Build::Graph::Task.new(walker, node)
|
|
77
|
-
|
|
78
|
-
task.visit do
|
|
79
|
-
node.outputs.each do |output|
|
|
80
|
-
output.touch
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
sequence << node
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
walker.update([node_a, node_b])
|
|
88
|
-
|
|
89
|
-
expect(walker.tasks.count).to be == 2
|
|
90
|
-
expect(walker.failed_tasks.count).to be == 0
|
|
91
|
-
expect(sequence).to be == [node_a, node_b]
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
it "should cascade failure" do
|
|
95
|
-
test_glob = Build::Files::Glob.new(__dir__, "*.rb")
|
|
96
|
-
listing_output = Build::Files::Paths.directory(__dir__, ["listing.txt"])
|
|
97
|
-
summary_output = Build::Files::Paths.directory(__dir__, ["summary.txt"])
|
|
98
|
-
|
|
99
|
-
node_a = Build::Graph::Node.new(test_glob, listing_output)
|
|
100
|
-
node_b = Build::Graph::Node.new(listing_output, summary_output)
|
|
101
|
-
|
|
102
|
-
# A walker runs repeatedly, updating tasks which have been marked as dirty.
|
|
103
|
-
walker = Build::Graph::Walker.new do |walker, node|
|
|
104
|
-
task = Build::Graph::Task.new(walker, node)
|
|
105
|
-
|
|
106
|
-
task.visit do
|
|
107
|
-
if node == node_a
|
|
108
|
-
raise Build::Graph::TransientError.new('Test Failure')
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
walker.update([node_a, node_b])
|
|
114
|
-
|
|
115
|
-
expect(walker.tasks.count).to be == 2
|
|
116
|
-
expect(walker.failed_tasks.count).to be == 2
|
|
117
|
-
expect(listing_output).to be_intersect walker.failed_outputs
|
|
118
|
-
expect(summary_output).to be_intersect walker.failed_outputs
|
|
119
|
-
|
|
120
|
-
walker.clear_failed
|
|
121
|
-
|
|
122
|
-
expect(walker.tasks.count).to be == 0
|
|
123
|
-
expect(walker.failed_tasks.count).to be == 0
|
|
124
|
-
end
|
|
125
|
-
end
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
require 'covered/rspec'
|
|
3
|
-
|
|
4
|
-
RSpec.configure do |config|
|
|
5
|
-
config.disable_monkey_patching!
|
|
6
|
-
|
|
7
|
-
# Enable flags like --only-failures and --next-failure
|
|
8
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
|
9
|
-
|
|
10
|
-
config.expect_with :rspec do |c|
|
|
11
|
-
c.syntax = :expect
|
|
12
|
-
end
|
|
13
|
-
end
|