Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4073552
HarbormasterBuildGraph.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
HarbormasterBuildGraph.php
View Options
<?php
/**
* Directed graph representing a build plan
*/
final
class
HarbormasterBuildGraph
extends
AbstractDirectedGraph
{
private
$stepMap
;
public
static
function
determineDependencyExecution
(
HarbormasterBuildPlan
$plan
)
{
$steps
=
id
(
new
HarbormasterBuildStepQuery
(
)
)
->
setViewer
(
PhabricatorUser
::
getOmnipotentUser
(
)
)
->
withBuildPlanPHIDs
(
array
(
$plan
->
getPHID
(
)
)
)
->
execute
(
)
;
$steps_by_phid
=
mpull
(
$steps
,
null
,
'getPHID'
)
;
$step_phids
=
mpull
(
$steps
,
'getPHID'
)
;
if
(
count
(
$steps
)
===
0
)
{
return
array
(
)
;
}
$graph
=
id
(
new
HarbormasterBuildGraph
(
$steps_by_phid
)
)
->
addNodes
(
$step_phids
)
;
$raw_results
=
$graph
->
getBestEffortTopographicallySortedNodes
(
)
;
$results
=
array
(
)
;
foreach
(
$raw_results
as
$node
)
{
$results
[
]
=
array
(
'node'
=>
$steps_by_phid
[
$node
[
'node'
]
]
,
'depth'
=>
$node
[
'depth'
]
,
'cycle'
=>
$node
[
'cycle'
]
,
)
;
}
return
$results
;
}
public
function
__construct
(
$step_map
)
{
$this
->
stepMap
=
$step_map
;
}
protected
function
loadEdges
(
array
$nodes
)
{
$map
=
array
(
)
;
foreach
(
$nodes
as
$node
)
{
$step
=
$this
->
stepMap
[
$node
]
;
$deps
=
$step
->
getStepImplementation
(
)
->
getDependencies
(
$step
)
;
$map
[
$node
]
=
array
(
)
;
foreach
(
$deps
as
$dep
)
{
$map
[
$node
]
[
]
=
$dep
;
}
}
return
$map
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 11, 06:22 (16 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1143336
Default Alt Text
HarbormasterBuildGraph.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment