|
@@ -0,0 +1,94 @@
|
|
1
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+<project basedir=".">
|
|
3
|
+
|
|
4
|
+ <import file="build-configutils.xml"/>
|
|
5
|
+
|
|
6
|
+ <macrodef name="getplugininfo">
|
|
7
|
+ <attribute name="file"/>
|
|
8
|
+ <attribute name="prefix" default=""/>
|
|
9
|
+
|
|
10
|
+ <sequential>
|
|
11
|
+ <local name="filecontents"/>
|
|
12
|
+ <local name="domain.version"/>
|
|
13
|
+ <local name="domain.updates"/>
|
|
14
|
+ <local name="domain.metadata"/>
|
|
15
|
+ <local name="temp.dir"/>
|
|
16
|
+
|
|
17
|
+ <!-- Extract the plugin.config file -->
|
|
18
|
+ <tempfile property="temp.dir" destdir="${java.io.tmpdir}" prefix="plugintmp"/>
|
|
19
|
+ <mkdir dir="${temp.dir}"/>
|
|
20
|
+ <unzip src="@{file}" dest="${temp.dir}">
|
|
21
|
+ <patternset>
|
|
22
|
+ <include name="META-INF/plugin.config"/>
|
|
23
|
+ </patternset>
|
|
24
|
+ </unzip>
|
|
25
|
+
|
|
26
|
+ <!-- Read the contents and tidy up -->
|
|
27
|
+ <loadfile srcfile="${temp.dir}/META-INF/plugin.config" property="filecontents"/>
|
|
28
|
+ <delete dir="${temp.dir}"/>
|
|
29
|
+
|
|
30
|
+ <readdomain contents="${filecontents}" domain="version" outputproperty="domain.version"/>
|
|
31
|
+ <readdomain contents="${filecontents}" domain="updates" outputproperty="domain.updates"/>
|
|
32
|
+ <readdomain contents="${filecontents}" domain="metadata" outputproperty="domain.metadata"/>
|
|
33
|
+
|
|
34
|
+ <readvalue domaincontents="${domain.version}" setting="number" outputproperty="@{prefix}version"/>
|
|
35
|
+ <readvalue domaincontents="${domain.updates}" setting="id" outputproperty="@{prefix}id"/>
|
|
36
|
+ <readvalue domaincontents="${domain.metadata}" setting="name" outputproperty="@{prefix}name"/>
|
|
37
|
+ </sequential>
|
|
38
|
+ </macrodef>
|
|
39
|
+
|
|
40
|
+ <macrodef name="bundleplugins">
|
|
41
|
+ <attribute name="jar"/>
|
|
42
|
+ <element name="plugins" implicit="yes"/>
|
|
43
|
+
|
|
44
|
+ <sequential>
|
|
45
|
+ <local name="temp.dir"/>
|
|
46
|
+
|
|
47
|
+ <!-- Extract the version.config file -->
|
|
48
|
+ <tempfile property="temp.dir" destdir="${java.io.tmpdir}" prefix="plugintmp"/>
|
|
49
|
+ <mkdir dir="${temp.dir}"/>
|
|
50
|
+ <unzip src="@{jar}" dest="${temp.dir}">
|
|
51
|
+ <patternset>
|
|
52
|
+ <include name="com/dmdirc/version.config"/>
|
|
53
|
+ </patternset>
|
|
54
|
+ </unzip>
|
|
55
|
+
|
|
56
|
+ <!-- Make a directory to drop plugins in -->
|
|
57
|
+ <mkdir dir="${temp.dir}/plugins"/>
|
|
58
|
+
|
|
59
|
+ <!-- Output some boilerplate to the config -->
|
|
60
|
+ <echo file="${temp.dir}/com/dmdirc/version.config" append="true">
|
|
61
|
+keysections:
|
|
62
|
+ bundledplugins_versions
|
|
63
|
+
|
|
64
|
+bundledplugins_versions:
|
|
65
|
+</echo>
|
|
66
|
+ <for param="plugin">
|
|
67
|
+ <plugins/>
|
|
68
|
+ <sequential>
|
|
69
|
+ <local name="plugin.version"/>
|
|
70
|
+ <local name="plugin.id"/>
|
|
71
|
+ <local name="plugin.name"/>
|
|
72
|
+
|
|
73
|
+ <!-- Grab our plugin's info -->
|
|
74
|
+ <getplugininfo prefix="plugin." file="@{plugin}"/>
|
|
75
|
+
|
|
76
|
+ <!-- Add the information to our config -->
|
|
77
|
+ <echo file="${temp.dir}/com/dmdirc/version.config" append="true"> ${plugin.name}=${plugin.version}</echo>
|
|
78
|
+ <echo file="${temp.dir}/com/dmdirc/version.config" append="true"/>
|
|
79
|
+
|
|
80
|
+ <!-- And drop the file in our directory -->
|
|
81
|
+ <copy file="@{plugin}" todir="${temp.dir}/plugins" overwrite="true"/>
|
|
82
|
+
|
|
83
|
+ <echo>Bundling plugin ${plugin.name} version ${plugin.version}</echo>
|
|
84
|
+ </sequential>
|
|
85
|
+ </for>
|
|
86
|
+
|
|
87
|
+ <!-- Now jar our new things back up -->
|
|
88
|
+ <jar destfile="@{jar}" basedir="${temp.dir}" update="true"/>
|
|
89
|
+
|
|
90
|
+ <delete dir="${temp.dir}"/>
|
|
91
|
+ </sequential>
|
|
92
|
+ </macrodef>
|
|
93
|
+
|
|
94
|
+</project>
|