Files
eiffel-org/documentation/current/eiffelstudio/eiffelstudio-guided-tour/using-automatic-class-licensing.wiki
halw 3503f5ef9e Author:halw
Date:2010-01-07T22:55:13.000000Z


git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@387 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
2010-01-07 22:55:13 +00:00

110 lines
5.3 KiB
Plaintext

[[Property:title|Automatic class licensing (ES GT Beta)]]
[[Property:link_title|Using automatic class licensing]]
[[Property:weight|2]]
[[Property:uuid|3abb5fc8-b5e5-2d25-fcac-72929abba0a7]]
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 ( <code lang="text">.lic</code> ) to use. If such a file is found, then EiffelStudio includes the contents of that file as an ending <code>note</code> part in your class. Here's the text of a class that includes an Eiffel Software license:
<code>
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
</code>
==License file format==
License text should appear in a text file with the file type "<code lang="text">.lic</code>". The text should contain the <code>note</code> 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:
<code>
${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
]"
</code>
Notice that a variable is used for the <code>note</code> keyword (to support the language keyword change from <code>indexing</code> to <code>note</code>). 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 the 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 (the directory that contains your project file, the "<code lang="text">.ecf</code>" file).
:# The '''Eiffel Software license template directory''': <code lang="text">$ISE_EIFFEL/studio/templates/licenses</code>
:# The '''Eiffel user files license template directory''': <code lang="text">$ISE_USER_FILES/studio/templates/licenses</code>
==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:
<code>
note
license_name: "OurLicense"
</code>
The <code lang="text">license_name</code> term should be placed in the top <code>note</code> clause of the class. (If you include in the bottom <code>note</code> clause, the <code>license_name</code> term itself will be removed when the class license gets replaced.)
In this case, EiffelStudio will search for the file `<code lang="text">OurLicense.lic</code>'. It will look first in the '''Eiffel user files license template directory''', then in the '''Eiffel Software license template directory'''.
Look in the '''Eiffel Software license template directory''' and you will see several standard license files, for example, <code lang="text">forum2.lic</code> and <code lang="text">gpl2</code>. Also included is <code lang="text">default.lic</code>, which we'll examine later.
So, if you can use one of the provided license files, they are there. If you need a customized license file, you should create it in the '''Eiffel user files license template directory'''.
===Using a 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 ( <code lang="text">.ecf</code> ) 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 <code lang="text">license_name</code> term in the source code of classes.
The license text file should be named in one of two ways:
:# The <code lang="text">.lic</code> file name corresponds to the project name (e.g., <code lang="text">my_project.lic</code> for <code lang="text">my_project.ecf</code>)
:# The license text file is named <code lang="text">license.lic</code>
The second option is convenient if you have a project, a library for instance, that has multiple <code lang="text">.ecf</code> files for different purposes.