Simplify your external dependency management - DPC11

  • 9,584 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
9,584
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
38
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. v Simplify your externaldependency management
  • 2. Simplify your ext. dependency management About me  Stephan Hochdörfer, bitExpert AG  Department Manager Research Labs  enjoying PHP since 1999  S.Hochdoerfer@bitExpert.de  @shochdoerfer
  • 3. Simplify your ext. dependency management Dependencies?
  • 4. Simplify your ext. dependency management Dependencies? internal external Dependencies Dependencies
  • 5. Simplify your ext. dependency management Dependencies? external Dependencies Extensions Systemtools Frameworks Libs
  • 6. Simplify your ext. dependency management Our first project....
  • 7. Simplify your ext. dependency management Our first project.... +
  • 8. Simplify your ext. dependency management Our first project – the structure yourpoject |-application |-library |---Facebook |---Zend |-public |---js |---css |-tests
  • 9. Simplify your ext. dependency management Maintenance nightmare!
  • 10. Simplify your ext. dependency management Version control, anyone?
  • 11. Simplify your ext. dependency management Subversion – svn:externals
  • 12. Simplify your ext. dependency management Git - Submodules
  • 13. Simplify your ext. dependency management Git - Subtree
  • 14. Simplify your ext. dependency management Recap No overview of dependency configuration
  • 15. Simplify your ext. dependency management Recap Externals must be of the same type as the repository!
  • 16. Simplify your ext. dependency management Recap Commiting to Externals is possible!
  • 17. Simplify your ext. dependency management Insight You cannot control dependencies with a VCS!
  • 18. Simplify your ext. dependency management Insight A VCS is not made for dependency management!
  • 19. Simplify your ext. dependency management Requirements first!
  • 20. Simplify your ext. dependency management Do not hide dependency metadata!
  • 21. Simplify your ext. dependency management Transitive dependencies
  • 22. Simplify your ext. dependency management Do not reinvent the wheel v
  • 23. Simplify your ext. dependency management Separation from VCS
  • 24. Simplify your ext. dependency management Mind change: Build process needed!
  • 25. Simplify your ext. dependency management Step 1: Building the build
  • 26. Simplify your ext. dependency management Step 2: Package the software
  • 27. Simplify your ext. dependency management Step 3: Deliver the software
  • 28. Simplify your ext. dependency management Build automation
  • 29. Simplify your ext. dependency management Build automation
  • 30. Simplify your ext. dependency management Build automation with Phing <?xml version="1.0" encoding="UTF-8"?> <project name="MyProject" default="build"> <target name="prepare"> <echo msg="Creating dir ./build" /> <mkdir dir="./build" /> </target> <target name="build" depends="prepare"> <echo msg="Copying files..." /> <copy file="./info.php" tofile="./build/info.php" /> </target> </project>
  • 31. Simplify your ext. dependency management Build automation with pear
  • 32. Simplify your ext. dependency management Build automation with pear pantr pantr = project-based PEAR installer
  • 33. Simplify your ext. dependency management Build automation with pantr 1. pantr pear:init lib
  • 34. Simplify your ext. dependency management Build automation with pantr 2. pantr pear:channel-discover pear.pagosoft.com
  • 35. Simplify your ext. dependency management Build automation with pantr 3. pantr pear:install pgs/parser
  • 36. Simplify your ext. dependency management Packaging
  • 37. Simplify your ext. dependency management *nix packages – 4 steps to enlightenment
  • 38. Simplify your ext. dependency management *nix packages – 4 steps to enlightenment 1. Create directory yourproject-0.0.1
  • 39. Simplify your ext. dependency management *nix packages – 4 steps to enlightenment 2. dh_make –createorig -s
  • 40. Simplify your ext. dependency management *nix packages – 4 steps to enlightenment 3. Add a Makefile
  • 41. Simplify your ext. dependency management *nix packages – 4 steps to enlightenment BINDIR = $(DESTDIR)/usr/bin clean: install: mkdir -p $(BINDIR) cp info.php $(BINDIR) uninstall: rm -f $(BINDIR)/info.php
  • 42. Simplify your ext. dependency management *nix packages – 4 steps to enlightenment 4. fakeroot debian/rules binary
  • 43. Simplify your ext. dependency management *nix packages – Dependencies?
  • 44. Simplify your ext. dependency management *nix packages – Dependencies? Add them to debian/control file
  • 45. Simplify your ext. dependency management *nix packages – Dependencies? Source: yourproject Section: unknown Priority: extra Maintainer: Stephan Hochdoerfer Build-Depends: debhelper (>= 7.0.50~) Standards-Version: 3.8.4 Package: yourproject Architecture: any Depends: php5-cgi php5-mysql Description: yourproject short description long description...
  • 46. Simplify your ext. dependency management PEAR package – 3 steps to enlightenment
  • 47. Simplify your ext. dependency management PEAR package – 3 steps to enlightenment 1. Create directory yourproject-0.0.1
  • 48. Simplify your ext. dependency management PEAR package – 3 steps to enlightenment 2. Create package.xml
  • 49. Simplify your ext. dependency management PEAR package – 3 steps to enlightenment <?xml version="1.0" encoding="UTF-8"?> <package packagerversion="1.8.0" version="2.0"> <name>Yourapp</name> <channel>pear.yourapp.com</channel> <summary>Yourapp summary</summary> <description>Yourapp description.</description> <lead> <name>Stephan Hochdoerfer</name> <user>sh</user> <email>S.Hochdoerfer@bitExpert.de</email> <active>yes</active> </lead> <date>2009-10-18</date> <time>16:00:00</time> <version> <release>0.9.0</release>
  • 50. Simplify your ext. dependency management PEAR package – 3 steps to enlightenment <dependencies> <required> <php> <min>5.0.0</min> </php> <pearinstaller> <min>1.4.0</min> </pearinstaller> </required> </dependencies> <phprelease /></package>
  • 51. Simplify your ext. dependency management PEAR package – 3 steps to enlightenment 3. pear package
  • 52. Simplify your ext. dependency management How to deliver the packages?
  • 53. Simplify your ext. dependency management How to deliver the packages? *nix repository vs. PEAR server
  • 54. Simplify your ext. dependency management How to deliver the packages? pearhub, pearfarm, openPear
  • 55. Simplify your ext. dependency management How to deliver the packages? PEAR Proxy needed?
  • 56. Simplify your ext. dependency management Missing the glue!
  • 57. Simplify your ext. dependency management Java anyone?
  • 58. Simplify your ext. dependency management Maven – a project management tool
  • 59. Simplify your ext. dependency management Maven Goal: Standardization
  • 60. Simplify your ext. dependency management Maven Lifecycle archetype
  • 61. Simplify your ext. dependency management Maven Lifecycle archetype validate
  • 62. Simplify your ext. dependency management Maven Lifecycle archetype validate compile
  • 63. Simplify your ext. dependency management Maven Lifecycle archetype validate compile test
  • 64. Simplify your ext. dependency management Maven Lifecycle archetype validate compile test package
  • 65. Simplify your ext. dependency management Maven Lifecycle archetype validate compile test integration-test package
  • 66. Simplify your ext. dependency management Maven Lifecycle archetype validate compile verify test integration-test package
  • 67. Simplify your ext. dependency management Maven Lifecycle archetype validate install compile verify test integration-test package
  • 68. Simplify your ext. dependency management Maven Lifecycle archetype deploy validate install compile verify test integration-test package
  • 69. Simplify your ext. dependency management Maven - Project Object Model <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <groupId>com.acme</groupId> <artifactId>myproject</artifactId> <packaging>jar</packaging> <version>0.0.1-SNAPSHOT</version> <name>My project</name> </project>
  • 70. Simplify your ext. dependency management Maven - Dependencies <dependencies> <dependency> <groupId>com.zend</groupId> <artifactId>framework</artifactId> <version>1.11.6-SNAPSHOT</version> <type>jar</type> <scope>compile</scope> </dependency> </dependencies>
  • 71. Simplify your ext. dependency management Maven Beginners guide Maven for PHP?
  • 72. Simplify your ext. dependency management Maven Beginners guide 1. Download & install Maven
  • 73. Simplify your ext. dependency management Maven Beginners guide 2. Edit settings.xml to add PHP for Maven repository
  • 74. Simplify your ext. dependency management Maven Beginners guide <pluginRepository> <id>release-repo1.php-maven.org</id> <name>PHP-Maven 2 Release Repository</name> <url>http://repo1.php-maven.org/release</url> <releases> <enabled>true</enabled> </releases> </pluginRepository>
  • 75. Simplify your ext. dependency management Maven Beginners guide 3. Create new Maven project
  • 76. Simplify your ext. dependency management Maven Beginners guide mvn archetype:generate -DarchetypeGroupId=org.phpmaven -DarchetypeArtifactId=php5-lib-archetype -DarchetypeVersion=1.1 -DgroupId=org.yourproject -DartifactId=appname
  • 77. Simplify your ext. dependency management Maven Beginners guide 2. Deploy your project
  • 78. Simplify your ext. dependency management Maven Beginners guide mvn deploy
  • 79. Simplify your ext. dependency management Maven Bonus points Can act as a proxy!
  • 80. Simplify your ext. dependency management Maven Bonus points Plugins, Plugins, Plugins,...
  • 81. Simplify your ext. dependency management Maven Bonus points Automatic release management
  • 82. Simplify your ext. dependency management Maven Bonus points Automatic deployment
  • 83. Simplify your ext. dependency management Maven Bonus points Build profiles
  • 84. Simplify your ext. dependency management Maven Bonus points IDE support, e.g. Eclipse, Netbeans,...
  • 85. http://joind.in/3232
  • 86. Simplify your ext. dependency management Image Credits http://www.sxc.hu/photo/1092493 http://www.sxc.hu/photo/910278 http://www.sxc.hu/photo/766748