This repository has been archived by the owner on Jun 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathrun_importit.php
78 lines (70 loc) · 2.06 KB
/
run_importit.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
<?hh
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
namespace Facebook\ImportIt;
use type Facebook\ShipIt\{
ShipDemoProject,
DemoGitHubUtils,
DemoSourceRepoInitPhase,
ShipItPhaseRunner,
ShipItManifest,
ShipItChangeset,
ShipItCleanPhase,
ShipItPullPhase,
ShipItGitHubInitPhase,
ShipItRepoSide,
ShipItTransport,
ShipItExitException,
};
final class ImportDemoProject {
public static function filterChangeset(
ShipItChangeset $changeset,
): ShipItChangeset {
return $changeset
|> ImportItPathFilters::moveDirectories(
$$,
ShipDemoProject::getPathMappings(),
);
}
public static async function genCliMain(): Awaitable<void> {
$manifest = (
new ShipItManifest(
/* default working dir = */ '/var/tmp/shipit',
/* source repo name */ 'fbshipit-target',
/* destination repo name */ 'fbshipit',
/* source roots = */ keyset['.'],
)
)->withDestinationBranch('main');
$phases = vec[
new DemoSourceRepoInitPhase(),
new ShipItCleanPhase(ShipItRepoSide::DESTINATION),
new ShipItPullPhase(ShipItRepoSide::DESTINATION),
new ShipItGitHubInitPhase(
'facebook',
'fbshipit',
ShipItRepoSide::SOURCE,
ShipItTransport::HTTPS,
DemoGitHubUtils::class,
),
new ShipItCleanPhase(ShipItRepoSide::SOURCE),
new ShipItPullPhase(ShipItRepoSide::SOURCE),
new ImportItSyncPhase($changeset ==> self::filterChangeset($changeset)),
];
try {
await (new ShipItPhaseRunner($manifest, $phases))->genRun();
} catch (ShipItExitException $e) {
exit($e->exitCode); // @oss-enable
// @oss-disable: PHP\fb\exit($e->exitCode);
}
}
}
<<__EntryPoint>>
async function gen_main(): Awaitable<void> {
require_once(\dirname(__DIR__).'/vendor/autoload.hack'); // @oss-enable
\Facebook\AutoloadMap\initialize(); // @oss-enable
await ImportDemoProject::genCliMain();
}