build-dependency 1.5.1 → 1.6.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/dependency/chain.rb +13 -22
- data/lib/build/dependency/partial_chain.rb +18 -21
- data/lib/build/dependency/provider.rb +28 -27
- data/lib/build/dependency/resolver.rb +12 -21
- data/lib/build/dependency/set.rb +27 -20
- data/lib/build/dependency/version.rb +7 -20
- data/lib/build/dependency/visualization.rb +58 -122
- data/lib/build/dependency.rb +9 -24
- data/license.md +21 -0
- data/readme.md +64 -0
- data/releases.md +5 -0
- data/test/build/dependency/chain.rb +223 -0
- data/test/build/dependency/partial_chain.rb +121 -0
- data/test/build/dependency/provider.rb +189 -0
- data/test/build/dependency/set.rb +122 -0
- data/test/build/dependency/visualization.rb +21 -0
- data/test/build/dependency/wildcard.rb +38 -0
- data.tar.gz.sig +1 -0
- metadata +49 -113
- metadata.gz.sig +0 -0
- data/.gitignore +0 -23
- data/.rspec +0 -4
- data/.travis.yml +0 -17
- data/Gemfile +0 -14
- data/Guardfile +0 -9
- data/README.md +0 -214
- data/Rakefile +0 -8
- data/build-dependency.gemspec +0 -24
- data/build_system_rules_and_algorithms.pdf +0 -0
- data/full.svg +0 -123
- data/partial.svg +0 -93
- data/spec/build/dependency/chain_spec.rb +0 -218
- data/spec/build/dependency/package.rb +0 -89
- data/spec/build/dependency/partial_chain_spec.rb +0 -119
- data/spec/build/dependency/provider_spec.rb +0 -123
- data/spec/build/dependency/set_spec.rb +0 -87
- data/spec/build/dependency/visualization_spec.rb +0 -33
- data/spec/build/dependency/wildcard_spec.rb +0 -45
- data/spec/spec_helper.rb +0 -12
- data/visualization.svg +0 -147
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2019-2026, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
require "build/dependency/set"
|
|
7
|
+
|
|
8
|
+
NamedObject = Struct.new(:name, :age)
|
|
9
|
+
|
|
10
|
+
describe Build::Dependency::Set do
|
|
11
|
+
let(:object_class) {Struct.new(:name, :age)}
|
|
12
|
+
|
|
13
|
+
with "empty set" do
|
|
14
|
+
let(:subject) {Build::Dependency::Set.new}
|
|
15
|
+
|
|
16
|
+
it "is empty" do
|
|
17
|
+
expect(subject).to be(:empty?)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
with "non-empty set" do
|
|
22
|
+
let(:bob) {object_class.new("Bob", 10)}
|
|
23
|
+
let(:subject) {Build::Dependency::Set.new([bob])}
|
|
24
|
+
|
|
25
|
+
it "should contain named objects" do
|
|
26
|
+
expect(subject).to be(:include?, bob)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "can enumerate all contained objects" do
|
|
30
|
+
expect(subject.each.to_a).to be == [bob]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "contains one item" do
|
|
34
|
+
expect(subject).not.to be(:empty?)
|
|
35
|
+
expect(subject.size).to be == 1
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "can be cleared" do
|
|
39
|
+
expect(subject).not.to be(:empty?)
|
|
40
|
+
subject.clear
|
|
41
|
+
expect(subject).to be(:empty?)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "can delete items" do
|
|
45
|
+
expect(subject).not.to be(:empty?)
|
|
46
|
+
subject.delete(bob)
|
|
47
|
+
expect(subject).to be(:empty?)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "can be frozen" do
|
|
51
|
+
subject.freeze
|
|
52
|
+
|
|
53
|
+
expect(subject).to be(:frozen?)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "can look up named items" do
|
|
57
|
+
expect(subject[bob.name]).to be == bob
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "should have string representation" do
|
|
61
|
+
expect(subject.to_s).to be =~ /Bob/
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it "could contain many items" do
|
|
66
|
+
set = Build::Dependency::Set.new
|
|
67
|
+
names = ["Apple", "Orange", "Banana", "Kiwifruit"]
|
|
68
|
+
|
|
69
|
+
names.each_with_index do |name, index|
|
|
70
|
+
set << NamedObject.new(name, index)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
expect(set.size).to be == names.size
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "should raise KeyError when adding duplicate items" do
|
|
77
|
+
set = Build::Dependency::Set.new
|
|
78
|
+
bob = NamedObject.new("Bob", 10)
|
|
79
|
+
|
|
80
|
+
set << bob
|
|
81
|
+
|
|
82
|
+
expect do
|
|
83
|
+
set.add(bob)
|
|
84
|
+
end.to raise_exception(KeyError)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it "can slice named items" do
|
|
88
|
+
set = Build::Dependency::Set.new
|
|
89
|
+
alice = NamedObject.new("Alice", 20)
|
|
90
|
+
bob = NamedObject.new("Bob", 30)
|
|
91
|
+
charlie = NamedObject.new("Charlie", 40)
|
|
92
|
+
|
|
93
|
+
set << alice
|
|
94
|
+
set << bob
|
|
95
|
+
set << charlie
|
|
96
|
+
|
|
97
|
+
expect(set.slice(["Alice", "Charlie"])).to be == [alice, charlie]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it "can be duplicated" do
|
|
101
|
+
original = Build::Dependency::Set.new
|
|
102
|
+
alice = NamedObject.new("Alice", 20)
|
|
103
|
+
bob = NamedObject.new("Bob", 30)
|
|
104
|
+
|
|
105
|
+
original << alice
|
|
106
|
+
original << bob
|
|
107
|
+
|
|
108
|
+
duplicate = original.dup
|
|
109
|
+
|
|
110
|
+
expect(duplicate.size).to be == 2
|
|
111
|
+
expect(duplicate).to be(:include?, alice)
|
|
112
|
+
expect(duplicate).to be(:include?, bob)
|
|
113
|
+
|
|
114
|
+
# Check that modifying the duplicate doesn't affect the original
|
|
115
|
+
charlie = NamedObject.new("Charlie", 40)
|
|
116
|
+
duplicate << charlie
|
|
117
|
+
|
|
118
|
+
expect(duplicate.size).to be == 3
|
|
119
|
+
expect(original.size).to be == 2
|
|
120
|
+
expect(original).not.to be(:include?, charlie)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2026, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
require "build/dependency_context"
|
|
7
|
+
|
|
8
|
+
describe Build::Dependency::Visualization do
|
|
9
|
+
include Build::DependencyContext::AppPackages
|
|
10
|
+
|
|
11
|
+
let(:subject) {Build::Dependency::Visualization.new}
|
|
12
|
+
|
|
13
|
+
it "should visualize dependency chain" do
|
|
14
|
+
chain = Build::Dependency::Chain.expand(["app", "tests"], packages)
|
|
15
|
+
|
|
16
|
+
mermaid = subject.generate(chain)
|
|
17
|
+
|
|
18
|
+
expect(mermaid).to be_a(String)
|
|
19
|
+
expect(mermaid).to be(:include?, "flowchart")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2017-2026, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
require "build/dependency_context"
|
|
7
|
+
|
|
8
|
+
describe Build::Dependency do
|
|
9
|
+
with "test packages" do
|
|
10
|
+
let(:a) do
|
|
11
|
+
Build::DependencyContext::Package.new("Library/Frobulate").tap do |package|
|
|
12
|
+
package.provides "Test/Frobulate" do
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
let(:b) do
|
|
18
|
+
Build::DependencyContext::Package.new("Library/Barbulate").tap do |package|
|
|
19
|
+
package.provides "Test/Barbulate" do
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should resolve all tests" do
|
|
25
|
+
chain = Build::Dependency::Chain.expand(["Test/*"], [a, b])
|
|
26
|
+
expect(chain.ordered.collect(&:provider)).to be == [a, b]
|
|
27
|
+
expect(chain.unresolved).to be == []
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should match non-wildcard dependencies" do
|
|
31
|
+
# Test that non-wildcard matching works
|
|
32
|
+
dependency = Build::Dependency::Depends.new("Test/Frobulate")
|
|
33
|
+
expect(dependency).not.to be(:wildcard?)
|
|
34
|
+
expect(dependency).to be(:match?, "Test/Frobulate")
|
|
35
|
+
expect(dependency).not.to be(:match?, "Test/Barbulate")
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
data.tar.gz.sig
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
_R�L��S."]:����{7\��m�݈��ؼ$ޛ!��;Aȇ�����;��_�������Ǯ<�|�#+{c��}�^Z&U�p`R� �Jl���Å!�9}���{��r��x�ebM���o*tD.�>Q��&�ũ(h;�؇�qGq1��F߮��S!xp')��#R���uW(�qo���u��P��p���S�*�X������F1��)�Pm����u4���5��u�I.G�k�V�#�\[�}���ibݵ��q8i�Q�aQ^����*��yO�Ps�F$��Ot.�������r`�@R�-��x�AI�]��:l�I�#5��V�n�2���ei8�|c�g4��4�W����V�*)V/���8�A~�
|
metadata
CHANGED
|
@@ -1,102 +1,47 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: build-dependency
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
|
-
cert_chain:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
name: bundler
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ">="
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: rspec
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - "~>"
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '3.8'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - "~>"
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '3.8'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: rake
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - ">="
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - ">="
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
83
|
-
description:
|
|
84
|
-
email:
|
|
85
|
-
- samuel.williams@oriontransfer.co.nz
|
|
9
|
+
cert_chain:
|
|
10
|
+
- |
|
|
11
|
+
-----BEGIN CERTIFICATE-----
|
|
12
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
|
13
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
|
14
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
|
15
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
|
16
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
|
17
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
|
18
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
|
19
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
|
20
|
+
sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
|
|
21
|
+
e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
|
|
22
|
+
XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
|
|
23
|
+
RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
|
|
24
|
+
tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
|
|
25
|
+
zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
|
|
26
|
+
xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
|
27
|
+
BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
|
|
28
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
|
|
29
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
|
|
30
|
+
cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
|
|
31
|
+
xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
|
|
32
|
+
c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
|
|
33
|
+
8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
|
|
34
|
+
JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
|
|
35
|
+
eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
|
|
36
|
+
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
|
37
|
+
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
|
38
|
+
-----END CERTIFICATE-----
|
|
39
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
40
|
+
dependencies: []
|
|
86
41
|
executables: []
|
|
87
42
|
extensions: []
|
|
88
43
|
extra_rdoc_files: []
|
|
89
44
|
files:
|
|
90
|
-
- ".gitignore"
|
|
91
|
-
- ".rspec"
|
|
92
|
-
- ".travis.yml"
|
|
93
|
-
- Gemfile
|
|
94
|
-
- Guardfile
|
|
95
|
-
- README.md
|
|
96
|
-
- Rakefile
|
|
97
|
-
- build-dependency.gemspec
|
|
98
|
-
- build_system_rules_and_algorithms.pdf
|
|
99
|
-
- full.svg
|
|
100
45
|
- lib/build/dependency.rb
|
|
101
46
|
- lib/build/dependency/chain.rb
|
|
102
47
|
- lib/build/dependency/partial_chain.rb
|
|
@@ -105,21 +50,21 @@ files:
|
|
|
105
50
|
- lib/build/dependency/set.rb
|
|
106
51
|
- lib/build/dependency/version.rb
|
|
107
52
|
- lib/build/dependency/visualization.rb
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
- visualization.svg
|
|
118
|
-
homepage: ''
|
|
53
|
+
- license.md
|
|
54
|
+
- readme.md
|
|
55
|
+
- releases.md
|
|
56
|
+
- test/build/dependency/chain.rb
|
|
57
|
+
- test/build/dependency/partial_chain.rb
|
|
58
|
+
- test/build/dependency/provider.rb
|
|
59
|
+
- test/build/dependency/set.rb
|
|
60
|
+
- test/build/dependency/visualization.rb
|
|
61
|
+
- test/build/dependency/wildcard.rb
|
|
119
62
|
licenses:
|
|
120
63
|
- MIT
|
|
121
|
-
metadata:
|
|
122
|
-
|
|
64
|
+
metadata:
|
|
65
|
+
documentation_uri: https://ioquatix.github.io/build-dependency/
|
|
66
|
+
funding_uri: https://github.com/sponsors/ioquatix
|
|
67
|
+
source_code_uri: https://github.com/ioquatix/build-dependency
|
|
123
68
|
rdoc_options: []
|
|
124
69
|
require_paths:
|
|
125
70
|
- lib
|
|
@@ -127,23 +72,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
127
72
|
requirements:
|
|
128
73
|
- - ">="
|
|
129
74
|
- !ruby/object:Gem::Version
|
|
130
|
-
version: '
|
|
75
|
+
version: '3.3'
|
|
131
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
77
|
requirements:
|
|
133
78
|
- - ">="
|
|
134
79
|
- !ruby/object:Gem::Version
|
|
135
80
|
version: '0'
|
|
136
81
|
requirements: []
|
|
137
|
-
rubygems_version:
|
|
138
|
-
signing_key:
|
|
82
|
+
rubygems_version: 4.0.6
|
|
139
83
|
specification_version: 4
|
|
140
84
|
summary: A set of data structures and algorithms for dependency resolution.
|
|
141
|
-
test_files:
|
|
142
|
-
- spec/build/dependency/chain_spec.rb
|
|
143
|
-
- spec/build/dependency/package.rb
|
|
144
|
-
- spec/build/dependency/partial_chain_spec.rb
|
|
145
|
-
- spec/build/dependency/provider_spec.rb
|
|
146
|
-
- spec/build/dependency/set_spec.rb
|
|
147
|
-
- spec/build/dependency/visualization_spec.rb
|
|
148
|
-
- spec/build/dependency/wildcard_spec.rb
|
|
149
|
-
- spec/spec_helper.rb
|
|
85
|
+
test_files: []
|
metadata.gz.sig
ADDED
|
Binary file
|
data/.gitignore
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
*.gem
|
|
2
|
-
*.rbc
|
|
3
|
-
.bundle
|
|
4
|
-
.config
|
|
5
|
-
.yardoc
|
|
6
|
-
Gemfile.lock
|
|
7
|
-
InstalledFiles
|
|
8
|
-
_yardoc
|
|
9
|
-
coverage
|
|
10
|
-
doc/
|
|
11
|
-
lib/bundler/man
|
|
12
|
-
pkg
|
|
13
|
-
rdoc
|
|
14
|
-
spec/reports
|
|
15
|
-
test/tmp
|
|
16
|
-
test/version_tmp
|
|
17
|
-
tmp
|
|
18
|
-
*.bundle
|
|
19
|
-
*.so
|
|
20
|
-
*.o
|
|
21
|
-
*.a
|
|
22
|
-
mkmf.log
|
|
23
|
-
.rspec_status
|
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
# Specify your gem's dependencies in build-dependency.gemspec
|
|
4
|
-
gemspec
|
|
5
|
-
|
|
6
|
-
group :development do
|
|
7
|
-
gem 'guard'
|
|
8
|
-
gem 'guard-rspec'
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
group :test do
|
|
12
|
-
gem 'simplecov'
|
|
13
|
-
gem 'coveralls', require: false
|
|
14
|
-
end
|
data/Guardfile
DELETED
data/README.md
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
# Build::Dependency
|
|
2
|
-
|
|
3
|
-
Build::Dependency provides dependency resolution algorithms.
|
|
4
|
-
|
|
5
|
-
[](http://travis-ci.org/ioquatix/build-dependency)
|
|
6
|
-
[](https://codeclimate.com/github/ioquatix/build-dependency)
|
|
7
|
-
[](https://coveralls.io/r/ioquatix/build-dependency)
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
Add this line to your application's Gemfile:
|
|
12
|
-
|
|
13
|
-
gem 'build-dependency'
|
|
14
|
-
|
|
15
|
-
And then execute:
|
|
16
|
-
|
|
17
|
-
$ bundle
|
|
18
|
-
|
|
19
|
-
Or install it yourself as:
|
|
20
|
-
|
|
21
|
-
$ gem install build-dependency
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
A dependency graph is a DAG (directed acyclic graph), such that if `A` depends on `B`, `A` has an edge pointing to `B`.
|
|
26
|
-
|
|
27
|
-
A dependency list is an ordered list of dependencies, such that if `A` depends on `B`, `B` will be listed earlier than `A`.
|
|
28
|
-
|
|
29
|
-
A dependency chain is the result of traversing the dependency graph from a given set of dependencies. It contains an ordered list of providers, a list of specific provisions.
|
|
30
|
-
|
|
31
|
-

|
|
32
|
-
|
|
33
|
-
A private dependency is not traversed when creating a partial chain. When building a partial chain for `app`, we don't follow `lib`'s private dependency on `Language/C++17`.
|
|
34
|
-
|
|
35
|
-

|
|
36
|
-
|
|
37
|
-
The orange box is the top level dependency, the grey box is an alias, the blue box is a specific provider, and the bold boxes are specific provisions which are being included.
|
|
38
|
-
|
|
39
|
-
### Model
|
|
40
|
-
|
|
41
|
-
To create your own dependency graph, you need to expose a model object which represents something that has dependencies and can be depended on.
|
|
42
|
-
|
|
43
|
-
Here is an example of a package model for Arch Linux `PKGBUILD` files:
|
|
44
|
-
|
|
45
|
-
```ruby
|
|
46
|
-
# A specific package.
|
|
47
|
-
class Package
|
|
48
|
-
include Build::Dependency
|
|
49
|
-
|
|
50
|
-
def initialize(path, metadata)
|
|
51
|
-
@path = path
|
|
52
|
-
@metadata = metadata
|
|
53
|
-
|
|
54
|
-
metadata.each do |key, value|
|
|
55
|
-
case key
|
|
56
|
-
when 'pkgname'
|
|
57
|
-
@name = value
|
|
58
|
-
when 'depends'
|
|
59
|
-
self.depends(value)
|
|
60
|
-
when 'provides'
|
|
61
|
-
self.provides(value)
|
|
62
|
-
when 'pkgver'
|
|
63
|
-
@pkgver = value
|
|
64
|
-
when 'pkgrel'
|
|
65
|
-
@pkgrel = value
|
|
66
|
-
when 'arch'
|
|
67
|
-
@arch = value
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
@name ||= File.basename(path)
|
|
72
|
-
self.provides(@name)
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
attr :path
|
|
76
|
-
attr :name
|
|
77
|
-
attr :metadata
|
|
78
|
-
|
|
79
|
-
def package_path
|
|
80
|
-
File.join(@path, package_file)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def package_file
|
|
84
|
-
"#{@name}-#{@pkgver}-#{@pkgrel}-#{@arch}.pkg.tar.xz"
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
# A context represents a directory full of packages.
|
|
89
|
-
class Context
|
|
90
|
-
def initialize(path)
|
|
91
|
-
@path = path
|
|
92
|
-
@packages = {}
|
|
93
|
-
|
|
94
|
-
load_packages!
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def packages_path
|
|
98
|
-
@path
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
attr :packages
|
|
102
|
-
|
|
103
|
-
def load_packages!
|
|
104
|
-
Dir.foreach(packages_path) do |package_name|
|
|
105
|
-
next if package_name.start_with?('.')
|
|
106
|
-
|
|
107
|
-
package_path = File.join(packages_path, package_name)
|
|
108
|
-
next unless File.directory?(package_path)
|
|
109
|
-
|
|
110
|
-
LOGGER.info "Loading #{package_path}..."
|
|
111
|
-
output, status = Open3.capture2("makepkg", "--printsrcinfo", chdir: package_path)
|
|
112
|
-
|
|
113
|
-
metadata = output.lines.collect(&:strip).delete_if(&:empty?).collect{|line| line.split(/\s*=\s*/, 2)}
|
|
114
|
-
|
|
115
|
-
package = Package.new(package_path, metadata)
|
|
116
|
-
@packages[package.name] = package
|
|
117
|
-
|
|
118
|
-
if package.name != package_name
|
|
119
|
-
LOGGER.warn "Package in directory #{package_name} has pkgname of #{package.name}!"
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
# Compute the dependency chain for the selection of packages.
|
|
125
|
-
def provision_chain(selection)
|
|
126
|
-
Build::Dependency::Chain.new(selection, @packages.values, selection)
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Chains
|
|
132
|
-
|
|
133
|
-
A chain represents a list of resolved packages. You generate a chain from a list of dependencies, a list of all available packages, and a selection of packages which help to resolve ambiguities (e.g. if two packages provide the same target, selection and then priority is used to resolve the ambiguity).
|
|
134
|
-
|
|
135
|
-
Here is a rake task for the above model which can build a directory of packages including both local PKGBUILDs and upstream packages:
|
|
136
|
-
|
|
137
|
-
```ruby
|
|
138
|
-
desc "Build a deployment of packages, specify the root package using TARGET="
|
|
139
|
-
task :collect do
|
|
140
|
-
target = ENV['TARGET'] or fail("Please supply TARGET=")
|
|
141
|
-
|
|
142
|
-
LOGGER.info "Resolving packages for #{target}"
|
|
143
|
-
|
|
144
|
-
context = Servers::Context.new(__dir__)
|
|
145
|
-
|
|
146
|
-
chain = context.provision_chain([target])
|
|
147
|
-
|
|
148
|
-
deploy_root = File.join(__dir__, "../deploy", target)
|
|
149
|
-
|
|
150
|
-
FileUtils::Verbose.rm_rf deploy_root
|
|
151
|
-
FileUtils::Verbose.mkdir_p deploy_root
|
|
152
|
-
|
|
153
|
-
system_packages = Set.new
|
|
154
|
-
|
|
155
|
-
# Depdencies that could not be resolved by our local packages must be resolved the system:
|
|
156
|
-
chain.unresolved.each do |(depends, source)|
|
|
157
|
-
output, status = Open3.capture2("pactree", "-lsu", depends.name)
|
|
158
|
-
|
|
159
|
-
abort "Failed to resolve dependency tree for package #{depends.name}" unless status.success?
|
|
160
|
-
|
|
161
|
-
system_packages += output.split(/\s+/)
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
# Copy system packages from pacman repositories:
|
|
165
|
-
Dir.chdir(deploy_root) do
|
|
166
|
-
Open3.pipeline(
|
|
167
|
-
["pacman", "-Sp", *system_packages.to_a],
|
|
168
|
-
['wget', '-nv', '-i', '-'],
|
|
169
|
-
)
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
# Copy local packages:
|
|
173
|
-
chain.ordered.each do |resolution|
|
|
174
|
-
package = resolution.provider
|
|
175
|
-
FileUtils::Verbose.cp package.package_path, File.join(deploy_root, package.package_file)
|
|
176
|
-
end
|
|
177
|
-
end
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
# Wildcards
|
|
181
|
-
|
|
182
|
-
It's possible to include wildcards in the dependency name. This is useful if you use scoped names, e.g. `Test/*` would depend on all test targets. The wildcard matching is done by `File.fnmatch?`.
|
|
183
|
-
|
|
184
|
-
## Contributing
|
|
185
|
-
|
|
186
|
-
1. Fork it
|
|
187
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
188
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
189
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
190
|
-
5. Create new Pull Request
|
|
191
|
-
|
|
192
|
-
## License
|
|
193
|
-
|
|
194
|
-
Released under the MIT license.
|
|
195
|
-
|
|
196
|
-
Copyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
|
197
|
-
|
|
198
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
199
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
200
|
-
in the Software without restriction, including without limitation the rights
|
|
201
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
202
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
203
|
-
furnished to do so, subject to the following conditions:
|
|
204
|
-
|
|
205
|
-
The above copyright notice and this permission notice shall be included in
|
|
206
|
-
all copies or substantial portions of the Software.
|
|
207
|
-
|
|
208
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
209
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
210
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
211
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
212
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
213
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
214
|
-
THE SOFTWARE.
|