287
edits
(Reverting my previous change; it's inconsistent with the rest of the page.) |
(Update Build guide) |
||
Line 22: | Line 22: | ||
=Getting the source= | =Getting the source= | ||
'' | There is extensive ''[https://developer.mozilla.org/en/Comm-central_source_code_(Mercurial) documentation]'' on how to get the Calendar source code on [https://developer.mozilla.org developer.mozilla.org]. | ||
The source code must be checked out via Mercurial (hg). | |||
In general, you should use a directory for the source code that does not contain spaces or such, i.e on windows "C:\Documents and Settings\MyUsername\My Documents\mozilla" is not a good choice. | |||
Before you start to build, you will need to configure your build environment to build Lightning. Since Lightning is an extension it needs to be built together with its host application Thunderbird. | |||
# | <pre># Enter the source directory | ||
cd src (we assume that src/ is your source directory here) | |||
# | # Generate a mozconfig yourself, or use this minimal default one for Thunderbird | ||
echo 'ac_add_options --enable-application=mail' > .mozconfig | |||
# Add calendaring to Thunderbird | |||
echo 'ac_add_options --enable-calendar' >> .mozconfig | |||
# Builds with the object directory the same as the source directory are not | |||
# supported, so set the object directory here. Note: Whether you have the | |||
# object directory within the source directory is up to you. .hgignore includes | |||
# objdir-* and obj-*, making your object directory start with one of them | |||
# will make change finding easier and hg faster, but moving it to outside | |||
# will make things like grep easier and quicker as well. | |||
echo 'mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdir-tb' >> .mozconfig | |||
# configure will be automatically generated using the 'autoconf-2.13' | |||
# command. If autoconf-2.13 isn't the right name for your system, as | |||
# is the case on OS X using MacPorts and on Ubuntu Linux, use the | |||
# real command name as demonstrated below. (Note: it's "autoconf2.13" | |||
# rather than "autoconf213" for Ubuntu 8.04, at least.) | |||
echo 'mk_add_options AUTOCONF=autoconf213' >> .mozconfig | |||
# Now do the build; configure will be run automatically | |||
make -f client.mk build</pre> | |||
make -f client.mk | |||
</pre> | |||
=Building the source (first time)= | =Building the source (first time)= | ||
If you have not previously built the source with the tree you just checked out, you need to do a full compile. Depending on platform and computer specs, this might take a while (Example: MacBook Pro, 2.2Ghz, 2GB ram, ~25-30 Minutes) Go have a beer in between or whatever you prefer :-) This will not be needed as often later on. | If you have not previously built the source with the tree you just checked out, you need to do a full compile. Depending on platform and computer specs, this might take a while (Example: MacBook Pro, 2.2Ghz, 2GB ram, ~25-30 Minutes) Go have a beer in between or whatever you prefer :-) This will not be needed as often later on. | ||
If everything went well, the last output won't contain any errors and you are ready to start your development build of sunbird. If you run into problems, please see the [[Calendar:Build#Troubleshooting|troubleshooting]] section at the bottom of this page. | |||
=Running | =Running Lightning= | ||
This section assumes you have a working Thunderbird (3.0 beta2 or later) installed. The best way to add Lightning to Thunderbird is to follow the [http://developer.mozilla.org/en/docs/Building_an_Extension#Test general steps], but for Lightning and Thunderbird. The extension ID for Lightning is <code>{3550f703-e582-4d05-9a08-453d09bdfdc6}</code>. You should use a separate profile for development, to not destroy your normal profile. | |||
The following steps make it easy on Linux, the profile path may be a bit different depending on your system. Remember to replace your profile name. This might also work out in a similar form on Windows and Mac. | |||
<pre> | <pre> | ||
# Enter the Lightning directory in your object directory | |||
cd @TOPSRCDIR@/../objdir-tb/dist/xpi-stage/lightning | |||
- | |||
# Create a new profile directory | |||
pwd > ~/.mozilla-thunderbird/<development profile path>/extensions/{3550f703-e582-4d05-9a08-453d09bdfdc6} | pwd > ~/.mozilla-thunderbird/<development profile path>/extensions/{3550f703-e582-4d05-9a08-453d09bdfdc6} | ||
</pre> | </pre> | ||
Now you can start thunderbird with your development profile. | Now you can start thunderbird with your development profile. | ||
<pre> | <pre> | ||
thunderbird -P <development profile name> | thunderbird -P <development profile name> | ||
Line 110: | Line 84: | ||
=Updating Calendar= | =Updating Calendar= | ||
If something has changed in calendar code, you will want to get the latest changes. The general documentation suggests you use client. | If something has changed in calendar code, you will want to get the latest changes. The general documentation suggests you use client.py to get all new changes: | ||
<pre> | <pre> | ||
cd | # Enter the source directory | ||
cd src | |||
# Update your local hg repository with the newest changes | |||
python client.py checkout | |||
</pre> | </pre> | ||
=Building Sunbird and Lightning (after first time)= | =Building Sunbird and Lightning (after first time)= | ||
After you have done a full build, it is usually not necessary to do the full build again for a while. The only case you might want to do a full build again is if something changed outside of calendar code that seems to affect building calendar (i.e a toolkit change). | After you have done a full build, it is usually not necessary to do the full build again for a while. The only case you might want to do a full build again is if something changed outside of calendar code that seems to affect building calendar (i.e a toolkit change). | ||
==Lightning== | ==Lightning== | ||
Line 155: | Line 101: | ||
<pre> | <pre> | ||
cd | # Enter the Lightning source directory in your object directory | ||
cd @TOPSRCDIR@/../objdir-tb/calendar/lightning | |||
# Start building | |||
make | make | ||
</pre> | </pre> | ||
After this you can start thunderbird with your development profile, and you should be up to date. | After this you can start thunderbird with your development profile, and you should be up to date. | ||
=Debugging and Preferences= | =Debugging and Preferences= | ||
You should set up your debugging environment in the same way you would for extension development. A nice guide can be found [http://developer.mozilla.org/en/docs/Setting_up_extension_development_environment here]. | You should set up your debugging environment in the same way you would for extension development. A nice guide can be found [http://developer.mozilla.org/en/docs/Setting_up_extension_development_environment here on developer.mozilla.org]. | ||
=Getting started with coding= | =Getting started with coding= | ||
Line 184: | Line 131: | ||
After you have changed everything you wanted to, you should take a look at the [[Calendar:Style_Guide|Style Guide]], to make sure your code follow the calendar style guidelines we use. | After you have changed everything you wanted to, you should take a look at the [[Calendar:Style_Guide|Style Guide]], to make sure your code follow the calendar style guidelines we use. | ||
Next, you need to create the patch. The following command can be used to create a patch of all ''changed'' files. Additional commands are needed if you added new files | Next, you need to create the patch. The following command can be used to create a patch of all ''changed'' files. Additional commands are needed if you added new files. | ||
<pre> | <pre> | ||
cd | # Enter the source directory | ||
cd src | |||
# | # Create the patch | ||
diff | hg diff >c:\my_first_bug.diff | ||
</pre> | |||
If you want to add new files, you will need to add those with the ''hg add'' command. After doing this, you can create the patch as described above. | |||
Now take a final look at the patch if it contains everything you wanted it to contain. You are ready to upload the patch to the bug. If there is no bug for your patch yet, you can [https://bugzilla.mozilla.org/enter_bug.cgi?product=Calendar&rep_platform=All&op_sys=All create one]. | Now take a final look at the patch if it contains everything you wanted it to contain. You are ready to upload the patch to the bug. If there is no bug for your patch yet, you can [https://bugzilla.mozilla.org/enter_bug.cgi?product=Calendar&rep_platform=All&op_sys=All create one]. | ||
Line 203: | Line 149: | ||
If you changed UI, its always a good idea to add a screenshot and request ui-review from a ui-reviewer. See also the module ownership page. | If you changed UI, its always a good idea to add a screenshot and request ui-review from a ui-reviewer. See also the module ownership page. | ||
The review process usually starts off with a ui-review. It is possible, that the code reviewer will postpone the review until you have ui-review+, in case it is clear that the UI will stay as proposed. In the code review, the reviewer checks if the style fits the [[Calendar:Style_Guide|Style Guide]], and does a general check if the patch works as advertised. To ease review, you should make sure there are no (new) error console warnings or errors, and all tests pass (<code>cd | The review process usually starts off with a ui-review. It is possible, that the code reviewer will postpone the review until you have ui-review+, in case it is clear that the UI will stay as proposed. In the code review, the reviewer checks if the style fits the [[Calendar:Style_Guide|Style Guide]], and does a general check if the patch works as advertised. To ease review, you should make sure there are no (new) error console warnings or errors, and all tests pass (<code>cd @TOPSRCDIR@/../objdir-tb/calendar; make -C test check</code>). | ||
As soon as you have r+ from all reviewers (r+ means having a positive review, also known as r=''shortname''), you should fix everything that was requested, and upload a new patch. Unless you have | As soon as you have r+ from all reviewers (r+ means having a positive review, also known as r=''shortname''), you should fix everything that was requested, and upload a new patch. Unless you have Mercurial (hg) access yourself, the reviewer will generally take care of checking in the patch. If that's not the case, or he forgets to do so, you can add the <code>checkin-needed</code> keyword to the bug. | ||
After the patch is checked in and all aspects of the bug are taken care of, the reviewer will resolve the bug as FIXED. The patch will then be available in the next spun nightly. When it is available, it is always a good practice to test the functionality using the original steps to reproduce. If everything works as proposed, you can set the bug as VERIFIED. If any regressions show up, you should file a new bug and set the <code>regression</code> keyword on it. | After the patch is checked in and all aspects of the bug are taken care of, the reviewer will resolve the bug as FIXED. The patch will then be available in the next spun nightly. When it is available, it is always a good practice to test the functionality using the original steps to reproduce. If everything works as proposed, you can set the bug as VERIFIED. If any regressions show up, you should file a new bug and set the <code>regression</code> keyword on it. | ||
====Applying a patch==== | ====Applying a patch==== | ||
''OUTDATED - WE NEED THE APPROPRIATE HG COMMANDS HERE'' | |||
From time to time, you might need to apply a patch from someone else, or maybe your own patch. This is quite easy, but note that if you plan on applying the patch, making some changes and then want to create a patch that doesn't contain the patch you originally applied, it might be quite a bit harder. This isn't very often the case though. | From time to time, you might need to apply a patch from someone else, or maybe your own patch. This is quite easy, but note that if you plan on applying the patch, making some changes and then want to create a patch that doesn't contain the patch you originally applied, it might be quite a bit harder. This isn't very often the case though. | ||
Line 234: | Line 182: | ||
If some changes went wrong, patch will create rejects files. To resolve changes, you should open the original file and the rejects file. On large rejects files, you might want to open the rejects file twice so you can see the lines that need to be removed and the lines that need to be added at the same time. | If some changes went wrong, patch will create rejects files. To resolve changes, you should open the original file and the rejects file. On large rejects files, you might want to open the rejects file twice so you can see the lines that need to be removed and the lines that need to be added at the same time. | ||
If you want to get rid of all changes at once, you can issue the following command. '''Warning''': This will get rid of all changes to the calendar tree you have made. | |||
<pre> | |||
# Enter the source directory | |||
cd src | |||
# Overwrite all local changes | |||
hg update -C | |||
</pre> | </pre> | ||
edits