blob: d80c6b2b6e757ed664e8b1505b6c4940955baeaf [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 Benkarda84be3b2022-11-02 05:33:37 +010092 <arg value="wiki"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020093 <arg value="--color"/>
94 </exec>
95 </target>
96
Matthias Andreas Benkard93a19fb2020-11-15 17:39:35 +010097 <target name="web.resources" depends="snowpack,snowpack-build" unless="skip-web"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020098 <target name="web.check" unless="skip-web" depends="web.resources,flow,eslint"/>
Matthias Andreas Benkard813e5972020-06-14 19:27:42 +020099 <target name="web.bundle" unless="skip-web" depends="web.resources,parcel"/>
100 <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 +0200101
Matthias Andreas Benkard96c61e42020-04-13 21:31:25 +0200102 <target name="package" description="Create executable JAR">
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200103 <exec executable="./mvnw">
104 <arg value="package"/>
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +0200105 <arg value="-Dquarkus.container-image.push=false"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200106 </exec>
107 </target>
108
Matthias Andreas Benkard96c61e42020-04-13 21:31:25 +0200109 <target name="deploy" description="Deploy JAR to Kubernetes">
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200110 <exec executable="./mvnw">
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +0200111 <arg value="package"/>
Matthias Andreas Benkard77d0f7b2020-11-10 07:12:08 +0100112 <arg value="-Drevision=${version.tag}"/>
Matthias Andreas Benkarde2d42e92020-06-16 21:08:30 +0200113 <arg value="-Dquarkus.container-image.build=true"/>
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +0200114 <arg value="-Dquarkus.container-image.push=true"/>
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200115 </exec>
116 <exec executable="kubectl">
Matthias Andreas Benkardbdab6592020-12-18 13:23:47 +0100117 <arg value="config"/>
118 <arg value="use-context"/>
119 <arg value="mulk"/>
120 </exec>
121 <exec executable="kubectl">
Matthias Andreas Benkard77d0f7b2020-11-10 07:12:08 +0100122 <arg value="set"/>
123 <arg value="image"/>
124 <arg value="deployments/mulkcms2"/>
125 <arg value="mulkcms2=docker.benkard.de/mulk/mulkcms2:${version.tag}"/>
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200126 </exec>
127 <exec executable="kubectl">
Matthias Andreas Benkardbdab6592020-12-18 13:23:47 +0100128 <arg value="rollout"/>
129 <arg value="status"/>
130 <arg value="deployments/mulkcms2"/>
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200131 </exec>
132 </target>
133
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200134 <target name="clean">
135 <exec executable="./mvnw">
136 <arg value="clean"/>
137 </exec>
Matthias Andreas Benkardb40f4652022-05-13 14:16:45 +0200138 <delete dir="${web-dir}/.parcel-cache"/>
Matthias Andreas Benkard34453242022-05-24 22:20:45 +0200139 <delete dir="${web-dir}/build"/>
140 <delete dir="${web-dir}/dist"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200141 <delete dir="${web-dir}/node_modules"/>
142 <delete dir="${web-dir}/web_modules"/>
143 </target>
144
145</project>