build 2.7.0 → 2.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '00349494157af5d057e1ee2a70c3b65c8dd6873fd60419e50f90cb47d2d77018'
4
- data.tar.gz: 0131571a8d92702daba61ab85c00ede57e1856505ea06a39e504296759a8e123
3
+ metadata.gz: b92547e352a87437f672b77a83666f9295deebb585c8949969e377dc2325cbb5
4
+ data.tar.gz: 364a58f6aa86c31a039b7cd5b39e6706128ad46bd84912df2d48098833c260bc
5
5
  SHA512:
6
- metadata.gz: c3196a81c93111aa37ba354b225c5796d6c9600205e229a863865c84c7b29d4bf7e817af4a41a8db50ced349a1b68feb281708ac765e089d9dbe576496576fce
7
- data.tar.gz: cce38609f20d57f6d751a5ba2ae80f321bc8d16eca34fb0f512d3b514d5695cc3bc418e9dee904ae1c821d10cd7cf67308fb13f1a28331d28889135f177a10fa
6
+ metadata.gz: 1c3583294056a16e3042a3d6ece645f326669bb5c13c0fad8507b5198d6a29e20fe82f266f8aba55787964ae1730d2e7ca021e0f9eba4d6c19666bb6594631f7
7
+ data.tar.gz: 91637b6d29d74cff4246741955d8a8b2a082510fd1a0b48ebc8228f60c48987f5a44e06718a452db3dbd4b9cadebbb04e7b0e2e628caadbbd97ee79f32a2d86d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,70 @@
1
+ # Getting Started
2
+
3
+ This guide explains how to get started with `build`, a task-driven build system similar to make.
4
+
5
+ ## Installation
6
+
7
+ Add the gem to your project:
8
+
9
+ ~~~ bash
10
+ $ bundle add build
11
+ ~~~
12
+
13
+ ## Core Concepts
14
+
15
+ `build` has several core concepts:
16
+
17
+ - A {ruby Build::Rule} which represents a named build operation with typed input and output parameters.
18
+ - A {ruby Build::Rulebook} which is a collection of rules organized by process name for fast lookup.
19
+ - A {ruby Build::Controller} which manages the build graph and executes rules concurrently.
20
+
21
+ ## Usage
22
+
23
+ Define rules using `Build::Rule` inside a build environment, then organize them into a rulebook:
24
+
25
+ ~~~ ruby
26
+ require "build/environment"
27
+ require "build/rulebook"
28
+ require "build/rule"
29
+
30
+ environment = Build::Environment.new do
31
+ define Build::Rule, "copy.file" do
32
+ input :source
33
+ output :destination
34
+
35
+ apply do |parameters|
36
+ cp parameters[:source], parameters[:destination]
37
+ end
38
+ end
39
+
40
+ define Build::Rule, "compile.cpp" do
41
+ input :source
42
+ output :object
43
+
44
+ apply do |parameters|
45
+ run! "clang++", "-c", parameters[:source], "-o", parameters[:object]
46
+ end
47
+ end
48
+ end
49
+
50
+ rulebook = Build::Rulebook.for(environment.flatten)
51
+ ~~~
52
+
53
+ ### Running a Build
54
+
55
+ Use {ruby Build::Controller} to orchestrate the build graph. The controller handles dependency resolution and runs rules concurrently where possible:
56
+
57
+ ~~~ ruby
58
+ require "build/controller"
59
+
60
+ controller = Build::Controller.new do |controller|
61
+ controller.add_chain(chain, [], environment)
62
+ end
63
+
64
+ controller.run
65
+
66
+ if controller.failed?
67
+ $stderr.puts "Build failed!"
68
+ exit(1)
69
+ end
70
+ ~~~
@@ -0,0 +1,13 @@
1
+ # Automatically generated context index for Utopia::Project guides.
2
+ # Do not edit then files in this directory directly, instead edit the guides and then run `bake utopia:project:agent:context:update`.
3
+ ---
4
+ description: Build is a framework for creating task based build systems.
5
+ metadata:
6
+ documentation_uri: https://ioquatix.github.io/build/
7
+ source_code_uri: https://github.com/kurocha/build.git
8
+ funding_uri: https://github.com/sponsors/ioquatix
9
+ files:
10
+ - path: getting-started.md
11
+ title: Getting Started
12
+ description: This guide explains how to get started with `build`, a task-driven
13
+ build system similar to make.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2024, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
 
6
6
  require "fileutils"
7
7
  require "build/graph"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2016-2019, by Samuel Williams.
4
+ # Copyright, 2016-2026, by Samuel Williams.
5
5
 
6
6
  require "build/files"
7
7
  require "build/graph"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2015-2019, by Samuel Williams.
4
+ # Copyright, 2015-2026, by Samuel Williams.
5
5
 
6
6
  require "build/files"
7
7
  require "build/makefile"
