How To Put Licence Blocks In Files

I’ve been working on the relicensing project recently, and it seems the following instructions are necessary.

When adding licence blocks to files:


  • Always use a clean copy of the boilerplate
  • Including all of the boilerplate, especially the BEGIN/END markers
  • Fill in the marked fields appropriately
  • Always use the same comment character for all parts of the block
  • In line-based comment styles such as “#”, separate the licence from other comments by a blank line


  • Copy and paste entire licence blocks between files
  • Invent your own block by adding comment markers to the uncommented boilerplate (unless you need a comment style not provided, in which case make it match other examples exactly)
  • Add other text to the licence comment block
  • Take a block of one comment type (e.g. “<!–“) and put it into a file surrounded by comment markers of another type (e.g. “/*”).

There is an exception to the last rule. You may put “#” blocks inside other comment styles in files which the XUL preprocessor runs over, as long as the surrounding comment markers are each on their own separate line, as follows:

# Version: MPL 1.1/GPL 2.0/LGPL 2.1
# The contents of this file are subject to the Mozilla Public License Version
# ***** END LICENSE BLOCK *****

One thought on “How To Put Licence Blocks In Files

  1. Somebody sounds grumbly… ;-)

    If you ask me, part of the problem is that the boilerplate texts are somewhat buried in the site. Getting to them from isn’t very difficult (although getting there by any means other than typing the URL in the location bar isn’t easy unless you’ve done it a lot), but when you’re already editing source code and there are so many viable examples in source already, it’s far easier to just copy an existing file, dele the code, and edit the boilerplate as necessary.