You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build-plugins.xml 3.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="DMDirc-plugins" default="default" basedir=".">
  3. <!-- Netbeans property files -->
  4. <property file="nbproject/project.properties"/>
  5. <property file="nbproject/private/private.properties"/>
  6. <property file="${user.properties.file}"/>
  7. <path id="libclasspath">
  8. <fileset dir="lib" includes="*.jar"/>
  9. </path>
  10. <taskdef resource="net/sf/fikin/ant/ant.properties" classpathref="libclasspath"/>
  11. <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="libclasspath"/>
  12. <target name="build-plugins" description="Build all plugins">
  13. <exec executable="bash">
  14. <arg value="createAllPluginJar.sh"/>
  15. <arg value="${src.dir}/com/dmdirc/addons/"/>
  16. </exec>
  17. </target>
  18. <target name="-update-bundled-plugins">
  19. <exec executable="bash">
  20. <arg value="updateBundledPlugins.sh"/>
  21. <arg value="${dist.jar}"/>
  22. </exec>
  23. </target>
  24. <target name="-check-addons-key" unless="dmdirc.addons.apikey">
  25. <fail>You must specify an API key in the the dmdirc.addons.apikey property</fail>
  26. </target>
  27. <target name="-check-addon-id" unless="addon.id">
  28. <fail>The ID of the addon to be published must be specified in the addon.id property</fail>
  29. </target>
  30. <target name="-check-addon-channel" unless="addon.channel">
  31. <fail>
  32. The channel of the addon to be published must be specified in the addon.channel property.
  33. Use 1 for Stable, 2 for Unstable, or 3 for Nightly.
  34. </fail>
  35. </target>
  36. <target name="-check-addon-file" unless="addon.file">
  37. <fail>The file of the addon to be published must be specified in the addon.file property</fail>
  38. </target>
  39. <target name="publish-all-plugins" description="Publishes all plugins to the addons site"
  40. depends="-check-addons-key,-check-addon-channel">
  41. <foreach target="publish-plugin" param="addon.file" inheritall="true" parallel="true">
  42. <path>
  43. <fileset dir="plugins">
  44. <include name="*.jar"/>
  45. </fileset>
  46. </path>
  47. </foreach>
  48. </target>
  49. <target name="publish-plugin" description="Publish a plugin to the addons site"
  50. depends="-check-addons-key,-check-addon-channel,-check-addon-file">
  51. <tempfile property="temp.dir" prefix="plugintmp"/>
  52. <mkdir dir="${temp.dir}"/>
  53. <unzip src="${addon.file}" dest="${temp.dir}">
  54. <patternset>
  55. <include name="META-INF/plugin.config"/>
  56. </patternset>
  57. </unzip>
  58. <loadfile srcfile="${temp.dir}/META-INF/plugin.config" property="addon.id">
  59. <filterchain>
  60. <!-- This is a bit fickle, and needs to understand config files better. -->
  61. <linecontains>
  62. <contains value=" id="/>
  63. </linecontains>
  64. <deletecharacters chars="\t id="/>
  65. <striplinebreaks/>
  66. </filterchain>
  67. </loadfile>
  68. <delete dir="${temp.dir}"/>
  69. <antcall target="publish-addon"/>
  70. </target>
  71. <target name="publish-addon" description="Publish an addon to the addons site"
  72. depends="-check-addons-key,-check-addon-id,-check-addon-channel,-check-addon-file">
  73. <httpmpost url="http://addons.dmdirc.com/editaddon/${addon.id}" logLevel="none">
  74. <postString name="apikey" value="${dmdirc.addons.apikey}"/>
  75. <postString name="channel" value="${addon.channel}"/>
  76. <postFile name="download" file="${addon.file}"/>
  77. </httpmpost>
  78. </target>
  79. </project>