mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-07 15:22:31 +01:00
git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2469 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
138 lines
7.2 KiB
Plaintext
138 lines
7.2 KiB
Plaintext
[[Property: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 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 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 "<code lang="text">.ecf</code>" file).
|
|
|
|
[[Image:Automatic class license project directory]]
|
|
|
|
===The Eiffel Software license template directory===
|
|
This directory is located at: <code lang="text">$ISE_EIFFEL/studio/templates/licenses</code>
|
|
|
|
[[Image:Automatic class license Eiffel Software directory]]
|
|
|
|
===The Eiffel user files license template directory===
|
|
This directory is located at: <code lang="text">$ISE_USER_FILES/studio/templates/licenses</code>
|
|
|
|
[[Image:Automatic class license Eiffel user files directory]]
|
|
|
|
|
|
==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'''.
|
|
|
|
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, <code lang="text">forum2.lic</code> and <code lang="text">eiffelsoftware</code>. Also included is <code lang="text">default.lic</code>, which we'll examine [[#The default license|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 ( <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.
|
|
|
|
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 <code lang="text">license_name</code> 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 <code lang="text">OurLicense.lic</code> in the '''Eiffel user files license template directory'''. To include the license text in the classes of <code lang="text">our_project</code>, the <code lang="text">our_project.lic</code> (or <code lang="text">license.lic</code>) file would contain this reference:
|
|
|
|
<code lang="text">
|
|
reference:OurLicense
|
|
</code>
|
|
|
|
|
|
===The default license===
|
|
|
|
As mentioned earlier, the file <code lang="text">default.lic</code> exists in the '''Eiffel Software license template directory'''. This file is empty ... and you should probably leave it that way.
|
|
|
|
The license text in <code lang="text">default.lic</code> is added to a class when no <code lang="text">license_name</code> term is found in the source code and no appropriate license text file exists in the project directory. So, because the <code lang="text">default.lic</code> 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 <code lang="text">default.lic</code> 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 <code lang="text">default.lic</code> will be included.
|
|
|
|
|
|
|