From c6a1f08dabea54babadd1db6e3d0513de6a6a71e Mon Sep 17 00:00:00 2001 From: SleepingShell Date: Mon, 22 May 2023 15:44:10 -0500 Subject: [PATCH] docs on local dependency --- docs/modules_packages_crates/dependencies.md | 26 ++++++++++++++++++- .../modules_packages_crates/dependencies.md | 26 ++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/docs/modules_packages_crates/dependencies.md b/docs/modules_packages_crates/dependencies.md index 503df28..3511f7c 100644 --- a/docs/modules_packages_crates/dependencies.md +++ b/docs/modules_packages_crates/dependencies.md @@ -28,13 +28,37 @@ For example, to add the [ecrecover-noir library](https://github.com/colinnielsen ecrecover = {tag = "v0.2.0", git = "https://github.com/colinnielsen/ecrecover-noir"} ``` +## Specifying a local dependency +You can also specify dependencies that are local to your machine. + +For example, this file structure has a library and binary crate +``` +├── binary_crate +│   ├── Nargo.toml +│   └── src +│   └── main.nr +└── liba + ├── Nargo.toml + └── src + └── lib.nr +``` + +Inside of the binary crate, you can specify: +```toml +# Nargo.toml + +[dependencies] +libA = { path = "../liba" } +``` + ## Importing dependencies You can import a dependency to a Noir file using the following syntax. For example, to import the -ecrecover-noir library referenced above: +ecrecover-noir library and local liba referenced above: ```rust use dep::ecrecover; +use dep::libA; ``` You can also import only the specific parts of dependency that you want to use. For example, diff --git a/versioned_docs/version-0.5.1/modules_packages_crates/dependencies.md b/versioned_docs/version-0.5.1/modules_packages_crates/dependencies.md index 503df28..3511f7c 100644 --- a/versioned_docs/version-0.5.1/modules_packages_crates/dependencies.md +++ b/versioned_docs/version-0.5.1/modules_packages_crates/dependencies.md @@ -28,13 +28,37 @@ For example, to add the [ecrecover-noir library](https://github.com/colinnielsen ecrecover = {tag = "v0.2.0", git = "https://github.com/colinnielsen/ecrecover-noir"} ``` +## Specifying a local dependency +You can also specify dependencies that are local to your machine. + +For example, this file structure has a library and binary crate +``` +├── binary_crate +│   ├── Nargo.toml +│   └── src +│   └── main.nr +└── liba + ├── Nargo.toml + └── src + └── lib.nr +``` + +Inside of the binary crate, you can specify: +```toml +# Nargo.toml + +[dependencies] +libA = { path = "../liba" } +``` + ## Importing dependencies You can import a dependency to a Noir file using the following syntax. For example, to import the -ecrecover-noir library referenced above: +ecrecover-noir library and local liba referenced above: ```rust use dep::ecrecover; +use dep::libA; ``` You can also import only the specific parts of dependency that you want to use. For example,