blob: 028c937fd8e4045b9ba760a8058da64882b4adb0 [file] [log] [blame]
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +02001<?xml version="1.0" encoding="utf-8"?>
2
3<project default="package">
4
Matthias Andreas Benkard77d0f7b2020-11-10 07:12:08 +01005 <tstamp>
6 <format property="version.date" pattern="yyyyMMddhhmmss"/>
7 </tstamp>
8
9 <property name="version.tag" value="1.${version.date}"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020010 <property name="web-dir" location="src/main/resources/META-INF/resources"/>
11
12 <target name="yarn" depends="yarn.check" if="yarn.run">
13 <exec executable="yarn" dir="${web-dir}">
14 <arg value="install"/>
15 </exec>
16 </target>
17
18 <target name="yarn.check">
19 <condition property="yarn.run">
20 <not>
21 <available file="${web-dir}/node_modules"/>
22 </not>
23 </condition>
24 </target>
25
26 <target name="snowpack" depends="snowpack.check,yarn" if="snowpack.run">
Matthias Andreas Benkard93a19fb2020-11-15 17:39:35 +010027 <!-- Build for development -->
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020028 <exec executable="yarn" dir="${web-dir}">
29 <arg value="run"/>
30 <arg value="snowpack"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020031 </exec>
32 </target>
33
34 <target name="snowpack.check">
35 <condition property="snowpack.run">
36 <not>
37 <available file="${web-dir}/web_modules"/>
38 </not>
39 </condition>
40 </target>
41
Matthias Andreas Benkard93a19fb2020-11-15 17:39:35 +010042 <target name="snowpack-build" depends="snowpack-build.check,yarn" if="snowpack-build.run">
43 <!-- Build for distribution -->
44 <exec executable="yarn" dir="${web-dir}">
45 <arg value="run"/>
46 <arg value="snowpack"/>
47 <arg value="build"/>
48 </exec>
49 </target>
50
51 <target name="snowpack-build.check">
52 <condition property="snowpack-build.run">
53 <not>
54 <available file="${web-dir}/build/web_modules"/>
55 </not>
56 </condition>
57 </target>
58
Matthias Andreas Benkard813e5972020-06-14 19:27:42 +020059 <target name="parcel" depends="parcel.check,yarn" if="parcel.run">
60 <exec executable="yarn" dir="${web-dir}">
61 <arg value="parcel"/>
62 <arg value="build"/>
63 <arg value="lib.css"/>
64 <arg value="lib.js"/>
Matthias Andreas Benkard813e5972020-06-14 19:27:42 +020065 <arg value="web_modules/ContentTools.js"/>
66 <arg value="web_modules/ContentTools/build/content-tools.min.css"/>
67 </exec>
68 </target>
69
70 <target name="parcel.check">
71 <condition property="parcel.run">
72 <not>
73 <available file="${web-dir}/dist"/>
74 </not>
75 </condition>
76 </target>
77
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020078 <target name="flow" depends="snowpack">
79 <exec executable="yarn" dir="${web-dir}">
80 <arg value="run"/>
81 <arg value="flow"/>
82 <arg value="--color=always"/>
83 </exec>
84 </target>
85
86 <target name="eslint" depends="snowpack">
87 <exec executable="yarn" dir="${web-dir}">
88 <arg value="run"/>
89 <arg value="eslint"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020090 <arg value="bookmarks"/>
Matthias Andreas Benkarde128d152020-04-19 19:40:59 +020091 <arg value="cms2"/>
92 <arg value="lazychat"/>
93 <arg value="posts"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020094 <arg value="--color"/>
95 </exec>
96 </target>
97
Matthias Andreas Benkard93a19fb2020-11-15 17:39:35 +010098 <target name="web.resources" depends="snowpack,snowpack-build" unless="skip-web"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020099 <target name="web.check" unless="skip-web" depends="web.resources,flow,eslint"/>
Matthias Andreas Benkard813e5972020-06-14 19:27:42 +0200100 <target name="web.bundle" unless="skip-web" depends="web.resources,parcel"/>
101 <target name="web" unless="skip-web" depends="web.resources,web.check,web.bundle" description="Generate web resources"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200102
Matthias Andreas Benkard96c61e42020-04-13 21:31:25 +0200103 <target name="package" description="Create executable JAR">
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200104 <exec executable="./mvnw">
105 <arg value="package"/>
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +0200106 <arg value="-Dquarkus.container-image.push=false"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200107 </exec>
108 </target>
109
Matthias Andreas Benkard96c61e42020-04-13 21:31:25 +0200110 <target name="deploy" description="Deploy JAR to Kubernetes">
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200111 <exec executable="./mvnw">
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +0200112 <arg value="package"/>
Matthias Andreas Benkard77d0f7b2020-11-10 07:12:08 +0100113 <arg value="-Drevision=${version.tag}"/>
Matthias Andreas Benkarde2d42e92020-06-16 21:08:30 +0200114 <arg value="-Dquarkus.container-image.build=true"/>
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +0200115 <arg value="-Dquarkus.container-image.push=true"/>
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200116 </exec>
117 <exec executable="kubectl">
Matthias Andreas Benkardbdab6592020-12-18 13:23:47 +0100118 <arg value="config"/>
119 <arg value="use-context"/>
120 <arg value="mulk"/>
121 </exec>
122 <exec executable="kubectl">
Matthias Andreas Benkard77d0f7b2020-11-10 07:12:08 +0100123 <arg value="set"/>
124 <arg value="image"/>
125 <arg value="deployments/mulkcms2"/>
126 <arg value="mulkcms2=docker.benkard.de/mulk/mulkcms2:${version.tag}"/>
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200127 </exec>
128 <exec executable="kubectl">
Matthias Andreas Benkardbdab6592020-12-18 13:23:47 +0100129 <arg value="rollout"/>
130 <arg value="status"/>
131 <arg value="deployments/mulkcms2"/>
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200132 </exec>
133 </target>
134
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200135 <target name="clean">
136 <exec executable="./mvnw">
137 <arg value="clean"/>
138 </exec>
139 <delete dir="${web-dir}/node_modules"/>
140 <delete dir="${web-dir}/web_modules"/>
141 </target>
142
143</project>