@@ -20,15 +20,43 @@ require "console"
20
20
  module Build
21
21
  # Represents the top-level build controller that manages the walker and process group.
22
22
  class Controller
23
+ # A builder class for constructing the controller.
24
+ class Builder
25
+ # Initialize the builder with an empty list of nodes.
26
+ def initialize
27
+ @nodes = []
28
+ end
29
+
30
+ # @attribute [Array(Graph::Node)] The list of nodes to build.
31
+ attr :nodes
32
+
33
+ # Add a build environment to the controller.
34
+ def add_chain(chain, arguments = [], environment)
35
+ @nodes << ChainNode.new(chain, arguments, environment)
36
+ end
37
+ end
38
+
39
+ # Create a new controller using a builder.
40
+ def self.build(**options)
41
+ builder = Builder.new
42
+
43
+ yield builder
44
+
45
+ new(builder.nodes, **options)
46
+ end
47
+
23
48
  # Initialize the controller, yielding self to allow adding chain nodes.
24
49
  # @parameter limit [Integer | Nil] Maximum number of concurrent processes.
25
- def initialize(limit: nil)
26
- @module = Module.new
27
-
28
- # Top level nodes, for sanity this is a static list.
29
- @nodes = []
30
- yield self
31
- @nodes.freeze
50
+ def initialize(nodes = [], limit: nil)
51
+ if block_given?
52
+ warn "Passing a block to Build::Controller.new is deprecated, use Build::Controller.build instead."
53
+
54
+ builder = Builder.new
55
+ yield builder
56
+ @nodes = builder.nodes.freeze
57
+ else
58
+ @nodes = nodes.freeze
59
+ end
32
60
 
33
61
  @group = Process::Group.new(limit: limit)
34
62
 
@@ -41,6 +69,15 @@ module Build
41
69
  attr :nodes
42
70
  attr :walker
43
71
 
72
+ # Visit a task, executing its update method within the context of the task's visit method.
73
+ #
74
+ # @parameter task [Build::Task] The task to visit.
75
+ def visit(task)
76
+ task.visit do
77
+ task.update
78
+ end
79
+ end
80
+
44
81
  # Execute a single step of the build graph for the given node.
45
82
  # @parameter walker [Build::Graph::Walker] The graph walker.
46
83
  # @parameter node [Build::Graph::Node] The node to process.
@@ -49,9 +86,7 @@ module Build
49
86
  task_class = node.task_class(parent_task) || Task
50
87
  task = task_class.new(walker, node, @group)
51
88
 
52
- task.visit do
53
- task.update
54
- end
89
+ self.visit(task)
55
90
  end
56
91
 
57
92
  # @returns [Boolean] Whether the build has failed.
@@ -59,11 +94,6 @@ module Build
59
94
  @walker.failed?
60
95
  end
61
96
 
62
- # Add a build environment to the controller.
63
- def add_chain(chain, arguments = [], environment)
64
- @nodes << ChainNode.new(chain, arguments, environment)
65
- end
66
-
67
97
  # Execute all top-level nodes, waiting for each to complete.
68
98
  def update
69
99
  @nodes.each do |node|
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
 
6
6
  require "build/graph"
7
7
 
data/lib/build/name.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2015-2019, by Samuel Williams.
4
+ # Copyright, 2015-2026, by Samuel Williams.
5
5
 
6
6
  module Build
7
7
  # Represents a human-readable name with helpers for generating identifiers, target names, and macros.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
 
6
6
  require "build/graph"
7
7
 
data/lib/build/rule.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2015-2019, by Samuel Williams.
4
+ # Copyright, 2015-2026, by Samuel Williams.
5
5
 
6
6
  module Build
7
7
  # 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.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2016-2019, by Samuel Williams.
4
+ # Copyright, 2016-2026, by Samuel Williams.
5
5
 
6
6
  require "build/graph"
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2015-2019, by Samuel Williams.
4
+ # Copyright, 2015-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "rule"
7
7
 
data/lib/build/task.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2016-2019, by Samuel Williams.
4
+ # Copyright, 2016-2026, by Samuel Williams.
5
5
 
6
6
  require "fileutils"
7
7
  require "build/graph"
data/lib/build/version.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2015-2024, by Samuel Williams.
4
+ # Copyright, 2015-2026, by Samuel Williams.
5
5
 
6
6
  # @namespace
7
7
  module Build
8
- VERSION = "2.7.0"
8
+ VERSION = "2.9.0"
9
9
  end
data/lib/build.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2015, by Samuel Williams.
4
+ # Copyright, 2015-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "build/version"
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2015-2024, by Samuel Williams.
3
+ Copyright, 2015-2026, by Samuel Williams.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -4,30 +4,20 @@ Build is a ruby gem providing systems for building task driven build systems sim
4
4
 
