blob: 49e7bebd9d7aff1eba8859707173c4308bef3fa5 [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 </exec>
66 </target>
67
68 <target name="parcel.check">
69 <condition property="parcel.run">
70 <not>
71 <available file="${web-dir}/dist"/>
72 </not>
73 </condition>
74 </target>
75
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020076 <target name="flow" depends="snowpack">
77 <exec executable="yarn" dir="${web-dir}">
78 <arg value="run"/>
79 <arg value="flow"/>
80 <arg value="--color=always"/>
81 </exec>
82 </target>
83
84 <target name="eslint" depends="snowpack">
85 <exec executable="yarn" dir="${web-dir}">
86 <arg value="run"/>
87 <arg value="eslint"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020088 <arg value="bookmarks"/>
Matthias Andreas Benkarde128d152020-04-19 19:40:59 +020089 <arg value="cms2"/>
90 <arg value="lazychat"/>
91 <arg value="posts"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020092 <arg value="--color"/>
93 </exec>
94 </target>
95
Matthias Andreas Benkard93a19fb2020-11-15 17:39:35 +010096 <target name="web.resources" depends="snowpack,snowpack-build" unless="skip-web"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020097 <target name="web.check" unless="skip-web" depends="web.resources,flow,eslint"/>
Matthias Andreas Benkard813e5972020-06-14 19:27:42 +020098 <target name="web.bundle" unless="skip-web" depends="web.resources,parcel"/>
99 <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 +0200100
Matthias Andreas Benkard96c61e42020-04-13 21:31:25 +0200101 <target name="package" description="Create executable JAR">
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200102 <exec executable="./mvnw">
103 <arg value="package"/>
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +0200104 <arg value="-Dquarkus.container-image.push=false"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200105 </exec>
106 </target>
107
Matthias Andreas Benkard96c61e42020-04-13 21:31:25 +0200108 <target name="deploy" description="Deploy JAR to Kubernetes">
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200109 <exec executable="./mvnw">
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +0200110 <arg value="package"/>
Matthias Andreas Benkard77d0f7b2020-11-10 07:12:08 +0100111 <arg value="-Drevision=${version.tag}"/>
Matthias Andreas Benkarde2d42e92020-06-16 21:08:30 +0200112 <arg value="-Dquarkus.container-image.build=true"/>
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +0200113 <arg value="-Dquarkus.container-image.push=true"/>
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200114 </exec>
115 <exec executable="kubectl">
Matthias Andreas Benkardbdab6592020-12-18 13:23:47 +0100116 <arg value="config"/>
117 <arg value="use-context"/>
118 <arg value="mulk"/>
119 </exec>
120 <exec executable="kubectl">
Matthias Andreas Benkard77d0f7b2020-11-10 07:12:08 +0100121 <arg value="set"/>
122 <arg value="image"/>
123 <arg value="deployments/mulkcms2"/>
124 <arg value="mulkcms2=docker.benkard.de/mulk/mulkcms2:${version.tag}"/>
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200125 </exec>
126 <exec executable="kubectl">
Matthias Andreas Benkardbdab6592020-12-18 13:23:47 +0100127 <arg value="rollout"/>
128 <arg value="status"/>
129 <arg value="deployments/mulkcms2"/>
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200130 </exec>
131 </target>
132
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200133 <target name="clean">
134 <exec executable="./mvnw">
135 <arg value="clean"/>
136 </exec>
Matthias Andreas Benkardb40f4652022-05-13 14:16:45 +0200137 <delete dir="${web-dir}/.parcel-cache"/>
Matthias Andreas Benkard34453242022-05-24 22:20:45 +0200138 <delete dir="${web-dir}/build"/>
139 <delete dir="${web-dir}/dist"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200140 <delete dir="${web-dir}/node_modules"/>
141 <delete dir="${web-dir}/web_modules"/>
142 </target>
143
144</project>