avm99963 | ea37fdf | 2021-02-03 01:27:13 +0100 | [diff] [blame] | 1 | # Build the extension |
| 2 | A zip file with the contents of the extension, which can be uploaded to the |
| 3 | Chrome Web Store and addons.mozilla.org, can be created with any of the |
| 4 | following procedures (make sure to [install Go](https://golang.org) before |
| 5 | building the extension, as it is needed during the build): |
| 6 | |
| 7 | ## Using the release.bash script |
| 8 | Run `bash release.bash -h` in order to learn how to use this command. To |
| 9 | summarize, the command accepts the `--channel` and `--browser` flags (or their |
| 10 | short versions `-c` and `-b`). |
| 11 | |
| 12 | As an example, if you wanted to create a ZIP file of the beta-branded extension |
| 13 | targeted for Firefox, you would run `bash release.bash -c beta -b gecko`. |
| 14 | |
| 15 | ## Using make |
| 16 | You can also use _make_ to build the extension. This is just a wrapper for the |
| 17 | `release.bash` command. |
| 18 | |
| 19 | Run `make all` to build the extension for all the available channels and |
| 20 | browsers. You can also run `make {target}` where `{target}` is one of the |
| 21 | following: `chromium-stable`, `chromium-beta`, `chromium-mv3-beta`, |
| 22 | `gecko-stable`. |
| 23 | |
| 24 | Run `make clean` to clean all the release files (this removes the `out` folder, |
| 25 | which is where the release files are saved). |
| 26 | |
| 27 | ## Load the extension "without" building it |
| 28 | If you're developing the extension, you might want to load it into your browser |
| 29 | without having to constantly build it after each change. In order to do that, |
| 30 | you'll only have to manually generate the manifest each time you change the |
| 31 | `template/manifest.gjson` file (or only once if you don't change it, and once |
| 32 | every time you pull new changes to your git clone). |
| 33 | |
| 34 | In order to do that, run `go run generateManifest.go {browser}`, where |
| 35 | `{browser}` is `CHROMIUM`, `GECKO` or `CHROMIUM_MV3`, and this will generate the |
| 36 | `manifest.json` file for the specified browser in the `src` directory. Now, you |
| 37 | can load the `src` folder directly in the browser in order to import the |
| 38 | extension. |
| 39 | |
| 40 | ## About the _Chromium MV3_ target |
| 41 | Chromium is working in a |
| 42 | [new version of the manifest.json file](https://developer.chrome.com/docs/extensions/mv3/intro/), |
| 43 | which also introduces some changes to the extension APIs. Eventually, all Chrome |
| 44 | extensions will be required to have migrated to Manifest V3 (MV3), so in order |
| 45 | to anticipate this change, a new experimental _Chromium MV3_ target has been |
| 46 | added. |
| 47 | |
| 48 | This target is experimental in the sense that it isn't actually used when |
| 49 | building the extension ZIPs which are uploaded to the Chrome Web Store (MV2 is |
| 50 | still used), and because these builds aren't currently being exhaustively |
| 51 | tested. |