1 | <?php |
||
30 | class Builder |
||
|
|||
31 | { |
||
32 | protected $builddir; |
||
33 | protected $io; |
||
34 | protected $dispatcher; |
||
35 | |||
36 | /** |
||
37 | * @var Context |
||
38 | */ |
||
39 | protected $context; |
||
40 | |||
41 | /** |
||
42 | * @var \Webcreate\Conveyor\Task\TaskRunner |
||
43 | */ |
||
44 | protected $taskRunner; |
||
45 | |||
46 | /** |
||
47 | * Constructor. |
||
48 | * |
||
49 | * @todo Can we refactor so we don't have to depend on the IOInterface? |
||
50 | * |
||
51 | * @param string $builddir destionation path for build |
||
52 | * @param array $tasks |
||
53 | * @param IOInterface $io |
||
54 | * @param EventDispatcherInterface $dispatcher |
||
55 | */ |
||
56 | 3 | public function __construct($builddir, array $tasks = array(), |
|
65 | |||
66 | /** |
||
67 | * Creates a task runner for builder tasks |
||
68 | * |
||
69 | * @param Task[] $tasks |
||
70 | * @return TaskRunner |
||
71 | */ |
||
72 | 3 | protected function createTaskRunner(array $tasks) |
|
112 | |||
113 | /** |
||
114 | * Add task to the build process |
||
115 | * |
||
116 | * @param Task $task |
||
117 | * @return $this |
||
118 | */ |
||
119 | public function addTask(Task $task) |
||
125 | |||
126 | /** |
||
127 | * Return destination path for build |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | 1 | public function getBuildDir() |
|
135 | |||
136 | /** |
||
137 | * @deprecated I rather not have the builder depend on the context, |
||
138 | * that's something for the BuildStage |
||
139 | * |
||
140 | * @param Context $context |
||
141 | * @return $this |
||
142 | */ |
||
143 | public function setContext(Context $context) |
||
149 | |||
150 | /** |
||
151 | * Run added tasks |
||
152 | * |
||
153 | * @param string $target |
||
154 | * @param Version $version |
||
155 | */ |
||
156 | 2 | public function build($target, Version $version) |
|
168 | |||
169 | protected function applyResultToFilelist(ExecuteResult $result) |
||
181 | |||
182 | /** |
||
183 | * Filters the tasks for given target |
||
184 | * |
||
185 | * @param string $target |
||
186 | * @param \Webcreate\Conveyor\Repository\Version $version |
||
187 | * @return Task[] task for the specific target |
||
188 | */ |
||
189 | 2 | protected function getSupportedTasks($target, Version $version) |
|
200 | |||
201 | /** |
||
202 | * Dispatch event when a dispatcher is available |
||
203 | * |
||
204 | * @param string $eventName |
||
205 | * @param Event $event |
||
206 | */ |
||
207 | 2 | protected function dispatch($eventName, Event $event = null) |
|
213 | } |
||
214 |