OCTFEBJUL
28
201020112012
21 captures
23 Oct 2010 - 24 Jul 2012
About this capture
Phing Symlink task
Many projects have shared items across them. For example, Typo3 projects can share the same source, but just sticking it on the include path doesn’t necessarily solve the problem, so you have to symlink it from a shared location into your project.
Since my build tool of choice is Phing and usually I like having a build running just by running “phing” in the project root, I had to get the symlinks created during the build process. The Symlink task does just that.
Using it is pretty straight forward:
Until the next release, you will have to define it using taskdef:
<!-- Load the symlink task --><taskdef name="symlink" classname​=​"phing.tasks.ext.SymlinkTask" />
Once defined, you can start symlinking (I’ll use the Typo3 example):
<target name="typo3:symlink" depends​=​"needConfiguration" description​=​"Generates the requried typo3 symlinks"> <delete file​=​"${build.public_dir}/${typo3.index_file}" /> <delete file​=​"${build.public_dir}/t3lib" /> <delete file​=​"${build.public_dir}/typo3" /> <delete file​=​"${build.public_dir}/typo3src" />   <symlink target​=​"/share/typo3_src-${typo3.source}" link​=​"${build.public_dir}/typo3src" /> <symlink target​=​"${build.public_dir}/typo3src/index.php" link​=​"${build.public_dir}/${typo3.index_file}" /> <symlink target​=​"${build.public_dir}/typo3src/t3lib" link​=​"${build.public_dir}/t3lib" /> <symlink target​=​"${build.public_dir}/typo3src/typo3" link​=​"${build.public_dir}/typo3" /></target>
The variables used within the target are:
build.public_dir – points to the document root of the build
typo3.source – version of Typo3 we’re using (4.4.4 for example)
typo3.index_file – t3index.php, we usually have a Zend bootstrap as index.php which includes the Typo3 index file
It can also do multiple symlinks at the same time. Consider having a “library” directory somewhere in your project, that contains the sources of some shared libraries (zend, doctrine, etc), to symlink all of those into your build:
<symlink link​=​"${build.path}/library"​> <fileset dir="/share/library"> <include name="*" /> </fileset></symlink>
If the contents of /share/library were “Zend, Doctrine”, then in your build you’d have:
library/Zend -> /share/library/Zend
library/Doctrine -> /share/library/Doctrine
To install Phing, please follow these instructions.
WRITTEN BY ANDREI ON THE 20TH OCTOBER 2010
Topics: Applications, Development, Work Tags: phing
Share this Comments: none so far
Post a Comment
Your email is never shared. Required fields are marked *
Name *
Email *
Website
Comment
to all my 98,000 followers, tim is now tweeting from 3evtim so update and follow #3evtim
Follow Us
Follow us on Twitter
Latest Posts
TYPO3 and the filesystem
TYPO3 in the cloud
Phing Symlink task
New brand and website for Leading Edge Design
How we built Singup.org
Topics…
Applications
Branding
Cloud
Design
Development
Life at 3ev
Opinions
Statistics
Training
Work
Blogroll
Berry Brothers Blog
butdoesitfloat.com
CherylKerl
FFFFOUND!
grain edit
Greyhandgang
Viva Radio
Newsletter
Want to receive our free newsletters and special alerts?
Simply enter your email address and hit enter/return.

Quicklinks
Expertise
The story so far…
Tim Carr
Dan Frost
Dean Hayden
Danny Knight
Andrei Serdeliuc
Simon Grout
Ben Grout
Jobs at 3ev
Work
Amazon Web Services (AWS)
AWS Training
TYPO3 Development
Design
Development
Social Apps
Support
Cloud Hosting
Blog
Applications
Branding
Cloud
Design
Development
Life at 3ev
Opinions
Statistics
Training
Work
Copyright © 3ev 2011. All rights reserved.The Workshop 11 Queens Place Brighton & Hove BN3 2LT. Phone: +44(0)1273 227 337. Email: info@3ev.com
ExpertiseWorkBlogContact