Using automatic class licensing

You can use EiffelStudio to include a license text in each of your classes automatically. The automatic class licensing facility is flexible so that you can use various strategies to retrieve the license text used.

When you save the text of a class file in EiffelStudio, the automatic licensing facility searches for an appropriate license text file to use. If such a file is found, then EiffelStudio includes the contents of that file as an ending note part in your class. Here's the text of a class that includes an Eiffel Software license:

class APPLICATION inherit ARGUMENTS create make feature {NONE} -- Initialization make -- Run application. do print ("Hello Eiffel World!%N") end note copyright: "Copyright (c) 1984-2010, Eiffel Software" copying: "[ Duplication and distribution prohibited. May be used only with Eiffel Software products, under terms of user license. Contact Eiffel Software for any other use. ]" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 ]" end

License file format

License text should appear in a text file with the file type ".lic". The text should contain the note clause which includes the license text and nothing more. EiffelStudio will parse the text and invalid instances of license text will not be merged into the target class.

The following text is the content of the license text file which was used to annotate the class shown above:

${NOTE_KEYWORD} copyright: "Copyright (c) 1984-${YEAR}, Eiffel Software" copying: "[ Duplication and distribution prohibited. May be used only with Eiffel Software products, under terms of user license. Contact Eiffel Software for any other use. ]" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 ]"

Notice that a variable is used for the note keyword (to support the language keyword change from indexing to note). Also a variable for the current year is used in the copyright notice.

Location of license text files

Where you keep your license text files depends upon which method you use to have EiffelStudio retrieve the license text from the files. Generally, license text is retrieved from files in one of three places:

Your project directory

This is the directory that contains your project configuration file, the ".ecf" file).

The Eiffel Software license template directory

This directory is located at: $ISE_EIFFEL/studio/templates/licenses

The Eiffel user files license template directory

This directory is located at: $ISE_USER_FILES/studio/templates/licenses

Methods of retrieval

Designating a license in class source code

You can put a note in the source code of a class which will cause EiffelStudio to search for a corresponding license file and then include the license text from that file. Here's what such a note might look like:

note license_name: "OurLicense"

The license_name term should be placed in the top note clause of the class. (If you include in the bottom note clause, the license_name term itself will be removed when the class license gets replaced.)

In this case, EiffelStudio will search for the file `OurLicense.lic'. It will look first in the Eiffel user files license template directory, then in the Eiffel Software license template directory.

If you look in the Eiffel Software license template directory (or in the image of that directory shown above), you will see several standard license files that are used by Eiffel Software, for example, forum2.lic and eiffelsoftware. Also included is default.lic, which we'll examine later.

You should create your customized license text files in the Eiffel user files license template directory, or in a local project directory as described below.

Using a local project license file

If you use the same license for a particular project, or set of related projects, you can keep the license file in the project directory along with your project ( .ecf ) file. In this case EiffelStudio will include the license text from that license file in each class in the project.

This method has the advantage that it is not necessary to put the license_name term in the source code of classes.

The license text file should be named in one of two ways:

  1. The .lic file name corresponds to the project name (e.g., my_project.lic for my_project.ecf)
  2. The license text file is named license.lic

The second option is convenient if you have a project, a library for instance, that has multiple .ecf files for different purposes.

Even if the license text you want to use is in one of the license template directories, you can use this local method to retrieve that text without including a license_name term in the source code for each class. You do this by building a local license text file and include in it only a reference to the appropriate license name.

For example, suppose that the our license text is in the file OurLicense.lic in the Eiffel user files license template directory. To include the license text in the classes of our_project, the our_project.lic (or license.lic) file would contain this reference:

reference:OurLicense

The default license

As mentioned earlier, the file default.lic exists in the Eiffel Software license template directory. This file is empty ... and you should probably leave it that way.

The license text in default.lic is added to a class when no license_name term is found in the source code and no appropriate license text file exists in the project directory. So, because the default.lic file is empty, no license text is added to classes by default.

However, if you would like to set up a different default license text behavior, you can do so. Just create a default.lic file in the Eiffel user files license template directory, and whenever license text is not found by some other method, the text from your customized default.lic will be included.

cached: 03/19/2024 12:33:09.000 AM