-
Notifications
You must be signed in to change notification settings - Fork 10
/
Travis.php
56 lines (48 loc) · 1.48 KB
/
Travis.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
<?php
$repoPath = "/home/travis/build/robske110/SignServerStats/";
$plugins = ["SignServerStats" => ["SSS/", true], "StatusList" => ["examples/StatusList/", true], "WarnOffline" => ["examples/WarnOffline", true], "LinkPlayerCount" => ["examples/LinkPlayerCount", true], "DumpInfo" => ["examples/DumpInfo.php" , false]];
foreach($plugins as $info){
$info[0] = $repoPath.$info[0];
if($info[1]){
echo("exec: "."cp -rf ".$info[0]." ./plugins/\n");
exec("cp -rf ".$info[0]." ./plugins/");
}else{
echo("exec: "."cp -f ".$info[0]." ./plugins/");
exec("cp -f ".$info[0]." ./plugins/\n");
}
}
$server = proc_open(PHP_BINARY . " src/pocketmine/PocketMine.php --no-wizard --disable-readline --settings.enable-dev-builds=true", [
0 => ["pipe", "r"],
1 => ["pipe", "w"],
2 => ["pipe", "w"]
], $pipes);
function sendCommand(string $cmd, $pipes){
fwrite($pipes[0], $cmd."\n");
}
sendCommand("version", $pipes);
foreach($plugins as $pluginName => $info){
if($info[1]){
sendCommand("makeplugin ".$pluginName, $pipes);
}
}
sendCommand("stop", $pipes);
while(!feof($pipes[1])){
echo(fgets($pipes[1]));
}
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
echo("\n\nReturn value: ". proc_close($server) ."\n");
$exit = 0;
foreach($plugins as $pluginName => $info){
if(!$info[1]){
continue;
}
if(count(glob("plugin_data/DevTools/".$pluginName."*.phar")) === 0){
echo("Failed to create ".$pluginName." phar!\n");
$exit = 1;
}else{
echo($pluginName." phar created!\n");
}
}
exit($exit);