Difference between revisions of "DeveloperGuide"

From The Battle for Wesnoth Wiki
(Dependencies)
(Commits)
Line 1: Line 1:
 +
== General ==
 +
 +
* [[WesnothRepository#Push_access|Set up developer access to the repository.]]
 +
<!-- FIXME: DEAD LIST * Subscribe to the commit mailing list: https://mail.gna.org/listinfo/wesnoth-commits or get the list moderator to approve commit messages from you otherwise -->
 +
* Be on the #wesnoth-dev IRC channel on freenode, and coordinate with other developers. Bots report commits and other developers may ask you questions or provide feedback.
 +
 
== Commits ==
 
== Commits ==
* Setting up developer access to the repository: [[WesnothRepository#Commit_access]]
+
 
* Register to commit mailing list: https://mail.gna.org/listinfo/wesnoth-commits or get the list moderator to approve commit messages from you otherwise
+
* Any given branch should <b>compile without warnings</b> and run after every commit -- we use [https://travis-ci.org/wesnoth/wesnoth Travis CI], which will report any build failures on master and maintenance branches (1.12, 1.14, etc.) to the #wesnoth-dev IRC channel.
* Trunk should compile and work after commit -- we use travis-ci, which will report any build failures on master to the irc channel. https://travis-ci.org/wesnoth/wesnoth
+
* All <b>unit tests</b> should pass after commit -- Travis will also test this. To run the C++ unit tests on your own machine, compile the "test" executable and run it. To run the WML unit tests, run <code>run_wml_tests -u</code> in the checkout root. If a test times out spuriously on Travis, you can restart the build by  
* All unit tests should pass after commit -- travis will also test this. To run the C++ unit tests, compile the "test" executable and run it. To run the WML unit tests, run "run_wml_tests -u" in the root of the repo.
+
*# Clicking on the link posted to IRC by the Travis bot:
** If a test times out spuriously on travis, you can restart the build by  
+
*#: 20141009 20:40:27-!- travis-ci [~travis-ci@ec2-184-73-55-78.compute-1.amazonaws.com] has joined #wesnoth-dev
*** clicking on the link posted to irc by the travis bot
+
*#: 20141009 20:40:27< travis-ci> wesnoth/wesnoth#4154 (master - c91604a : Ignacio R. Morelle): The build was broken.
***: 20141009 20:40:27-!- travis-ci [~travis-ci@ec2-184-73-55-78.compute-1.amazonaws.com] has joined #wesnoth-dev
+
*#: 20141009 20:40:27< travis-ci> Build details : http://travis-ci.org/wesnoth/wesnoth/builds/37536345
***: 20141009 20:40:27< travis-ci> wesnoth/wesnoth#4154 (master - c91604a : Ignacio R. Morelle): The build was broken.
+
*#: 20141009 20:40:27-!- travis-ci [~travis-ci@ec2-184-73-55-78.compute-1.amazonaws.com] has left #wesnoth-dev []
***: 20141009 20:40:27< travis-ci> Build details : http://travis-ci.org/wesnoth/wesnoth/builds/37536345
+
*# Clicking on the [http://i.imgur.com/mxwVKJP.png restart button] on the Travis website.
***: 20141009 20:40:27-!- travis-ci [~travis-ci@ec2-184-73-55-78.compute-1.amazonaws.com] has left #wesnoth-dev []
+
* Do <b>not</b> disable or ignore unit tests without a very good reason!
*** clicking on the [http://i.imgur.com/mxwVKJP.png restart button]
+
* A few small commits are better than a single large commit (which is hard to review), so when possible split it in working parts with info about where you are going
** Do not disable unit tests without a very good reason!
+
* Always review your changes, both before committing locally and before pushing upstream (see [[WesnothRepository#Reviewing your changes]]).
* Few small commits are better than a big one (hard to review), so when possible split it in working parts with info about where you are going
+
 
* Be on #wesnoth-dev IRC channel and coordinate with other developers. Bots report commits and some devs may ask you a question about it.
+
=== Changelogs and release notes ===
* Don't forget changelogs: ''changelog'' for any (significant enough) changes and ''player_changelog'' for changes visible to users.
+
 
* Always check your changes before commit (see [[WesnothRepository#Reviewing your changes]]).
+
We provide two separate changelogs at the root of the Wesnoth distribution and Git checkouts. The <b>players_changelog</b> file only contains entries for changes deemed relevant for players (not content creators), while the main <b>changelog</b> contains all changes, except for those that are only relevant to mainline developers and which are not expected to impact players or creators in any way.
* Commit message:
+
 
** Mention any change, especially if some are unrelated to the main one (but you should use separated commits for this).
+
It is your responsibility to update both changelogs as you see fit for every commit. For large changes spread over long series of commits, you will probably prefer to commit your changelog additions in a separate last commit to avoid or mitigate conflicts when merging upstream.
** Mention "bug #1234" for automatic cc to that gna bug number
+
 
** Mention a developer's IRC name will ping him on IRC (when the bot report it), and if he's not there, he may see it on the IRC logs
+
Important changes that might be expected to inconvenience or confuse players (including those building from source) or content creators, major bug fixes, and noteworthy feature additions for a future release should be mentioned and explained in <b>RELEASE_NOTES</b> as well, so that the release team can include this information in official announcements. See the contents of the file for instructions.
 +
 
 +
=== Commit messages ===
 +
 
 +
A good commit should not only contain good changes, but also include a helpful description of them for other developers, people tracking regressions, project maintainers, and even yourself in the future. There are many style guides on the Web describing best practices for documenting your Git commits.
 +
 
 +
For Wesnoth in particular, the general consensus is that contributors should adhere to the following rules:
 +
 
 +
* Every commit message should begin with a self-contained <b>summary/subject line</b> no more than 72 characters long. This is the first (and often the only) line someone using browsing tools will see.
 +
* If your message needs more than a leading summary line, separate it from the rest with a blank line.
 +
* Subsequent lines should also be no more than 72 characters long. Use blank lines to separate paragraphs and list items.
 +
* If you are performing branch merges, Git may include a list of conflicted paths in the commit message template. Edit this out; it ceases to be interesting after the conflicts have been resolved.
 +
* If you need to mention commit SHA1 hashes (e.g. in revert messages), make sure to use hashes from the upstream repository that are unlikely to change due to a future local or remote merge or rebase operation.
 +
 
 +
There are a few additional points to keep in mind for the wording of the contents:
 +
 
 +
* Include "bug #1234" somewhere in your commit message if it addresses a bug or feature request from the Wesnoth bug tracker.
 +
* Use the project's [[WesnothAcronyms|standard abbreviations]] for campaigns and gameplay concepts, like HttT for <cite>Heir to the Throne</cite>, ZoC for "Zone of Control", etc. If referring to a particular campaign or scenario in your commit subject, you should use this convention: "HttT S1: Made Galdrad less suicidal"
  
 
== Bugs management ==
 
== Bugs management ==

Revision as of 01:52, 29 December 2014

General

  • Set up developer access to the repository.
  • Be on the #wesnoth-dev IRC channel on freenode, and coordinate with other developers. Bots report commits and other developers may ask you questions or provide feedback.

Commits

  • Any given branch should compile without warnings and run after every commit -- we use Travis CI, which will report any build failures on master and maintenance branches (1.12, 1.14, etc.) to the #wesnoth-dev IRC channel.
  • All unit tests should pass after commit -- Travis will also test this. To run the C++ unit tests on your own machine, compile the "test" executable and run it. To run the WML unit tests, run run_wml_tests -u in the checkout root. If a test times out spuriously on Travis, you can restart the build by
    1. Clicking on the link posted to IRC by the Travis bot:
      20141009 20:40:27-!- travis-ci [~travis-ci@ec2-184-73-55-78.compute-1.amazonaws.com] has joined #wesnoth-dev
      20141009 20:40:27< travis-ci> wesnoth/wesnoth#4154 (master - c91604a : Ignacio R. Morelle): The build was broken.
      20141009 20:40:27< travis-ci> Build details : http://travis-ci.org/wesnoth/wesnoth/builds/37536345
      20141009 20:40:27-!- travis-ci [~travis-ci@ec2-184-73-55-78.compute-1.amazonaws.com] has left #wesnoth-dev []
    2. Clicking on the restart button on the Travis website.
  • Do not disable or ignore unit tests without a very good reason!
  • A few small commits are better than a single large commit (which is hard to review), so when possible split it in working parts with info about where you are going
  • Always review your changes, both before committing locally and before pushing upstream (see WesnothRepository#Reviewing your changes).

Changelogs and release notes

We provide two separate changelogs at the root of the Wesnoth distribution and Git checkouts. The players_changelog file only contains entries for changes deemed relevant for players (not content creators), while the main changelog contains all changes, except for those that are only relevant to mainline developers and which are not expected to impact players or creators in any way.

It is your responsibility to update both changelogs as you see fit for every commit. For large changes spread over long series of commits, you will probably prefer to commit your changelog additions in a separate last commit to avoid or mitigate conflicts when merging upstream.

Important changes that might be expected to inconvenience or confuse players (including those building from source) or content creators, major bug fixes, and noteworthy feature additions for a future release should be mentioned and explained in RELEASE_NOTES as well, so that the release team can include this information in official announcements. See the contents of the file for instructions.

Commit messages

A good commit should not only contain good changes, but also include a helpful description of them for other developers, people tracking regressions, project maintainers, and even yourself in the future. There are many style guides on the Web describing best practices for documenting your Git commits.

For Wesnoth in particular, the general consensus is that contributors should adhere to the following rules:

  • Every commit message should begin with a self-contained summary/subject line no more than 72 characters long. This is the first (and often the only) line someone using browsing tools will see.
  • If your message needs more than a leading summary line, separate it from the rest with a blank line.
  • Subsequent lines should also be no more than 72 characters long. Use blank lines to separate paragraphs and list items.
  • If you are performing branch merges, Git may include a list of conflicted paths in the commit message template. Edit this out; it ceases to be interesting after the conflicts have been resolved.
  • If you need to mention commit SHA1 hashes (e.g. in revert messages), make sure to use hashes from the upstream repository that are unlikely to change due to a future local or remote merge or rebase operation.

There are a few additional points to keep in mind for the wording of the contents:

  • Include "bug #1234" somewhere in your commit message if it addresses a bug or feature request from the Wesnoth bug tracker.
  • Use the project's standard abbreviations for campaigns and gameplay concepts, like HttT for Heir to the Throne, ZoC for "Zone of Control", etc. If referring to a particular campaign or scenario in your commit subject, you should use this convention: "HttT S1: Made Galdrad less suicidal"

Bugs management

  • Change status of fixed bugs to "Fixed" when committed
  • Change status of fixed bugs to "Closed" when released, see ReportingBugs#Bug_protocol for details
  • Check if there is new bugs relevant to your code and if any, assign them to you.

Dependencies

  • Any change in dependencies to build the project must be discussed on the mailing list (dev-talk).
  • Update SConstruct (and ideally cmake recipe also) to check for the dependency.
  • Note any change (added or removed deps, or increased version requirements) in the RELEASE_NOTES file. These will be announced in the forum announcement and in the emails to packagers.

Tips

  • If you build with scons, use clang rather than gcc, as it is 2-3x faster to compile wesnoth.

Set your choice permanently with

scons cxxtool=clang++

See also