blob: 7a3e0b05212c2dad17a26d17a4e2830dcdbe1bbd [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">
27 <exec executable="yarn" dir="${web-dir}">
28 <arg value="run"/>
29 <arg value="snowpack"/>
30 <arg value="--optimize"/>
31 </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 Benkard813e5972020-06-14 19:27:42 +020042 <target name="parcel" depends="parcel.check,yarn" if="parcel.run">
43 <exec executable="yarn" dir="${web-dir}">
44 <arg value="parcel"/>
45 <arg value="build"/>
46 <arg value="lib.css"/>
47 <arg value="lib.js"/>
Matthias Andreas Benkard813e5972020-06-14 19:27:42 +020048 <arg value="web_modules/ContentTools.js"/>
49 <arg value="web_modules/ContentTools/build/content-tools.min.css"/>
50 </exec>
51 </target>
52
53 <target name="parcel.check">
54 <condition property="parcel.run">
55 <not>
56 <available file="${web-dir}/dist"/>
57 </not>
58 </condition>
59 </target>
60
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020061 <target name="flow" depends="snowpack">
62 <exec executable="yarn" dir="${web-dir}">
63 <arg value="run"/>
64 <arg value="flow"/>
65 <arg value="--color=always"/>
66 </exec>
67 </target>
68
69 <target name="eslint" depends="snowpack">
70 <exec executable="yarn" dir="${web-dir}">
71 <arg value="run"/>
72 <arg value="eslint"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020073 <arg value="bookmarks"/>
Matthias Andreas Benkarde128d152020-04-19 19:40:59 +020074 <arg value="cms2"/>
75 <arg value="lazychat"/>
76 <arg value="posts"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020077 <arg value="--color"/>
78 </exec>
79 </target>
80
81 <target name="web.resources" depends="snowpack" unless="skip-web"/>
82 <target name="web.check" unless="skip-web" depends="web.resources,flow,eslint"/>
Matthias Andreas Benkard813e5972020-06-14 19:27:42 +020083 <target name="web.bundle" unless="skip-web" depends="web.resources,parcel"/>
84 <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 +020085
Matthias Andreas Benkard96c61e42020-04-13 21:31:25 +020086 <target name="package" description="Create executable JAR">
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020087 <exec executable="./mvnw">
88 <arg value="package"/>
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +020089 <arg value="-Dquarkus.container-image.push=false"/>
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +020090 </exec>
91 </target>
92
Matthias Andreas Benkard96c61e42020-04-13 21:31:25 +020093 <target name="deploy" description="Deploy JAR to Kubernetes">
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +020094 <exec executable="./mvnw">
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +020095 <arg value="package"/>
Matthias Andreas Benkard77d0f7b2020-11-10 07:12:08 +010096 <arg value="-Drevision=${version.tag}"/>
Matthias Andreas Benkarde2d42e92020-06-16 21:08:30 +020097 <arg value="-Dquarkus.container-image.build=true"/>
Matthias Andreas Benkard95d29a02020-04-24 16:07:49 +020098 <arg value="-Dquarkus.container-image.push=true"/>
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +020099 </exec>
100 <exec executable="kubectl">
Matthias Andreas Benkard77d0f7b2020-11-10 07:12:08 +0100101 <arg value="set"/>
102 <arg value="image"/>
103 <arg value="deployments/mulkcms2"/>
104 <arg value="mulkcms2=docker.benkard.de/mulk/mulkcms2:${version.tag}"/>
Matthias Andreas Benkard77138fa2020-04-13 21:06:17 +0200105 </exec>
106 <exec executable="kubectl">
107 <arg value="get"/>
108 <arg value="pods"/>
109 <arg value="-lapp=mulkcms2"/>
110 <arg value="-w"/>
111 </exec>
112 </target>
113
Matthias Andreas Benkard7f4dacc2020-04-13 11:25:19 +0200114 <target name="clean">
115 <exec executable="./mvnw">
116 <arg value="clean"/>
117 </exec>
118 <delete dir="${web-dir}/node_modules"/>
119 <delete dir="${web-dir}/web_modules"/>
120 </target>
121
122</project>