build.p5ant.storage.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project basedir="../../." name="p5ant.storage"
  3. xmlns:p5ant="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache.public/ant/ant.xsd"
  4. >
  5. <description> storage functions to protect system failures etc </description>
  6. <include file="build.p5ant.storage.PRODUCT.xml" as="PRODUCT"/>
  7. <include file="../system_ui_info_speech/build.system_ui_info_speech.PRODUCT.xml" as="p5suis"/>
  8. <include file="../apple/build_apple.xml" as="p5apl" optional="yes"/>
  9. <!--<include file="build_ant.xml" optional="true" as="build_ant"/>-->
  10. <!--<import file="build_ant.xml" optional="yes" as="p5ant"/>-->
  11. <extension-point name="register" depends="register.input,register.check_if_exists,update__x3A__action,update.message" description="to insert info if not exists"/>
  12. <target name="register.check_if_exists">
  13. <echo>[ R E G I S T E R ] checking for file in ${p5ant.repository.storage.register.property.dir}/${local.p5ant.storage.register.property.name}.property</echo>
  14. <condition property="register__x3A__deny_flag" value="ERROR property already registered - use update">
  15. <available file="${p5ant.repository.storage.register.property.dir}/${local.p5ant.storage.register.property.name}.property"/>
  16. </condition>
  17. <echo> [ R E S U L T ] ${register__x3A__deny_flag} </echo>
  18. </target>
  19. <extension-point name="update" depends="register.input,update__x3A__action,update.message" description="to update info about property "/>
  20. <target name="register.input">
  21. <input addproperty="local.p5ant.storage.register.property.name" message="local.p5ant.storage.register.property.name"/>
  22. <input addproperty="local.p5ant.storage.register.property.value" message="local.p5ant.storage.register.property.value"/>
  23. <property name="local.p5ant.storage.register.property.destfile" location="${p5ant.repository.storage.register.property.dir}/${local.p5ant.storage.register.property.name}.property"/>
  24. </target>
  25. <target name="update__x3A__action" unless="register__x3A__deny_flag" depends="register.input" description="to register some property globally to modules">
  26. <echo>
  27. [ S T O R A G E R E G I S T E R P R O P E R T Y ]
  28. input
  29. $local.p5ant.storage.register.property.name = ${local.p5ant.storage.register.property.name}
  30. $local.p5ant.storage.register.property.value = ${local.p5ant.storage.register.property.value}
  31. output
  32. $local.p5ant.storage.register.property.destfile = ${local.p5ant.storage.register.property.destfile}
  33. USAGE in foreign build/product type:
  34. condition property name = $local.p5ant.storage.register.property.name value ...
  35. ... or use loadproperty to override it - from standard directory concatenend:
  36. $${p5ant.repository.storage.register.property.dir}}/$${local.p5ant.storage.register.property.name}.property
  37. </echo>
  38. <echo file="${local.p5ant.storage.register.property.destfile}">#Ant properties
  39. #
  40. ${local.p5ant.storage.register.property.name}=${local.p5ant.storage.register.property.value}
  41. </echo>
  42. <condition property="register__x3A__deny_flag" value="error with creating property">
  43. <not><available file="${local.p5ant.storage.register.property.destfile}"/></not>
  44. </condition>
  45. </target>
  46. <target name="update.message" unless="register__x3A__deny_flag" >
  47. <property name="local.p5apl.terminal-notifier.group" value="${p5ant.storage.PRODUCT.name}"/>
  48. <property name="local.p5apl.terminal-notifier.message" value="zapisano plik properties"/>
  49. <property name="local.p5apl.terminal-notifier.title" value="plik gotowy zapisano"/>
  50. <property name="local.p5apl.terminal-notifier.subtitle" value="gotowy do używania"/>
  51. <ant antfile="${p5suis.build}" target="p5suis:say_to_queue.PL.drop_overflow">
  52. <property name="p5suis:say_text" value="zapisano plik property do override użytku"/>
  53. </ant>
  54. </target>
  55. <target name="update.message.error" if="register__x3A__deny_flag" >
  56. <property name="local.p5apl.terminal-notifier.group" value="${p5ant.storage.PRODUCT.name}"/>
  57. <property name="local.p5apl.terminal-notifier.message" value="nie zapisano plik properties"/>
  58. <property name="local.p5apl.terminal-notifier.title" value="plik już istnieje"/>
  59. <property name="local.p5apl.terminal-notifier.subtitle" value="błąd"/>
  60. <ant antfile="${p5suis.build}" target="p5suis:say_to_queue.PL.drop_overflow">
  61. <property name="p5suis:say_text" value="zmienna już jest ustalona - użyj metody update"/>
  62. </ant>
  63. </target>
  64. <!-- resolve -->
  65. <macrodef name="resolve">
  66. <attribute name="property" description="property name to try to resolve"/>
  67. <sequential>
  68. <property name="local.p5apl.terminal-notifier.group" value="${p5ant.storage.PRODUCT.name}"/>
  69. <property name="local.p5apl.terminal-notifier.title" value="${p5ant.storage.PRODUCT.name}"/>
  70. <property name="local.p5apl.terminal-notifier.subtitle" value="resolve property @{property}"/>
  71. <local name="local.p5ant.storage.resolve__x3A__exist_flag"/>
  72. <condition property="local.p5ant.storage.resolve__x3A__exist_flag" value="true">
  73. <available file="${p5ant.repository.storage.register.property.dir}/${local.p5ant.storage.register.property.name}.property" type="file"/>
  74. </condition>
  75. <condition property="local.p5ant.storage.resolve__x3A__filepath" value="${p5ant.repository.storage.register.property.dir}/${local.p5ant.storage.register.property.name}.property">
  76. <isset property="local.p5ant.storage.resolve__x3A__exist_flag"/>
  77. </condition>
  78. <property name="local.p5ant.storage.resolve__x3A__filepath" location="${p5ant.storage__x3A__blank.property}"/>
  79. <condition property="local.p5apl.terminal-notifier.message" value="wyzwolono odczyt istniejącego oczekiwanego property">
  80. <isset property="local.p5ant.storage.resolve__x3A__exist_flag"/>
  81. </condition>
  82. <condition property="local.p5apl.terminal-notifier.message" value="brak wcześniej zapisanego oczekiwanego property">
  83. <not><isset property="local.p5ant.storage.resolve__x3A__exist_flag"/></not>
  84. </condition>
  85. <loadproperties srcfile="${local.p5ant.storage.resolve__x3A__filepath}" />
  86. <condition property="local.p5apl.terminal-notifier.message" value="!!! pomimo istnienia property nie udało ustalić się jego wartości!!!">
  87. <not><isset property="@{property}"/></not>
  88. </condition>
  89. <property name="local.p5apl.terminal-notifier.message" value="Brak oczekiwanego pliku do otwarcia ${local.p5ant.safety.filename}"/>
  90. <echo>#92 [ S T O R A G E R E S O L V E ]
  91. $local.p5ant.storage.resolve__x3A__exist_flag = ${local.p5ant.storage.resolve__x3A__exist_flag}
  92. $local.p5ant.storage.resolve__x3A__filepath ${local.p5ant.storage.resolve__x3A__filepath}
  93. .. if ok then try eval request for $property = @{property}
  94. </echo>
  95. <antcall target="safety.p5apl.terminal-notifier.notify"/>
  96. </sequential>
  97. </macrodef>
  98. </project>