Skip to content

Commit

Permalink
DDC-684 - Fix flaw in build process, DBAL PEAR package now does not c…
Browse files Browse the repository at this point in the history
…ontain Common code and just adds a dependency on the PEAR channel. Additional full package is generated into dist/
  • Loading branch information
beberlei committed Aug 30, 2010
1 parent 9f1de0e commit 8054984
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 21 deletions.
4 changes: 0 additions & 4 deletions bin/doctrine

This file was deleted.

4 changes: 4 additions & 0 deletions bin/doctrine-dbal
@@ -0,0 +1,4 @@
#!/usr/bin/env php
<?php

include('doctrine-dbal.php');
42 changes: 42 additions & 0 deletions bin/doctrine-dbal.php
@@ -0,0 +1,42 @@
<?php

require_once 'Doctrine/Common/ClassLoader.php';

$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();

$classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
$classLoader->register();

$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';

$helperSet = null;
if (file_exists($configFile)) {
if ( ! is_readable($configFile)) {
trigger_error(
'Configuration file [' . $configFile . '] does not have read permission.', E_ERROR
);
}

require $configFile;

foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof \Symfony\Components\Console\Helper\HelperSet) {
$helperSet = $helperSetCandidate;
break;
}
}
}

$helperSet = ($helperSet) ?: new \Symfony\Components\Console\Helper\HelperSet();

$cli = new \Symfony\Components\Console\Application('Doctrine Command Line Interface', Doctrine\DBAL\Version::VERSION);
$cli->setCatchExceptions(true);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(
// DBAL Commands
new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),

));
$cli->run();
39 changes: 22 additions & 17 deletions build.xml
Expand Up @@ -21,8 +21,8 @@
Fileset for command line scripts
-->
<fileset id="bin-scripts" dir="./bin">
<include name="doctrine"/>
<include name="doctrine.php"/>
<include name="doctrine-dbal"/>
<include name="doctrine-dbal.php"/>
</fileset>

<!--
Expand All @@ -43,7 +43,7 @@
Fileset for source of the Symfony YAML and Console components.
-->
<fileset id="symfony-sources" dir="./lib/vendor">
<include name="Symfony/Components/**"/>
<include name="Symfony/Component**"/>
</fileset>

<!--
Expand Down Expand Up @@ -76,21 +76,21 @@
Builds DBAL package, preparing it for distribution.
-->
<target name="build-dbal" depends="test">
<copy todir="${build.dir}/dbal">
<copy todir="${build.dir}/doctrine-dbal">
<fileset refid="shared-artifacts"/>
</copy>
<copy todir="${build.dir}/dbal">
<copy todir="${build.dir}/doctrine-dbal">
<fileset refid="common-sources"/>
<fileset refid="dbal-sources"/>
</copy>
<copy todir="${build.dir}/dbal/Doctrine">
<copy todir="${build.dir}/doctrine-dbal/Doctrine">
<fileset refid="symfony-sources"/>
</copy>
<copy todir="${build.dir}/dbal/bin">
<copy todir="${build.dir}/doctrine-dbal/bin">
<fileset refid="bin-scripts"/>
</copy>
<exec command="sed 's/${version}-DEV/${version}/' ${build.dir}/dbal/Doctrine/DBAL/Version.php > ${build.dir}/dbal/Doctrine/DBAL/Version2.php" passthru="true" />
<exec command="mv ${build.dir}/dbal/Doctrine/DBAL/Version2.php ${build.dir}/dbal/Doctrine/DBAL/Version.php" passthru="true" />
<exec command="sed 's/${version}-DEV/${version}/' ${build.dir}/doctrine-dbal/Doctrine/DBAL/Version.php > ${build.dir}/doctrine-dbal/Doctrine/DBAL/Version2.php" passthru="true" />
<exec command="mv ${build.dir}/doctrine-dbal/Doctrine/DBAL/Version2.php ${build.dir}/doctrine-dbal/Doctrine/DBAL/Version.php" passthru="true" />
</target>

<target name="build" depends="test, build-dbal"/>
Expand Down Expand Up @@ -132,7 +132,7 @@
Builds distributable PEAR packages.
-->
<target name="build-packages" depends="build">
<d51pearpkg2 baseinstalldir="/" dir="${build.dir}/dbal">
<d51pearpkg2 baseinstalldir="/" dir="${build.dir}/doctrine-dbal">
<name>DoctrineDBAL</name>
<summary>Doctrine Database Abstraction Layer</summary>
<channel>pear.doctrine-project.org</channel>
Expand All @@ -148,17 +148,22 @@
<dependencies>
<php minimum_version="5.3.2" />
<pear minimum_version="1.6.0" recommended_version="1.6.1" />
<package name="DoctrineCommon" channel="pear.doctrine-project.org" minimum_version="2.0.0BETA4" />
</dependencies>
<dirroles key="bin">script</dirroles>
<replacement path="bin/doctrine" type="pear-config" from="@php_bin@" to="php_bin" />
<replacement path="bin/doctrine.php" type="pear-config" from="@php_bin@" to="php_bin" />
<replacement path="bin/doctrine.php" type="pear-config" from="@bin_dir@" to="bin_dir" />
<ignore>Doctrine/Common/</ignore>
<release>
<install as="doctrine" name="bin/doctrine" />
<install as="doctrine.php" name="bin/doctrine.php" />
<install as="doctrine-dbal" name="bin/doctrine-dbal" />
<install as="doctrine-dbal.php" name="bin/doctrine-dbal.php" />
</release>
</d51pearpkg2>
<exec command="pear package" dir="${build.dir}/dbal" passthru="true" />
<exec command="mv DoctrineDBAL-${version}.tgz ../../dist" dir="${build.dir}/dbal" passthru="true" />
<exec command="pear package" dir="${build.dir}/doctrine-dbal" passthru="true" />
<exec command="mv DoctrineDBAL-${version}.tgz ../../dist" dir="${build.dir}/doctrine-dbal" passthru="true" />
<tar destfile="dist/DoctrineDBAL-${version}-full.tar.gz" compression="gzip" basedir="${build.dir}">
<fileset dir="${build.dir}">
<include name="**/**" />
<exclude name="logs/" />
</fileset>
</tar>
</target>
</project>

0 comments on commit 8054984

Please sign in to comment.