michael@0: .. _jar_manifests: michael@0: michael@0: ============= michael@0: JAR Manifests michael@0: ============= michael@0: michael@0: JAR Manifests are plaintext files in the tree that are used to package chrome michael@0: files into the correct JARs, and create michael@0: `Chrome Registration `_ michael@0: manifests. JAR Manifests are commonly named ``jar.mn``. They are michael@0: declared in ``moz.build`` files using the ``JAR_MANIFESTS`` variable. michael@0: michael@0: ``jar.mn`` files are automatically processed by the build system when building a michael@0: source directory that contains one. The ``jar``.mn is run through the michael@0: :ref:`preprocessor` before being passed to the manifest processor. In order to michael@0: have ``@variables@`` expanded (such as ``@AB_CD@``) throughout the file, add michael@0: the line ``#filter substitution`` at the top of your ``jar.mn`` file. michael@0: michael@0: The format of a jar.mn is fairly simple; it consists of a heading specifying michael@0: which JAR file is being packaged, followed by indented lines listing files and michael@0: chrome registration instructions. michael@0: michael@0: To see a simple ``jar.mn`` file at work, see ``toolkit/profile/jar.mn``. A much michael@0: more complex ``jar.mn`` is at ``toolkit/locales/jar.mn``. michael@0: michael@0: Shipping Chrome Files michael@0: ===================== michael@0: michael@0: To ship chrome files in a JAR, an indented line indicates a file to be packaged:: michael@0: michael@0: .jar: michael@0: path/in/jar/file_name.xul (source/tree/location/file_name.xul) michael@0: michael@0: The source tree location may also be an *absolute* path (taken from the michael@0: top of the source tree:: michael@0: michael@0: path/in/jar/file_name.xul (/path/in/sourcetree/file_name.xul) michael@0: michael@0: An asterisk marker (``*``) at the beginning of the line indicates that the michael@0: file should be processed by the :ref:`preprocessor` before being packaged:: michael@0: michael@0: * path/in/jar/preprocessed.xul (source/tree/location/file_name.xul) michael@0: michael@0: A plus marker (``+``) at the beginning of the line indicates that the file michael@0: should replace an existing file, even if the source file's timestamp isn't michael@0: newer than the existing file:: michael@0: michael@0: + path/in/jar/file_name.xul (source/tree/location/my_file_name.xul) michael@0: michael@0: Preprocessed files always replace existing files, to ensure that changes in michael@0: ``#expand`` or ``#include`` directives are picked up, so ``+`` and ``*`` are michael@0: equivalent. michael@0: michael@0: There is a special source-directory format for localized files (note the michael@0: percent sign in the source file location): this format reads ``localized.dtd`` michael@0: from the ``en-US`` directory if building an English version, and reads the michael@0: file from the alternate localization source tree michael@0: ``/l10n//path/localized.dtd`` if building a localized version:: michael@0: michael@0: locale/path/localized.dtd (%localized/path/localized.dtd) michael@0: michael@0: Register Chrome michael@0: =============== michael@0: michael@0: `Chrome Registration `_ michael@0: instructions are marked with a percent sign (``%``) at the beginning of the michael@0: line, and must be part of the definition of a JAR file. Any additional percents michael@0: signs are replaced with an appropriate relative URL of the JAR file being michael@0: packaged:: michael@0: michael@0: % content global %path/in/jar/ michael@0: % overlay chrome://blah/content/blah.xul chrome://foo/content/overlay.xul michael@0: michael@0: There are two possible locations for a manifest file. If the chrome is being michael@0: built into a standalone application, the ``jar.mn`` processor creates a michael@0: ``.manifest`` next to the JAR file itself. This is the default michael@0: behavior. michael@0: michael@0: If the build specifies ``USE_EXTENSION_MANIFEST = 1``, the ``jar.mn`` processor michael@0: creates a single ``chrome.manifest`` file suitable for registering chrome as michael@0: an extension.