Skip to content

Latest commit

 

History

History
72 lines (48 loc) · 4.71 KB

repo_rules.md

File metadata and controls

72 lines (48 loc) · 4.71 KB

nimble_install

load("@rules_nim//nim:nimble.bzl", "nimble_install")

nimble_install(name, nimble_attrs, nimble_file, pkgs_dir_prefix, quiet, repo_mapping)

Runs nimble install on nimble_file attribute which brings dependencies into the scope. CAUTION: Such a simple wrapper around nimble invocation comes with a cost of omitting Bazel's repository cache. Therefore it is suggested to generate nimble.lock file and then use nimble_lock repository rule (with the appropriate nimble_lock_update target). See numericalnim e2e example.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this repository. Name required
nimble_attrs - List of strings optional ["--noLockFile"]
nimble_file - Label optional None
pkgs_dir_prefix - String optional "pkgs2"
quiet - Boolean optional False
repo_mapping In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function).
Dictionary: String -> String optional

nimble_lock

load("@rules_nim//nim:nimble.bzl", "nimble_lock")

nimble_lock(name, lock_file, repo_mapping)

Downloads dependencies from the nimble.lock file.

To speed up dependency download process, user can utilize Bazel repository cache. This repo rule creates a file nimble.bazel.lock which content is essentially equal to the passed nimble.lock one, with the except that it puts Bazel's integrity hash into the checksums scopes of nimble.lock file. nimble supports only sha1 but this rule downloads repositories through direct links of supported (["https://github.com", "https://gitlab.com"]) git hosting services, through Bazel's rctx.download_and_extract API.

User can utilize nimble_lock_update rule which updates nimble.lock file with the expected integrity values under checksums scopes. See numericalnim e2e example.

load("@rules_nim//nim:defs.bzl", "nimble_lock_update")

nimble_lock_update(
    name = "update",
    nimble_lock_file = "nimble.lock",
    nimble_repo = "@nimble",
)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this repository. Name required
lock_file The nimble lock file. Label required
repo_mapping In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function).
Dictionary: String -> String optional