Skip to content

Commit

Permalink
use modern sbt syntax in doc (#1508)
Browse files Browse the repository at this point in the history
Co-authored-by: Muki Seiler <[email protected]>
  • Loading branch information
SethTisue and muuki88 authored Jul 5, 2022
1 parent 6b5fd90 commit 89d9ca8
Show file tree
Hide file tree
Showing 22 changed files with 243 additions and 243 deletions.
32 changes: 16 additions & 16 deletions src/sphinx/archetypes/cheatsheet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The available options are

- Adding via ``bashScriptExtraDefines`` and ``batScriptExtraDefines``
- Providing a ``application.ini`` (JavaApp) or ``etc-default`` (JavaServer) file
- Set ``javaOptions in Universal`` (JavaApp) or ``javaOptions in Linux`` (JavaServer, linux only)
- Set ``Universal / javaOptions`` (JavaApp) or ``Linux / javaOptions`` (JavaServer, linux only)

.. warning:: If you want to change the location of your config keep in mind that the path in
**bashScriptConfigLocation** should either
Expand Down Expand Up @@ -124,7 +124,7 @@ See :ref:`server-app-config`
Setting - javaOptions
---------------------

The last option to set your java options is using ``javaOptions in Universal`` (JavaApp and Server).
The last option to set your java options is using ``Universal / javaOptions`` (JavaApp and Server).
This will generate files according to your archetype. The following table gives you an overview what
you can use and how things will be behave if you mix different options. Options lower in the table
are more specific and will thus override the any previous settings (if allowed).
Expand All @@ -137,8 +137,8 @@ Nil Universal Some(appIniLocation) JavaApp User provid
opts Universal Some(_) JavaApp added creates ``application.ini`` but leaves ``bashScriptConfigLocation`` unchanged
opts Universal None JavaApp added creates ``application.ini`` and sets ``bashScriptConfigLocation``. If ``src/universal/conf/application.ini`` is present it will be overridden
Nil Linux None JavaServer added creates ``etc-default`` and sets ``bashScriptConfigLocation``
opts Linux None JavaServer added creates ``etc-default``, appends ``javaOptions in Linux`` and sets ``bashScriptConfigLocation``
opts Linux Some(_) JavaServer added creates ``etc-default``, appends ``javaOptions in Linux`` and overrides ``bashScriptConfigLocation``
opts Linux None JavaServer added creates ``etc-default``, appends ``Linux / javaOptions`` and sets ``bashScriptConfigLocation``
opts Linux Some(_) JavaServer added creates ``etc-default``, appends ``Linux / javaOptions`` and overrides ``bashScriptConfigLocation``
======== ========= ======================== ========== ======== =======


Expand Down Expand Up @@ -204,21 +204,21 @@ Possible values:

You can use ``${{variable_name}}`` to reference variables when writing your script. The default set of variables is:

* ``author`` - The name of the author; defined by ``maintainer in Linux``.
* ``descr`` - The short description of the service; defined by ``packageSummary in Linux``.
* ``exec`` - The script/binary to execute when starting the service; defined by ``executableScriptName in Linux``.
* ``chdir`` - The working directory for the service; defined by ``defaultLinuxInstallLocation/(packageName in Linux)``.
* ``author`` - The name of the author; defined by ``Linux / maintainer``.
* ``descr`` - The short description of the service; defined by ``Linux / packageSummary``.
* ``exec`` - The script/binary to execute when starting the service; defined by ``Linux / executableScriptName``.
* ``chdir`` - The working directory for the service; defined by ``defaultLinuxInstallLocation/(Linux / packageName)``.
* ``retries`` - The number of times to retry starting the server; defined to be the constant ``0``.
* ``retryTimeout`` - The amount of time to wait before trying to run the server; defined to be the constant ``60``.
* ``app_name`` - The name of the application (linux friendly); defined by ``packageName in Linux``.
* ``app_name`` - The name of the application (linux friendly); defined by ``Linux / packageName``.
* ``version`` - The software version; defined by ``version``.
* ``daemon_user`` - The user that the service should run as; defined by ``daemonUser in Linux``.
* ``daemon_user_uid`` - The user ID of the user that the service should run as; defined by ``daemonUserUid in Linux``.
* ``daemon_group`` - The group of the user that the service should run as; defined by ``daemonGroup in Linux``.
* ``daemon_group_gid`` - The group ID of the group of the user that the service should run as; defined by ``daemonGroupGid in Linux``.
* ``daemon_shell`` - The shell of the user that the service should run as; defined by ``daemonShell in Linux``.
* ``term_timeout`` - The timeout for the service to respond to a TERM signal; defined by ``termTimeout in Linux``, defaults to ``60``.
* ``kill_timeout`` - The timeout for the service to respond to a KILL signal; defined by ``killTimeout in Linux``, defaults to ``30``.
* ``daemon_user`` - The user that the service should run as; defined by ``Linux / daemonUser``.
* ``daemon_user_uid`` - The user ID of the user that the service should run as; defined by ``Linux / daemonUserUid``.
* ``daemon_group`` - The group of the user that the service should run as; defined by ``Linux / daemonGroup``.
* ``daemon_group_gid`` - The group ID of the group of the user that the service should run as; defined by ``Linux / daemonGroupGid``.
* ``daemon_shell`` - The shell of the user that the service should run as; defined by ``Linux / daemonShell``.
* ``term_timeout`` - The timeout for the service to respond to a TERM signal; defined by ``Linux / termTimeout``, defaults to ``60``.
* ``kill_timeout`` - The timeout for the service to respond to a KILL signal; defined by ``Linux / killTimeout``, defaults to ``30``.
* ``start_facilities`` - Intended for the ``Required-Start:`` line in the ``INIT INFO`` block. Its value is automatically generated with respect to the chosen system loader.
* ``stop_facilities`` - Intended for the ``Required-Stop:`` line in the ``INIT INFO`` block. Its value is automatically generated with respect to the chosen system loader.
* ``start_runlevels`` - Intended for the ``Default-Start:`` line in the ``INIT INFO`` block. Its value is automatically generated with respect to the chosen system loader.
Expand Down
6 changes: 3 additions & 3 deletions src/sphinx/archetypes/java_app/customize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ configuration file during execution. You can define the configuration file locat


The configuration path is the path on the **target** system. This means that native-packager needs to process this path
to create a valid ``universal:mapping`` s entry.
to create a valid ``Universal/mapping`` s entry.

* ``${app_home}/../`` is removed
* ``%APP_HOME%`` is removed and ``\`` is being replaced with ``/``
Expand Down Expand Up @@ -59,7 +59,7 @@ You can specify your options via the ``build.sbt``.

.. code-block:: scala
javaOptions in Universal ++= Seq(
Universal / javaOptions ++= Seq(
// -J params will be added as jvm parameters
"-J-Xmx64m",
"-J-Xms64m",
Expand All @@ -75,7 +75,7 @@ You can specify your options via the ``build.sbt``.
For the ``-X`` settings you need to add a suffix ``-J`` so the start script will
recognize these as vm config parameters.

When you use the ``javaOptions in Universal`` sbt-native-packager will generate configuration files
When you use the ``Universal / javaOptions`` sbt-native-packager will generate configuration files
if you haven't set the ``batScriptConfigLocation`` and/or ``bashScriptConfigLocation`` to ``None``.

Via Application.ini
Expand Down
22 changes: 11 additions & 11 deletions src/sphinx/archetypes/java_app/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class with the following setting:

.. code-block:: scala
mainClass in Compile := Some("foo.bar.Main")
Compile / mainClass := Some("foo.bar.Main")
In order to generate launch scripts only for specified ``mainClass``, you will need to discard automatically found main classes:

.. code-block:: scala
discoveredMainClasses in Compile := Seq()
Compile / discoveredMainClasses := Seq()
To create a staging version of your package call

Expand Down Expand Up @@ -75,11 +75,11 @@ java app archetype! For example you can build *zips*, *deb* or *docker* by just
sbt
# create a zip file
> universal:packageBin
> Universal / packageBin
# create a deb file
> debian:packageBin
> Debian / packageBin
# publish a docker image to your local registry
> docker:publishLocal
> Docker / publishLocal
Expand Down Expand Up @@ -167,8 +167,8 @@ Multiple Applications
If you have multiple main classes then the ``JavaAppPackaging`` archetype provides you with two different ways of
generating start scripts.

1. A start script for each entry point. This is the default behaviour, when no ``mainClass in Compile`` is set
2. One start script for the defined ``mainClass in Compile`` and forwarding scripts for all other main classes.
1. A start script for each entry point. This is the default behaviour, when no ``Compile / mainClass`` is set
2. One start script for the defined ``Compile / mainClass`` and forwarding scripts for all other main classes.

.. note:: What does *'forwarder script'* mean?

Expand All @@ -180,7 +180,7 @@ generating start scripts.
Multiple start scripts
----------------------

No configuration is needed. SBT sets ``mainClass in Compile`` automatically to ``None`` if multiple main classes are
No configuration is needed. SBT sets ``Compile / mainClass`` automatically to ``None`` if multiple main classes are
discovered.

**Example:**
Expand All @@ -199,8 +199,8 @@ For two main classes ``com.example.FooMain`` and ``com.example.BarMain`` ``sbt s
Single start script with forwarders
-----------------------------------

Generates a single start script for the defined main class in ``mainClass in Compile`` and forwarding scripts for all
other ``discoveredMainClasses in Compile``. The forwarder scripts call the defined start script and set the ``-main``
Generates a single start script for the defined main class in ``Compile / mainClass`` and forwarding scripts for all
other ``Compile / discoveredMainClasses``. The forwarder scripts call the defined start script and set the ``-main``
parameter to the concrete main class.

The start script name uses the ``executableScriptName`` setting for its name. The forwarder scripts use a simplified
Expand All @@ -214,7 +214,7 @@ The ``build.sbt`` has an explicit main class set.
.. code-block:: scala
name := "my-project"
mainClass in Compile := Some("com.example.FooMain")
Compile / mainClass := Some("com.example.FooMain")
For two main classes ``com.example.FooMain`` and ``com.example.BarMain`` ``sbt stage`` will generate these scripts:

Expand Down
14 changes: 7 additions & 7 deletions src/sphinx/archetypes/java_server/customize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ Customize the daemon user and group for your application with the following sett
.. code-block:: scala
// a different daemon user
daemonUser in Linux := "my-user"
Linux / daemonUser := "my-user"
// if there is an existing one you can specify the uid
daemonUserUid in Linux := Some("123")
Linux / daemonUserUid := Some("123")
// a different daemon group
daemonGroup in Linux := "my-group"
Linux / daemonGroup := "my-group"
// if the group already exists you can specify the uid
daemonGroupGid in Linux := Some("1001")
Linux / daemonGroupGid := Some("1001")
Environment variables
~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -121,7 +121,7 @@ RPM Scriptlets
--------------

RPM puts all scripts into one file. To override or append settings to your
scriptlets use ``maintainerScripts in Rpm`` or these ``RpmConstants._``s:
scriptlets use ``Rpm / maintainerScripts`` or these ``RpmConstants._``s:
``Pre``
%pre scriptlet
Expand Down Expand Up @@ -242,9 +242,9 @@ Linux Replacements
.. attention::
Every replacement corresponds to a single setting or task. For the `linuxScriptReplacements` you need
to override the setting/task in the `in Linux` scope. For example
to override the setting/task in the `Linux` scope. For example

``daemonUser in Linux := "new-user"``
``Linux / daemonUser := "new-user"``

overrides the ``daemon_user`` in the linuxScriptReplacements.

Expand Down
2 changes: 1 addition & 1 deletion src/sphinx/archetypes/systemloaders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ In order to change the location of the systemloader script/config file you need

.. code-block:: scala
defaultLinuxStartScriptLocation in Debian := "/lib/systemd/system"
Debian / defaultLinuxStartScriptLocation := "/lib/systemd/system"
You may need to change these paths according to your distribution. References are
Expand Down
42 changes: 21 additions & 21 deletions src/sphinx/formats/debian.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Build

.. code-block:: bash
sbt debian:packageBin
sbt debian/packageBin
Required Settings
~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -136,9 +136,9 @@ To compress the debian package, override `debianNativeBuildOptions` with

.. code-block:: scala
debianNativeBuildOptions in Debian := Nil // dpkg-deb's default compression (currently xz)
Debian / debianNativeBuildOptions := Nil // dpkg-deb's default compression (currently xz)
debianNativeBuildOptions in Debian := Seq("-Zgzip", "-z3") // gzip compression at level 3
Debian / debianNativeBuildOptions := Seq("-Zgzip", "-z3") // gzip compression at level 3
Note that commit cee091c released in 1.1.1 disables package re-compression by
default. While this works great with tools such as apt and dpkg, un-compressed
Expand Down Expand Up @@ -187,45 +187,45 @@ Settings and Tasks inherited from parent plugins can be scoped with ``Debian``.

.. code-block:: scala
linuxPackageMappings in Debian := linuxPackageMappings.value
Debian / linuxPackageMappings := linuxPackageMappings.value
Settings
--------

Debian requires the following specific settings:

``name in Debian``
``Debian / name``
The name of the package for debian (if different from general linux name).

``version in Debian``
``Debian / version``
The debian-friendly version of the package. Should be of the form ``x.y.z-build-aa``.

``debianPackageConflicts in Debian``
``Debian / debianPackageConflicts``
The list of debian packages that this package conflicts with.

``debianPackageDependencies in Debian``
``Debian / debianPackageDependencies``
The list of debian packages that this package depends on.

``debianPackageProvides in Debian``
``Debian / debianPackageProvides``
The list of debian packages that are provided by this package.

``debianPackageRecommends in Debian``
``Debian / debianPackageRecommends``
The list of debian packages that are recommended to be installed with this package.

``linuxPackageMappings in Debian``
``Debian / linuxPackageMappings``
Debian requires a ``/usr/share/doc/{package name}/changelog.gz`` file that describes
the version changes in this package. These should be appended to the base linux versions.

``maintainerScripts in Debian`` (``debianMaintainerScripts``)
*DEPRECATED* use ``maintainerScripts in Debian`` instead.
``Debian / maintainerScripts`` (``debianMaintainerScripts``)
*DEPRECATED* use ``Debian / maintainerScripts`` instead.
These are the packaging scripts themselves used by ``dpkg-deb`` to build your debian. These
scripts are used when installing/uninstalling a debian, like prerm, postinstall, etc. These scripts
are placed in the ``DEBIAN`` file when building. Some of these files can be autogenerated,
for example when using a package archetype, like server_application. However, any autogenerated file
can be overridden by placing your own files in the ``src/debian/DEBIAN`` directory.

``changelog in Debian``
``Debian / changelog``
This is the changelog used by ``dpkg-genchanges`` to create the .changes file. This will allow you to
upload the debian package to a mirror.

Expand All @@ -235,13 +235,13 @@ Tasks

The Debian support grants the following commands:

``debian:package-bin``
``Debian / package-bin``
Generates the ``.deb`` package for this project.

``debian:lintian``
``Debian / lintian``
Generates the ``.deb`` file and runs the ``lintian`` command to look for issues in the package. Useful for debugging.

``debian:gen-changes``
``Debian / gen-changes``
Generates the ``.changes``, and therefore the ``.deb`` package for this project.


Expand All @@ -258,9 +258,9 @@ This example adds a dependency on java and recommends a git installation.

.. code-block:: scala
debianPackageDependencies in Debian ++= Seq("java2-runtime", "bash (>= 2.05a-11)")
Debian / debianPackageDependencies ++= Seq("java2-runtime", "bash (>= 2.05a-11)")
debianPackageRecommends in Debian += "git"
Debian / debianPackageRecommends += "git"
Hook Actions into the Debian Package Lifecycle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -272,9 +272,9 @@ can add ``preinst`` , ``postinst`` , ``prerm`` and/or ``postrm`` scripts. Just p
.. code-block:: scala
import DebianConstants._
maintainerScripts in Debian := maintainerScriptsAppend((maintainerScripts in Debian).value)(
Debian / maintainerScripts := maintainerScriptsAppend((Debian / maintainerScripts).value)(
Preinst -> "echo 'hello, world'",
Postinst -> s"echo 'installed ${(packageName in Debian).value}'"
Postinst -> s"echo 'installed ${(Debian / packageName).value}'"
)
The helper methods can be found in `MaintainerScriptHelper Scaladocs`_.
Expand Down
Loading

0 comments on commit 89d9ca8

Please sign in to comment.