-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy pathbuild.php
100 lines (82 loc) · 2.5 KB
/
build.php
1
2
3
4
5
6
7
8
9
10
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?hh
/*
* Copyright (c) 2004-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
namespace HHVM\UserDocumentation;
use namespace HH\Lib\{C, Vec};
<<__EntryPoint>>
function build_site(): void {
require_once(__DIR__.'/../vendor/autoload.hack');
\Facebook\AutoloadMap\initialize();
$argv = \HH\global_get('argv') as KeyedContainer<_, _>
|> Vec\drop($$, 1);
$filters = keyset[];
$flags = keyset[];
foreach ($argv as $arg) {
if ($arg is BuildFlags) {
$flags[] = $arg;
} else {
$filters[] = $arg as string;
}
}
if (!\is_dir(BuildPaths::SCRATCH_DIR)) {
\mkdir(BuildPaths::SCRATCH_DIR, 0755, /* recursive = */ true);
}
if (!\is_dir(BuildPaths::FINAL_DIR)) {
\mkdir(BuildPaths::FINAL_DIR, 0755, /* recursive = */ true);
}
$steps = vec[
// No Dependencies
APISourcesBuildStep::class,
PHPIniSupportInHHVMBuildStep::class,
FacebookIPRangesBuildStep::class,
// Just the API Sources
HHAPIDocBuildStep::class,
// Needs getting the PHP ini settings HHVM supports
PHPIniSupportInHHVMMarkdownBuildStep::class,
// Needs the YAML
GuidesIndexBuildStep::class,
// Needs the previous indices
UnifiedAPIIndexBuildStep::class,
SiteMapBuildStep::class,
APILegacyRedirectsBuildStep::class,
// This needs to be able to invoke static methods on the controllers;
// some of the controller files require_once() generated indicies, so the
// indices must be built before codegen can be updated.
RoutingCodegenBuildStep::class,
// Needed by SASS
SASSDependenciesBuildStep::class,
// Static Resources
SASSBuildStep::class,
StaticResourceMapBuildStep::class,
// Needs the Markdown
GuidesHTMLBuildStep::class,
APIHTMLBuildStep::class,
// Needs to be done after all Hack codegen
UpdateAutoloaderBuildStep::class,
];
if (!C\is_empty($filters)) {
$steps = Vec\filter(
$steps,
$step ==> {
foreach ($filters as $filter) {
if (\stripos($step, $filter) !== false) {
return true;
}
}
return false;
},
);
}
$steps = Vec\concat(vec[BuildIDBuildStep::class], $steps);
foreach ($steps as $step) {
(new $step($flags))->buildAll();
}
echo "\n"; // Make the bash prompt nice after :p
}