简体   繁体   English

为什么要在PHP项目和phing中使用“ build /”文件夹

[英]Why to have “build/” folder with PHP project and phing

What is a benefit of having "build/" folder where all the sources will be placed and "built"? 使用“ build /”文件夹放置所有源并进行“构建”有什么好处?

Maybe it's a silly question, but I'm trying to understand Continuous Integration with PHP. 也许这是一个愚蠢的问题,但是我试图理解与PHP的持续集成。 Any example of build.xml for phing uses such build/ folder, but what's a sense in that for PHP where a checked out project doesn't require a compilation, only a basic configuration. 用于phing的build.xml的任何示例都使用这样的build /文件夹,但是对于PHP来说,这是有意义的,其中检出的项目不需要编译,而仅需要基本配置。 Copying it all into build/ will just complicate the things, because you'll have doubled files and +1 folder to the web root path (if you'd like to have web UI to run selenium tests on) 将其全部复制到build /中只会使事情复杂化,因为您会将文件和+1文件夹加倍到Web根路径(如果您想让Web UI对其进行硒测试)

Particularly I need phing for two cases: 特别是在两种情况下我需要phing:
1) let new user setup his first installation (or update old), right on a working copy 1)让新用户直接在工作副本上设置其首次安装(或更新旧版本)
2) run unit/func-tests, phpcc, phpcs, phpdoc etc (all that usually on CI server) 2)运行单元/功能测试,phpcc,phpcs,phpdoc等(通常在CI服务器上运行)

Should I have "build/" for the second task? 我应该为第二个任务设置“ build /”吗? What is the best practice for PHP? PHP的最佳实践是什么?

There are several good reasons to have a build directory (ie, deployment to multiple environments, performing some text replacement, minimizing and combining CSS and JS, optimizing images, handling of config files etc.) 拥有构建目录有很多充分的理由(例如,部署到多个环境,执行一些文本替换,最小化和组合CSS和JS,优化图像,处理配置文件等)。

However, these may not apply in your use cases. 但是,这些可能不适用于您的用例。 There is no rule saying you need this directory. 没有规则说您需要此目录。 Depending on your thinking on testing in production, a build directory may be a good reason to keep this directory. 根据您对生产测试的想法,构建目录可能是保留此目录的一个很好的理由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM