-
Notifications
You must be signed in to change notification settings - Fork 17
/
phar.build.inc
55 lines (50 loc) · 1.06 KB
/
phar.build.inc
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
<?php
/**
* The is a config file for compile phar package.
* User: Inhere
* Date: 2018/1/26 22:11
* @var \Swoft\Console\Advanced\PharCompiler $compiler
*/
// config
$compiler
->stripComments(true)
->setShebang(true)
->addSuffix(['.tpl', '.json', '.stub'])
->addExcludeDir([
'test',
'doc',
'docs',
'tests',
'Tests',
'example',
'runtime',
'swoole-ide-helper',
])
->addFile([
// 'LICENSE',
'composer.json',
'README.md',
'bin/bootstrap.php',
])
->setCliIndex('bin/swoftcli')
// ->setWebIndex('web/index.php')
// ->setVersionFile('config/config.php')
;
$stripDirs = [
'psr/',
'nikic/',
'monolog/',
'symfony/',
'toolkit/',
];
// Swoft 相关都不能去除注释
$compiler->setStripFilter(function ($file) use ($stripDirs) {
/** @var \SplFileInfo $file */
$path = $file->getPathname();
foreach ($stripDirs as $dir) {
if (\strpos($path, $dir)) {
return true;
}
}
return false;
});