build 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/build.gemspec +2 -2
- data/lib/build/chain_node.rb +28 -13
- data/lib/build/rulebook.rb +8 -7
- data/lib/build/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aacb41a16bc0e414fd04e7aecfb8d3647e2b8c5925c35ba44991cee5f7108022
|
4
|
+
data.tar.gz: 3d81a66f4f9d669d1040c3a0677e78fef4af0aae522540b3c2c023dab8efcd56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 182f4ee1649e5f69cc60f6af4f32e11e4f8960bf14feb9cc096aef136a12c3b49efd92f42ca1991b24afbed51e81509c502cff4b295c77a4da876691987c5686
|
7
|
+
data.tar.gz: 509fc310c4be7c16281753748b1625d8fde8085babc4f8bf71840da9867bf50dddd313e848be8c4e99e3c9312a4c853466c7bfeef418d660415228317ecb886c
|
data/build.gemspec
CHANGED
@@ -18,8 +18,8 @@ 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.
|
22
|
-
spec.add_dependency "build-dependency", "~> 1.
|
21
|
+
spec.add_dependency "build-environment", "~> 1.3"
|
22
|
+
spec.add_dependency "build-dependency", "~> 1.4"
|
23
23
|
spec.add_dependency "build-makefile", "~> 1.0"
|
24
24
|
|
25
25
|
spec.add_dependency "graphviz"
|
data/lib/build/chain_node.rb
CHANGED
@@ -39,29 +39,42 @@ module Build
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def apply_dependency(scope, dependency)
|
42
|
-
|
42
|
+
logger = scope.logger
|
43
43
|
|
44
|
-
#
|
45
|
-
provision = @chain.resolved[dependency].first
|
44
|
+
# logger.debug {"Traversing: #{dependency}..."}
|
46
45
|
|
47
46
|
environments = [@environment]
|
48
47
|
public_environments = []
|
48
|
+
provisions = @chain.resolved[dependency]
|
49
|
+
public_alias = dependency.alias?
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
51
|
+
provisions.each do |provision|
|
52
|
+
provision.each_dependency do |nested_dependency|
|
53
|
+
if environment = apply_dependency(scope, nested_dependency)
|
54
|
+
# logger.debug("Evaluating #{nested_dependency} -> #{provision} generated: #{environment}")
|
55
|
+
|
56
|
+
environments << environment
|
57
|
+
|
58
|
+
if public_alias || nested_dependency.public?
|
59
|
+
public_environments << environment
|
60
|
+
# else
|
61
|
+
# logger.debug("Skipping #{nested_dependency} in public environment.")
|
62
|
+
end
|
56
63
|
end
|
57
64
|
end
|
58
65
|
end
|
59
66
|
|
60
67
|
unless dependency.alias?
|
61
|
-
|
68
|
+
logger.debug {"Building: #{dependency}"}
|
69
|
+
|
70
|
+
# environments.each do |environment|
|
71
|
+
# logger.debug {"Using #{environment}"}
|
72
|
+
# end
|
62
73
|
|
63
74
|
local_environment = Build::Environment.combine(*environments)&.evaluate || Build::Environment.new
|
64
75
|
|
76
|
+
# logger.debug("Local Environment: #{local_environment}")
|
77
|
+
|
65
78
|
task_class = Rulebook.for(local_environment).with(Task, environment: local_environment)
|
66
79
|
|
67
80
|
task = task_class.new(scope.walker, self, scope.group, logger: scope.logger)
|
@@ -70,11 +83,13 @@ module Build
|
|
70
83
|
|
71
84
|
scope.walker.with(task_class: task_class) do
|
72
85
|
task.visit do
|
73
|
-
output_environment = Build::Environment.new(local_environment)
|
86
|
+
output_environment = Build::Environment.new(local_environment, name: dependency.name)
|
74
87
|
|
75
|
-
|
88
|
+
provisions.each do |provision|
|
89
|
+
output_environment.construct!(task, *@arguments, &provision.value)
|
90
|
+
end
|
76
91
|
|
77
|
-
public_environments << output_environment.dup(parent: nil)
|
92
|
+
public_environments << output_environment.dup(parent: nil, name: dependency.name)
|
78
93
|
end
|
79
94
|
end
|
80
95
|
end
|
data/lib/build/rulebook.rb
CHANGED
@@ -22,7 +22,8 @@ require_relative 'rule'
|
|
22
22
|
|
23
23
|
module Build
|
24
24
|
class Rulebook
|
25
|
-
def initialize
|
25
|
+
def initialize(name = nil)
|
26
|
+
@name = name
|
26
27
|
@rules = {}
|
27
28
|
@processes = {}
|
28
29
|
end
|
@@ -44,6 +45,11 @@ module Build
|
|
44
45
|
def with(superclass, **state)
|
45
46
|
task_class = Class.new(superclass)
|
46
47
|
|
48
|
+
# name = @name
|
49
|
+
# task_class.send(:define_method, :to_s) do
|
50
|
+
# "name"
|
51
|
+
# end
|
52
|
+
|
47
53
|
# Define methods for all processes, e.g. task_class#compile
|
48
54
|
@processes.each do |key, rules|
|
49
55
|
# Define general rules, which use rule applicability for disambiguation:
|
@@ -72,16 +78,11 @@ module Build
|
|
72
78
|
end
|
73
79
|
end
|
74
80
|
|
75
|
-
rulebook = self
|
76
|
-
task_class.send(:define_method, :rulebook) do
|
77
|
-
rulebook
|
78
|
-
end
|
79
|
-
|
80
81
|
return task_class
|
81
82
|
end
|
82
83
|
|
83
84
|
def self.for(environment)
|
84
|
-
rulebook = self.new
|
85
|
+
rulebook = self.new(environment.name)
|
85
86
|
|
86
87
|
environment.defined.each do |name, define|
|
87
88
|
rulebook << define.klass.build(name, &define.block)
|
data/lib/build/version.rb
CHANGED
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: 2.
|
4
|
+
version: 2.1.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: 2019-02-
|
11
|
+
date: 2019-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: build-graph
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.3'
|
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.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: build-dependency
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.4'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.4'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: build-makefile
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|