rubuild-core 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +23 -0
- data/History.txt +11 -0
- data/Manifest.txt +35 -0
- data/README.rdoc +43 -0
- data/Rakefile +10 -0
- data/bin/rubuild +18 -0
- data/examples/printargs +5 -0
- data/lib/rubuild.rb +14 -0
- data/lib/rubuild/build.rb +4 -0
- data/lib/rubuild/build/context.rb +78 -0
- data/lib/rubuild/build/dep.rb +359 -0
- data/lib/rubuild/build/factory.rb +30 -0
- data/lib/rubuild/build/simple.rb +3 -0
- data/lib/rubuild/build/simple/context.rb +90 -0
- data/lib/rubuild/build/simple/dep.rb +367 -0
- data/lib/rubuild/build/simple/factory.rb +17 -0
- data/lib/rubuild/env.rb +113 -0
- data/lib/rubuild/env/location.rb +105 -0
- data/lib/rubuild/env/provider.rb +51 -0
- data/lib/rubuild/env/requirer.rb +66 -0
- data/lib/rubuild/load.rb +3 -0
- data/lib/rubuild/load/info.rb +52 -0
- data/lib/rubuild/load/loader.rb +75 -0
- data/lib/rubuild/load/namespace.rb +117 -0
- data/lib/rubuild/options.rb +34 -0
- data/lib/rubuild/util.rb +11 -0
- data/test/test_dep.rb +176 -0
- data/test/test_env.rb +91 -0
- data/test/test_env_location.rb +68 -0
- data/test/test_env_provider.rb +45 -0
- data/test/test_env_requirer.rb +52 -0
- data/test/test_load_info.rb +63 -0
- data/test/test_load_loader.rb +119 -0
- data/test/test_load_namespace.rb +43 -0
- data/test/test_options.rb +32 -0
- metadata +159 -0
data/.autotest
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'autotest/restart'
|
4
|
+
|
5
|
+
# Autotest.add_hook :initialize do |at|
|
6
|
+
# at.extra_files << "../some/external/dependency.rb"
|
7
|
+
#
|
8
|
+
# at.libs << ":../some/external"
|
9
|
+
#
|
10
|
+
# at.add_exception 'vendor'
|
11
|
+
#
|
12
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
13
|
+
# at.files_matching(/test_.*rb$/)
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# %w(TestA TestB).each do |klass|
|
17
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
|
21
|
+
# Autotest.add_hook :run_command do |at|
|
22
|
+
# system "rake build"
|
23
|
+
# end
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
.autotest
|
2
|
+
History.txt
|
3
|
+
Manifest.txt
|
4
|
+
Rakefile
|
5
|
+
README.rdoc
|
6
|
+
bin/rubuild
|
7
|
+
examples/printargs
|
8
|
+
lib/rubuild.rb
|
9
|
+
lib/rubuild/build.rb
|
10
|
+
lib/rubuild/build/context.rb
|
11
|
+
lib/rubuild/build/dep.rb
|
12
|
+
lib/rubuild/build/factory.rb
|
13
|
+
lib/rubuild/build/simple.rb
|
14
|
+
lib/rubuild/build/simple/context.rb
|
15
|
+
lib/rubuild/build/simple/dep.rb
|
16
|
+
lib/rubuild/build/simple/factory.rb
|
17
|
+
lib/rubuild/env.rb
|
18
|
+
lib/rubuild/env/location.rb
|
19
|
+
lib/rubuild/env/provider.rb
|
20
|
+
lib/rubuild/env/requirer.rb
|
21
|
+
lib/rubuild/load.rb
|
22
|
+
lib/rubuild/load/info.rb
|
23
|
+
lib/rubuild/load/loader.rb
|
24
|
+
lib/rubuild/load/namespace.rb
|
25
|
+
lib/rubuild/options.rb
|
26
|
+
lib/rubuild/util.rb
|
27
|
+
test/test_dep.rb
|
28
|
+
test/test_env.rb
|
29
|
+
test/test_env_location.rb
|
30
|
+
test/test_env_provider.rb
|
31
|
+
test/test_env_requirer.rb
|
32
|
+
test/test_load_info.rb
|
33
|
+
test/test_load_loader.rb
|
34
|
+
test/test_load_namespace.rb
|
35
|
+
test/test_options.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
= rubuild-core
|
2
|
+
|
3
|
+
http://rubuild.rubyforge.org
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
=== Rubuild - Source-selection polymorphic build tool.
|
8
|
+
Rubuild is a replacement for "make", written in Ruby.
|
9
|
+
|
10
|
+
Rubuild is motivated by the desire to support source-selection polymorphism -
|
11
|
+
that is, the ability to select different tools and/or source files (which
|
12
|
+
implement known interfaces) during the compilation process.
|
13
|
+
|
14
|
+
==== Modules and Classes
|
15
|
+
[Rubuild::Build] Classes for managing dependency actions.
|
16
|
+
[Rubuild::Env] Classes for managing provide/require semantics for build steps.
|
17
|
+
|
18
|
+
== FEATURES/PROBLEMS:
|
19
|
+
|
20
|
+
|
21
|
+
== SYNOPSIS:
|
22
|
+
|
23
|
+
|
24
|
+
== REQUIREMENTS:
|
25
|
+
|
26
|
+
* Safer >= 0.3.0
|
27
|
+
|
28
|
+
== INSTALL:
|
29
|
+
|
30
|
+
* sudo gem install rubuild-core
|
31
|
+
|
32
|
+
== DEVELOPERS:
|
33
|
+
|
34
|
+
After checking out the source, run:
|
35
|
+
|
36
|
+
$ rake newb
|
37
|
+
|
38
|
+
This task will install any missing dependencies, run the tests/specs,
|
39
|
+
and generate the RDoc.
|
40
|
+
|
41
|
+
== LICENSE:
|
42
|
+
|
43
|
+
This software is placed into the public domain.
|
data/Rakefile
ADDED
data/bin/rubuild
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubuild'
|
4
|
+
|
5
|
+
env = Rubuild::Env.new(Rubuild::Build::Simple::Factory.new)
|
6
|
+
options = Rubuild::Options.new(ARGV)
|
7
|
+
l = Rubuild::Env::Location.new('options', env.build_factory)
|
8
|
+
l.set_data(options)
|
9
|
+
env.provide('options', l)
|
10
|
+
loader = Rubuild::Load::Loader.new(Rubuild::Load::NameSpace::Factory.new)
|
11
|
+
loader.inc_paths += options.inc_paths
|
12
|
+
loader.provision(env, 'load')
|
13
|
+
loc = File.open(options.file, 'r') do |f|
|
14
|
+
loader.loadString(env, f.read, options.file)
|
15
|
+
end
|
16
|
+
rctx = env.build_factory.create_context
|
17
|
+
loc.found_dep.load(rctx)
|
18
|
+
rctx.run
|
data/examples/printargs
ADDED
data/lib/rubuild.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Rubuild
|
2
|
+
VERSION = "0.0.3"
|
3
|
+
end
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
gem 'safer'
|
7
|
+
require 'safer/ivar'
|
8
|
+
require 'safer/protocol'
|
9
|
+
|
10
|
+
require 'rubuild/util'
|
11
|
+
require 'rubuild/build'
|
12
|
+
require 'rubuild/env'
|
13
|
+
require 'rubuild/load'
|
14
|
+
require 'rubuild/options'
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module Rubuild
|
2
|
+
module Build
|
3
|
+
## Rubuild::Build::Context
|
4
|
+
# Rubuild::Build::Context is the base class of all dependancy execution
|
5
|
+
# environments in Rubuild. The Rubuild::Build::Context will trap any errors
|
6
|
+
# raised by associated dependancies - and only those associated dependancies -
|
7
|
+
# during the 'run' step, and as such provides some measure of recoverability
|
8
|
+
# for errors occurring in parent dependancies when trying to undertake certain
|
9
|
+
# actions: in order to recover from an error executing a command, create a new
|
10
|
+
# Rubuild::Build::Context as part of your dependancy action and run it.
|
11
|
+
class Context
|
12
|
+
|
13
|
+
## Rubuild::Build::Context::Error
|
14
|
+
# Superclass of errors that get generated by a Build::Context.
|
15
|
+
class Error < StandardError
|
16
|
+
# The Rubuild::Build::Context which generated the error.
|
17
|
+
Safer::IVar.instance_variable(self, :context)
|
18
|
+
# Reader accessor routine for :context instance variable.
|
19
|
+
Safer::IVar.export_reader(self, :context)
|
20
|
+
|
21
|
+
# Create a Rubuild::Build::Context::Error.
|
22
|
+
# Used internally.
|
23
|
+
# [+context+] the Rubuild::Build::Context which generated the error.
|
24
|
+
# [+message+] Human-readable string describing the error.
|
25
|
+
def initialize(context, message)
|
26
|
+
super(message)
|
27
|
+
self.rubuild_build_context_error__context = context
|
28
|
+
end # Rubuild::Build::Context::Error#initialize
|
29
|
+
|
30
|
+
## Rubuild::Build::Context::Error::Runable
|
31
|
+
# Attempt to make dependency runable when not loaded.
|
32
|
+
class Runable < Rubuild::Build::Context::Error
|
33
|
+
# The dependency that was made runable when not loaded into the build
|
34
|
+
# context.
|
35
|
+
Safer::IVar.instance_variable(self, :dep)
|
36
|
+
Safer::IVar.export_reader(self, :dep)
|
37
|
+
|
38
|
+
# Create a Rubuild::Build::Context::Error::Runable exception.
|
39
|
+
# [+context+] Rubuild::Build::Context which generated the exception.
|
40
|
+
# [+dep+] Dependency made runable when not loaded.
|
41
|
+
def initialize(context, dep)
|
42
|
+
super(
|
43
|
+
context,
|
44
|
+
"Attempt to make dependancy #{dep.name} runable when not loaded."
|
45
|
+
)
|
46
|
+
self.rubuild_build_context_error_runable__dep = dep
|
47
|
+
end # Rubuild::Build::Context::Error::Runable#initialize
|
48
|
+
end # Rubuild::Build::Context::Error::Runable
|
49
|
+
|
50
|
+
## Rubuild::Build::Context::Error::Run
|
51
|
+
# Some loaded dependencies did not get run.
|
52
|
+
class Run < Rubuild::Build::Context::Error
|
53
|
+
|
54
|
+
# Create a Rubuild::Build::Context::Error::Run.
|
55
|
+
# [+context+] Rubuild::Build::Context which generated the error.
|
56
|
+
def initialize(context)
|
57
|
+
super(context, "Some loaded dependencies did not get run.")
|
58
|
+
end # Rubuild::Build::Context::Error::Run#initialize
|
59
|
+
end # Rubuild::Build::Context::Error::Run
|
60
|
+
end # Rubuild::Build::Context::Error
|
61
|
+
|
62
|
+
class ProtocolClass
|
63
|
+
# Create an exception to capture the event that not all loaded dependencies
|
64
|
+
# were built.
|
65
|
+
# Used internally.
|
66
|
+
# [_return_] Rubuild::Build::Context::Error::Run exception.
|
67
|
+
def run_error
|
68
|
+
end
|
69
|
+
|
70
|
+
# Execute the dependencies loaded into this build context, in dependency
|
71
|
+
# order.
|
72
|
+
def run
|
73
|
+
end
|
74
|
+
end
|
75
|
+
Protocol = Safer::Protocol.create_from_class(ProtocolClass)
|
76
|
+
end # Rubuild::Build::Context
|
77
|
+
end # Rubuild::Build
|
78
|
+
end # Rubuild
|
@@ -0,0 +1,359 @@
|
|
1
|
+
##Rubuild
|
2
|
+
module Rubuild
|
3
|
+
## Rubuild::Build
|
4
|
+
module Build
|
5
|
+
|
6
|
+
## Rubuild::Build::Dep
|
7
|
+
# Base class of all dependancy objects in Rubuild.
|
8
|
+
# The dependancy object deals only with the maintenance of dependancy
|
9
|
+
# information, so subclasses are only necessary if variables
|
10
|
+
# are inserted into the dependancy tracking algorithms.
|
11
|
+
# For example, modifications to the algorithm would be necessary to
|
12
|
+
# support threaded operation.
|
13
|
+
# Clients will not usually instantiate instances of Rubuild::Build::Dep
|
14
|
+
# directly, but instead use the 'create_dep' method of a
|
15
|
+
# Rubuild::Build::DepFactory.
|
16
|
+
class Dep
|
17
|
+
|
18
|
+
## Rubuild::Build::Dep::Error
|
19
|
+
# Superclass of errors that get generated during dependancy processing.
|
20
|
+
class Error < StandardError
|
21
|
+
# :attr_reader: dep
|
22
|
+
# The Rubuild::Build::Dep that caused the exception.
|
23
|
+
Safer::IVar.instance_variable(self, :dep)
|
24
|
+
Safer::IVar.export_reader(self, :dep)
|
25
|
+
|
26
|
+
# Create a Rubuild::Build::Dep::Error exception.
|
27
|
+
# Used internally.
|
28
|
+
# [+dep+] The Rubuild::Build::Dep which is the source of the
|
29
|
+
# exception.
|
30
|
+
# [+message+] Human-readable string describing the exception.
|
31
|
+
def initialize(dep, message)
|
32
|
+
super(message)
|
33
|
+
self.rubuild_build_dep_error__dep = dep
|
34
|
+
end # Rubuild::Build::Dep::Error#initialize
|
35
|
+
|
36
|
+
## Rubuild::Build::Dep::Error::Action
|
37
|
+
# Error that occurs when calling the dependency block.
|
38
|
+
class Action < Rubuild::Build::Dep::Error
|
39
|
+
# :attr_reader: error
|
40
|
+
# The exception that was raised executing a dependency action.
|
41
|
+
Safer::IVar.instance_variable(self, :error)
|
42
|
+
Safer::IVar.export_reader(self, :error)
|
43
|
+
|
44
|
+
# :attr_reader: build_context
|
45
|
+
# The Rubuild::Build::Context in which the exception occurred.
|
46
|
+
Safer::IVar.instance_variable(self, :build_context)
|
47
|
+
Safer::IVar.export_reader(self, :build_context)
|
48
|
+
|
49
|
+
# Create a Rubuild::Build::Dep::Error::Action
|
50
|
+
# Used internally.
|
51
|
+
# [+dep+] The Rubuild::Build::Dep whose action raised +error+.
|
52
|
+
# [+error+] Exception raised while processing a Rubuild::Build::Dep
|
53
|
+
# action.
|
54
|
+
# [+build_context+] The Rubuild::Build::Context context in which the
|
55
|
+
# Rubuild::Build::Dep action was being executed.
|
56
|
+
def initialize(dep, error, build_context)
|
57
|
+
super(dep, error.message)
|
58
|
+
self.rubuild_build_dep_error_action__error = error
|
59
|
+
self.rubuild_build_dep_error_action__build_context = build_context
|
60
|
+
end # Rubuild::Build::Dep::Error::Action#intialize
|
61
|
+
|
62
|
+
def report(file)
|
63
|
+
if self.error.respond_to?(:report)
|
64
|
+
self.error.report(file)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end # Rubuild::Build::Dep::Error::Action
|
68
|
+
|
69
|
+
## Rubuild::Build::Dep::Error::Parameter
|
70
|
+
# Parameter error (parameter modified after dependency made runable).
|
71
|
+
class Parameter < Rubuild::Build::Dep::Error
|
72
|
+
# :attr_reader: parameter
|
73
|
+
# The parameter which was set after the dependency was made runable.
|
74
|
+
Safer::IVar.instance_variable(self, :parameter)
|
75
|
+
Safer::IVar.export_reader(self, :parameter)
|
76
|
+
|
77
|
+
# Create a Rubuild::Build::Dep::Error::Parameter
|
78
|
+
# Used internally.
|
79
|
+
# [+dep+] The Rubuild::Build::Dep for which someone tried to modify
|
80
|
+
# the parameter.
|
81
|
+
# [+nm+] The name of the parameter attempted modification.
|
82
|
+
def initialize(dep, nm)
|
83
|
+
super(
|
84
|
+
dep,
|
85
|
+
"Dependency parameter '#{nm}' modified after " +
|
86
|
+
"dep '#{dep.name}' built."
|
87
|
+
)
|
88
|
+
self.rubuild_build_dep_error_parameter__parameter = nm
|
89
|
+
end # Rubuild::Build::Dep::Error::Parameter#initialize
|
90
|
+
|
91
|
+
## Rubuild::Build::Dep::Error::Parameter::Args
|
92
|
+
# Argument set after dependency made runable
|
93
|
+
class Args < Rubuild::Build::Dep::Error::Parameter
|
94
|
+
# Create a Rubuild::Build::Dep::Error::Parameter::Args
|
95
|
+
# Used internally.
|
96
|
+
# [+dep+] The Rubuild::Build::Dep for which someone modified the
|
97
|
+
# 'args' parameter when the dependency was runable.
|
98
|
+
def initialize(dep)
|
99
|
+
super(dep, 'args')
|
100
|
+
end # Rubuild::Build::Dep::Error::Parameter::Args#initialize
|
101
|
+
end # Rubuild::Build::Dep::Error::Parameter::Args
|
102
|
+
|
103
|
+
## Rubuild::Build::Dep::Error::Parameter::Command
|
104
|
+
# Command set after dependency made runable
|
105
|
+
class Command < Rubuild::Build::Dep::Error::Parameter
|
106
|
+
# Create a Rubuild::Build::Dep::Error::Parameter::Command
|
107
|
+
# Used internally.
|
108
|
+
# [+dep+] The Rubuild::Build::Dep for which someone modified the
|
109
|
+
# 'command' parameter when the dependency was runable.
|
110
|
+
def initialize(dep)
|
111
|
+
super(dep, 'command')
|
112
|
+
end # Rubuild::Build::Dep::Error::Parameter::Command#initialize
|
113
|
+
end # Rubuild::Build::Dep::Error::Parameter::Command
|
114
|
+
end # Rubuild::Build::Dep::Error::Parameter
|
115
|
+
|
116
|
+
## Rubuild::Build::Dep::Error::Runable
|
117
|
+
# Runable error (dependency tree modified after dependency made
|
118
|
+
# runable).
|
119
|
+
class Runable < Rubuild::Build::Dep::Error
|
120
|
+
# :attr_reader: parent
|
121
|
+
# parent dependency that attempted insertion into +dep+'s dependency
|
122
|
+
# tree, even though +dep+ was runable.
|
123
|
+
Safer::IVar.instance_variable(self, :parent)
|
124
|
+
Safer::IVar.export_reader(self, :parent)
|
125
|
+
|
126
|
+
# Create a Rubuild::Build::Dep::Error::Runable
|
127
|
+
# Used internally.
|
128
|
+
# [+dep+] Runable dependency against which the user attempted
|
129
|
+
# dependency hierarchy manipulation.
|
130
|
+
# [+parent+] Putative parent dependency the user attempted to place
|
131
|
+
# in +dep+'s dependency tree.
|
132
|
+
def initialize(dep, parent)
|
133
|
+
super(
|
134
|
+
dep,
|
135
|
+
"Parent dependancy #{parent} added to #{dep} " +
|
136
|
+
"after dependancy made runable."
|
137
|
+
)
|
138
|
+
self.rubuild_build_dep_error_runable__parent = parent
|
139
|
+
end # Rubuild::Build::Dep::Error::Runable#initialize
|
140
|
+
end # Rubuild::Build::Dep::Error::Runable
|
141
|
+
|
142
|
+
## Rubuild::Build::Dep::Error::Load
|
143
|
+
# Load error (circular dependency detected).
|
144
|
+
class Load < Rubuild::Build::Dep::Error
|
145
|
+
# :attr_reader: loading
|
146
|
+
# Dependencies loaded when the circle was detected.
|
147
|
+
Safer::IVar.instance_variable(self, :loading)
|
148
|
+
Safer::IVar.export_reader(self, :loading)
|
149
|
+
|
150
|
+
# Create a Rubuild::Build::Dep::Error::Load
|
151
|
+
# Used internally.
|
152
|
+
# [+dep+] The dependency which blocks on its own execution.
|
153
|
+
# [+loading+] Dependencies loaded at the time the circle was
|
154
|
+
# detected.
|
155
|
+
def initialize(dep, loading)
|
156
|
+
super(
|
157
|
+
dep,
|
158
|
+
"Circular dependency detected."
|
159
|
+
)
|
160
|
+
self.rubuild_build_dep_error_load__loading = loading
|
161
|
+
end # Rubuild::Build::Dep::Error::Load#initialize
|
162
|
+
|
163
|
+
def report(file)
|
164
|
+
file.puts("#{self.dep.name} loaded from:\n")
|
165
|
+
self.loading.each do |trace|
|
166
|
+
file.puts(" #{trace.name}")
|
167
|
+
end
|
168
|
+
file.puts("call stack:")
|
169
|
+
self.backtrace.each do |stack|
|
170
|
+
file.puts(" #{stack}")
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end # Rubuild::Build::Dep::Error::Load
|
174
|
+
|
175
|
+
## Rubuild::Build::Dep::Error::Build
|
176
|
+
# Build error (attempt to build twice).
|
177
|
+
class Build < Rubuild::Build::Dep::Error
|
178
|
+
# :attr_reader: build_context
|
179
|
+
# The build context in which the dep was re-built.
|
180
|
+
Safer::IVar.instance_variable(self, :build_context)
|
181
|
+
Safer::IVar.export_reader(self, :build_context)
|
182
|
+
|
183
|
+
def initialize(dep, build_context)
|
184
|
+
super(dep, "Attempt to build twice.")
|
185
|
+
self.rubuild_build_dep_error_build__build_context = build_context
|
186
|
+
end # Rubuild::Build::Dep::Error::Build#initialize
|
187
|
+
end # Rubuild::Build::Dep::Error::Build
|
188
|
+
|
189
|
+
## Rubuild::Build::Dep::Error::DepInconsistent
|
190
|
+
# The parent and the child dependency do not agree about their
|
191
|
+
# relationship.
|
192
|
+
class DepInconsistent < Rubuild::Build::Dep::Error
|
193
|
+
# :attr_reader: parent
|
194
|
+
# Parent of the dependency associated with this error.
|
195
|
+
Safer::IVar.instance_variable(self, :parent)
|
196
|
+
Safer::IVar.export_reader(self, :parent)
|
197
|
+
def initialize(dep, parent)
|
198
|
+
super(
|
199
|
+
dep, "Parent dependency #{parent.name} thought this was child.")
|
200
|
+
self.rubuild_build_dep_error_depinconsistent__parent = parent
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end # Rubuild::Build::Dep::Error
|
204
|
+
|
205
|
+
## Rubuild::Build::Dep::ProtocolClass
|
206
|
+
# Used to derive Rubuild::Build::Dep::Protocol
|
207
|
+
class ProtocolClass
|
208
|
+
# [+command+] command to execute.
|
209
|
+
# if supplied (i.e. non-+nil+), object must respond to
|
210
|
+
# +:call+. +command.call+ method will be invoked at time
|
211
|
+
# that this dependency should be processed, with first
|
212
|
+
# argument being this dependency object (+self+), and
|
213
|
+
# subsequent arguments as set by the +args=+ method.
|
214
|
+
# [+name+] name string for dependency. for pretty-printing dependency
|
215
|
+
# errors.
|
216
|
+
def initialize(command, name)
|
217
|
+
end
|
218
|
+
|
219
|
+
# Resets the dependency action to be invoked.
|
220
|
+
# [+command+] New command to be invoked.
|
221
|
+
# [_return_] +self+.
|
222
|
+
def set_command(command)
|
223
|
+
end
|
224
|
+
|
225
|
+
# Inserts dependency between +self+ and all child dependencies of
|
226
|
+
# +self+.
|
227
|
+
# [+dep+] Dependency against which all child dependencies of +self+
|
228
|
+
# should wait.
|
229
|
+
def surrogate(dep)
|
230
|
+
end
|
231
|
+
|
232
|
+
# Makes +dep+ a parent dependency of +self+ - in other words, +dep+
|
233
|
+
# must be run before +self+ can be run.
|
234
|
+
# [+dep+] Dependency that must be executed before +self+ can execute.
|
235
|
+
def add_parent(dep)
|
236
|
+
end
|
237
|
+
|
238
|
+
# Record that a child dependency has been added to +self+.
|
239
|
+
# Used internally.
|
240
|
+
# [+dep+] New child dependency.
|
241
|
+
def child_added(dep)
|
242
|
+
end
|
243
|
+
|
244
|
+
# Mark that all parent dependencies have been satisfied for +self+.
|
245
|
+
# Inform all build contexts that _might_ execute this dependency that
|
246
|
+
# this dependency is now runable.
|
247
|
+
# Used internally.
|
248
|
+
def make_runable
|
249
|
+
end
|
250
|
+
|
251
|
+
# Check for circular dependencies.
|
252
|
+
# Used internally.
|
253
|
+
# [+loading+] Rubuild::Build::Dep chain in progress. Used as a
|
254
|
+
# backtrace, in case a circular dependency is detected.
|
255
|
+
# [+check+] Array of Rubuild::Build::Dep objects to place in 'parent'
|
256
|
+
# list, when searching for circular dependencies.
|
257
|
+
def circle_check(loading, check)
|
258
|
+
end
|
259
|
+
|
260
|
+
# Record that a build-context is waiting to build this dependency.
|
261
|
+
# Search for circular dependencies.
|
262
|
+
# Used internally.
|
263
|
+
# [+loading+] Rubuild::Build::Dep dependency chain in progress, that
|
264
|
+
# lead to +self+ being loaded into a
|
265
|
+
# Rubuild::Build::Context.
|
266
|
+
# [+buildctx+] Rubuild::Build::Context into which +self+ is being
|
267
|
+
# loaded.
|
268
|
+
def load_self(loading, buildctx)
|
269
|
+
end
|
270
|
+
|
271
|
+
# Loads +self+ and all parent dependancies into the execution context
|
272
|
+
# +buildctx+.
|
273
|
+
# [+buildctx+] Rubuild::Build::Context into which +self+ is being
|
274
|
+
# loaded.
|
275
|
+
def load(buildctx)
|
276
|
+
end
|
277
|
+
|
278
|
+
# Return array of all Rubuild::Build::Context objects that will build
|
279
|
+
# this dependency.
|
280
|
+
def builders
|
281
|
+
end
|
282
|
+
|
283
|
+
# Return the child-dependencies of +self+ that placed +self+ into the
|
284
|
+
# Rubuild::Build::Context +builder+.
|
285
|
+
# [+builder+] A Rubuild::Build::Context into which +self+ was loaded.
|
286
|
+
# [_return_] The dependency hierarchy in +builder+ that resulted in
|
287
|
+
# +self+ being loaded, or nil if +self+ was not loaded into
|
288
|
+
# +builder+.
|
289
|
+
def loaders(builder)
|
290
|
+
end
|
291
|
+
|
292
|
+
# Inform all children that a parent dependency (or +self+) failed to
|
293
|
+
# execute a command due to +err+.
|
294
|
+
# Used internally.
|
295
|
+
# [+err+] Exception that prevents +self+ from completing.
|
296
|
+
# [_return_] Rubuild::Build::Dep::Error::Action for +err+.
|
297
|
+
def action_error_real(err)
|
298
|
+
end
|
299
|
+
|
300
|
+
# Error +err+ occurred while executing +self+'s dependency command.
|
301
|
+
# Inform all child dependencies of the event.
|
302
|
+
# Used internally.
|
303
|
+
# [+err+] Exception that prevented +self+'s dependency command from
|
304
|
+
# completing.
|
305
|
+
# [+runctx+] Rubuild::Build::Context used to execute +self+.
|
306
|
+
# [_return_] Rubuild::Build::Dep::Error::Action for +err+.
|
307
|
+
def action_error(err, runctx)
|
308
|
+
end
|
309
|
+
|
310
|
+
# Child is being informed by +parent+ that error +err+ occurred
|
311
|
+
# processing a dependency action.
|
312
|
+
# Used internally.
|
313
|
+
# [+parent+] Parent dependency that will not run, thus preventing
|
314
|
+
# +self+ from running.
|
315
|
+
# [+err+] Error that prevents +parent+ from running.
|
316
|
+
def parent_action_error(parent, err)
|
317
|
+
end
|
318
|
+
|
319
|
+
# Used by a Rubuild::Build::Context to execute the dependency command
|
320
|
+
# for +self+.
|
321
|
+
# Used internally.
|
322
|
+
# [+runctx+] Rubuild::Build::Context used to execute +self+'s
|
323
|
+
# dependency command.
|
324
|
+
def runctx_build(runctx)
|
325
|
+
end
|
326
|
+
|
327
|
+
# Record that a parent dependency has been built.
|
328
|
+
# Will result in this dependency being made runable, when all parent
|
329
|
+
# dependencies are satisfied.
|
330
|
+
# Used internally.
|
331
|
+
# [+dep+] Parent dependency that was built.
|
332
|
+
def parent_built(dep)
|
333
|
+
end
|
334
|
+
|
335
|
+
# Boolean indicates whether +self+'s dependency action has been run.
|
336
|
+
attr_reader :built
|
337
|
+
|
338
|
+
# Array of additional arguments to :command.call(). The first
|
339
|
+
# argument to :command.call() is always +self+.
|
340
|
+
attr_accessor :args
|
341
|
+
|
342
|
+
# Error that prevented dependency execution.
|
343
|
+
attr_reader :err
|
344
|
+
|
345
|
+
# Human-readable name of this dependency.
|
346
|
+
attr_reader :name
|
347
|
+
end # Rubuild::Build::Dep::ProtocolClass
|
348
|
+
|
349
|
+
## Rubuild::Build::Dep
|
350
|
+
|
351
|
+
# Protocol object.
|
352
|
+
PROTOCOL = Safer::Protocol.create_from_class(ProtocolClass)
|
353
|
+
|
354
|
+
|
355
|
+
end # Rubuild::Build::Dep
|
356
|
+
|
357
|
+
end # Rubuild::Build
|
358
|
+
|
359
|
+
end # Rubuild
|