package dune-release

  1. Overview
  2. Docs

Distribution description

Distribution description

type watermark = string * [ `String of string | `Version | `Version_num | `Name | `Vcs of [ `Commit_id ] | `Opam of Fpath.t option * string * string ]

The type for watermarks. A watermark identifier, e.g. "ID" and its definition:

  • `String s, s is the definition.
  • `Name, is the name of package.
  • `Version, is the version of the distribution.
  • `Version_num, is the version of the distribution with a potential leading 'v' or 'V' dropped.
  • `Vcs `Commit_id, is the commit identifier (hash) of the distribution. May be post-fixed by "dirty" in dev package (`Pin) builds.
  • `Opam (file, field, sep), is the values of the field field concatenated with separator sep of the opam file file, expressed relative to the distribution root directory, if file is None this is the package's default opam file, see describe. Not all fields are supported see the value of Opam.File.field_names.

When a file is watermarked with an identifier "ID", any occurence of the sequence %%ID%% in its content is substituted by its definition.

type t

The type for describing distribution creation.

val v : ?watermarks:watermark list -> ?files_to_watermark:(unit -> (Fpath.t list, Rresult.R.msg) Rresult.result) -> ?massage:(unit -> (unit, Rresult.R.msg) Rresult.result) -> ?exclude_paths:(unit -> (Fpath.t list, Rresult.R.msg) Rresult.result) -> unit -> t

distrib ~watermarks ~files_to_watermark ~massage ~exclude_paths () influences the distribution creation process performed by the dune-release tool. See the full details about distribution creation.

In the following the distribution build directory is a private clone of the package's source repository's HEAD when dune-release distrib is invoked.

  • watermarks defines the source watermarks for the distribution, defaults to watermarks.
  • files_to_watermark is invoked in the distribution build directory to determine the files to watermark, defaults to files_to_watermark.
  • massage is invoked in the distribution build directory, after watermarking, but before archiving. It can be used to generate distribution time build artefacts. Defaults to massage.
  • exclude_paths () is invoked in the distribution build directory, after massaging, to determine the paths that are excluded from being added to the distribution archive. Defaults to exclude_paths.
val default_watermarks : watermark list

default_watermarks is the default list of watermarks. It has the following elements:

  • ("NAME", `Name)
  • ("VERSION", `Version)
  • ("VERSION_NUM", `Version_num)
  • ("VCS_COMMIT_ID", `Vcs [`Commit_id])
  • ("PKG_MAINTAINER", `Opam (None, "maintainer", ", "))
  • ("PKG_AUTHORS", `Opam (None, "authors", ", ")
  • ("PKG_HOMEPAGE", `Opam (None, "homepage", " ")
  • ("PKG_ISSUES", `Opam (None, "bug-reports", " ")
  • ("PKG_DOC", `Opam (None, "doc", " "))
  • ("PKG_LICENSE", `Opam (None, "license", ", ")
  • ("PKG_REPO", `Opam (None, "dev-repo", " "))

Prepending to the list overrides default definitions.

val default_files_to_watermark : unit -> (Fpath.t list, Rresult.R.msg) Rresult.result

default_files_to_watermark () is the default list of files to watermark. It is invoked in the distribution build directory and gets the set of tracked files of this directory from which it removes the files that end with .flv, .gif, .ico, .jpeg, .jpg, .mov, .mp3, .mp4, .otf, .pdf, .png, .ttf, .woff.

val default_massage : unit -> (unit, Rresult.R.msg) Rresult.result

default_massage is the default distribution massaging function. It is invoked in the distribution build directory and does nothing.

val default_exclude_paths : unit -> (Fpath.t list, Rresult.R.msg) Rresult.result

default_exclude_paths () is the default list of paths to exclude from the distribution archive. It is invoked in the distribution build directory and returns the following static set of files.

fun () -> Ok [".git"; ".gitignore"; ".gitattributes"; ".hg"; ".hgignore";
              "build"; "Makefile"; "_build"]
val watermarks : t -> watermark list
val files_to_watermark : t -> unit -> (Fpath.t list, Rresult.R.msg) Rresult.result
val massage : t -> unit -> (unit, Rresult.R.msg) Rresult.result
val exclude_paths : t -> unit -> (Fpath.t list, Rresult.R.msg) Rresult.result
val define_watermarks : dry_run:bool -> name:string -> version:string -> opam:Fpath.t -> watermark list -> (string * string) list
val watermark_files : (string * string) list -> Fpath.t list -> (unit, Rresult.R.msg) Rresult.result
OCaml

Innovation. Community. Security.