forked from liferay/liferay-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-common-plugins-inspector.xml
215 lines (189 loc) · 5.39 KB
/
build-common-plugins-inspector.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="build-common-plugins-inspector.xml">
<macrodef name="record-fail">
<attribute name="message" />
<sequential>
<if>
<equals arg1="${basedir.name}" arg2="test-broken" />
<then>
<echo append="true" file="../plugins-inspector.log">@{message}</echo>
</then>
<else>
<fail>@{message}</fail>
</else>
</if>
</sequential>
</macrodef>
<target name="inspect-plugins">
<delete file="../plugins-inspector.log" />
<checksum file="build.xml" property="build.xml.checksum" />
<if>
<not>
<equals arg1="${build.xml.checksum}" arg2="aa45183ecb2cda43d255c7070a6225de" />
</not>
<then>
<record-fail message="build.xml is nonstandard." />
</then>
</if>
<for param="module.name">
<path>
<dirset dir="." includes="*" />
</path>
<sequential>
</sequential>
</for>
<if>
<equals arg1="${basedir.name}" arg2="test-broken" />
<then>
<checksum file="../plugins-inspector.log" property="plugins-inspector.log.checksum" />
<if>
<not>
<equals arg1="${plugins-inspector.log.checksum}" arg2="6fc1f47ae6b8108699b044550eb5e64b" />
</not>
<then>
<fail>Plugins inspector is not detecting all errors.</fail>
</then>
</if>
</then>
<elseif>
<equals arg1="${basedir.name}" arg2="test-working" />
<then>
<if>
<available file="../plugins-inspector.log" />
<then>
<fail>Plugins inspector is not detecting false errors.</fail>
</then>
</if>
</then>
</elseif>
</if>
<delete file="../plugins-inspector.log" />
<!--<exec dir="." executable="git">
<arg line="clean -d -f -x ." />
</exec>
<for param="module.name">
<path>
<dirset dir="." includes="*" />
</path>
<sequential>
<if>
<and>
<available file="@{module.name}/docroot" />
<available file="@{module.name}/src" />
</and>
<then>
<fail>Module @{module.name} must not have both a "docroot" and a "src" directory.</fail>
</then>
</if>
<if>
<and>
<not>
<available file="@{module.name}/docroot" />
</not>
<not>
<available file="@{module.name}/src" />
</not>
</and>
<then>
<fail>Module @{module.name} must have a "docroot" or a "src" directory.</fail>
</then>
</if>
<if>
<available file="@{module.name}/docroot/WEB-INF/liferay-hook.xml" />
<then>
<if>
<and>
<resourcecontains resource="@{module.name}/docroot/WEB-INF/liferay-hook.xml" substring="<language-properties>" />
<not>
<resourcecontains resource="@{module.name}/docroot/WEB-INF/liferay-hook.xml" substring="<language-properties>content/Language*.properties</language-properties>" />
</not>
</and>
<then>
<fail>@{module.name}/docroot/WEB-INF/liferay-hook.xml has an nonstandard language-properties element.</fail>
</then>
</if>
<if>
<and>
<resourcecontains resource="@{module.name}/docroot/WEB-INF/liferay-hook.xml" substring="<custom-jsp-dir>" />
<not>
<resourcecontains resource="@{module.name}/docroot/WEB-INF/liferay-hook.xml" substring="<custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>" />
</not>
</and>
<then>
<fail>@{module.name}/docroot/WEB-INF/liferay-hook.xml has a nonstandard custom-jsp-dir element.</fail>
</then>
</if>
</then>
</if>
<if>
<resourcecontains resource="@{module.name}/docroot/WEB-INF/web.xml" substring="Invoker Filter" />
<then>
<fail>@{module.name}/docroot/WEB-INF/web.xml contains generated code.</fail>
</then>
</if>
<if>
<available file="@{module.name}/ivy.xml.MD5" />
<then>
<fail>@{module.name}/ivy.xml.MD5 must not be checked into source control.</fail>
</then>
</if>
<if>
<available file="@{module.name}/docroot/WEB-INF/lib" />
<then>
<fail>@{module.name}/docroot/WEB-INF/lib must not be checked into source control.</fail>
</then>
</if>
<if>
<available file="@{module.name}/docroot/WEB-INF/tld" />
<then>
<fail>@{module.name}/docroot/WEB-INF/tld must not be checked into source control.</fail>
</then>
</if>
<if>
<available file="@{module.name}/lib" />
<then>
<fail>@{module.name}/lib must not be checked into source control.</fail>
</then>
</if>
</sequential>
</for>
<if>
<available file=".gitignore" />
<then>
<echo file=".gitignore">/*/bin
/*/classes
/*/ivy.xml.MD5
/*/javadoc
/*/lib
/*/test-classes
/*/test-results</echo>
</then>
</if>
<antcall target="clean" />
<antcall target="compile" />
<exec dir="." executable="git" outputproperty="git.command.output">
<arg line="status ." />
</exec>
<if>
<or>
<contains string="${git.command.output}" substring="Changes not staged for commit" />
<contains string="${git.command.output}" substring="Untracked files" />
</or>
<then>
<fail>Plugins must not generate modified files.</fail>
</then>
</if>
<resourcecount property="gitignore.count">
<fileset defaultexcludes="false" dir="." includes="**/.gitignore" />
</resourcecount>
<if>
<not>
<equals arg1="${gitignore.count}" arg2="0" />
</not>
<then>
<fail>Plugins must not have custom .gitignore files.</fail>
</then>
</if>-->
</target>
</project>