Version Control != Dependency Management

Post on 04-Jul-2015

2.816 views 4 download

description

Are you using svn:externals, git-submodules or something similar with your Version Control System of choice for connecting third-party libraries to your PHP projects? This presentation explores ways to handle dependencies in PHP projects, just like projects in other programming languages have done for ages. See http://ikoodi.nl/2011/01/25/version-control-dependency-management/ for full article.

Transcript of Version Control != Dependency Management

October 29, 2010

Patrick van Disselhttp://ikoodi.nl pvdissel@tricode.nl @pvdissel

Version Control!=

Dependency Management

Note

This presentation is focussed on and for PHP projects, but the principal can be applied on

projects in other programming language

PHP

Common project structureNice separation:● Application● Libraries● Public

Common structure in VCS

Single directory structure

Libraries copied in every project;causing duplication

Subversion(svn)

Common structure in VCS

svn:externals to tagsAs it should be used

With Subversion (SVN)

Common structure in VCS

svn:externals to trunkAs it's often used

With Subversion (SVN)

Getting externals in SVN

External fetching on SVN checkout

svn:externalsPros:● svn:externals fixes duplication

Cons:● Externals are hidden in SVN metadata● Externals are NOT read-only(!)● Externals can ONLY point to a SVN repository● Makes branching/tagging harder

svn:externals

Makes a rudimentary dependency manager from Subversion

How do others handledependency management?

*nix

A solution the *nix way

● Compile won't succeed until all required dependencies are available

● Configurable to use optional dependencies when available

with Make

Java

A solution the Java waywith Maven

A solution the Java waywith Maven

PHP

Solutions available for PHP

a framework and distribution system for reusable PHP components

Solutions available for PHP

Pyrus (PHP5.3.1+) is a tool to manage PEAR packages. Pyrus simplifies and improves the PEAR experience. Features include:● Standalone tool (pyrus.phar)● Can be integrated into application● Pear repository management/connection● Dependency Management● Packaging in the PHAR format (PHp Archive)

Solutions available for PHP

PHing Is Not GNU make.A PHP project build system/tool based on Apache Ant

Solutions available for PHP

Use a Version Control System likeSubversion to control code versions

Solutions available for PHP

Use a build tool likePhing to "build" projects

Solutions available for PHP

Use Pear as repository forlibraries and applications

Solutions available for PHP

Use Pyrus to integrate thePear repository with

Phing for dependency management

So..?

It isn't working yet!!

Currently Phing doesn't havea plugin to work with Pyrus

(October 29, 2010)

Resources

● Phing - www.phing.info● Pear - http://pear.php.net● Pear2 / Pyrus - http://pear2.php.net

Pyrus presentation: http://slidesha.re/cIAcgp● Extending Phing -

http://phing.info/docs/guide/stable/chapters/ExtendingPhing.html ● Phar - http://php.net/phar● Pake - http://pake-project.com● Make - http://en.wikipedia.org/wiki/Make_(software)● Apache Maven - http://maven.apache.org● Apache Ant - http://ant.apache.org● Apache Ivy - http://ant.apache.org/ivy

Questions?