Adrià Vilanova Martínez | 9aa2931 | 2022-01-16 02:42:46 +0100 | [diff] [blame] | 1 | .PHONY: node_deps clean_dist deps clean_deps serve_chromium serve_chromium_mv3 serve_gecko release release_chromium_stable release_chromium_beta release_chromium_canary release_gecko_stable build_test_extension clean_releases clean |
avm99963 | 6c35730 | 2020-08-09 19:54:08 +0200 | [diff] [blame] | 2 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 3 | WEBPACK := ./node_modules/webpack-cli/bin/cli.js |
| 4 | RELEASE_SCRIPT := bash tools/release.bash |
avm99963 | 6c35730 | 2020-08-09 19:54:08 +0200 | [diff] [blame] | 5 | |
Adrià Vilanova Martínez | 413cb44 | 2021-09-06 00:30:45 +0200 | [diff] [blame] | 6 | # The sed command and the third_party/google-protobuf-commonjs_strict folder are |
| 7 | # needed because of https://github.com/protocolbuffers/protobuf/issues/7778. |
| 8 | grpc_proto_gen: |
| 9 | (cd src/killSwitch && \ |
| 10 | protoc -I=. --js_out=import_style=commonjs_strict:. api_proto/*.proto && \ |
Adrià Vilanova Martínez | 50435f8 | 2022-01-21 19:33:36 +0100 | [diff] [blame] | 11 | protoc -I. --grpc-web_out=import_style=commonjs,mode=grpcwebtext:. api_proto/*.proto) |
Adrià Vilanova Martínez | 4118859 | 2022-01-21 19:47:41 +0100 | [diff] [blame] | 12 | (cd src/workflows && \ |
| 13 | protoc -I=. --js_out=import_style=commonjs_strict:. proto/*.proto) |
Adrià Vilanova Martínez | 413cb44 | 2021-09-06 00:30:45 +0200 | [diff] [blame] | 14 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 15 | node_deps: |
| 16 | npm ci --no-save |
avm99963 | 6c35730 | 2020-08-09 19:54:08 +0200 | [diff] [blame] | 17 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 18 | clean_dist: |
| 19 | rm -rf dist |
avm99963 | 6c35730 | 2020-08-09 19:54:08 +0200 | [diff] [blame] | 20 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 21 | deps: node_deps |
| 22 | mkdir -p dist |
avm99963 | bbc88c6 | 2020-12-25 03:44:41 +0100 | [diff] [blame] | 23 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 24 | clean_deps: |
| 25 | rm -rf node_modules |
avm99963 | 6c35730 | 2020-08-09 19:54:08 +0200 | [diff] [blame] | 26 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 27 | serve_chromium: deps |
| 28 | $(WEBPACK) --mode development --env browser_target=chromium --watch |
| 29 | |
| 30 | serve_chromium_mv3: deps |
| 31 | $(WEBPACK) --mode development --env browser_target=chromium_mv3 --watch |
| 32 | |
| 33 | serve_gecko: deps |
| 34 | $(WEBPACK) --mode development --env browser_target=gecko --watch |
| 35 | |
| 36 | release: release_chromium_stable release_chromium_beta release_gecko_stable |
| 37 | |
| 38 | release_chromium_stable: deps |
| 39 | $(WEBPACK) --mode production --env browser_target=chromium |
| 40 | $(RELEASE_SCRIPT) -c stable -b chromium |
| 41 | rm -rf dist/chromium |
| 42 | |
| 43 | release_chromium_beta: deps |
Adrià Vilanova Martínez | d4a4f3d | 2021-10-23 18:25:39 +0200 | [diff] [blame] | 44 | $(WEBPACK) --mode production --env browser_target=chromium_mv3 |
| 45 | $(RELEASE_SCRIPT) -c beta -b chromium_mv3 |
| 46 | rm -rf dist/chromium_mv3 |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 47 | |
Adrià Vilanova Martínez | 9aa2931 | 2022-01-16 02:42:46 +0100 | [diff] [blame] | 48 | release_chromium_canary: deps |
| 49 | $(WEBPACK) --mode production --env browser_target=chromium_mv3 --env canary |
| 50 | $(RELEASE_SCRIPT) -c canary -b chromium_mv3 |
| 51 | rm -rf dist/chromium_mv3 |
| 52 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 53 | release_gecko_stable: deps |
| 54 | $(WEBPACK) --mode production --env browser_target=gecko |
| 55 | $(RELEASE_SCRIPT) -c stable -b gecko |
| 56 | rm -rf dist/gecko |
| 57 | |
| 58 | # Target to build the extension for webext lint in the Zuul Check Pipeline. |
| 59 | build_test_extension: deps |
| 60 | $(WEBPACK) --mode production --env browser_target=gecko |
| 61 | $(RELEASE_SCRIPT) -c stable -b gecko |
| 62 | |
| 63 | clean_releases: |
avm99963 | 6c35730 | 2020-08-09 19:54:08 +0200 | [diff] [blame] | 64 | rm -rf out |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 65 | |
| 66 | clean: clean_deps clean_dist clean_releases |