forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-test-oauth2.xml
149 lines (119 loc) · 4.13 KB
/
build-test-oauth2.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
<?xml version="1.0"?>
<project basedir="." name="portal-test-saml" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-test.xml" />
<target name="prepare-oauth2-osgi-configuration">
<if>
<available file="${project.dir}/portal-web/test/functional/com/liferay/portalweb/tests/coreinfrastructure/security/oauth2/dependencies/${osgi.config.file.name}" />
<then>
<property name="osgi.dependency.dir" value="${project.dir}/portal-web/test/functional/com/liferay/portalweb/tests/coreinfrastructure/security/oauth2/dependencies" />
</then>
<else>
<property name="osgi.dependency.dir" value="${project.dir}/portal-web/test/functional/com/liferay/portalweb/dependencies" />
</else>
</if>
<copy
file="${osgi.dependency.dir}/${osgi.config.file.name}"
todir="${liferay.home}"
/>
<replace
file="${liferay.home}/${osgi.config.file.name}"
token="companyId=L"20098""
value="companyId=L"${companyId}""
/>
<if>
<isset property="bundle.id" />
<then>
<move
file="${liferay.home}/${osgi.config.file.name}"
todir="${liferay.home}-${bundle.id}/osgi/configs"
/>
</then>
<else>
<move
file="${liferay.home}/${osgi.config.file.name}"
todir="${liferay.home}/osgi/configs"
/>
</else>
</if>
</target>
<target depends="setup-yarn" name="start-oauth2-application">
<property location="${project.dir}/oauth2" name="oauth2.application.dir" />
<basename file="${oauth2.application.zip.url}" property="oauth2.application.file.name" />
<trycatch>
<try>
<mirrors-get
dest="${oauth2.application.dir}/${oauth2.application.file.name}"
src="${oauth2.application.zip.url}"
/>
</try>
<catch>
<mkdir dir="${oauth2.application.dir}" />
<execute dir="${oauth2.application.dir}">
curl ${oauth2.application.zip.url} --output ${oauth2.application.file.name}
</execute>
<propertyregex
input="${oauth2.application.zip.url}"
property="oauth2.application.mirrors.dir"
regexp="https?://(mirrors[^/]+/)?(.+)/[^/]+"
replace="\2"
/>
<mkdir dir="${mirrors.cache.dir}/${oauth2.application.mirrors.dir}" />
<copy
file="${oauth2.application.dir}/${oauth2.application.file.name}"
tofile="${mirrors.cache.dir}/${oauth2.application.mirrors.dir}/${oauth2.application.file.name}"
/>
</catch>
</trycatch>
<decompress
dest="${oauth2.application.dir}"
src="${oauth2.application.dir}/${oauth2.application.file.name}"
/>
<delete file="${oauth2.application.dir}/${oauth2.application.file.name}" />
<parallel>
<daemons>
<sequential>
<local name="start.oauth2.bash.file" />
<property location="start_oauth2.sh" name="start.oauth2.bash.file" />
<echo file="${start.oauth2.bash.file}">
<![CDATA[
#!/bin/bash
export PATH="${node.home}/bin:${node.home}/lib/node_modules/corepack/shims:${env.PATH}"
${npx.exec} serve -s ${oauth2.application.dir}/liferay-${oauth2.application.zip.id}/${oauth2.application.zip.id}-custom-element/build
]]>
</echo>
<exec executable="/bin/bash">
<arg line="${start.oauth2.bash.file}" />
</exec>
<delete file="${start.oauth2.bash.file}" />
</sequential>
</daemons>
<waitfor checkevery="5" checkeveryunit="second" maxwait="5" maxwaitunit="minute" timeoutproperty="wait.for.oauth2">
<http url="${oauth2.url}" />
</waitfor>
</parallel>
</target>
<target name="stop-oauth2-application">
<if>
<os family="unix" />
<then>
<local name="stop.oauth2.bash.file" />
<property location="stop_oauth2.sh" name="stop.oauth2.bash.file" />
<echo file="${stop.oauth2.bash.file}">
<![CDATA[
#!/bin/bash
ps -o pid,args -e | grep npx | grep liferay-${oauth2.application.zip.id} | grep -v grep
for i in `ps -o pid,args -e | grep npx | grep liferay-${oauth2.application.zip.id} | grep -v grep | cut -c1-5`
do
echo "Killing $i"
kill -9 $i
done
]]>
</echo>
<exec executable="/bin/bash">
<arg line="${stop.oauth2.bash.file}" />
</exec>
<delete file="${stop.oauth2.bash.file}" />
</then>
</if>
</target>
</project>