phing打包项目

1.首先用pear安装phing

$ pear channel-discover pear.phing.info

$ pear install --alldeps phing/phing

2.配置环境变量

$ sudo cp /usr/local/php/bin/phing /usr/bin/phing

3.查看phing安装是否安装

$ phing 

如果控制台输出 Buildfile: build.xml does not exist!  安装成功

4.在需要打包的项目下编写build.xml

<?xml version='1.0' encoding='UTF-8'?>

    <project name='project' basedir='.' default='install'>

      <property name='package' value='${phing.project.name}' override='true' />
      <property name='installdir' value='../phing/install/${phing.project.name}' override='true' />
      <property name='srcdir' value='${project.basedir}' override='true' />
	  <property name="svn_user" value="username" />  
      <property name="svn_pass" value="password" />  


      <!--- ============================================  -->
      <!--- Fileset: codefiles                            -->
      <!--- ============================================  -->
      <fileset dir='${srcdir}' id='codefiles' defaultexcludes="true">
        <include name='**' />
		<!--排除不需要打包的文件或者文件夹-->
		<exclude name="**/.svn" /> 
		<exclude name="**/.settings/" /> 
		<exclude name="**/config/" /> 
		<exclude name="**/storage/" /> 
		<exclude name="**/.env" />
		<exclude name="**/.env.example" />
		<exclude name="**/.project" />
		<exclude name="**/build.xml" />
		<exclude name="**/.project.xml" />
		<exclude name="**/.buildpath" />
      </fileset>

      <!--- ============================================  -->
      <!--- Target: prepare                               -->
      <!--- ============================================  -->
      <target name='prepare'>
        <echo msg='Making directory ${installdir}' />
        <mkdir dir='${installdir}' />
      </target>

	  <!-- Target: build  Checkout from svn, and make tar.gz -->  
      <target name="build" depends="prepare">  
        <!--<echo msg="Export code from svn..." />  
        <input propertyname="export_revision">Revision to export from svn:</input>  
        <svnupdate  
           svnpath="svn"  
           revision="${export_revision}"  
           username="${svn_user}" password="${svn_pass}"  
           nocache="true"  
           todir="./"/>  -->
   
        <echo msg="Creating archive..." />  
        
        <tar destfile="./${phing.project.name}.tar.gz" compression="gzip">  
             <fileset refid='codefiles' /> 
        </tar>  
      </target>  

      <!--- ============================================  -->
      <!--- Target: get                                   -->
      <!--- ============================================  -->
      <!--<target name='get'>
        <svnupdate svnpath='file://D:/svn/myfirstrepo' todir='${srcdir}' />
      </target>-->

      <!--- ============================================  -->
      <!--- Target: phpunit                               -->
      <!--- ============================================  -->

      <!--<target name='phpunit'>
        <phpunit haltonfailure='true' printsummary='true'>
          <batchtest>
            <fileset dir='./tests'>
              <include name='*Test.php' />
            </fileset>
          </batchtest>
        </phpunit>
      </target>-->

      <!--- ============================================  -->
      <!--- Target: install                               -->
      <!--- ============================================  -->
      <target name='install' depends='prepare,build'>
        <!--<copy todir='${installdir}' overwrite='true'>
          <fileset refid='codefiles' />
        </copy>-->
        <copy file='./${phing.project.name}.tar.gz' tofile='./${installdir}/./${phing.project.name}.tar.gz' overwrite='true' />
		<delete file="./${phing.project.name}.tar.gz" />  
      </target>

    </project>
5.切换到打包项目路径 执行phing  默认自动寻找build.xml
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值