build 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +10 -12
- data/Gemfile +0 -5
- data/Rakefile +3 -2
- data/build.gemspec +4 -2
- data/lib/build/chain_node.rb +95 -0
- data/lib/build/controller.rb +4 -12
- data/lib/build/logger.rb +7 -5
- data/lib/build/rule.rb +24 -1
- data/lib/build/rulebook.rb +9 -9
- data/lib/build/task.rb +18 -18
- data/lib/build/version.rb +1 -1
- data/spec/build/controller_spec.rb +80 -66
- data/spec/build/rulebook_spec.rb +1 -1
- data/spec/build/target.rb +20 -0
- data/spec/spec_helper.rb +2 -19
- metadata +40 -11
- data/lib/build/target_node.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9cc4f25b15c353f405140484002cf0106fa5cdfc115269ff256d92fcc86be47f
|
4
|
+
data.tar.gz: d92ce080796f19b6a1a3ff80acbd51b43f97845ac201c7ea295da464e64daf34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0924bb939bbb829cd707df95fe25b0ed21965dd1d0a87509f1adeb9bb4f9a16df2e35dedeed89ffc68a31763d3db3a8766b7b60b4338f4996b87c135357f1cf
|
7
|
+
data.tar.gz: 58b0a8611fa3549816e8ecc837876fd33be5b3c6eae51fc868ad8063f1e0810fdb948ea4a80864123c73077308f47ccde5f35ea50665a89f0c74d7c0c2c8a805
|
data/.travis.yml
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
language: ruby
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
- 2.2.4
|
6
|
-
- 2.3.0
|
7
|
-
- ruby-head
|
8
|
-
- rbx-2
|
9
|
-
env: COVERAGE=true
|
2
|
+
dist: xenial
|
3
|
+
cache: bundler
|
4
|
+
|
10
5
|
matrix:
|
11
|
-
|
12
|
-
|
13
|
-
- rvm:
|
14
|
-
- rvm:
|
6
|
+
include:
|
7
|
+
- rvm: 2.3
|
8
|
+
- rvm: 2.4
|
9
|
+
- rvm: 2.5
|
10
|
+
- rvm: 2.6
|
11
|
+
- rvm: 2.6
|
12
|
+
env: COVERAGE=BriefSummary,Coveralls
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/build.gemspec
CHANGED
@@ -18,12 +18,14 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.required_ruby_version = '>= 2.0'
|
19
19
|
|
20
20
|
spec.add_dependency "build-graph", "~> 1.0"
|
21
|
-
spec.add_dependency "build-environment", "~> 1.
|
21
|
+
spec.add_dependency "build-environment", "~> 1.2"
|
22
|
+
spec.add_dependency "build-dependency", "~> 1.2"
|
22
23
|
spec.add_dependency "build-makefile", "~> 1.0"
|
23
24
|
|
24
25
|
spec.add_dependency "graphviz"
|
25
26
|
|
26
|
-
spec.add_development_dependency "
|
27
|
+
spec.add_development_dependency "covered"
|
28
|
+
spec.add_development_dependency "bundler"
|
27
29
|
spec.add_development_dependency "rspec", "~> 3.6"
|
28
30
|
spec.add_development_dependency "rake"
|
29
31
|
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'build/files'
|
22
|
+
require 'build/graph'
|
23
|
+
|
24
|
+
require_relative 'task'
|
25
|
+
|
26
|
+
module Build
|
27
|
+
class ChainNode < Graph::Node
|
28
|
+
def initialize(chain, arguments, environment)
|
29
|
+
@chain = chain
|
30
|
+
@arguments = arguments
|
31
|
+
@environment = environment
|
32
|
+
|
33
|
+
# Wait here, for all dependent targets, to be done:
|
34
|
+
super(Files::List::NONE, :inherit, chain)
|
35
|
+
end
|
36
|
+
|
37
|
+
def task_class
|
38
|
+
Task
|
39
|
+
end
|
40
|
+
|
41
|
+
def apply_dependency(scope, dependency)
|
42
|
+
# puts "Traversing #{dependency.name}..."
|
43
|
+
|
44
|
+
# Not sure why need first
|
45
|
+
provision = @chain.resolved[dependency].first
|
46
|
+
|
47
|
+
environments = [@environment]
|
48
|
+
public_environments = []
|
49
|
+
|
50
|
+
provision.each_dependency do |dependency|
|
51
|
+
if environment = apply_dependency(scope, dependency)
|
52
|
+
environments << environment
|
53
|
+
|
54
|
+
unless dependency.private?
|
55
|
+
public_environments << environment
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
unless dependency.alias?
|
61
|
+
# puts "Building #{dependency.name}: #{provision.value}..."
|
62
|
+
|
63
|
+
local_environment = Build::Environment.combine(*environments)&.evaluate || Build::Environment.new
|
64
|
+
|
65
|
+
task_class = Rulebook.for(local_environment).with(Task, environment: local_environment)
|
66
|
+
|
67
|
+
task = task_class.new(scope.walker, self, scope.group, logger: scope.logger)
|
68
|
+
|
69
|
+
output_environment = nil
|
70
|
+
|
71
|
+
scope.walker.with(task_class: task_class) do
|
72
|
+
task.visit do
|
73
|
+
output_environment = Build::Environment.new(local_environment)
|
74
|
+
|
75
|
+
output_environment.construct!(task, *@arguments, &provision.value)
|
76
|
+
|
77
|
+
public_environments << output_environment.dup(parent: nil)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
return Build::Environment.combine(*public_environments)
|
83
|
+
end
|
84
|
+
|
85
|
+
def apply!(scope)
|
86
|
+
@chain.dependencies.each do |dependency|
|
87
|
+
apply_dependency(scope, dependency)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def to_s
|
92
|
+
"#<#{self.class}>"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
data/lib/build/controller.rb
CHANGED
@@ -27,7 +27,7 @@ require_relative 'rulebook'
|
|
27
27
|
require_relative 'name'
|
28
28
|
|
29
29
|
require_relative 'rule_node'
|
30
|
-
require_relative '
|
30
|
+
require_relative 'chain_node'
|
31
31
|
require_relative 'task'
|
32
32
|
|
33
33
|
require_relative 'logger'
|
@@ -72,17 +72,9 @@ module Build
|
|
72
72
|
@walker.failed?
|
73
73
|
end
|
74
74
|
|
75
|
-
# Add a build
|
76
|
-
def
|
77
|
-
|
78
|
-
|
79
|
-
# Not sure if this is a good idea - makes debugging slightly easier.
|
80
|
-
Object.const_set("TaskClassFor#{Name.from_target(target.name).identifier}_#{task_class.object_id}", task_class)
|
81
|
-
|
82
|
-
# A target node will invoke the build callback on target.
|
83
|
-
@nodes << TargetNode.new(task_class, target, arguments)
|
84
|
-
|
85
|
-
return @nodes.last
|
75
|
+
# Add a build environment to the controller.
|
76
|
+
def add_chain(chain, arguments = [], environment)
|
77
|
+
@nodes << ChainNode.new(chain, arguments, environment)
|
86
78
|
end
|
87
79
|
|
88
80
|
def update
|
data/lib/build/logger.rb
CHANGED
@@ -64,11 +64,13 @@ module Build
|
|
64
64
|
|
65
65
|
buffer << "\n"
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
67
|
+
if @verbose
|
68
|
+
if environment
|
69
|
+
environment.each do |key, value|
|
70
|
+
buffer << "\texport #{key}=#{value.dump}\n"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
72
74
|
end
|
73
75
|
|
74
76
|
def format_exception(exception, buffer)
|
data/lib/build/rule.rb
CHANGED
@@ -19,8 +19,16 @@
|
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
21
|
module Build
|
22
|
-
# A rule is a function with a specific set of input and output parameters, which can match against a given set of specific
|
22
|
+
# A rule is a function with a specific set of input and output parameters, which can match against a given set of specific arguments. For example, there might be several rules for compiling, but the specific rules depend on the language being compiled.
|
23
23
|
class Rule
|
24
|
+
def self.build(name, &block)
|
25
|
+
rule = self.new(*name.split('.', 2))
|
26
|
+
|
27
|
+
rule.instance_eval(&block)
|
28
|
+
|
29
|
+
return rule.freeze
|
30
|
+
end
|
31
|
+
|
24
32
|
class Parameter
|
25
33
|
def initialize(direction, name, options = {}, &block)
|
26
34
|
@direction = direction
|
@@ -119,6 +127,21 @@ module Build
|
|
119
127
|
|
120
128
|
attr :primary_output
|
121
129
|
|
130
|
+
def freeze
|
131
|
+
return self if frozen?
|
132
|
+
|
133
|
+
@name.freeze
|
134
|
+
@full_name.freeze
|
135
|
+
@process_name.freeze
|
136
|
+
@type.freeze
|
137
|
+
|
138
|
+
@apply.freeze
|
139
|
+
@parameters.freeze
|
140
|
+
@primary_output.freeze
|
141
|
+
|
142
|
+
super
|
143
|
+
end
|
144
|
+
|
122
145
|
def input(name, options = {}, &block)
|
123
146
|
self << Parameter.new(:input, name, options, &block)
|
124
147
|
end
|
data/lib/build/rulebook.rb
CHANGED
@@ -36,12 +36,12 @@ module Build
|
|
36
36
|
processes = @processes[rule.process_name] ||= []
|
37
37
|
processes << rule
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def [] name
|
41
41
|
@rules[name]
|
42
42
|
end
|
43
43
|
|
44
|
-
def with(superclass, state
|
44
|
+
def with(superclass, **state)
|
45
45
|
task_class = Class.new(superclass)
|
46
46
|
|
47
47
|
# Define methods for all processes, e.g. task_class#compile
|
@@ -65,12 +65,18 @@ module Build
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
# Typically, this defines methods like #environment and #target which can be accessed in the build rule.
|
68
69
|
state.each do |key, value|
|
69
70
|
task_class.send(:define_method, key) do
|
70
71
|
value
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
75
|
+
rulebook = self
|
76
|
+
task_class.send(:define_method, :rulebook) do
|
77
|
+
rulebook
|
78
|
+
end
|
79
|
+
|
74
80
|
return task_class
|
75
81
|
end
|
76
82
|
|
@@ -78,13 +84,7 @@ module Build
|
|
78
84
|
rulebook = self.new
|
79
85
|
|
80
86
|
environment.defined.each do |name, define|
|
81
|
-
|
82
|
-
|
83
|
-
object.instance_eval(&define.block)
|
84
|
-
|
85
|
-
object.freeze
|
86
|
-
|
87
|
-
rulebook << object
|
87
|
+
rulebook << define.klass.build(name, &define.block)
|
88
88
|
end
|
89
89
|
|
90
90
|
return rulebook
|
data/lib/build/task.rb
CHANGED
@@ -49,18 +49,22 @@ module Build
|
|
49
49
|
def initialize(walker, node, group, logger: nil)
|
50
50
|
super(walker, node)
|
51
51
|
|
52
|
+
@environment = environment
|
52
53
|
@group = group
|
53
|
-
|
54
|
-
@logger = logger || Logger.new($stderr)
|
54
|
+
@logger = logger
|
55
55
|
end
|
56
56
|
|
57
|
+
attr :environment
|
58
|
+
attr :group
|
59
|
+
attr :logger
|
60
|
+
|
57
61
|
def wet?
|
58
62
|
@node.dirty?
|
59
63
|
end
|
60
64
|
|
61
65
|
def spawn(*arguments)
|
62
66
|
if wet?
|
63
|
-
@logger
|
67
|
+
@logger&.info(:shell) {arguments}
|
64
68
|
status = @group.spawn(*arguments)
|
65
69
|
|
66
70
|
if status != 0
|
@@ -80,21 +84,21 @@ module Build
|
|
80
84
|
def touch(path)
|
81
85
|
return unless wet?
|
82
86
|
|
83
|
-
@logger
|
87
|
+
@logger&.info(:shell) {['touch', path]}
|
84
88
|
FileUtils.touch(path)
|
85
89
|
end
|
86
90
|
|
87
91
|
def cp(source_path, destination_path)
|
88
92
|
return unless wet?
|
89
93
|
|
90
|
-
@logger
|
94
|
+
@logger&.info(:shell) {['cp', source_path, destination_path]}
|
91
95
|
FileUtils.copy(source_path, destination_path)
|
92
96
|
end
|
93
97
|
|
94
98
|
def rm(path)
|
95
99
|
return unless wet?
|
96
100
|
|
97
|
-
@logger
|
101
|
+
@logger&.info(:shell) {['rm -rf', path]}
|
98
102
|
FileUtils.rm_rf(path)
|
99
103
|
end
|
100
104
|
|
@@ -102,7 +106,7 @@ module Build
|
|
102
106
|
return unless wet?
|
103
107
|
|
104
108
|
unless File.exist?(path)
|
105
|
-
@logger
|
109
|
+
@logger&.info(:shell) {['mkpath', path]}
|
106
110
|
FileUtils.mkpath(path)
|
107
111
|
end
|
108
112
|
end
|
@@ -110,24 +114,19 @@ module Build
|
|
110
114
|
def install(source_path, destination_path)
|
111
115
|
return unless wet?
|
112
116
|
|
113
|
-
@logger
|
117
|
+
@logger&.info(:shell) {['install', source_path, destination_path]}
|
114
118
|
FileUtils.install(source_path, destination_path)
|
115
119
|
end
|
116
120
|
|
117
121
|
def write(path, data, mode = "w")
|
118
122
|
return unless wet?
|
119
123
|
|
120
|
-
@logger
|
124
|
+
@logger&.info(:shell) {["write", path, "#{data.size}bytes"]}
|
121
125
|
File.open(path, mode) do |file|
|
122
126
|
file.write(data)
|
123
127
|
end
|
124
128
|
end
|
125
129
|
|
126
|
-
# @deprecated Please use {#self} instead.
|
127
|
-
def fs
|
128
|
-
self
|
129
|
-
end
|
130
|
-
|
131
130
|
def update
|
132
131
|
@node.apply!(self)
|
133
132
|
end
|
@@ -135,12 +134,13 @@ module Build
|
|
135
134
|
def invoke_rule(rule, arguments, &block)
|
136
135
|
arguments = rule.normalize(arguments, self)
|
137
136
|
|
138
|
-
@logger
|
137
|
+
@logger&.debug(:invoke) {"-> #{rule}(#{arguments.inspect})"}
|
139
138
|
|
140
|
-
|
141
|
-
|
139
|
+
invoke(
|
140
|
+
RuleNode.new(rule, arguments, &block)
|
141
|
+
)
|
142
142
|
|
143
|
-
@logger
|
143
|
+
@logger&.debug(:invoke) {"<- #{rule}(...) -> #{rule.result(arguments)}"}
|
144
144
|
|
145
145
|
return rule.result(arguments)
|
146
146
|
end
|
data/lib/build/version.rb
CHANGED
@@ -23,92 +23,106 @@
|
|
23
23
|
require 'build/rulebook'
|
24
24
|
require 'build/controller'
|
25
25
|
|
26
|
+
require_relative 'target'
|
27
|
+
|
26
28
|
RSpec.describe Build::Controller do
|
27
|
-
let(:
|
28
|
-
Class.new do
|
29
|
-
def initialize(name)
|
30
|
-
@name = name
|
31
|
-
end
|
32
|
-
|
33
|
-
attr :name
|
34
|
-
|
35
|
-
def build(&block)
|
36
|
-
@build = block if block_given?
|
37
|
-
|
38
|
-
return @build
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
29
|
+
let(:base) {Build::Environment.new(name: "base")}
|
42
30
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
31
|
+
context "failure exit status" do
|
32
|
+
let(:make_target) do
|
33
|
+
Target.new("make") do |target|
|
34
|
+
target.provides "make" do
|
35
|
+
define Build::Rule, "make.file" do
|
36
|
+
output :destination
|
37
|
+
|
38
|
+
apply do |parameters|
|
39
|
+
run! "exit -1"
|
40
|
+
end
|
41
|
+
end
|
50
42
|
end
|
51
43
|
end
|
52
44
|
end
|
53
45
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
46
|
+
let(:build_target) do
|
47
|
+
Target.new("foo") do |target|
|
48
|
+
target.depends "make"
|
49
|
+
|
50
|
+
target.provides "foo" do
|
51
|
+
foo_path = Build::Files::Path['foo']
|
52
|
+
|
53
|
+
make destination: foo_path
|
54
|
+
end
|
55
|
+
end
|
58
56
|
end
|
59
57
|
|
60
|
-
|
61
|
-
|
58
|
+
it "build graph should fail" do
|
59
|
+
chain = Build::Dependency::Chain.expand(["foo"], [make_target, build_target])
|
60
|
+
|
61
|
+
controller = Build::Controller.new do |controller|
|
62
|
+
controller.add_chain(chain, [], base)
|
63
|
+
end
|
64
|
+
|
65
|
+
controller.logger.level = Logger::DEBUG
|
66
|
+
|
67
|
+
controller.update
|
68
|
+
|
69
|
+
expect(controller.failed?).to be_truthy
|
62
70
|
end
|
63
|
-
|
64
|
-
controller.logger.level = Logger::DEBUG
|
65
|
-
|
66
|
-
controller.update
|
67
|
-
|
68
|
-
expect(controller.failed?).to be_truthy
|
69
71
|
end
|
70
72
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
73
|
+
context "copying files" do
|
74
|
+
let(:files_target) do
|
75
|
+
Target.new("files") do |target|
|
76
|
+
target.provides "files" do
|
77
|
+
define Build::Rule, "make.file" do
|
78
|
+
output :destination
|
79
|
+
|
80
|
+
apply do |parameters|
|
81
|
+
touch parameters[:destination]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
define Build::Rule, "copy.file" do
|
86
|
+
input :source
|
87
|
+
output :destination
|
88
|
+
|
89
|
+
apply do |parameters|
|
90
|
+
cp parameters[:source], parameters[:destination]
|
91
|
+
end
|
92
|
+
end
|
78
93
|
end
|
79
94
|
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
95
|
+
end
|
96
|
+
|
97
|
+
let(:build_target) do
|
98
|
+
Target.new("build") do |target|
|
99
|
+
target.depends "files"
|
84
100
|
|
85
|
-
|
86
|
-
|
101
|
+
target.provides "foo" do
|
102
|
+
foo_path = Build::Files::Path['foo']
|
103
|
+
bar_path = Build::Files::Path['bar']
|
104
|
+
|
105
|
+
make destination: foo_path
|
106
|
+
copy source: foo_path, destination: bar_path
|
87
107
|
end
|
88
108
|
end
|
89
109
|
end
|
90
110
|
|
91
|
-
|
92
|
-
|
93
|
-
foo_path = Build::Files::Path['foo']
|
94
|
-
bar_path = Build::Files::Path['bar']
|
111
|
+
it "should execute the build graph" do
|
112
|
+
chain = Build::Dependency::Chain.expand(["foo"], [files_target, build_target])
|
95
113
|
|
96
|
-
|
114
|
+
controller = Build::Controller.new do |controller|
|
115
|
+
controller.add_chain(chain, [], base)
|
116
|
+
end
|
97
117
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
118
|
+
expect(controller.nodes.size).to be 1
|
119
|
+
|
120
|
+
controller.update
|
121
|
+
|
122
|
+
expect(File).to be_exist('foo')
|
123
|
+
expect(File).to be_exist('bar')
|
124
|
+
|
125
|
+
FileUtils.rm ['foo', 'bar']
|
103
126
|
end
|
104
|
-
|
105
|
-
expect(controller.nodes.size).to be 1
|
106
|
-
|
107
|
-
controller.update
|
108
|
-
|
109
|
-
expect(File).to be_exist('foo')
|
110
|
-
expect(File).to be_exist('bar')
|
111
|
-
|
112
|
-
FileUtils.rm ['foo', 'bar']
|
113
127
|
end
|
114
128
|
end
|
data/spec/build/rulebook_spec.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
require 'build/dependency'
|
3
|
+
|
4
|
+
class Target
|
5
|
+
include Build::Dependency
|
6
|
+
|
7
|
+
def initialize(name = nil)
|
8
|
+
@name = name
|
9
|
+
|
10
|
+
if block_given?
|
11
|
+
yield self
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
attr :name
|
16
|
+
|
17
|
+
def inspect
|
18
|
+
"\#<#{self.class}: #{@name}>"
|
19
|
+
end
|
20
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,23 +1,6 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
require 'simplecov'
|
5
|
-
|
6
|
-
SimpleCov.start do
|
7
|
-
add_filter "/spec/"
|
8
|
-
end
|
9
|
-
|
10
|
-
if ENV['TRAVIS']
|
11
|
-
require 'coveralls'
|
12
|
-
Coveralls.wear!
|
13
|
-
end
|
14
|
-
rescue LoadError
|
15
|
-
warn "Could not load simplecov: #{$!}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
require "bundler/setup"
|
20
|
-
require "build"
|
2
|
+
require 'covered/rspec'
|
3
|
+
require 'build'
|
21
4
|
|
22
5
|
RSpec.configure do |config|
|
23
6
|
# Enable flags like --only-failures and --next-failure
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: build-graph
|
@@ -30,14 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: build-dependency
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.2'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: build-makefile
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,20 +80,34 @@ dependencies:
|
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: covered
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: bundler
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
|
-
- - "
|
101
|
+
- - ">="
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
103
|
+
version: '0'
|
76
104
|
type: :development
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
|
-
- - "
|
108
|
+
- - ">="
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
110
|
+
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: rspec
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,6 +152,7 @@ files:
|
|
124
152
|
- Rakefile
|
125
153
|
- build.gemspec
|
126
154
|
- lib/build.rb
|
155
|
+
- lib/build/chain_node.rb
|
127
156
|
- lib/build/controller.rb
|
128
157
|
- lib/build/graphviz.rb
|
129
158
|
- lib/build/logger.rb
|
@@ -131,13 +160,13 @@ files:
|
|
131
160
|
- lib/build/rule.rb
|
132
161
|
- lib/build/rule_node.rb
|
133
162
|
- lib/build/rulebook.rb
|
134
|
-
- lib/build/target_node.rb
|
135
163
|
- lib/build/task.rb
|
136
164
|
- lib/build/version.rb
|
137
165
|
- spec/build/controller_spec.rb
|
138
166
|
- spec/build/name_spec.rb
|
139
167
|
- spec/build/rule_spec.rb
|
140
168
|
- spec/build/rulebook_spec.rb
|
169
|
+
- spec/build/target.rb
|
141
170
|
- spec/spec_helper.rb
|
142
171
|
homepage: ''
|
143
172
|
licenses:
|
@@ -158,8 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
187
|
- !ruby/object:Gem::Version
|
159
188
|
version: '0'
|
160
189
|
requirements: []
|
161
|
-
|
162
|
-
rubygems_version: 2.6.12
|
190
|
+
rubygems_version: 3.0.2
|
163
191
|
signing_key:
|
164
192
|
specification_version: 4
|
165
193
|
summary: Build is a framework for working with task based build systems.
|
@@ -168,4 +196,5 @@ test_files:
|
|
168
196
|
- spec/build/name_spec.rb
|
169
197
|
- spec/build/rule_spec.rb
|
170
198
|
- spec/build/rulebook_spec.rb
|
199
|
+
- spec/build/target.rb
|
171
200
|
- spec/spec_helper.rb
|
data/lib/build/target_node.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
20
|
-
|
21
|
-
require 'build/files'
|
22
|
-
require 'build/graph'
|
23
|
-
|
24
|
-
module Build
|
25
|
-
class TargetNode < Graph::Node
|
26
|
-
def initialize(task_class, target, arguments)
|
27
|
-
@target = target
|
28
|
-
@task_class = task_class
|
29
|
-
@arguments = arguments
|
30
|
-
|
31
|
-
# Wait here, for all dependent targets, to be done:
|
32
|
-
super(Files::List::NONE, :inherit, target)
|
33
|
-
end
|
34
|
-
|
35
|
-
attr :task_class
|
36
|
-
|
37
|
-
def name
|
38
|
-
@task_class.name
|
39
|
-
end
|
40
|
-
|
41
|
-
def apply!(scope)
|
42
|
-
scope.instance_exec(*@arguments, &@target.build)
|
43
|
-
end
|
44
|
-
|
45
|
-
def inspect
|
46
|
-
@task_class.name.inspect
|
47
|
-
end
|
48
|
-
|
49
|
-
def to_s
|
50
|
-
"#<#{self.class} #{@target.name}>"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|