blob: 7cb4294c1c89480e4aeafb4a12b63e5254136c33 [file] [log] [blame]
Adrià Vilanova Martíneza03d03a2023-03-11 23:30:07 +01001.PHONY: node_deps clean_dist deps clean_deps lit_localize_extract lit_localize_build lit_localize_all 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 test clean trigger_nightly_build
avm999636c357302020-08-09 19:54:08 +02002
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +02003WEBPACK := ./node_modules/webpack-cli/bin/cli.js
Adrià Vilanova Martínezb47ec062023-01-15 17:43:26 +01004JEST := node --experimental-vm-modules ./node_modules/jest/bin/jest.js
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +02005RELEASE_SCRIPT := bash tools/release.bash
avm999636c357302020-08-09 19:54:08 +02006
Adrià Vilanova Martínez413cb442021-09-06 00:30:45 +02007grpc_proto_gen:
8 (cd src/killSwitch && \
9 protoc -I=. --js_out=import_style=commonjs_strict:. api_proto/*.proto && \
Adrià Vilanova Martínez50435f82022-01-21 19:33:36 +010010 protoc -I. --grpc-web_out=import_style=commonjs,mode=grpcwebtext:. api_proto/*.proto)
Adrià Vilanova Martínez41188592022-01-21 19:47:41 +010011 (cd src/workflows && \
12 protoc -I=. --js_out=import_style=commonjs_strict:. proto/*.proto)
Adrià Vilanova Martínez413cb442021-09-06 00:30:45 +020013
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020014node_deps:
15 npm ci --no-save
avm999636c357302020-08-09 19:54:08 +020016
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020017clean_dist:
18 rm -rf dist
avm999636c357302020-08-09 19:54:08 +020019
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020020deps: node_deps
21 mkdir -p dist
avm99963bbc88c62020-12-25 03:44:41 +010022
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020023clean_deps:
24 rm -rf node_modules
avm999636c357302020-08-09 19:54:08 +020025
Adrià Vilanova Martíneza03d03a2023-03-11 23:30:07 +010026lit_localize_extract:
27 npx lit-localize extract
28
29lit_localize_build:
30 npx lit-localize build
31
32lit_localize_all: lit_localize_extract lit_localize_build
33
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020034serve_chromium: deps
35 $(WEBPACK) --mode development --env browser_target=chromium --watch
36
37serve_chromium_mv3: deps
38 $(WEBPACK) --mode development --env browser_target=chromium_mv3 --watch
39
40serve_gecko: deps
41 $(WEBPACK) --mode development --env browser_target=gecko --watch
42
43release: release_chromium_stable release_chromium_beta release_gecko_stable
44
45release_chromium_stable: deps
46 $(WEBPACK) --mode production --env browser_target=chromium
47 $(RELEASE_SCRIPT) -c stable -b chromium
48 rm -rf dist/chromium
49
50release_chromium_beta: deps
Adrià Vilanova Martínezd4a4f3d2021-10-23 18:25:39 +020051 $(WEBPACK) --mode production --env browser_target=chromium_mv3
52 $(RELEASE_SCRIPT) -c beta -b chromium_mv3
53 rm -rf dist/chromium_mv3
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020054
Adrià Vilanova Martínez9aa29312022-01-16 02:42:46 +010055release_chromium_canary: deps
56 $(WEBPACK) --mode production --env browser_target=chromium_mv3 --env canary
57 $(RELEASE_SCRIPT) -c canary -b chromium_mv3
58 rm -rf dist/chromium_mv3
59
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020060release_gecko_stable: deps
61 $(WEBPACK) --mode production --env browser_target=gecko
62 $(RELEASE_SCRIPT) -c stable -b gecko
63 rm -rf dist/gecko
64
65# Target to build the extension for webext lint in the Zuul Check Pipeline.
66build_test_extension: deps
67 $(WEBPACK) --mode production --env browser_target=gecko
68 $(RELEASE_SCRIPT) -c stable -b gecko
69
70clean_releases:
avm999636c357302020-08-09 19:54:08 +020071 rm -rf out
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020072
Adrià Vilanova Martínezb47ec062023-01-15 17:43:26 +010073test:
74 $(JEST)
75
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020076clean: clean_deps clean_dist clean_releases
Adrià Vilanova Martínezb4af9752022-06-21 12:09:58 +020077
78# Manually trigger the nightly build. It also makes sure the tracked master branch is up to update
79trigger_nightly_build:
80 git fetch
81 zuul-client enqueue-ref --tenant gerrit --pipeline nightly-build --project infinitegforums --ref refs/heads/master --newrev $$(git rev-parse gerrit/master)