5
5
  [![Development Status](https://github.com/ioquatix/build/workflows/Test/badge.svg)](https://github.com/ioquatix/build/actions?workflow=Test)
6
6
 
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- gem 'build'
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install build
20
-
21
7
  ## Usage
22
8
 
23
- Please see the [project documentation](https://ioquatix.github.io/build) for more details.
9
+ Please see the [project documentation](https://ioquatix.github.io/build/) for more details.
10
+
11
+ - [Getting Started](https://ioquatix.github.io/build/guides/getting-started/index) - This guide explains how to get started with `build`, a task-driven build system similar to make.
24
12
 
25
13
  ## Releases
26
14
 
27
- Please see the [project releases](https://ioquatix.github.io/buildreleases/index) for all releases.
15
+ Please see the [project releases](https://ioquatix.github.io/build/releases/index) for all releases.
28
16
 
29
17
  ### v2.7.0
30
18
 
19
+ - Remove logger dependency and options.
20
+
31
21
  ## Contributing
32
22
 
33
23
  We welcome contributions to this project.
@@ -38,6 +28,22 @@ We welcome contributions to this project.
38
28
  4. Push to the branch (`git push origin my-new-feature`).
39
29
  5. Create new Pull Request.
40
30
 
31
+ ### Running Tests
32
+
33
+ To run the test suite:
34
+
35
+ ``` shell
36
+ bundle exec sus
37
+ ```
38
+
39
+ ### Making Releases
40
+
41
+ To make a new release:
42
+
43
+ ``` shell
44
+ bundle exec bake gem:release:patch # or minor or major
45
+ ```
46
+
41
47
  ### Developer Certificate of Origin
42
48
 
43
49
  In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
data/releases.md CHANGED
@@ -1,3 +1,5 @@
1
1
  # Releases
2
2
 
3
3
  ## v2.7.0
4
+
5
+ - Remove logger dependency and options.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -94,30 +94,17 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.0'
97
- - !ruby/object:Gem::Dependency
98
- name: graphviz
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '1.0'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '1.0'
111
97
  executables: []
112
98
  extensions: []
113
99
  extra_rdoc_files: []
114
100
  files:
101
+ - context/getting-started.md
102
+ - context/index.yaml
115
103
  - lib/build.rb
116
104
  - lib/build/build_node.rb
117
105
  - lib/build/chain_node.rb
118
106
  - lib/build/controller.rb
119
107
  - lib/build/dependency_node.rb
120
- - lib/build/graphviz.rb
121
108
  - lib/build/name.rb
122
109
  - lib/build/provision_node.rb
123
110
  - lib/build/rule.rb
@@ -128,13 +115,12 @@ files:
128
115
  - license.md
129
116
  - readme.md
130
117
  - releases.md
131
- homepage: https://github.com/kurocha/build
132
118
  licenses:
133
119
  - MIT
134
120
  metadata:
135
- documentation_uri: https://ioquatix.github.io/build
136
- funding_uri: https://github.com/sponsors/ioquatix
121
+ documentation_uri: https://ioquatix.github.io/build/
137
122
  source_code_uri: https://github.com/kurocha/build.git
123
+ funding_uri: https://github.com/sponsors/ioquatix
138
124
  rdoc_options: []
139
125
  require_paths:
140
126
  - lib
@@ -142,14 +128,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ">="
144
130
  - !ruby/object:Gem::Version
145
- version: '3.2'
131
+ version: '3.3'
146
132
  required_rubygems_version: !ruby/object:Gem::Requirement
147
133
  requirements:
148
134
  - - ">="
149
135
  - !ruby/object:Gem::Version
150
136
  version: '0'
151
137
  requirements: []
152
- rubygems_version: 4.0.3
138
+ rubygems_version: 4.0.6
153
139
  specification_version: 4
154
140
  summary: Build is a framework for creating task based build systems.
155
141
  test_files: []
metadata.gz.sig CHANGED
Binary file
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Released under the MIT License.
4
- # Copyright, 2015, by Samuel Williams.
5
-
6
- module Build
7
- # Generate a Graphviz graph visualisation of the build graph.
8
- # @parameter walker [Build::Graph::Walker] The completed walker containing tasks.
9
- # @returns [Graphviz::Graph] A graph object ready for rendering.
10
- def self.graph_visualisation(walker)
11
- graph = Graphviz::Graph.new("G", rankdir: "LR")
12
-
13
- walker.tasks.each do |node, task|
14
- input_nodes = []
15
- output_nodes = []
16
-
17
- task.inputs.each do |path|
18
- input_nodes << graph.add_node(path.basename)
19
- end
20
-
21
- task.outputs.each do |path|
22
- output_nodes << graph.add_node(path.basename)
23
- end
24
-
25
- if output_nodes.size == 1
26
- input_nodes.each do |input_node|
27
- edge = input_node.connect(output_nodes.first)
28
- edge.attributes[:label] = node.title
29
- end
30
- end
31
- end
32
-
33
- return graph
34
- end
35
- end