crodas/build

简单的构建工具

v0.2.0 2015-10-25 22:10 UTC

This package is auto-updated.

Last update: 2024-09-12 18:38:02 UTC


README

Build 是一个任务管理和自动化工具。它受到 MakefilePython 的 doit 的启发

概念

  • 使用注解来定义 tasks
  • crodas/Build 除非需要,否则不会构建任何东西
    • 当没有输出文件时
    • 当任何输入文件更改时
<?php // Tasks.php
/** 
 * @Task(build_site) 
 */
function concat_files($output, Array $input, Array $settings $builder)
{
  /* Do something with the input files */
  $content = "";
  foreach ($input as $f) {
    $content .= file_get_contents($f);
  }
  
  /* Write it in the $output file */
  file_put_contents($output, $content);
}
<?php // build.php

$builder  = new crodas\Build("/tasks.php");
$bundle_js = $build->build_site(['foo.js', 'xxx.js']);