Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 1st, 2012  |  syntax: None  |  size: 3.32 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Idioms for supporing parent build using Ant 1.8 extension points
  2. <?xml version="1.0" encoding="utf-8"?>
  3. <project name="common-targets">
  4.  
  5.     <extension-point name="compile" />
  6.     <extension-point name="test" depends="compile" />
  7.     <extension-point name="package" depends="test" />
  8.     <extension-point name="deploy" depends="package" />
  9.  
  10. </project>
  11.        
  12. <?xml version="1.0" encoding="utf-8"?>
  13. <project name="compile">
  14.  
  15.     <import file="common-targets.xml" />
  16.  
  17.     <target name="compile:compile" extensionOf="compile">
  18.         <echo message="Compiling..." />
  19.     </target>
  20.  
  21. </project>
  22.        
  23. <?xml version="1.0" encoding="utf-8"?>
  24. <project name="test">
  25.  
  26.     <import file="common-targets.xml" />
  27.  
  28.     <target name="test:test" extensionOf="test">
  29.         <echo message="Testing..." />
  30.     </target>
  31.  
  32. </project>
  33.        
  34. <?xml version="1.0" encoding="utf-8"?>
  35. <project name="default-lifecycle">
  36.  
  37.     <import file="compile.xml" />
  38.     <import file="test.xml" />
  39.     <import file="package.xml" />
  40.     <import file="deploy.xml" />
  41.  
  42. </project>
  43.        
  44. <?xml version="1.0" encoding="utf-8"?>
  45. <project name="child1">
  46.     <import file="../scripts/default-lifecycle.xml" />
  47. </project>
  48.        
  49. <?xml version="1.0" encoding="utf-8"?>
  50. <project name="child2">
  51.     <import file="../scripts/default-lifecycle.xml" />
  52. </project>
  53.        
  54. .-+
  55.   |
  56.   +-build.xml
  57.   +-child1
  58.      |
  59.      +-build.xml
  60.   +-child2
  61.      |
  62.      +-build.xml
  63.   +-scripts
  64.        
  65. <?xml version="1.0" encoding="utf-8"?>
  66. <project name="parent">
  67.  
  68.     <import file="common-targets.xml" />
  69.  
  70.     <target name="parent:compile" depends="parent:init-build-path" extensionOf="compile">
  71.         <subant target="compile" buildpathref="parent..build-path" />
  72.     </target>
  73.  
  74.     <target name="parent:test" depends="parent:init-build-path" extensionOf="test">
  75.         <subant target="test" buildpathref="parent..build-path" />
  76.     </target>
  77.  
  78.     <target name="parent:package" depends="parent:init-build-path" extensionOf="package">
  79.         <subant target="package" buildpathref="parent..build-path" />
  80.     </target>
  81.  
  82.     <target name="parent:deploy" depends="parent:init-build-path" extensionOf="deploy">
  83.         <subant target="deploy" buildpathref="parent..build-path" />
  84.     </target>
  85.  
  86.     <target name="parent:init-build-path">
  87.         <path id="parent..build-path">
  88.             <fileset dir="." includes="**/build.xml" excludes="build.xml" />
  89.         </path>
  90.         <echo message="Build order is ${toString:parent..build-path}" />
  91.     </target>
  92.  
  93. </project>
  94.        
  95. <?xml version="1.0" encoding="utf-8"?>
  96. <project name="parent">
  97.  
  98.     <target name="compile" depends="parent:init-build-path">
  99.         <subant target="compile" buildpathref="parent..build-path" />
  100.     </target>
  101.  
  102.     <target name="test" depends="parent:init-build-path">
  103.         <subant target="test" buildpathref="parent..build-path" />
  104.     </target>
  105.  
  106.     <target name="package" depends="parent:init-build-path">
  107.         <subant target="package" buildpathref="parent..build-path" />
  108.     </target>
  109.  
  110.     <target name="deploy" depends="parent:init-build-path">
  111.         <subant target="deploy" buildpathref="parent..build-path" />
  112.     </target>
  113.  
  114.     <target name="parent:init-build-path">
  115.         <path id="parent..build-path">
  116.             <fileset dir="." includes="**/build.xml" excludes="build.xml" />
  117.         </path>
  118.         <echo message="Build order is ${toString:parent..build-path}" />
  119.     </target>
  120.  
  121. </project>