Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | |
| 3 | <project default="package"> |
| 4 | |
Matthias Andreas Benkard | 77d0f7b | 2020-11-10 07:12:08 +0100 | [diff] [blame^] | 5 | <tstamp> |
| 6 | <format property="version.date" pattern="yyyyMMddhhmmss"/> |
| 7 | </tstamp> |
| 8 | |
| 9 | <property name="version.tag" value="1.${version.date}"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 10 | <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 Benkard | 813e597 | 2020-06-14 19:27:42 +0200 | [diff] [blame] | 42 | <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 Benkard | 813e597 | 2020-06-14 19:27:42 +0200 | [diff] [blame] | 48 | <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 Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 61 | <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 Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 73 | <arg value="bookmarks"/> |
Matthias Andreas Benkard | e128d15 | 2020-04-19 19:40:59 +0200 | [diff] [blame] | 74 | <arg value="cms2"/> |
| 75 | <arg value="lazychat"/> |
| 76 | <arg value="posts"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 77 | <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 Benkard | 813e597 | 2020-06-14 19:27:42 +0200 | [diff] [blame] | 83 | <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 Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 85 | |
Matthias Andreas Benkard | 96c61e4 | 2020-04-13 21:31:25 +0200 | [diff] [blame] | 86 | <target name="package" description="Create executable JAR"> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 87 | <exec executable="./mvnw"> |
| 88 | <arg value="package"/> |
Matthias Andreas Benkard | 95d29a0 | 2020-04-24 16:07:49 +0200 | [diff] [blame] | 89 | <arg value="-Dquarkus.container-image.push=false"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 90 | </exec> |
| 91 | </target> |
| 92 | |
Matthias Andreas Benkard | 96c61e4 | 2020-04-13 21:31:25 +0200 | [diff] [blame] | 93 | <target name="deploy" description="Deploy JAR to Kubernetes"> |
Matthias Andreas Benkard | 77138fa | 2020-04-13 21:06:17 +0200 | [diff] [blame] | 94 | <exec executable="./mvnw"> |
Matthias Andreas Benkard | 95d29a0 | 2020-04-24 16:07:49 +0200 | [diff] [blame] | 95 | <arg value="package"/> |
Matthias Andreas Benkard | 77d0f7b | 2020-11-10 07:12:08 +0100 | [diff] [blame^] | 96 | <arg value="-Drevision=${version.tag}"/> |
Matthias Andreas Benkard | e2d42e9 | 2020-06-16 21:08:30 +0200 | [diff] [blame] | 97 | <arg value="-Dquarkus.container-image.build=true"/> |
Matthias Andreas Benkard | 95d29a0 | 2020-04-24 16:07:49 +0200 | [diff] [blame] | 98 | <arg value="-Dquarkus.container-image.push=true"/> |
Matthias Andreas Benkard | 77138fa | 2020-04-13 21:06:17 +0200 | [diff] [blame] | 99 | </exec> |
| 100 | <exec executable="kubectl"> |
Matthias Andreas Benkard | 77d0f7b | 2020-11-10 07:12:08 +0100 | [diff] [blame^] | 101 | <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 Benkard | 77138fa | 2020-04-13 21:06:17 +0200 | [diff] [blame] | 105 | </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 Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 114 | <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> |