OLD | NEW |
1 Adblock Plus for Chrome, Opera, Microsoft Edge and Firefox | 1 Adblock Plus for Chrome, Opera, Microsoft Edge and Firefox |
2 ========================================================== | 2 ========================================================== |
3 | 3 |
4 This repository contains the platform-specific Adblock Plus source code for | 4 This repository contains the platform-specific Adblock Plus source code for |
5 Chrome, Opera, Microsoft Edge and Firefox. It can be used to build | 5 Chrome, Opera, Microsoft Edge and Firefox. It can be used to build |
6 Adblock Plus for these platforms, generic Adblock Plus code will be extracted | 6 Adblock Plus for these platforms, generic Adblock Plus code will be extracted |
7 from other repositories automatically (see _dependencies_ file). | 7 from other repositories automatically (see _dependencies_ file). |
8 | 8 |
9 Note that the Firefox extension built from this repository is the new | 9 Note that the Firefox extension built from this repository is the new |
10 [WebExtension](https://developer.mozilla.org/en-US/Add-ons/WebExtensions). | 10 [WebExtension](https://developer.mozilla.org/en-US/Add-ons/WebExtensions). |
11 The source code of the legacy Adblock Plus extension | 11 The source code of the legacy Adblock Plus extension |
12 can be found [here](https://hg.adblockplus.org/adblockplus). | 12 can be found [here](https://hg.adblockplus.org/adblockplus). |
13 | 13 |
14 Building | 14 Building |
15 --------- | 15 --------- |
16 | 16 |
17 ### Requirements | 17 ### Requirements |
18 | 18 |
19 - [Mercurial](https://www.mercurial-scm.org/) or [Git](https://git-scm.com/) (wh
ichever you used to clone this repository) | 19 - [Mercurial](https://www.mercurial-scm.org/) or [Git](https://git-scm.com/) (wh
ichever you used to clone this repository) |
20 - [Python 2.7](https://www.python.org) | 20 - [Python 2.7](https://www.python.org) |
21 - [The Jinja2 module](http://jinja.pocoo.org/docs) (>= 2.8) | 21 - [The Jinja2 module](http://jinja.pocoo.org/docs) (>= 2.8) |
22 - For signed builds: [PyCrypto module](https://www.dlitz.net/software/pycrypto
/) | 22 - For signed builds: [PyCrypto module](https://www.dlitz.net/software/pycrypto
/) |
23 - [Node.js](https://nodejs.org/) (>= 7) | 23 - [Node.js](https://nodejs.org/) (>= 7) |
24 | 24 |
| 25 ### Building on Windows |
| 26 |
| 27 On Windows, you need a [Linux environment running on WSL](https://docs.microsoft
.com/windows/wsl/install-win10). |
| 28 Then install the above requirements and run the commands below from within Bash. |
| 29 |
25 ### Building the extension | 30 ### Building the extension |
26 | 31 |
27 Run one of the following commands in the project directory, depending on your | 32 Run one of the following commands in the project directory, depending on your |
28 target platform: | 33 target platform: |
29 | 34 |
30 ./build.py build -t chrome -k adblockpluschrome.pem | 35 ./build.py build -t chrome -k adblockpluschrome.pem |
31 ./build.py build -t edge | 36 ./build.py build -t edge |
32 ./build.py build -t gecko | 37 ./build.py build -t gecko |
33 | 38 |
34 This will create a build with a name in the form | 39 This will create a build with a name in the form |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 74 |
70 The build script calls the ensure_dependencies script automatically to manage | 75 The build script calls the ensure_dependencies script automatically to manage |
71 the dependencies (see _dependencies_ file). Dependencies with local | 76 the dependencies (see _dependencies_ file). Dependencies with local |
72 modifications won't be updated. Otherwise during development specifying a | 77 modifications won't be updated. Otherwise during development specifying a |
73 feature-branch's name for a dependency's revision is sometimes useful. | 78 feature-branch's name for a dependency's revision is sometimes useful. |
74 Alternatively dependency management can be disabled completely by setting the | 79 Alternatively dependency management can be disabled completely by setting the |
75 _SKIP_DEPENDENCY_UPDATES_ environment variable, for example: | 80 _SKIP_DEPENDENCY_UPDATES_ environment variable, for example: |
76 | 81 |
77 SKIP_DEPENDENCY_UPDATES=true ./build.py devenv -t chrome | 82 SKIP_DEPENDENCY_UPDATES=true ./build.py devenv -t chrome |
78 | 83 |
79 Running the unit tests | 84 Running tests |
80 ---------------------- | 85 ------------- |
| 86 |
| 87 ### Unit tests |
81 | 88 |
82 To verify your changes you can use the unit test suite located in the _qunit_ | 89 To verify your changes you can use the unit test suite located in the _qunit_ |
83 directory of the repository. In order to run the unit tests go to the | 90 directory of the repository. In order to run the unit tests go to the |
84 extension's Options page, open the JavaScript Console and type in: | 91 extension's Options page, open the JavaScript Console and type in: |
85 | 92 |
86 location.href = "qunit/index.html"; | 93 location.href = "qunit/index.html"; |
87 | 94 |
88 The unit tests will run automatically once the page loads. | 95 The unit tests will run automatically once the page loads. |
89 You can also run these tests with a headless Firefox or Chromium process. | 96 |
90 Install the dependencies first: | 97 ### External test runner |
| 98 |
| 99 There is also an external test runner that can be invoked from the |
| 100 command line in order to run the unit tests along some integration |
| 101 tests on different browsers, and automatically run the linter as well. |
| 102 |
| 103 On Windows, in order to use the test runner, in addition to setting up a Linux |
| 104 environment as outlined above, you need to have Node.js installed in your native |
| 105 Windows environment. Then run the commands below from within PowerShell or |
| 106 cmd.exe (unlike when building the extension which needs to be done from Bash). |
| 107 |
| 108 Make sure the required packages are installed and up-to-date: |
91 | 109 |
92 npm install | 110 npm install |
93 | 111 |
94 Start the testing process for all browsers: | 112 Start the testing process for all browsers: |
95 | 113 |
96 npm test | 114 npm test |
97 | 115 |
98 Start the testing process in one browser only: | 116 Start the testing process in one browser only: |
99 | 117 |
100 npm test -- -g <gecko/chrome> | 118 npm test -- -g <gecko/chrome> |
101 | 119 |
102 Linting | 120 Linting |
103 ------- | 121 ------- |
104 | 122 |
105 You can lint the code using [ESLint](http://eslint.org). | 123 You can lint the code using [ESLint](http://eslint.org). |
106 | 124 |
107 You will need to setup first. This will install our configuration | 125 You will need to setup first. This will install our configuration |
108 [eslint-config-eyeo](https://hg.adblockplus.org/codingtools/file/tip/eslint-conf
ig-eyeo) | 126 [eslint-config-eyeo](https://hg.adblockplus.org/codingtools/file/tip/eslint-conf
ig-eyeo) |
109 and everything needed after you run: | 127 and everything needed after you run: |
110 | 128 |
111 npm install | 129 npm install |
112 | 130 |
113 Then you can run to lint the code: | 131 Then you can run to lint the code: |
114 | 132 |
115 npm run lint | 133 npm run lint |
OLD | NEW |