Permalink
Browse files

refactored build including git subsplit management and PEAR package g…

…eneration
  • Loading branch information...
claylo authored and mtdowling committed Oct 11, 2012
1 parent a6be53b commit 932046684165b01418965ea8efccd1a9cda79a96
View
@@ -17,6 +17,7 @@ vendor/
# Ignore build files
build/
+phing/build.properties
# Ignore subsplit working directory
.subsplit
View
@@ -9,11 +9,14 @@ before_script:
- tar -xzf pecl_http-1.7.4.tgz
- sh -c "cd pecl_http-1.7.4 && phpize && ./configure && make && sudo make install" > /dev/null
- echo "extension=http.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
- - echo 'Installing composer'
- - wget --quiet http://getcomposer.org/composer.phar
- - php composer.phar install --dev
- - cp phpunit.xml.dist phpunit.xml
+ - pear config-set auto_discover 1
+ - pear install pear.phing.info/phing
+ - pear install pear.phpunit.de/phploc
+ - pear install pear/PHP_CodeSniffer
+ - pear install pear.pdepend.org/PHP_Depend
+ - phpenv rehash
+ - composer install --dev
+ - cp phing/build.properties.travis phing/build.properties
- echo 'Ensuring the correct version of node is running'
- ~/.nvm/nvm.sh install v0.6.14
- - ~/.nvm/nvm.sh run v0.6.14 tests/Guzzle/Tests/Http/server.js &
-script: phpunit
+script: phing travisci
View
100 build.xml
@@ -1,52 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="guzzle" default="package">
-
+ <!-- set local values, like git location -->
+ <property file="phing/build.properties" override="true" />
+
<property name="dir.output" value="${project.basedir}/build/artifacts" />
-
- <fileset id="sources" dir="./src">
- <include name="**"/>
- </fileset>
-
- <target name="tag">
- <echo>Not yet implemented</echo>
- </target>
+ <property name="dir.imports" value="${project.basedir}/phing/imports" />
+ <property name="dir.bin" value="${project.basedir}/bin" />
+ <property name="repo.dir" value="${project.basedir}" />
+
+ <import file="${dir.imports}/dependencies.xml"/>
+ <import file="${dir.imports}/test.xml"/>
+ <import file="${dir.imports}/deploy.xml"/>
+ <!-- <import file="${dir.imports}/metrics.xml"/> -->
+
<target name="test" description="Run unit tests" depends="test-init">
<exec passthru="true" command="phpunit" />
+ <testserver cmd="${cmd.testserver}" action="stop" />
</target>
<target name="test-init" depends="install-dependencies" description="Initialize test dependencies">
+ <testserver cmd="${cmd.testserver}" action="start" />
<copy file="phpunit.xml.dist" tofile="phpunit.xml" overwrite="false" />
</target>
- <target name="install-dependencies">
- <if>
- <available file="composer.phar" />
- <then>
- <echo>Composer is installed</echo>
- </then>
- <else>
- <echo message="Installing composer" />
- <exec command="curl -s http://getcomposer.org/installer | php" passthru="true" />
- <exec command="php composer.phar install --dev" passthru="true" />
- </else>
- </if>
- </target>
-
- <target name="clean-dependencies">
- <delete dir="${project.basedir}/vendor"/>
- <delete file="composer.lock" />
- </target>
-
- <target name="update-dependencies">
- <exec command="php composer.phar update --dev" passthru="true" />
+ <target name="build-init" description="Initialize local phing properties">
+ <copy file="phing/build.properties.dist" tofile="phing/build.properties" overwrite="false" />
</target>
<target name="clean">
<delete dir="${dir.output}"/>
</target>
- <target name="prepare" depends="clean,test-init">
+ <target name="prepare" depends="clean,test-init,build-init">
<mkdir dir="${dir.output}"/>
<mkdir dir="${dir.output}/logs" />
</target>
@@ -94,54 +80,4 @@
</pharpackage>
<exec command="php -d guzzle_phar=${dir.output}/guzzle-min.phar `which phpunit`" passthru="true" />
</target>
-
- <target name="build-pear">
-
- <exec command="git describe --abbrev=0 --tags | tail -c6" outputProperty="version" />
- <delete file="${project.basedir}/src/package2.xml" />
- <delete file="${dir.output}/guzzle-${version}.tgz" />
-
- <delete dir="${dir.output}/pear" />
- <mkdir dir="${dir.output}/pear" />
- <copy todir="${dir.output}/pear">
- <fileset refid="sources"/>
- </copy>
-
- <pearpkg2 name="Guzzle" dir="${dir.output}/pear">
- <option name="outputdirectory" value="${dir.output}/pear"/>
- <option name="packagefile" value="package.xml"/>
- <option name="packagedirectory" value="${dir.output}/pear"/>
- <option name="baseinstalldir" value="/"/>
- <option name="channel" value="guzzlephp.org/pear"/>
- <option name="summary" value="Guzzle is a PHP 5.3+ HTTP client and framework for building RESTful web service clients"/>
- <option name="description" value="PHP HTTP client"/>
- <option name="apiversion" value="${version}"/>
- <option name="apistability" value="stable"/>
- <option name="releaseversion" value="${version}"/>
- <option name="releasestability" value="stable"/>
- <option name="license" value="MIT"/>
- <option name="phpdep" value="5.3.2"/>
- <option name="pearinstallerdep" value="1.4.6"/>
- <option name="packagetype" value="php"/>
- <option name="notes" value="-"/>
- <mapping name="maintainers">
- <element>
- <element key="handle" value="mtdowling"/>
- <element key="name" value="Michael Dowling"/>
- <element key="email" value="mtdowling@gmail.com"/>
- <element key="role" value="lead"/>
- </element>
- </mapping>
- <option name="date" value="${date}" />
- <fileset dir="${project.basedir}/src">
- <include name="**/*.php" />
- </fileset>
- </pearpkg2>
-
- <exec dir="${dir.output}/pear" command="pear package" />
- <delete dir="${dir.output}/pear/Guzzle" />
- <delete file="${dir.output}/pear/package.xml" />
-
- </target>
-
-</project>
+</project>
@@ -0,0 +1,16 @@
+# you may need to update this if you're working on a fork.
+guzzle.remote=git@github.com:guzzle/guzzle.git
+
+# github credentials -- only used by GitHub API calls to create subtree repos
+github.basicauth=username:password
+# for the subtree split and testing
+github.org=guzzle
+
+# your git path
+cmd.git=git
+
+# your composer command
+cmd.composer=composer
+
+# test server start
+cmd.testserver=node
@@ -0,0 +1,16 @@
+# update this if you're working on a fork.
+guzzle.remote=git@github.com:guzzle/guzzle.git
+
+# github credentials -- only used by GitHub API calls to create subtree repos
+github.basicauth=username:password
+# for the subtree split and testing
+github.org=guzzle
+
+# your git path
+cmd.git=/usr/bin/git
+
+# your composer command
+cmd.composer=composer
+
+# test server start
+cmd.testserver="~/.nvm/nvm.sh run v0.6.14"
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="../../" default="install-dependencies">
+
+ <property name="cmd.composer" value="" />
+ <property name="cmd.git" value="" />
+ <property name="cmd.testserver" value="" />
+
+ <!--
+ Our custom tasks
+ -->
+ <taskdef name="composerlint" classname="phing.tasks.ComposerLintTask" />
+ <taskdef name="testserver" classname="phing.tasks.NodeServerTask" />
+ <taskdef name="guzzlesubsplit" classname="phing.tasks.GuzzleSubSplitTask" />
+ <taskdef name="guzzlepear" classname="phing.tasks.GuzzlePEARPackageTask" />
+
+ <!--
+ Handle locating composer (global) or composer.phar, and
+ if necessary, installing composer.phar locally.
+ -->
+ <target name="install-composer" description="Installs composer locally if it can't be found in build.properties or global install.">
+ <if>
+ <contains string="${cmd.composer}" substring="composer" />
+ <then>
+ <echo>Using composer at ${cmd.composer}</echo>
+ </then>
+ <else>
+ <exec command="which composer" outputProperty="cmd.composer" />
+ <if>
+ <contains string="${cmd.composer}" substring="composer" />
+ <then>
+ <echo>Using composer at ${cmd.composer}</echo>
+ </then>
+
+ <elseif>
+ <available file="${project.basedir}/composer.phar" />
+ <then>
+ <echo>Composer is installed locally</echo>
+ <property name="cmd.composer" value="${php.interpreter} ${project.basedir}/composer.phar" override="true"/>
+ </then>
+ </elseif>
+
+ <else>
+ <echo message="Installing composer locally" />
+ <exec command="curl -s http://getcomposer.org/installer | php" passthru="true" />
+ <property name="cmd.composer" value="${php.interpreter} ${project.basedir}/composer.phar" override="true"/>
+ </else>
+ </if>
+ </else>
+ </if>
+ <echo message="cmd.composer is ${cmd.composer}"/>
+ </target>
+
+ <target name="find-git">
+ <if>
+ <contains string="${cmd.git}" substring="git" />
+ <then>
+ <echo>using git at ${cmd.git}</echo>
+ </then>
+ <else>
+ <exec command="which git" outputProperty="cmd.git" />
+ <echo>found git at ${cmd.git}</echo>
+ </else>
+ </if>
+ </target>
+
+
+
+ <target name="install-dependencies" depends="install-composer">
+ <exec command="${cmd.composer} install --dev" passthru="true" />
+ </target>
+
+
+ <target name="update-dependencies" depends="install-composer">
+ <exec command="${cmd.composer} update --dev" passthru="true" />
+ </target>
+
+
+ <target name="clean-dependencies">
+ <delete dir="${project.basedir}/vendor"/>
+ <delete file="${project.basedir}/composer.lock" />
+ </target>
+
+</project>
Oops, something went wrong.

0 comments on commit 9320466

Please sign in to comment.