Source Code
Getting the source code
The Adblock Plus source code can viewed throught the HG web interface. To get a local copy of the source run the following from the command line:
hg clone http://hg.mozdev.org/adblockplus/
To reset your local copy to the state of a particular Adblock Plus release run this command:
hg up -r ADBLOCK_PLUS_0_7_5_4_RELEASE
(replace ADBLOCK_PLUS_0_7_5_4_RELEASE by the tag of the required version).
HG client and documentation links
- Mercurial (quickstart)
- Mozilla’s Mercurial FAQ
- Distributed Revision Control with Mercurial (hgbook)
- GUI clients and other tools
Creating an Adblock Plus build
To create a development build, go into the directory “src” inside your local repository copy and run this command:
perl make_devbuild.pl
This will create a file like adblockplus-1.2.3.4+.nnnnnnnnnn.xpi containing the source code currently in the repository and all available locales. To create a development build with only some locales specify these locales on the command line, e.g.:
perl make_devbuild.pl en-US de-DE ru-RU
Note: Running this script should work out of the box on Linux and OS X, on Windows you will need Perl and Info-ZIP. Both are part of the MozillaBuild package.
Setting up a test environment and running unit tests
Creating a build, installing it and restarting the browser to test each small change is tedious. For easier developing create a file “.profileDirs” in the “src” directory of the repository listing the profiles you want to test with, e.g.:
c:\Documents and Setting\<user>\Application Data\Mozilla\Firefox\Profiles\<seed>.default c:\Documents and Setting\<user>\Application Data\Songbird1\Profiles\<seed>.default
Then run the setupTestEnvironment.pl script from the command line:
perl setupTestEnvironment.pl
It will set up Adblock Plus in all profiles listed. Only install.rdf, chrome.manifest, XPCOM components and preferences will be actually copied, the browser will access your repository directly for the chrome files. By setting the nglayout.debug.disable_xul_cache preference to true you will make sure that changes in the repository appear in the browser without a browser restart.
Once the test environment is set up you can run the unit tests by going to chrome://mochikit/content/harness-abp.xul?autorun=1 in your browser.
