-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
153 lines (133 loc) · 7.32 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?xml version="1.0"?>
<!--
~ @package panopticon
~ @copyright Copyright (c)2023-2025 Nikolaos Dionysopoulos / Akeeba Ltd
~ @license https://www.gnu.org/licenses/agpl-3.0.txt GNU Affero General Public License, version 3 or later
-->
<project name="panopticon" description="Akeeba Panopticon Connector for Joomla! 3" default="git">
<import file="${phing.dir}/../buildfiles/phing/common.xml"/>
<!-- Override properties set up in common.xml -->
<property name="dirs.root" value="${phing.dir}" override="true" />
<property name="dirs.release" value="${dirs.root}/release" override="true" />
<property name="dirs.templates" value="${phing.dir}/build/templates" override="true" />
<property name="dirs.component" value="${phing.dir}/component" override="true" />
<property name="dirs.modules" value="${phing.dir}/modules" override="true" />
<property name="dirs.plugins" value="${phing.dir}/plugins" override="true" />
<property name="dirs.documentation" value="${phing.dir}/documentation" override="true" />
<!-- Load externally defined properties -->
<property file="${phing.dir.common}/default.properties" override="true" />
<property file="${phing.dir}/../build.properties" override="true" />
<property file="${phing.dir}/../build.${host.os}.properties" override="true" />
<property file="${phing.dir}/build/build.properties" override="true" />
<property file="${phing.dir}/build/override.properties" override="true" />
<property file="${phing.dir}/build.properties" override="true" />
<property file="${phing.dir}/override.properties" override="true" />
<!--
====================================================================================================
Tasks - General
====================================================================================================
-->
<target name="git" description="Makes only packages, not the documentation"
depends="new-release,setup-properties,xml-version,package-plugins,update_xml">
</target>
<target name="new-release" depends="composer-install,link">
<echo>Emptying release directory</echo>
<delete dir="${dirs.release}" quiet="true" includeemptydirs="true"/>
<mkdir dir="${dirs.release}"/>
<echo>Removing .DS_Store files</echo>
<exec executable="sh" dir="${dirs.root}">
<arg value="killDS.sh" />
</exec>
</target>
<target name="setup-properties" description="Set up version and build properties">
<!-- Initialize the build.date timestamp -->
<tstamp>
<format property="build.date" pattern="yyyy-MM-dd" />
</tstamp>
<!-- Initialize the version if it's not set -->
<if>
<equals arg1="${version}" arg2="git" />
<then>
<autoversion workingCopy="${dirs.root}" propertyName="version" />
</then>
</if>
<filterchain id="standard-tokens">
<replacetokens begintoken="##" endtoken="##">
<token key="DATE" value="${build.date}"/>
<token key="VERSION" value="${version}"/>
<token key="PRO" value="1"/>
</replacetokens>
</filterchain>
<if>
<available file="${dirs.templates}/version.php" property="completely.ignored" />
<then>
<copy file="${dirs.templates}/version.php" tofile="${dirs.plugins}/system/panopticon/version.php" overwrite="true">
<filterchain refid="standard-tokens" />
</copy>
</then>
</if>
</target>
<!--
====================================================================================================
Tasks - Updates
====================================================================================================
-->
<target name="update_xml">
<if>
<not>
<contains string="${version}" substring="-dev" />
</not>
<then>
<property name="build.package_name" value="plg_system_panopticon.zip" />
<!-- Generate the file hashes -->
<filehash file="${dirs.release}/${build.package_name}" algorithm="md5" propertyname="buildhash.md5" />
<filehash file="${dirs.release}/${build.package_name}" algorithm="sha1" propertyname="buildhash.sha1" />
<filehash file="${dirs.release}/${build.package_name}" algorithm="sha256" propertyname="buildhash.sha256" />
<filehash file="${dirs.release}/${build.package_name}" algorithm="sha384" propertyname="buildhash.sha384" />
<filehash file="${dirs.release}/${build.package_name}" algorithm="sha512" propertyname="buildhash.sha512" />
<!-- Create the XML representation of the current version's update information -->
<loadfile file="${dirs.templates}/update.xml" property="update.current">
<filterchain id="updatefile-tokens">
<replacetokens begintoken="##" endtoken="##">
<token key="DATE" value="${build.date}" />
<token key="VERSION" value="${version}" />
<token key="HASH_MD5" value="${buildhash.md5}" />
<token key="HASH_SHA1" value="${buildhash.sha1}" />
<token key="HASH_SHA256" value="${buildhash.sha256}" />
<token key="HASH_SHA384" value="${buildhash.sha384}" />
<token key="HASH_SHA512" value="${buildhash.sha512}" />
</replacetokens>
</filterchain>
</loadfile>
<!-- Add the current version as the first update item -->
<loadfile file="${dirs.root}/updates/plg_system_panopticon.xml" property="update.all">
<filterchain>
<replaceregexp>
<regexp pattern="<updates>" replace="<updates>${update.current}" ignoreCase="false" />
</replaceregexp>
</filterchain>
</loadfile>
<!-- Remove duplicates and save the mostly minified file to the repo -->
<xmlupdate xml="${update.all}" tofile="${dirs.root}/updates/plg_system_panopticon.xml" />
<!-- Upload the update XML file to S3 as well -->
<exec
executable="s3cmd"
passthru="true">
<arg value="put" />
<arg value="${dirs.root}/updates/plg_system_panopticon.xml" />
<arg value="s3://${s3.bucket}/updates/plg_system_panopticon.xml" />
<arg value="--acl-public" />
<arg value="--add-header=Cache-Control:max-age=300" />
</exec>
</then>
</if>
</target>
<!--
====================================================================================================
Tasks - Documentation
====================================================================================================
-->
<target name="documentation" description="Creates the documentation packages">
<echo>No documentation for the connector itself.</echo>
</target>
</project>