forked from DSATool/DSA41BasisPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
84 lines (84 loc) · 3.98 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="deploy" name="DSA41Basis">
<property name="DSATool.location" value="../DSATool"/>
<property name="PluginName" value="DSA41Basis"/>
<property name="Includes" value="dependencies/**,licences/**,resources/**"/>
<target name="deploy" description="Creates JAR archive and deploys it to DSATool plugin directory">
<copy todir="${DSATool.location}">
<fileset dir="." includes="${Includes}"/>
</copy>
<path id="classpath">
<fileset dir="${DSATool.location}"/>
</path>
<mkdir dir="bin"/>
<javac srcdir="src" destdir="bin" classpathref="classpath" includeantruntime="false" debug="true" debuglevel="lines,vars,source" source="1.8" target="1.8"/>
<mkdir dir="plugins"/>
<jar destfile="plugins/${PluginName}.jar">
<fileset dir="bin"/>
<metainf file="LICENSE"/>
<metainf file="NOTICE"/>
</jar>
<copy file="plugins/${PluginName}.jar" todir="${DSATool.location}/plugins"/>
<copy file="release/previous/release-info.json" tofile="${DSATool.location}/update/${PluginName}.json"/>
</target>
<target name="update" description="Creates a zip file for release" depends="deploy">
<delete dir="release/current"/>
<mkdir dir="release/current"/>
<copy todir="release/current" includeEmptyDirs="false">
<fileset dir="." includes="${Includes},plugins/${PluginName}.jar">
<different targetdir="release/previous"/>
</fileset>
</copy>
<fileset id="deleted" dir="release/previous" includes="${Includes},plugins/${PluginName}.jar">
<present present="srconly" targetdir="."/>
</fileset>
<resourcecount property="hasDeleted" refId="deleted" when="greater" count="0"/>
<echo file="release/current/deleted.txt">${toString:deleted}</echo>
<delete>
<fileset file="release/current/deleted.txt">
<size value="3" when="less"/>
</fileset>
</delete>
<tstamp>
<format property="releaseDate" pattern="yyyy-MM-dd_HH-mm" />
</tstamp>
<loadfile srcfile="release/previous/release-info.json" property="previousReleaseDate">
<filterchain>
<linecontains>
<contains value="releaseDate"/>
</linecontains>
<tokenfilter>
<replaceregex pattern=".*: ."/>
<replaceregex pattern=".,"/>
</tokenfilter>
<striplinebreaks/>
</filterchain>
</loadfile>
<copy file="release/release-info.template" tofile="release/current/release-info.json"/>
<replace file="release/current/release-info.json" token="@releaseDate@" value="${releaseDate}"/>
<replace file="release/current/release-info.json" token="@previousReleaseDate@" value="${previousReleaseDate}"/>
<copy file="release/current/release-info.json" tofile="release/current/update/${PluginName}.json"/>
<copy file="release/current/release-info.json" tofile="${DSATool.location}/update/${PluginName}.json"/>
<copy file="release/update-info.template" tofile="release/update-info.json" overwrite="true"/>
<replace file="release/update-info.json" token="@releaseDate@" value="${releaseDate}"/>
<zip destfile="release/${PluginName}_${releaseDate}.zip">
<fileset dir="release/current"/>
</zip>
<delete dir="release/previous"/>
<copy todir="release/previous" includeEmptyDirs="false">
<fileset dir="." includes="${Includes},plugins/${PluginName}.jar"/>
</copy>
<copy file="release/current/release-info.json" todir="release/previous"/>
<delete dir="release/current"/>
</target>
<target name="release" description="Creates a full release as well as an update" depends="update">
<mkdir dir="update"/>
<copy file="release/release-info.template" tofile="update/${PluginName}.json"/>
<replace file="update/${PluginName}.json" token="@releaseDate@" value="${releaseDate}"/>
<replace file="update/${PluginName}.json" token="@previousReleaseDate@" value="${previousReleaseDate}"/>
<zip destfile="release/${PluginName}_${releaseDate}_full.zip">
<fileset dir="." includes="${Includes},plugins/${PluginName}.jar,update/${PluginName}.json"/>
</zip>
<delete dir="update"/>
</target>
</project>