gggeek /
phpxmlrpc
| 1 | <?php |
||||||||
| 2 | /** |
||||||||
| 3 | * Makefile for phpxmlrpc library. |
||||||||
| 4 | * To be used with the Pake tool: https://github.com/indeyets/pake/wiki |
||||||||
| 5 | * |
||||||||
| 6 | * @copyright (c) 2015-2021 G. Giunta |
||||||||
| 7 | * |
||||||||
| 8 | * @todo !important allow user to specify location of docbook xslt instead of the one installed via composer |
||||||||
| 9 | */ |
||||||||
| 10 | |||||||||
| 11 | namespace PhpXmlRpc { |
||||||||
| 12 | |||||||||
| 13 | class Builder |
||||||||
| 14 | { |
||||||||
| 15 | protected static $buildDir = 'build'; |
||||||||
| 16 | protected static $libVersion; |
||||||||
| 17 | protected static $tools = array( |
||||||||
| 18 | 'asciidoctor' => 'asciidoctor', |
||||||||
| 19 | 'fop' => 'fop', |
||||||||
| 20 | 'php' => 'php', |
||||||||
| 21 | 'zip' => 'zip', |
||||||||
| 22 | ); |
||||||||
| 23 | protected static $options = array( |
||||||||
| 24 | 'repo' => 'https://github.com/gggeek/phpxmlrpc', |
||||||||
| 25 | 'branch' => 'master', |
||||||||
| 26 | 'workspace' => null |
||||||||
| 27 | ); |
||||||||
| 28 | |||||||||
| 29 | public static function libVersion() |
||||||||
| 30 | { |
||||||||
| 31 | if (self::$libVersion == null) |
||||||||
| 32 | throw new \Exception('Missing library version argument'); |
||||||||
| 33 | return self::$libVersion; |
||||||||
| 34 | } |
||||||||
| 35 | |||||||||
| 36 | /// @todo allow this to be set via an option |
||||||||
| 37 | public static function buildDir() |
||||||||
| 38 | { |
||||||||
| 39 | return self::$buildDir; |
||||||||
| 40 | } |
||||||||
| 41 | |||||||||
| 42 | public static function workspaceDir() |
||||||||
| 43 | { |
||||||||
| 44 | return self::option('workspace') != '' ? self::option('workspace') : self::buildDir().'/workspace'; |
||||||||
| 45 | } |
||||||||
| 46 | |||||||||
| 47 | public static function toolsDir() |
||||||||
| 48 | { |
||||||||
| 49 | return self::buildDir().'/tools'; |
||||||||
| 50 | } |
||||||||
| 51 | |||||||||
| 52 | // most likely things will break if this one is moved outside the BuildDir |
||||||||
| 53 | public static function distDir() |
||||||||
| 54 | { |
||||||||
| 55 | return self::buildDir().'/xmlrpc-'.self::libVersion(); |
||||||||
| 56 | } |
||||||||
| 57 | |||||||||
| 58 | // these will be generated in BuildDir |
||||||||
| 59 | public static function distFiles() |
||||||||
| 60 | { |
||||||||
| 61 | return array( |
||||||||
| 62 | 'xmlrpc-'.self::libVersion().'.tar.gz', |
||||||||
| 63 | 'xmlrpc-'.self::libVersion().'.zip', |
||||||||
| 64 | ); |
||||||||
| 65 | } |
||||||||
| 66 | |||||||||
| 67 | public static function getOpts($args=array(), $cliOpts=array()) |
||||||||
| 68 | { |
||||||||
| 69 | if (count($args) > 0) |
||||||||
| 70 | // throw new \Exception('Missing library version argument'); |
||||||||
| 71 | self::$libVersion = $args[0]; |
||||||||
| 72 | |||||||||
| 73 | foreach (self::$tools as $name => $binary) { |
||||||||
| 74 | if (isset($cliOpts[$name])) { |
||||||||
| 75 | self::$tools[$name] = $cliOpts[$name]; |
||||||||
| 76 | } |
||||||||
| 77 | } |
||||||||
| 78 | |||||||||
| 79 | foreach (self::$options as $name => $value) { |
||||||||
| 80 | if (isset($cliOpts[$name])) { |
||||||||
| 81 | self::$options[$name] = $cliOpts[$name]; |
||||||||
| 82 | } |
||||||||
| 83 | } |
||||||||
| 84 | |||||||||
| 85 | //pake_echo('---'.self::$libVersion.'---'); |
||||||||
| 86 | } |
||||||||
| 87 | |||||||||
| 88 | /** |
||||||||
| 89 | * @param string $name |
||||||||
| 90 | * @return string |
||||||||
| 91 | */ |
||||||||
| 92 | public static function tool($name) |
||||||||
| 93 | { |
||||||||
| 94 | return self::$tools[$name]; |
||||||||
| 95 | } |
||||||||
| 96 | |||||||||
| 97 | /** |
||||||||
| 98 | * @param string $name |
||||||||
| 99 | * @return string |
||||||||
| 100 | */ |
||||||||
| 101 | public static function option($name) |
||||||||
| 102 | { |
||||||||
| 103 | return self::$options[$name]; |
||||||||
| 104 | } |
||||||||
| 105 | |||||||||
| 106 | /** |
||||||||
| 107 | * @param string $inFile |
||||||||
| 108 | * @param string $xssFile |
||||||||
| 109 | * @param string $outFileOrDir |
||||||||
| 110 | * @throws \Exception |
||||||||
| 111 | */ |
||||||||
| 112 | public static function applyXslt($inFile, $xssFile, $outFileOrDir) |
||||||||
| 113 | { |
||||||||
| 114 | if (!file_exists($inFile)) { |
||||||||
| 115 | throw new \Exception("File $inFile cannot be found"); |
||||||||
| 116 | } |
||||||||
| 117 | if (!file_exists($xssFile)) { |
||||||||
| 118 | throw new \Exception("File $xssFile cannot be found"); |
||||||||
| 119 | } |
||||||||
| 120 | |||||||||
| 121 | $docbookXslPath = realpath(Builder::buildDir().'/tools/vendor/docbook/docbook-xsl/fo/docbook.xsl'); |
||||||||
| 122 | file_put_contents( |
||||||||
| 123 | $xssFile, |
||||||||
| 124 | str_replace('%docbook.xsl%', $docbookXslPath, file_get_contents($xssFile)) |
||||||||
| 125 | ); |
||||||||
| 126 | |||||||||
| 127 | // Load the XML source |
||||||||
| 128 | $xml = new \DOMDocument(); |
||||||||
| 129 | $xml->load($inFile); |
||||||||
| 130 | $xsl = new \DOMDocument(); |
||||||||
| 131 | $xsl->load($xssFile); |
||||||||
| 132 | |||||||||
| 133 | // Configure the transformer |
||||||||
| 134 | $processor = new \XSLTProcessor(); |
||||||||
| 135 | if (version_compare(PHP_VERSION, '5.4', "<")) { |
||||||||
| 136 | if (defined('XSL_SECPREF_WRITE_FILE')) { |
||||||||
| 137 | ini_set("xsl.security_prefs", XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE); |
||||||||
| 138 | } |
||||||||
| 139 | } else { |
||||||||
| 140 | // the php online docs only mention setSecurityPrefs, but somehow some installs have setSecurityPreferences... |
||||||||
| 141 | if (method_exists('XSLTProcessor', 'setSecurityPrefs')) { |
||||||||
| 142 | $processor->setSecurityPrefs(XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE); |
||||||||
| 143 | } else { |
||||||||
| 144 | $processor->setSecurityPreferences(XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE); |
||||||||
|
0 ignored issues
–
show
|
|||||||||
| 145 | } |
||||||||
| 146 | } |
||||||||
| 147 | $processor->importStyleSheet($xsl); // attach the xsl rules |
||||||||
| 148 | |||||||||
| 149 | if (is_dir($outFileOrDir)) { |
||||||||
| 150 | if (!$processor->setParameter('', 'base.dir', realpath($outFileOrDir))) { |
||||||||
| 151 | echo "setting param base.dir KO\n"; |
||||||||
| 152 | } |
||||||||
| 153 | } |
||||||||
| 154 | |||||||||
| 155 | $out = $processor->transformToXML($xml); |
||||||||
| 156 | |||||||||
| 157 | if (!is_dir($outFileOrDir)) { |
||||||||
| 158 | file_put_contents($outFileOrDir, $out); |
||||||||
| 159 | } |
||||||||
| 160 | } |
||||||||
| 161 | |||||||||
| 162 | public static function highlightPhpInHtml($content) |
||||||||
| 163 | { |
||||||||
| 164 | $startTag = '<pre class="programlisting">'; |
||||||||
| 165 | $endTag = '</pre>'; |
||||||||
| 166 | |||||||||
| 167 | //$content = file_get_contents($inFile); |
||||||||
| 168 | $last = 0; |
||||||||
| 169 | $out = ''; |
||||||||
| 170 | while (($start = strpos($content, $startTag, $last)) !== false) { |
||||||||
| 171 | $end = strpos($content, $endTag, $start); |
||||||||
| 172 | $code = substr($content, $start + strlen($startTag), $end - $start - strlen($startTag)); |
||||||||
| 173 | if ($code[strlen($code) - 1] == "\n") { |
||||||||
| 174 | $code = substr($code, 0, -1); |
||||||||
| 175 | } |
||||||||
| 176 | |||||||||
| 177 | $code = str_replace(array('>', '<'), array('>', '<'), $code); |
||||||||
| 178 | $code = highlight_string('<?php ' . $code, true); |
||||||||
| 179 | $code = str_replace('<span style="color: #0000BB"><?php <br />', '<span style="color: #0000BB">', $code); |
||||||||
| 180 | |||||||||
| 181 | $out = $out . substr($content, $last, $start + strlen($startTag) - $last) . $code . $endTag; |
||||||||
| 182 | $last = $end + strlen($endTag); |
||||||||
| 183 | } |
||||||||
| 184 | $out .= substr($content, $last, strlen($content)); |
||||||||
| 185 | |||||||||
| 186 | return $out; |
||||||||
| 187 | } |
||||||||
| 188 | } |
||||||||
| 189 | |||||||||
| 190 | } |
||||||||
| 191 | |||||||||
| 192 | namespace { |
||||||||
| 193 | |||||||||
| 194 | use PhpXmlRpc\Builder; |
||||||||
| 195 | |||||||||
| 196 | function run_default($task=null, $args=array(), $cliOpts=array()) |
||||||||
|
0 ignored issues
–
show
The parameter
$cliOpts is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$task is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$args is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||||
| 197 | { |
||||||||
| 198 | echo "Syntax: pake {\$pake-options} \$task \$lib-version [\$git-tag] {\$task-options}\n"; |
||||||||
| 199 | echo "\n"; |
||||||||
| 200 | echo " Run 'pake help' to list all pake options\n"; |
||||||||
| 201 | echo " Run 'pake -T' to list available tasks\n"; |
||||||||
| 202 | echo " Run 'pake -P' to list all available tasks (including hidden ones) and their dependencies\n"; |
||||||||
| 203 | echo "\n"; |
||||||||
| 204 | echo " Task options:\n"; |
||||||||
| 205 | echo " --repo=REPO URL of the source repository to clone. Defaults to the official github repo.\n"; |
||||||||
| 206 | echo " --branch=BRANCH The git branch to build from. Defaults to 'master'\n"; |
||||||||
| 207 | echo " --workspace=DIR The dir where to check out source code. Defaults to build/workspace\n"; |
||||||||
| 208 | echo " --asciidoctor=ASCIIDOCTOR Location of the asciidoctor command-line tool\n"; |
||||||||
| 209 | echo " --fop=FOP Location of the apache fop command-line tool\n"; |
||||||||
| 210 | echo " --php=PHP Location of the php command-line interpreter\n"; |
||||||||
| 211 | echo " --zip=ZIP Location of the zip tool\n"; |
||||||||
| 212 | } |
||||||||
| 213 | |||||||||
| 214 | function run_getopts($task=null, $args=array(), $cliOpts=array()) |
||||||||
|
0 ignored issues
–
show
The parameter
$task is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||||
| 215 | { |
||||||||
| 216 | Builder::getOpts($args, $cliOpts); |
||||||||
| 217 | } |
||||||||
| 218 | |||||||||
| 219 | /** |
||||||||
| 220 | * Downloads source code in the build workspace directory, optionally checking out the given branch/tag |
||||||||
| 221 | * @todo allow using current installation / dir as source, bypassing git clone in workspace - at least for doc generation |
||||||||
| 222 | */ |
||||||||
| 223 | function run_init($task=null, $args=array(), $cliOpts=array()) |
||||||||
|
0 ignored issues
–
show
The parameter
$args is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$cliOpts is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$task is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||||
| 224 | { |
||||||||
| 225 | // download the current version into the workspace |
||||||||
| 226 | $targetDir = Builder::workspaceDir(); |
||||||||
| 227 | |||||||||
| 228 | // check if workspace exists and is not already set to the correct repo |
||||||||
| 229 | if (is_dir($targetDir) && pakeGit::isRepository($targetDir)) { |
||||||||
|
0 ignored issues
–
show
The type
pakeGit was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||||
| 230 | $repo = new pakeGit($targetDir); |
||||||||
| 231 | $remotes = $repo->remotes(); |
||||||||
| 232 | if (trim($remotes['origin']['fetch']) != Builder::option('repo')) { |
||||||||
| 233 | throw new Exception("Directory '$targetDir' exists and is not linked to correct git repo"); |
||||||||
| 234 | } |
||||||||
| 235 | |||||||||
| 236 | /// @todo we should just fetch if we are checking out a tag, but pull if we are checking out a branch. |
||||||||
| 237 | /// Also, we should only pull after having checked out the correct branch... |
||||||||
| 238 | $repo->pull(); |
||||||||
| 239 | } else { |
||||||||
| 240 | pake_mkdirs(dirname($targetDir)); |
||||||||
|
0 ignored issues
–
show
The function
pake_mkdirs was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 241 | $repo = pakeGit::clone_repository(Builder::option('repo'), Builder::workspaceDir()); |
||||||||
| 242 | } |
||||||||
| 243 | |||||||||
| 244 | $repo->checkout(Builder::option('branch')); |
||||||||
| 245 | } |
||||||||
| 246 | |||||||||
| 247 | /** |
||||||||
| 248 | * Runs all the build steps. |
||||||||
| 249 | * |
||||||||
| 250 | * (does nothing by itself, as all the steps are managed via task dependencies) |
||||||||
| 251 | */ |
||||||||
| 252 | function run_build($task=null, $args=array(), $cliOpts=array()) |
||||||||
|
0 ignored issues
–
show
The parameter
$cliOpts is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$task is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$args is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||||
| 253 | { |
||||||||
| 254 | } |
||||||||
| 255 | |||||||||
| 256 | function run_clean_doc() |
||||||||
| 257 | { |
||||||||
| 258 | pake_remove_dir(Builder::workspaceDir().'/doc/api'); |
||||||||
|
0 ignored issues
–
show
The function
pake_remove_dir was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 259 | $finder = pakeFinder::type('file')->name('*.html'); |
||||||||
|
0 ignored issues
–
show
The type
pakeFinder was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||||
| 260 | pake_remove($finder, Builder::workspaceDir().'/doc/manual'); |
||||||||
|
0 ignored issues
–
show
The function
pake_remove was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 261 | $finder = pakeFinder::type('file')->name('*.xml'); |
||||||||
| 262 | pake_remove($finder, Builder::workspaceDir().'/doc/manual'); |
||||||||
| 263 | } |
||||||||
| 264 | |||||||||
| 265 | /** |
||||||||
| 266 | * Generates documentation in all formats |
||||||||
| 267 | */ |
||||||||
| 268 | function run_doc($task=null, $args=array(), $cliOpts=array()) |
||||||||
|
0 ignored issues
–
show
The parameter
$cliOpts is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$task is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$args is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||||
| 269 | { |
||||||||
| 270 | // in |
||||||||
| 271 | $srcDir = Builder::workspaceDir(); |
||||||||
| 272 | // out |
||||||||
| 273 | $docDir = Builder::workspaceDir().'/doc'; |
||||||||
| 274 | |||||||||
| 275 | // API docs |
||||||||
| 276 | |||||||||
| 277 | // from phpdoc comments using phpdocumentor |
||||||||
| 278 | $cmd = Builder::tool('php'); |
||||||||
| 279 | pake_sh("$cmd " . Builder::toolsDir(). "/vendor/bin/phpdoc run --cache-folder ".Builder::buildDir()."/.phpdoc -d ".$srcDir.'/src'." -t ".$docDir.'/api --title PHP-XMLRPC --defaultpackagename PHPXMLRPC'); |
||||||||
|
0 ignored issues
–
show
The function
pake_sh was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 280 | |||||||||
| 281 | // from phpdoc comments using Sami |
||||||||
| 282 | // deprecated on 2021/12, as Sami is abandonware |
||||||||
| 283 | /*$samiConfig = <<<EOT |
||||||||
| 284 | <?php |
||||||||
| 285 | \$iterator = Symfony\Component\Finder\Finder::create() |
||||||||
| 286 | ->files() |
||||||||
| 287 | ->exclude('debugger') |
||||||||
| 288 | ->exclude('demo') |
||||||||
| 289 | ->exclude('doc') |
||||||||
| 290 | ->exclude('tests') |
||||||||
| 291 | ->in('./build/workspace'); |
||||||||
| 292 | return new Sami\Sami(\$iterator, array( |
||||||||
| 293 | 'title' => 'PHP-XMLRPC', |
||||||||
| 294 | 'build_dir' => 'build/workspace/doc/api', |
||||||||
| 295 | 'cache_dir' => 'build/cache', |
||||||||
| 296 | )); |
||||||||
| 297 | EOT; |
||||||||
| 298 | file_put_contents('build/sami_config.php', $samiConfig); |
||||||||
| 299 | $cmd = Builder::tool('php'); |
||||||||
| 300 | pake_sh("$cmd " . Builder::toolsDir(). "/vendor/bin/sami.php update -vvv build/sami_config.php");*/ |
||||||||
| 301 | |||||||||
| 302 | // User Manual |
||||||||
| 303 | |||||||||
| 304 | // html (single file) from asciidoc |
||||||||
| 305 | $cmd = Builder::tool('asciidoctor'); |
||||||||
| 306 | pake_sh("$cmd -d book -o $docDir/manual/phpxmlrpc_manual.html $srcDir/doc/manual/phpxmlrpc_manual.adoc"); |
||||||||
| 307 | |||||||||
| 308 | // then docbook from asciidoc |
||||||||
| 309 | /// @todo create phpxmlrpc_manual.xml with the good version number |
||||||||
| 310 | /// @todo create phpxmlrpc_manual.xml with the date set to the one of last commit (or today?) |
||||||||
| 311 | pake_sh("$cmd -d book -b docbook -o $docDir/manual/phpxmlrpc_manual.xml $srcDir/doc/manual/phpxmlrpc_manual.adoc"); |
||||||||
| 312 | |||||||||
| 313 | # Other tools for docbook... |
||||||||
| 314 | # |
||||||||
| 315 | # jade cmd yet to be rebuilt, starting from xml file and putting output in ./out dir, e.g. |
||||||||
| 316 | # jade -t xml -d custom.dsl xmlrpc_php.xml |
||||||||
| 317 | # |
||||||||
| 318 | # convertdoc command for xmlmind xxe editor |
||||||||
| 319 | # convertdoc docb.toHTML xmlrpc_php.xml -u out |
||||||||
| 320 | # |
||||||||
| 321 | # saxon + xerces xml parser + saxon extensions + xslthl: adds a little syntax highlighting |
||||||||
| 322 | # (bold and italics only, no color) for php source examples... |
||||||||
| 323 | # java \ |
||||||||
| 324 | # -classpath c:\programmi\saxon\saxon.jar\;c:\programmi\saxon\xslthl.jar\;c:\programmi\xerces\xercesImpl.jar\;C:\htdocs\xmlrpc_cvs\docbook-xsl\extensions\saxon65.jar \ |
||||||||
| 325 | # -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl \ |
||||||||
| 326 | # -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl \ |
||||||||
| 327 | # -Dxslthl.config=file:///c:/htdocs/xmlrpc_cvs/docbook-xsl/highlighting/xslthl-config.xml \ |
||||||||
| 328 | # com.icl.saxon.StyleSheet -o xmlrpc_php.fo.xml xmlrpc_php.xml custom.fo.xsl use.extensions=1 |
||||||||
| 329 | |||||||||
| 330 | // HTML (multiple files) from docbook - discontinued, as we use the nicer-looking html gotten from asciidoc |
||||||||
| 331 | /*Builder::applyXslt($docDir.'/manual/phpxmlrpc_manual.xml', $docDir.'/build/custom.xsl', $docDir.'/manual'); |
||||||||
| 332 | // post process html files to highlight php code samples |
||||||||
| 333 | foreach(pakeFinder::type('file')->name('*.html')->in($docDir.'/manual') as $file) |
||||||||
| 334 | { |
||||||||
| 335 | file_put_contents($file, Builder::highlightPhpInHtml(file_get_contents($file))); |
||||||||
| 336 | }*/ |
||||||||
| 337 | |||||||||
| 338 | // PDF file from docbook |
||||||||
| 339 | |||||||||
| 340 | // convert to fo and then to pdf using apache fop |
||||||||
| 341 | Builder::applyXslt($docDir.'/manual/phpxmlrpc_manual.xml', $docDir.'/build/custom.fo.xsl', $docDir.'/manual/phpxmlrpc_manual.fo.xml'); |
||||||||
| 342 | $cmd = Builder::tool('fop'); |
||||||||
| 343 | pake_sh("$cmd $docDir/manual/phpxmlrpc_manual.fo.xml $docDir/manual/phpxmlrpc_manual.pdf"); |
||||||||
| 344 | |||||||||
| 345 | // cleanup |
||||||||
| 346 | unlink($docDir.'/manual/phpxmlrpc_manual.xml'); |
||||||||
| 347 | unlink($docDir.'/manual/phpxmlrpc_manual.fo.xml'); |
||||||||
| 348 | } |
||||||||
| 349 | |||||||||
| 350 | function run_clean_dist() |
||||||||
| 351 | { |
||||||||
| 352 | pake_remove_dir(Builder::distDir()); |
||||||||
|
0 ignored issues
–
show
The function
pake_remove_dir was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 353 | $finder = pakeFinder::type('file')->name(Builder::distFiles()); |
||||||||
| 354 | pake_remove($finder, Builder::buildDir()); |
||||||||
|
0 ignored issues
–
show
The function
pake_remove was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 355 | } |
||||||||
| 356 | |||||||||
| 357 | /** |
||||||||
| 358 | * Creates the tarballs for a release |
||||||||
| 359 | */ |
||||||||
| 360 | function run_dist($task=null, $args=array(), $cliOpts=array()) |
||||||||
|
0 ignored issues
–
show
The parameter
$args is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$cliOpts is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$task is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||||
| 361 | { |
||||||||
| 362 | // copy workspace dir into dist dir, without git |
||||||||
| 363 | pake_mkdirs(Builder::distDir()); |
||||||||
|
0 ignored issues
–
show
The function
pake_mkdirs was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 364 | $finder = pakeFinder::type('any')->ignore_version_control(); |
||||||||
| 365 | /// @todo make sure we don't recurse - avoid 'build' dir |
||||||||
| 366 | pake_mirror($finder, realpath(Builder::workspaceDir()), realpath(Builder::distDir())); |
||||||||
|
0 ignored issues
–
show
The function
pake_mirror was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 367 | |||||||||
| 368 | // @todo remove unwanted files from dist dir - files and dirs from .gitattributes |
||||||||
| 369 | |||||||||
| 370 | // also: do we still need to run dos2unix? |
||||||||
| 371 | |||||||||
| 372 | // create tarballs |
||||||||
| 373 | $cwd = getcwd(); |
||||||||
| 374 | chdir(dirname(Builder::distDir())); |
||||||||
| 375 | foreach(Builder::distFiles() as $distFile) { |
||||||||
| 376 | // php can not really create good zip files via phar: they are not compressed! |
||||||||
| 377 | if (substr($distFile, -4) == '.zip') { |
||||||||
| 378 | $cmd = Builder::tool('zip'); |
||||||||
| 379 | $extra = '-9 -r'; |
||||||||
| 380 | pake_sh("$cmd $distFile $extra ".basename(Builder::distDir())); |
||||||||
|
0 ignored issues
–
show
The function
pake_sh was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 381 | } |
||||||||
| 382 | else { |
||||||||
| 383 | $finder = pakeFinder::type('any')->pattern(basename(Builder::distDir()).'/**'); |
||||||||
| 384 | // see https://bugs.php.net/bug.php?id=58852 |
||||||||
| 385 | $pharFile = str_replace(Builder::libVersion(), '_LIBVERSION_', $distFile); |
||||||||
| 386 | pakeArchive::createArchive($finder, '.', $pharFile); |
||||||||
|
0 ignored issues
–
show
The type
pakeArchive was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||||
| 387 | rename($pharFile, $distFile); |
||||||||
| 388 | } |
||||||||
| 389 | } |
||||||||
| 390 | chdir($cwd); |
||||||||
| 391 | } |
||||||||
| 392 | |||||||||
| 393 | function run_clean_workspace($task=null, $args=array(), $cliOpts=array()) |
||||||||
|
0 ignored issues
–
show
The parameter
$args is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$cliOpts is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$task is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||||
| 394 | { |
||||||||
| 395 | if (realpath(__DIR__) === realpath(Builder::workspaceDir())) { |
||||||||
| 396 | throw new \Exception("Can not remove workspace dir, as it is where pakefile is located!"); |
||||||||
| 397 | } |
||||||||
| 398 | pake_remove_dir(Builder::workspaceDir()); |
||||||||
|
0 ignored issues
–
show
The function
pake_remove_dir was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 399 | } |
||||||||
| 400 | |||||||||
| 401 | /** |
||||||||
| 402 | * Cleans up the whole build directory |
||||||||
| 403 | * @todo 'make clean' usually just removes the results of the build, distclean removes all but sources |
||||||||
| 404 | */ |
||||||||
| 405 | function run_clean($task=null, $args=array(), $cliOpts=array()) |
||||||||
|
0 ignored issues
–
show
The parameter
$args is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$cliOpts is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$task is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||||
| 406 | { |
||||||||
| 407 | pake_remove_dir(Builder::buildDir()); |
||||||||
|
0 ignored issues
–
show
The function
pake_remove_dir was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 408 | } |
||||||||
| 409 | |||||||||
| 410 | // helper task: display help text |
||||||||
| 411 | pake_task( 'default' ); |
||||||||
|
0 ignored issues
–
show
The function
pake_task was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 412 | // internal task: parse cli options |
||||||||
| 413 | pake_task('getopts'); |
||||||||
| 414 | pake_task('init', 'getopts'); |
||||||||
| 415 | pake_task('doc', 'getopts', 'init', 'clean-doc'); |
||||||||
| 416 | pake_task('build', 'getopts', 'init', 'doc'); |
||||||||
| 417 | pake_task('dist', 'getopts', 'init', 'build', 'clean-dist'); |
||||||||
| 418 | pake_task('clean-doc', 'getopts'); |
||||||||
| 419 | pake_task('clean-dist', 'getopts'); |
||||||||
| 420 | pake_task('clean-workspace', 'getopts'); |
||||||||
| 421 | pake_task('clean', 'getopts'); |
||||||||
| 422 | |||||||||
| 423 | } |
||||||||
| 424 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.