blob: 3fdb95e103bcc96d48e28d0d3ec17d252489d724 [file] [log] [blame]
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +02001.PHONY: node_deps clean_dist deps clean_deps serve_chromium serve_chromium_mv3 serve_gecko release release_chromium_stable release_chromium_beta release_gecko_stable build_test_extension clean_releases clean
avm999636c357302020-08-09 19:54:08 +02002
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +02003WEBPACK := ./node_modules/webpack-cli/bin/cli.js
4RELEASE_SCRIPT := bash tools/release.bash
avm999636c357302020-08-09 19:54:08 +02005
Adrià Vilanova Martínez413cb442021-09-06 00:30:45 +02006# The sed command and the third_party/google-protobuf-commonjs_strict folder are
7# needed because of https://github.com/protocolbuffers/protobuf/issues/7778.
8grpc_proto_gen:
9 (cd src/killSwitch && \
10 protoc -I=. --js_out=import_style=commonjs_strict:. api_proto/*.proto && \
11 protoc -I. --grpc-web_out=import_style=commonjs,mode=grpcwebtext:. api_proto/*.proto && \
12 (cd api_proto && \
13 sed -i -E "s/require\('google-protobuf\//require('..\/..\/third_party\/google-protobuf-commonjs_strict\//" *_pb.js ))
14
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020015node_deps:
16 npm ci --no-save
avm999636c357302020-08-09 19:54:08 +020017
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020018clean_dist:
19 rm -rf dist
avm999636c357302020-08-09 19:54:08 +020020
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020021deps: node_deps
22 mkdir -p dist
avm99963bbc88c62020-12-25 03:44:41 +010023
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020024clean_deps:
25 rm -rf node_modules
avm999636c357302020-08-09 19:54:08 +020026
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020027serve_chromium: deps
28 $(WEBPACK) --mode development --env browser_target=chromium --watch
29
30serve_chromium_mv3: deps
31 $(WEBPACK) --mode development --env browser_target=chromium_mv3 --watch
32
33serve_gecko: deps
34 $(WEBPACK) --mode development --env browser_target=gecko --watch
35
36release: release_chromium_stable release_chromium_beta release_gecko_stable
37
38release_chromium_stable: deps
39 $(WEBPACK) --mode production --env browser_target=chromium
40 $(RELEASE_SCRIPT) -c stable -b chromium
41 rm -rf dist/chromium
42
43release_chromium_beta: deps
44 $(WEBPACK) --mode production --env browser_target=chromium
45 $(RELEASE_SCRIPT) -c beta -b chromium
46 rm -rf dist/chromium
47
48release_gecko_stable: deps
49 $(WEBPACK) --mode production --env browser_target=gecko
50 $(RELEASE_SCRIPT) -c stable -b gecko
51 rm -rf dist/gecko
52
53# Target to build the extension for webext lint in the Zuul Check Pipeline.
54build_test_extension: deps
55 $(WEBPACK) --mode production --env browser_target=gecko
56 $(RELEASE_SCRIPT) -c stable -b gecko
57
58clean_releases:
avm999636c357302020-08-09 19:54:08 +020059 rm -rf out
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020060
61clean: clean_deps clean_dist clean_releases