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"> |
Matthias Andreas Benkard | 93a19fb | 2020-11-15 17:39:35 +0100 | [diff] [blame] | 27 | <!-- Build for development --> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 28 | <exec executable="yarn" dir="${web-dir}"> |
| 29 | <arg value="run"/> |
| 30 | <arg value="snowpack"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 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 | 93a19fb | 2020-11-15 17:39:35 +0100 | [diff] [blame] | 42 | <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 Benkard | 813e597 | 2020-06-14 19:27:42 +0200 | [diff] [blame] | 59 | <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 Benkard | 813e597 | 2020-06-14 19:27:42 +0200 | [diff] [blame] | 65 | </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 Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 76 | <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 Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 88 | <arg value="bookmarks"/> |
Matthias Andreas Benkard | e128d15 | 2020-04-19 19:40:59 +0200 | [diff] [blame] | 89 | <arg value="cms2"/> |
| 90 | <arg value="lazychat"/> |
| 91 | <arg value="posts"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 92 | <arg value="--color"/> |
| 93 | </exec> |
| 94 | </target> |
| 95 | |
Matthias Andreas Benkard | 93a19fb | 2020-11-15 17:39:35 +0100 | [diff] [blame] | 96 | <target name="web.resources" depends="snowpack,snowpack-build" unless="skip-web"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 97 | <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] | 98 | <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 Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 100 | |
Matthias Andreas Benkard | 96c61e4 | 2020-04-13 21:31:25 +0200 | [diff] [blame] | 101 | <target name="package" description="Create executable JAR"> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 102 | <exec executable="./mvnw"> |
| 103 | <arg value="package"/> |
Matthias Andreas Benkard | 95d29a0 | 2020-04-24 16:07:49 +0200 | [diff] [blame] | 104 | <arg value="-Dquarkus.container-image.push=false"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 105 | </exec> |
| 106 | </target> |
| 107 | |
Matthias Andreas Benkard | 96c61e4 | 2020-04-13 21:31:25 +0200 | [diff] [blame] | 108 | <target name="deploy" description="Deploy JAR to Kubernetes"> |
Matthias Andreas Benkard | 77138fa | 2020-04-13 21:06:17 +0200 | [diff] [blame] | 109 | <exec executable="./mvnw"> |
Matthias Andreas Benkard | 95d29a0 | 2020-04-24 16:07:49 +0200 | [diff] [blame] | 110 | <arg value="package"/> |
Matthias Andreas Benkard | 77d0f7b | 2020-11-10 07:12:08 +0100 | [diff] [blame] | 111 | <arg value="-Drevision=${version.tag}"/> |
Matthias Andreas Benkard | e2d42e9 | 2020-06-16 21:08:30 +0200 | [diff] [blame] | 112 | <arg value="-Dquarkus.container-image.build=true"/> |
Matthias Andreas Benkard | 95d29a0 | 2020-04-24 16:07:49 +0200 | [diff] [blame] | 113 | <arg value="-Dquarkus.container-image.push=true"/> |
Matthias Andreas Benkard | 77138fa | 2020-04-13 21:06:17 +0200 | [diff] [blame] | 114 | </exec> |
| 115 | <exec executable="kubectl"> |
Matthias Andreas Benkard | bdab659 | 2020-12-18 13:23:47 +0100 | [diff] [blame] | 116 | <arg value="config"/> |
| 117 | <arg value="use-context"/> |
| 118 | <arg value="mulk"/> |
| 119 | </exec> |
| 120 | <exec executable="kubectl"> |
Matthias Andreas Benkard | 77d0f7b | 2020-11-10 07:12:08 +0100 | [diff] [blame] | 121 | <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 Benkard | 77138fa | 2020-04-13 21:06:17 +0200 | [diff] [blame] | 125 | </exec> |
| 126 | <exec executable="kubectl"> |
Matthias Andreas Benkard | bdab659 | 2020-12-18 13:23:47 +0100 | [diff] [blame] | 127 | <arg value="rollout"/> |
| 128 | <arg value="status"/> |
| 129 | <arg value="deployments/mulkcms2"/> |
Matthias Andreas Benkard | 77138fa | 2020-04-13 21:06:17 +0200 | [diff] [blame] | 130 | </exec> |
| 131 | </target> |
| 132 | |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 133 | <target name="clean"> |
| 134 | <exec executable="./mvnw"> |
| 135 | <arg value="clean"/> |
| 136 | </exec> |
Matthias Andreas Benkard | b40f465 | 2022-05-13 14:16:45 +0200 | [diff] [blame] | 137 | <delete dir="${web-dir}/.parcel-cache"/> |
Matthias Andreas Benkard | 3445324 | 2022-05-24 22:20:45 +0200 | [diff] [blame] | 138 | <delete dir="${web-dir}/build"/> |
| 139 | <delete dir="${web-dir}/dist"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 140 | <delete dir="${web-dir}/node_modules"/> |
| 141 | <delete dir="${web-dir}/web_modules"/> |
| 142 | </target> |
| 143 | |
| 144 | </project> |