summaryrefslogtreecommitdiff
path: root/src/qbuild/rr-build
blob: 7918f4f883c87db17976c7ffa72c457fef0c9069 (plain)
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
#!/usr/bin/env php
<?php
/**
 * Automatic roadrunner builds.
 */

use Spiral\RoadRunner\QuickBuild\Builder;

require_once "src/Builder.php";

// load build config
$version = $argv[1] ?? "1.3.1";

// load build config
$config = $argv[2] ?? __DIR__ . "/.build.json";

// Greeting!
Builder::cprintf(
    "Building <green>RoadRunner</reset> specifically for you (version: <white>%s</reset>)...\n",
    $version
);

$builder = Builder::loadConfig($config);
if ($builder == null) {
    Builder::cprintf("<red>Unable to load config:</reset> %s\n", $config);
    return;
}

$errors = $builder->configErrors();
if (!empty($errors)) {
    Builder::cprintf("<yellow>Found configuration errors:</reset>\n");
    foreach ($errors as $error) {
        Builder::cprintf("- <red>%s</reset>\n", $error);
    }

    return;
}

// Start build
$builder->build(getcwd(), __DIR__ . '/main.go', 'rr', $version);