forked from mootools/mootools-core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build
executable file
·46 lines (30 loc) · 937 Bytes
/
build
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
#!/usr/bin/env php
<?php
$stderr = fopen('php://stderr', 'w');
require dirname(__FILE__) . '/Packager/packager.php';
$executable = array_shift($argv);
$package = dirname(__FILE__);
$pkg = new Packager($package);
fwrite($stderr, "\nPackager is building $package\n\n");
fwrite($stderr, "Included Components:\n");
$no_compat = false;
foreach ($argv as $arg){
if ($arg == '-1.2compat'){
array_erase($argv, $arg);
$no_compat = true;
break;
}
}
$files = (empty($argv)) ? $pkg->get_all_files() : $pkg->components_to_files($argv);
foreach ($files as $file){
fwrite($stderr, "- $file: [" . implode(", ", $pkg->get_file_provides($file)) . "]\n");
}
fwrite($stderr, "\n");
$output = $pkg->build_from_files($files);
if ($no_compat){
$output = preg_replace("%//<1\.2compat>.*?//</1\.2compat>%s", '', $output);
$output = preg_replace("%/\*<1\.2compat>.*?</1.2compat>\*/%s", '', $output);
}
echo $output;
fclose($stderr);
?>