-
Notifications
You must be signed in to change notification settings - Fork 46
Building the extension
We've created an automated script called make_release.py, which you can find in the /tools directory of the source code. This script can make a final build of CatBlock, like you'd find on the addon stores or the Releases page; or it can make an unpacked environment for testing code, with any unneeded Git cruft removed.
- Python 3.x (the script does not work with Python 2.x)
As an example, let's build CatBlock for Google Chrome, as if we were to upload it to the Chrome Web Store (so we'd need a ZIP file instead of a packed CRX). Just navigate to the root of the repository in a terminal and run the following command:
python3 tools/make_release.py -b chrome -ext zip
(N.B. Windows users may have to add C:\Python3\bin (or wherever the python3.exe is located to their %PATH%)
This will create a ZIP file in a folder called builds. If we instead replaced zip in that command with browser, we would get a CRX for manually loading into the browser (by drag-and-dropping onto chrome://extensions).
Lets assume we're still using Chrome, and want to test a branch we've been asked to review, but want it in a separate directory for testing.
As before, we'll have our terminal in the root of the repository, and we'll run this command:
python3 tools/make_release.py -b chrome -devenv
The development environment will be created as a folder with name catblock_chrome in the root of the project directory.
This script accepts 4 arguments:
-
-b,--browser(required)- Specifies which browser you want built. Can be one of
chrome,firefox,opera,edgeorall
- Specifies which browser you want built. Can be one of
-
-ext,--extension(optional, when -devenv is included; otherwise required)- Specifies that we want a packed extension to be generated. Can be one of
browserorzip - NOTE: CatBlock for Edge is always generated as a ZIP, since a tool for converting extensions to the .appx format is not publicly available (yet).
- Specifies that we want a packed extension to be generated. Can be one of
-
-devenv(optional)- When included, development environment will be created
-
--updatelangs(optional)- When included, script will attempt to update all language files
We strongly recommend, that you install CatBlock from official extensions stores but feel free to sideload CatBlock and see, how it works!
There's also a bleeding-edge version of CatBlock called, CatBlock Nightly, which has the latest changes contained within. These are stored in their own dedicated repository. We're working on having them automatically uploaded to their respective stores so that we can automatically update them.
Alright, let's proceed to the sideloading!
First, you will need to:
- either create an unpacked development environment (by specifying
-devenvin the command) - or generate a packed extension (by specifying
-ext browser)
When you've generated an unpacked development environment:
- Go to the Chrome menu >
Tools>Extensions - Check
Developer modethen pressLoad unpacked extension... - Select the generated
catblock_chromefolder in the project directory - That's it!
When you've generated a packed extension:
- Navigate to
chrome://extensionspage - Navigate to
/buildsfolder and locatecatblock-chrome.crxfile - Drag the
catblock-chrome.crxfile and drop it to the Extensions page you've opened in the first step - That's it!
When you've generated an unpacked development environment:
- Navigate to
opera://extensions - Press
Developer Modebutton and then pressLoad Unpacked Extension...button - Select the generated
catblock_operafolder in the project directory - That's it!
When you've generated a packed extension:
- Open
opera://extensionspage - Navigate to
/buildsfolder and locatecatblock-opera.nexfile - Drag
catblock-opera.nexfile and drop it to the Extensions page you've opened in the first step - That's it!
When you've generated an unpacked development environment:
- Navigate to
about:debuggingpage - Tick
Enable add-on debuggingoption - Click on
Load Temporary Add-onbutton - Select the generated
catblock_firefoxfolder in the project directory - That's it!
When you've generated a packed extension:
- Make sure that you are running Firefox Developer Edition or Firefox Nightly!
- Go to
about:configand setxpinstall.signatures.requiredto false - Go to
about:addons=> click on settings icon - Select
Install Add-on from file... - Select
catblock-firefox.xpifile - That's it!
NOTE: Currently, there is no way, how to generate a packaged .appx extension/application for Microsoft Edge browser for 3rd party developers.
When you've created an unpacked development environment:
- Navigate to
catblock_edgefolder - Run
Setup.cmdfile - Start up Edge, open up
about:flagspage - Make sure that checkbox next to
Enable extension developer featuresis selected - Restart Edge
- Click on three dots (...) and then on
Extensionsin menu - Click on
Load extension - Select unpacked "catblock" folder
After each startup of Edge browser, you won't immediately see CatBlock as an installed extension, because it hasn't been signed and released to the Windows Store.
After about 10 seconds you should get a prompt asking whether you want to load unsigned extensions or not. Say yes.
Wiki content is Copyright © 2017 the CatBlock team (Kieran Peckett, Tomáš Taro) and released under the Creative Commons BY-SA 4.0 International License.