builds_to_ant.xsl 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. exclude-result-prefixes="xs"
  5. version="2.0">
  6. <!-- template do zbudowania listy podzadan na podsatwie <fileset id="builds_to_ant" dir="temp" includes="prezes1.build_root_x2f_.d1e1.CRM_PROCES_x2f_.d1e46.CRM_WSKAZNIK_x2f_.d1e51.CRM_LISTA_ZASOBOW.*" /> -->
  7. <xsl:output indent="yes"/>
  8. <xsl:strip-space elements="*"/>
  9. <xsl:include href="get_all_xsd.xsl"/>
  10. <xsl:param name="temp" required="yes"/>
  11. <xsl:param name="default_antfile"/>
  12. <!--<xsl:param name="loop_xpath" required="yes"/>-->
  13. <xsl:param name="loop_xpath_real" required="yes"/>
  14. <xsl:param name="loop_path_recurs" required="yes"/>
  15. <xsl:param name="xpath_query" required="yes"/>
  16. <xsl:param name="featureID_name_dita" required="yes"/>
  17. <xsl:param name="xpath_query_test.xml"/>
  18. <!--<xsl:param name="recurse_ant_basedir" required="yes"/>-->
  19. <!--<xsl:param name="temp_current" required="yes"/>-->
  20. <xsl:param name="ant-launcher.jar" required="yes"/>
  21. <xsl:param name="build_check_java_process_count.xml" required="yes"/>
  22. <xsl:param name="parallel_java_process_max" required="yes"/>
  23. <xsl:param name="loop_xpath" /> <!-- required="yes" , added at @2017-04-14 to concat $temp in exec -->
  24. <xsl:param name="feature_pos" required="yes"/>
  25. <xsl:param name="feature_pos_parent" /> <!-- required="yes" do wykluczenia bledow z przejsciem przez loop jak jest wiecej elementow Proces_tree -->
  26. <xsl:param name="process_locks"/>
  27. <xsl:param name="uuid" required="yes"/>
  28. <xsl:param name="debug" select="1"/>
  29. <xsl:param name="xml_id" required="yes"/>
  30. <xsl:param name="recurse_ant_basedir.recurse_cache"/>
  31. <xsl:param name="typeNameRoot" required="yes"/>
  32. <xsl:variable name="xpath_query_test">
  33. <xsl:choose>
  34. <xsl:when test="$xpath_query_test.xml">
  35. <xsl:copy-of select="doc($xpath_query_test.xml)"/>
  36. </xsl:when>
  37. <xsl:otherwise>
  38. <xpath_query_test>OK</xpath_query_test>
  39. </xsl:otherwise>
  40. </xsl:choose>
  41. </xsl:variable>
  42. <xsl:template name="last_slash">
  43. <xsl:param name="string" required="yes"/>
  44. <xsl:for-each select="tokenize($string,'/')">
  45. <xsl:if test="position()=(last() - 1)">
  46. <xsl:value-of select="."/>
  47. </xsl:if>
  48. </xsl:for-each>
  49. </xsl:template>
  50. <xsl:template match="builds_to_ant">
  51. <project xmlns:gml="http://www.opengis.net/gml"
  52. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  53. xmlns:xlink="http://www.w3.org/1999/xlink"
  54. xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
  55. xmlns:wfs="http://www.opengis.net/wfs"
  56. xmlns:ogc="http://www.opengis.net/ogc"
  57. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  58. basedir="../."
  59. name="builds_to_ant_proj{$loop_path_recurs}{$loop_xpath_real}"
  60. default="builds_to_ant{$loop_path_recurs}{$loop_xpath_real}">
  61. <property name="build_check_java_process_count.xml" value="{$build_check_java_process_count.xml}"/>
  62. <property name="parallel_java_process_max" value="{$parallel_java_process_max}"/>
  63. <tempfile prefix=".builds_to_ant_set_parallel_java_process_max" suffix=".xml" destdir="{$temp}" deleteonexit="true" >
  64. <xsl:attribute name="property" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
  65. </tempfile>
  66. <property name="xpath_query" value="{$xpath_query}"/>
  67. <xsl:element name="target">
  68. <xsl:attribute name="name" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
  69. <ant antfile="{$build_check_java_process_count.xml}">
  70. <xsl:attribute name="output" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
  71. <property name="builds_to_ant_set_parallel_java_process_max">
  72. <xsl:attribute name="value" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
  73. </property>
  74. <property name="parallel_java_process_max" value="{$parallel_java_process_max}"/>
  75. <property name="process_locks" value="{$process_locks}"/>
  76. </ant>
  77. <loadfile>
  78. <xsl:attribute name="property" select="concat('builds_to_ant_set_parallel_java_process_max_loadfile',$loop_path_recurs,$loop_xpath_real)"/>
  79. <xsl:attribute name="srcfile" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
  80. </loadfile>
  81. <!--<delete verbose="false">
  82. <xsl:attribute name="file" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
  83. </delete>-->
  84. </xsl:element>
  85. <xsl:element name="target">
  86. <xsl:attribute name="name" select="concat('builds_to_ant',$loop_path_recurs,$loop_xpath_real)"/>
  87. <xsl:attribute name="depends" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
  88. <xsl:variable name="last_slash">
  89. <xsl:call-template name="last_slash">
  90. <xsl:with-param name="string" select="$temp"/>
  91. </xsl:call-template>
  92. </xsl:variable>
  93. <xsl:comment> default_antfile: <xsl:value-of select="$default_antfile"/> ; </xsl:comment>
  94. <xsl:choose>
  95. <xsl:when test="not($xpath_query_test/xpath_query_test='OK')">
  96. <xsl:message> $xpath_query_test NOT OK - bypassed by xpath_query filter </xsl:message>
  97. <echo> $xpath_query_test NOT OK - bypassed by xpath_query filter </echo>
  98. </xsl:when>
  99. <xsl:when test="1=1"> <!-- $last_slash='temp' -->
  100. <xsl:if test="$debug &gt; 1"><xsl:message> FIRST LEVEL ANT is executed in PARALLEL </xsl:message></xsl:if>
  101. <xsl:if test="$debug &gt; 1"><echo>
  102. ######98 PARALLEL STARTING CURRENT LEAF BUILDING BY RelatedFeature #######
  103. # $temp = <xsl:value-of select="$temp"/> ;
  104. # builds_to_ant - uruchomienie ANT w parallel temp/<xsl:value-of select="."/>;
  105. # $xpath_query = <xsl:value-of select="$xpath_query"/>;
  106. # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
  107. # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
  108. #
  109. ################################################################
  110. </echo></xsl:if>
  111. <!--<tempfile suffix=".xml" destdir="{$process_locks}" deleteonexit="yes" createfile="yes">
  112. <xsl:attribute name="property" select="concat('builds_to_ant_lock',$loop_path_recurs,$loop_xpath_real)"/>
  113. </tempfile>-->
  114. <parallel failonany="true">
  115. <xsl:attribute name="threadCount" select="concat('${builds_to_ant_set_parallel_java_process_max_loadfile',$loop_path_recurs,$loop_xpath_real,'}')"/>
  116. <!-- threadCount="4" -->
  117. <xsl:for-each select="tokenize(.,';')">
  118. <!-- is also possible to run ordinary ant task! -->
  119. <!--<echo message="executing pos:{position()} antfile: {$temp}/{$loop_xpath}/{.}/build.xml "/>-->
  120. <!--<ant antfile="{$temp}/{$loop_xpath}/{.}/build.xml" dir="." inheritall="false">
  121. <property name="parallel_pos" value="{position()}"/>
  122. </ant>--> <!-- CHANGED from ${temp}/{.} -->
  123. <sequential>
  124. <java>
  125. <xsl:attribute name="jar" select="$ant-launcher.jar"/>
  126. <!--<xsl:attribute name="classname" select="'org.apache.tools.ant.Main'"/>-->
  127. <!--<xsl:attribute name="dir" select="'${basedir}'"/>-->
  128. <xsl:attribute name="fork" select="'true'"/>
  129. <xsl:attribute name="clonevm" select="'false'"/>
  130. <xsl:attribute name="failonerror" select="'true'"/>
  131. <!--<xsl:attribute name="append" select="'false'"/>-->
  132. <!--<xsl:attribute name="resultproperty" select="concat(.,'_resprop')"/>-->
  133. <!--<xsl:attribute name="output" select="concat($temp,'/',.,'_out.log')"/>-->
  134. <arg value="-buildfile"/>
  135. <arg value="{$temp}/{$loop_xpath}/{.}/build.xml"/>
  136. </java>
  137. <!--<loadfile property="builds_to_ant_cache_fid_ant{$loop_path_recurs}{$loop_xpath_real}{$xml_id}.{$feature_pos_parent}.{position()}" srcfile="{$temp}/{$loop_xpath}/{position()}.fid_parent.txt"/>-->
  138. <!-- THIS SHOULD BE THE SAME AS IN build_recurse_ant.xsl/builds_to_ant.xsl (to be template) line 1000 name CACHE_COPY_TASK - EOF -->
  139. <!--<echo> #146 builds_to_ant detected fid *.fid_parent.txt <xsl:value-of select="concat('${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}')"/></echo>-->
  140. <!-- <mkdir>
  141. <xsl:attribute name="dir" select="concat($recurse_ant_basedir.recurse_cache,'/',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}')"/>
  142. </mkdir>
  143. <!-\- child elements -\->
  144. <mkdir>
  145. <xsl:attribute name="dir" select="concat($recurse_ant_basedir.recurse_cache,'/',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}','/_child_',$xml_id,'.',$feature_pos_parent,'.', position())"/>
  146. </mkdir>
  147. <copy failonerror="false"> <!-\- we copy important files to cache. Recursed cached files should be already aliased in child process (smallest parts) -\->
  148. <xsl:attribute name="todir" select="concat($recurse_ant_basedir.recurse_cache,'/',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}','/_child_',$xml_id,'.',$feature_pos_parent,'.', position() )"/>
  149. <fileset dir="{$temp}/{$loop_xpath_real}" includes="*" /> <!-\- {@xml_id}. -\->
  150. </copy>
  151. <!-\- root elements -\->
  152. <copy failonerror="false"> <!-\- we copy important files to cache. Recursed cached files should be already aliased in child process (smallest parts) -\->
  153. <xsl:attribute name="todir" select="concat($recurse_ant_basedir.recurse_cache,'/',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}')"/>
  154. <fileset dir="{$temp}/{$loop_xpath}/../" includes="{tokenize($loop_xpath_real,'/')[count(tokenize($loop_xpath_real,'/'))]}.*" />
  155. <fileset dir="{$temp}/{$loop_xpath}/../" includes="{ $feature_pos}.fid_parent.txt" /><!-\- ostatni po / wartosc sciezki -\->
  156. </copy>-->
  157. <!-- EOF THIS SHOULD BE THE SAME AS IN build_recurse_ant.xsl/builds_to_ant.xsl (to be template) line 1000 name CACHE_COPY_TASK -->
  158. </sequential>
  159. </xsl:for-each>
  160. </parallel>
  161. <!--<delete>
  162. <xsl:attribute name="file" select="concat('${builds_to_ant_lock',$loop_path_recurs,$loop_xpath_real,'}')"/>
  163. </delete>-->
  164. <xsl:if test="$debug &gt; 1"><echo>
  165. #######98B PARALLEL FINISHED CURRENT LEAF BUILDING BY RelatedFeature #######
  166. # $temp = <xsl:value-of select="$temp"/> ;
  167. # builds_to_ant - uruchomienie ANT w parallel temp/<xsl:value-of select="."/>;
  168. # $xpath_query = <xsl:value-of select="$xpath_query"/>;
  169. # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
  170. # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
  171. #
  172. ################################################################
  173. </echo></xsl:if>
  174. </xsl:when>
  175. <xsl:otherwise>
  176. <xsl:if test="$debug &gt; 1"><xsl:message> SECOND AND NEXT LEVEL ANT is executed in normal </xsl:message></xsl:if>
  177. <xsl:if test="$debug &gt; 1"><echo>
  178. ######98 NOT PARALLEL STARTING CURRENT LEAF BUILDING BY RelatedFeature #######
  179. # $temp = <xsl:value-of select="$temp"/> ;
  180. # builds_to_ant - uruchomienie ANT w parallel temp/<xsl:value-of select="."/>;
  181. # $xpath_query = <xsl:value-of select="$xpath_query"/>;
  182. # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
  183. # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
  184. #
  185. ################################################################
  186. </echo></xsl:if>
  187. <xsl:for-each select="tokenize(.,';')">
  188. <echo>#####155 Running antfile: <xsl:value-of select="concat($temp,'/',$loop_xpath,'/',.,'/build.xml')"/></echo>
  189. <ant antfile="{$temp}/{$loop_xpath}/{.}/build.xml" dir="."/><!-- bylo przed 2017-04-14 <ant antfile="{$temp}/{.}" dir="."/>-->
  190. </xsl:for-each>
  191. <xsl:if test="$debug &gt; 1"><echo>
  192. #######98B NOT PARALLEL FINISHED CURRENT LEAF BUILDING BY RelatedFeature #######
  193. # $temp = <xsl:value-of select="$temp"/> ;
  194. # builds_to_ant - uruchomienie ANT w parallel temp/<xsl:value-of select="."/>;
  195. # $xpath_query = <xsl:value-of select="$xpath_query"/>;
  196. # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
  197. # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
  198. #
  199. ################################################################
  200. </echo></xsl:if>
  201. </xsl:otherwise>
  202. </xsl:choose>
  203. </xsl:element>
  204. <!--<delete verbose="false">
  205. <xsl:attribute name="file" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
  206. </delete>-->
  207. </project>
  208. </xsl:template>
  209. <xsl:template match="builds_to_ant" mode="exec">
  210. <project xmlns:gml="http://www.opengis.net/gml"
  211. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  212. xmlns:xlink="http://www.w3.org/1999/xlink"
  213. xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
  214. xmlns:wfs="http://www.opengis.net/wfs"
  215. xmlns:ogc="http://www.opengis.net/ogc"
  216. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  217. basedir="../."
  218. name="builds_to_ant_proj{$loop_path_recurs}{$loop_xpath_real}"
  219. default="builds_to_ant{$loop_path_recurs}{$loop_xpath_real}">
  220. <property name="build_check_java_process_count.xml" value="{$build_check_java_process_count.xml}"/>
  221. <property name="parallel_java_process_max" value="{$parallel_java_process_max}"/>
  222. <tempfile prefix=".builds_to_ant_set_parallel_java_process_max" suffix=".xml" destdir="{$temp}" deleteonexit="true" >
  223. <xsl:attribute name="property" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
  224. </tempfile>
  225. <property name="xpath_query" value="{$xpath_query}"/>
  226. <xsl:element name="target">
  227. <xsl:attribute name="name" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
  228. <ant antfile="{$build_check_java_process_count.xml}">
  229. <xsl:attribute name="output" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
  230. <property name="builds_to_ant_set_parallel_java_process_max">
  231. <xsl:attribute name="value" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
  232. </property>
  233. <property name="parallel_java_process_max" value="{$parallel_java_process_max}"/>
  234. <property name="process_locks" value="{$process_locks}"/>
  235. </ant>
  236. <loadfile>
  237. <xsl:attribute name="property" select="concat('builds_to_ant_set_parallel_java_process_max_loadfile',$loop_path_recurs,$loop_xpath_real)"/>
  238. <xsl:attribute name="srcfile" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
  239. </loadfile>
  240. <!--<delete verbose="false">
  241. <xsl:attribute name="file" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
  242. </delete>-->
  243. </xsl:element>
  244. <target name="builds_to_ant{$loop_path_recurs}{$loop_xpath_real}">
  245. <xsl:attribute name="depends" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
  246. <xsl:comment> default_antfile: <xsl:value-of select="$default_antfile"/> ; </xsl:comment>
  247. <!-- robimy na paraler -->
  248. <xsl:choose>
  249. <xsl:when test="not($xpath_query_test/xpath_query_test='OK')">
  250. <xsl:message> $xpath_query_test NOT OK - bypassed by xpath_query filter </xsl:message>
  251. <echo> $xpath_query_test NOT OK - bypassed by xpath_query filter </echo>
  252. </xsl:when>
  253. <xsl:when test="1=1"> <!-- error brak klasy Error: Could not find or load main class org.apache.tools.ant.Main -->
  254. <xsl:if test="$debug &gt; 1"><echo>
  255. ######234 PARALLEL STARTING CURRENT BUILDING BY RelatedFeatureLoop #######
  256. # $temp = <xsl:value-of select="$temp"/> ;
  257. # builds_to_ant - uruchomienie ANT w parallel temp/<xsl:value-of select="."/>;
  258. # $xpath_query = <xsl:value-of select="$xpath_query"/>;
  259. # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
  260. # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
  261. # $feature_pos_parent= <xsl:value-of select="$feature_pos_parent"/>; $feature_pos= <xsl:value-of select="$feature_pos"/>;
  262. ################################################################
  263. </echo></xsl:if>
  264. <!--<tempfile suffix=".xml" destdir="{$process_locks}" deleteonexit="yes" createfile="yes">
  265. <xsl:attribute name="property" select="concat('builds_to_ant_lock',$loop_path_recurs,$loop_xpath_real)"/>
  266. </tempfile>-->
  267. <parallel failonany="false"> <!-- we tried to retry lowe -->
  268. <xsl:attribute name="threadCount" select="concat('${builds_to_ant_set_parallel_java_process_max_loadfile',$loop_path_recurs,$loop_xpath_real,'}')"/>
  269. <xsl:for-each select="tokenize(.,';')">
  270. <!-- could be exec also in parallel task !!! -->
  271. <!--<exec executable="/opt/local/bin/ant" dir="{$temp}" failifexecutionfails="true">
  272. <xsl:element name="arg">
  273. <xsl:attribute name="line" select="concat('-f ',$temp,'/',$loop_xpath,'/',.,'/build_root.xml')"/>
  274. </xsl:element>
  275. <xsl:element name="arg">
  276. <xsl:attribute name="line" select="concat('-Dparallel_pos=',position())"/>
  277. </xsl:element>
  278. </exec>-->
  279. <sequential>
  280. <java>
  281. <xsl:attribute name="jar" select="$ant-launcher.jar"/>
  282. <!--<xsl:attribute name="classname" select="'org.apache.tools.ant.Main'"/>-->
  283. <xsl:attribute name="dir" select="concat($temp,'/',$loop_xpath,'/',.)"/>
  284. <xsl:attribute name="fork" select="'true'"/>
  285. <xsl:attribute name="clonevm" select="'false'"/>
  286. <xsl:attribute name="newenvironment" select="'true'"/>
  287. <xsl:attribute name="failonerror" select="'true'"/>
  288. <!--<xsl:attribute name="resultproperty" select="concat(.,'_resprop')"/>-->
  289. <!--<xsl:attribute name="output" select="concat(.,'_out.log')"/>-->
  290. <arg value="-buildfile"/>
  291. <arg value="{$temp}/{$loop_xpath}/{.}/build_root.xml"/>
  292. <xsl:element name="arg">
  293. <xsl:attribute name="line" select="concat('-Dparallel_pos=',position())"/>
  294. </xsl:element>
  295. </java>
  296. <!--<loadfile property="builds_to_ant_cache_fid_ant{$loop_path_recurs}{$loop_xpath_real}{$xml_id}.{$feature_pos_parent}.{position()}" srcfile="{$temp}/{$loop_xpath}/{position()}.fid_parent.txt"/>
  297. <echo> #321 builds_to_ant detected fid *.fid_parent.txt <xsl:value-of select="concat('${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}')"/></echo>
  298. <mkdir>
  299. <xsl:attribute name="dir" select="concat($recurse_ant_basedir.recurse_cache,'/_ant__',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}')"/>
  300. </mkdir>
  301. <copy failonerror="false"> <!-\- we copy important files to cache. Recursed cached files should be already aliased in child process (smallest parts) -\->
  302. <xsl:attribute name="todir" select="concat($recurse_ant_basedir.recurse_cache,'/_ant__',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}')"/>
  303. <fileset dir="{$temp}/{$loop_xpath}/../" includes="{tokenize($loop_xpath_real,'/')[count(tokenize($loop_xpath_real,'/'))]}.*" />
  304. <fileset dir="{$temp}/{$loop_xpath}/../" includes="{ $feature_pos}.fid_parent.txt" /><!-\- ostatni po / wartosc sciezki -\->
  305. </copy>
  306. <mkdir>
  307. <xsl:attribute name="dir" select="concat($recurse_ant_basedir.recurse_cache,'/_ant__',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}','/',$xml_id,'.',$feature_pos_parent,'.', position())"/>
  308. </mkdir>
  309. <copy failonerror="false"> <!-\- we copy important files to cache. Recursed cached files should be already aliased in child process (smallest parts) -\->
  310. <xsl:attribute name="todir" select="concat($recurse_ant_basedir.recurse_cache,'/_ant__',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}','/',$xml_id,'.',$feature_pos_parent,'.', position() )"/>
  311. <fileset dir="{$temp}/{$loop_xpath_real}" includes="*" /> <!-\- {@xml_id}. -\->
  312. </copy>-->
  313. </sequential>
  314. </xsl:for-each>
  315. </parallel>
  316. <!--<delete>
  317. <xsl:attribute name="file" select="concat('${builds_to_ant_lock',$loop_path_recurs,$loop_xpath_real,'}')"/>
  318. </delete>-->
  319. <xsl:if test="$debug &gt; 1"><echo>
  320. #######257 NOT PARALLEL FINISHED CURRENT LEAF BUILDING BY RelatedFeatureLoop #######
  321. # $temp = <xsl:value-of select="$temp"/> ;
  322. # builds_to_ant - uruchomienie ANT w parallel temp/<xsl:value-of select="."/>;
  323. # $xpath_query = <xsl:value-of select="$xpath_query"/>;
  324. # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
  325. # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
  326. #
  327. ################################################################
  328. </echo></xsl:if>
  329. </xsl:when>
  330. <xsl:otherwise>
  331. <xsl:if test="$debug &gt; 1"><echo>
  332. ######270 DISABLED PARALLEL STARTING CURRENT BUILDING BY RelatedFeatureLoop #######
  333. # $temp = <xsl:value-of select="$temp"/> ;
  334. # builds_to_ant - uruchomienie ANT w parallel temp/<xsl:value-of select="."/>;
  335. # $xpath_query = <xsl:value-of select="$xpath_query"/>;
  336. # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
  337. # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
  338. #
  339. ################################################################
  340. </echo></xsl:if>
  341. <xsl:for-each select="tokenize(.,';')">
  342. <xsl:if test="$debug &gt; 1"><echo>#####281 Running exec antfile: <xsl:value-of select="concat($temp,'/',$loop_xpath,'/',.,'/build_root.xml')"/>
  343. ##### $feature_pos_parent= <xsl:value-of select="$feature_pos_parent"/>; $feature_pos= <xsl:value-of select="$feature_pos"/>;
  344. #####
  345. </echo></xsl:if>
  346. <!-- TODO DEBUG OFF LOOP -->
  347. <exec executable="/opt/local/bin/ant" dir="{$temp}" failifexecutionfails="true">
  348. <xsl:element name="arg">
  349. <xsl:attribute name="line" select="concat('-f ',$temp,'/',$loop_xpath,'/',.,'/build_root.xml')"/>
  350. </xsl:element>
  351. <xsl:element name="arg">
  352. <xsl:attribute name="line" select="concat('-Dparallel_pos=',position())"/>
  353. </xsl:element>
  354. </exec>
  355. <!--<ant antfile="{.}/build_root.xml" dir="{$temp}" inheritall="false" usenativebasedir="true" />-->
  356. </xsl:for-each>
  357. </xsl:otherwise>
  358. </xsl:choose>
  359. <echo>#285 VERYFING CORRECT CHILD EXEC IF FAILED RETRY IT </echo>
  360. <xsl:for-each select="tokenize(.,';')">
  361. <echo>#285 VERYFING <xsl:value-of select="concat($temp,'/',$loop_xpath,'/',.,'/build_root.xml')"/> (.test_if_exec_child_ant.xml + {$uuid}_out_task_dita_final.dita.xml ) </echo>
  362. <loadfile property="Verify_numbers_file_{position()}" srcFile="{$temp}/{$loop_xpath}/{.}/.test_if_exec_child_ant.xml"/>
  363. <condition property="Verify_{position()}" taskname="Retry_{position()}">
  364. <or>
  365. <available file="{$temp}/{$loop_xpath}/{.}/{$uuid}_out_task_dita_final.dita.xml"/> <!-- todo zrobic sprawdzenie czy bylo warto sciagac podwezel -->
  366. <xsl:element name="contains">
  367. <xsl:attribute name="string" select="concat('${Verify_numbers_file_',position(),'}')"/>
  368. <xsl:attribute name="substring" select="'numberMatched=&quot;0&quot;'"/>
  369. </xsl:element>
  370. </or>
  371. </condition>
  372. </xsl:for-each>
  373. <xsl:for-each select="tokenize(.,';')">
  374. <antcall target="Retry_{position()}"/>
  375. <antcall target="Confirm_{position()}"/>
  376. </xsl:for-each>
  377. </target>
  378. <!-- retries tasks-->
  379. <xsl:for-each select="tokenize(.,';')">
  380. <target name="Retry_{position()}">
  381. <xsl:attribute name="unless" select="concat('${Verify_',position(),'}')"/>
  382. <echo>
  383. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx #350 FIXING BAD RELATEDLOOP EXECUTION for <xsl:value-of select="concat($temp,'/',$loop_xpath,'/',.,'build_root.xml')"/>
  384. </echo>
  385. <delete includeEmptyDirs="true" quiet="true">
  386. <fileset dir="{$temp}/{$loop_xpath}/{.}">
  387. <include name="*"/>
  388. <exclude name="build_root.xml"/>
  389. </fileset>
  390. </delete>
  391. <exec executable="/opt/local/bin/ant" dir="{$temp}" failifexecutionfails="true">
  392. <xsl:element name="arg">
  393. <xsl:attribute name="line" select="concat('-f ',$temp,'/',$loop_xpath,'/',.,'/build_root.xml')"/>
  394. </xsl:element>
  395. <xsl:element name="arg">
  396. <xsl:attribute name="line" select="concat('-Dparallel_pos=',position())"/>
  397. </xsl:element>
  398. </exec>
  399. </target>
  400. </xsl:for-each>
  401. <!-- confirm ok tasks -->
  402. <xsl:for-each select="tokenize(.,';')">
  403. <target name="Confirm_{position()}">
  404. <xsl:attribute name="if" select="concat('${Verify_',position(),'}')"/>
  405. <echo> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx #350 #380 CONFIRMED RELATEDLOOP EXECUTION for <xsl:value-of select="concat($temp,'/',$loop_xpath,'/',.,'build_root.xml')"/></echo>
  406. </target>
  407. </xsl:for-each>
  408. <!--<delete>
  409. <xsl:attribute name="file" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
  410. </delete>-->
  411. </project>
  412. </xsl:template>
  413. </xsl:stylesheet>