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 | <arg value="web_modules/ContentTools.js"/> |
| 66 | <arg value="web_modules/ContentTools/build/content-tools.min.css"/> |
| 67 | </exec> |
| 68 | </target> |
| 69 | |
| 70 | <target name="parcel.check"> |
| 71 | <condition property="parcel.run"> |
| 72 | <not> |
| 73 | <available file="${web-dir}/dist"/> |
| 74 | </not> |
| 75 | </condition> |
| 76 | </target> |
| 77 | |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 78 | <target name="flow" depends="snowpack"> |
| 79 | <exec executable="yarn" dir="${web-dir}"> |
| 80 | <arg value="run"/> |
| 81 | <arg value="flow"/> |
| 82 | <arg value="--color=always"/> |
| 83 | </exec> |
| 84 | </target> |
| 85 | |
| 86 | <target name="eslint" depends="snowpack"> |
| 87 | <exec executable="yarn" dir="${web-dir}"> |
| 88 | <arg value="run"/> |
| 89 | <arg value="eslint"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 90 | <arg value="bookmarks"/> |
Matthias Andreas Benkard | e128d15 | 2020-04-19 19:40:59 +0200 | [diff] [blame] | 91 | <arg value="cms2"/> |
| 92 | <arg value="lazychat"/> |
| 93 | <arg value="posts"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 94 | <arg value="--color"/> |
| 95 | </exec> |
| 96 | </target> |
| 97 | |
Matthias Andreas Benkard | 93a19fb | 2020-11-15 17:39:35 +0100 | [diff] [blame] | 98 | <target name="web.resources" depends="snowpack,snowpack-build" unless="skip-web"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 99 | <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] | 100 | <target name="web.bundle" unless="skip-web" depends="web.resources,parcel"/> |
| 101 | <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] | 102 | |
Matthias Andreas Benkard | 96c61e4 | 2020-04-13 21:31:25 +0200 | [diff] [blame] | 103 | <target name="package" description="Create executable JAR"> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 104 | <exec executable="./mvnw"> |
| 105 | <arg value="package"/> |
Matthias Andreas Benkard | 95d29a0 | 2020-04-24 16:07:49 +0200 | [diff] [blame] | 106 | <arg value="-Dquarkus.container-image.push=false"/> |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 107 | </exec> |
| 108 | </target> |
| 109 | |
Matthias Andreas Benkard | 96c61e4 | 2020-04-13 21:31:25 +0200 | [diff] [blame] | 110 | <target name="deploy" description="Deploy JAR to Kubernetes"> |
Matthias Andreas Benkard | 77138fa | 2020-04-13 21:06:17 +0200 | [diff] [blame] | 111 | <exec executable="./mvnw"> |
Matthias Andreas Benkard | 95d29a0 | 2020-04-24 16:07:49 +0200 | [diff] [blame] | 112 | <arg value="package"/> |
Matthias Andreas Benkard | 77d0f7b | 2020-11-10 07:12:08 +0100 | [diff] [blame] | 113 | <arg value="-Drevision=${version.tag}"/> |
Matthias Andreas Benkard | e2d42e9 | 2020-06-16 21:08:30 +0200 | [diff] [blame] | 114 | <arg value="-Dquarkus.container-image.build=true"/> |
Matthias Andreas Benkard | 95d29a0 | 2020-04-24 16:07:49 +0200 | [diff] [blame] | 115 | <arg value="-Dquarkus.container-image.push=true"/> |
Matthias Andreas Benkard | 77138fa | 2020-04-13 21:06:17 +0200 | [diff] [blame] | 116 | </exec> |
| 117 | <exec executable="kubectl"> |
Matthias Andreas Benkard | bdab659 | 2020-12-18 13:23:47 +0100 | [diff] [blame] | 118 | <arg value="config"/> |
| 119 | <arg value="use-context"/> |
| 120 | <arg value="mulk"/> |
| 121 | </exec> |
| 122 | <exec executable="kubectl"> |
Matthias Andreas Benkard | 77d0f7b | 2020-11-10 07:12:08 +0100 | [diff] [blame] | 123 | <arg value="set"/> |
| 124 | <arg value="image"/> |
| 125 | <arg value="deployments/mulkcms2"/> |
| 126 | <arg value="mulkcms2=docker.benkard.de/mulk/mulkcms2:${version.tag}"/> |
Matthias Andreas Benkard | 77138fa | 2020-04-13 21:06:17 +0200 | [diff] [blame] | 127 | </exec> |
| 128 | <exec executable="kubectl"> |
Matthias Andreas Benkard | bdab659 | 2020-12-18 13:23:47 +0100 | [diff] [blame] | 129 | <arg value="rollout"/> |
| 130 | <arg value="status"/> |
| 131 | <arg value="deployments/mulkcms2"/> |
Matthias Andreas Benkard | 77138fa | 2020-04-13 21:06:17 +0200 | [diff] [blame] | 132 | </exec> |
| 133 | </target> |
| 134 | |
Matthias Andreas Benkard | 7f4dacc | 2020-04-13 11:25:19 +0200 | [diff] [blame] | 135 | <target name="clean"> |
| 136 | <exec executable="./mvnw"> |
| 137 | <arg value="clean"/> |
| 138 | </exec> |
Matthias Andreas Benkard | b40f465 | 2022-05-13 14:16:45 +0200 | [diff] [blame] | 139 | <delete dir="${web-dir}/.parcel-cache"/> |
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> |