Skip to content

Commit a418bd2

Browse files
Updated docs with instructions for project source overriding.
Signed-off-by: victor.linroth.sensmetry <victor.linroth@sensmetry.com>
1 parent 68d3143 commit a418bd2

5 files changed

Lines changed: 99 additions & 4 deletions

File tree

docs/src/commands/add.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ Adds IRI and optional version constraint to list of usages in the project
1414
information file `.project.json`. By default this will also update the lockfile
1515
and sync the local environment (creating one if not already present).
1616

17+
When adding a usage with a path or URL the configuration file will be
18+
automatically updated with the appropriate project source override as described
19+
in [Dependencies](../config/dependencies.md). The configuration file updated
20+
will either be the one given with `--config-file` or (if `--no-config` is not
21+
present) the `sysand.toml` at the root of the project. If no configuration file
22+
is given and `--no-config` is set the usage will be added to the project but no
23+
source will be configured so future syncing will not take this into account.
24+
1725
## Arguments
1826

1927
- `<IRI>`: IRI identifying the project to be used
@@ -25,6 +33,10 @@ and sync the local environment (creating one if not already present).
2533

2634
- `--no-lock`: Do not automatically resolve usages (and generate lockfile)
2735
- `--no-sync`: Do not automatically install dependencies
36+
- `--local-src <LOCAL_SRC>`: Path to local interchange project
37+
- `--local-kpar <LOCAL_KPAR>`: Path to local interchange project archive (KPAR)
38+
- `--remote-src <REMOTE_SRC>`: URL to remote interchange project
39+
- `--remote-kpar <REMOTE_KPAR>`: URL to remote interchange project archive (KPAR)
2840

2941
{{#include ./partials/dependency_opts.md}}
3042

docs/src/commands/remove.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Remove usage from project information
44

5+
Will also remove project source overrides from configuration file if available.
6+
57
## Usage
68

79
```sh

docs/src/config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ can be used to specify the path to an additional config file.
2323
## Configurable options
2424

2525
- [Indexes](config/indexes.md)
26+
- [Dependencies](config/dependencies.md)

docs/src/config/dependencies.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Dependencies
2+
3+
Sometimes you may wish to use a project that isn't resolvable through an
4+
available index or you want to override the dependency resolution for other
5+
reasons. In any case you can do this by adding the appropriate IRI and `Source`
6+
to a `project` entry in the `sysand.toml` configuration file at the root of
7+
your project. This follows the same structure as found in the lockfile, where
8+
`identifiers` are given as a list of IRI:s and `sources` are a list of sources.
9+
A project may have multiple identifiers in case it is referred to differently
10+
by different projects, and multiple sources where the additional ones after the
11+
first serve as backups in case the previous ones fail to resolve. Note that
12+
these should be sources of the exact same project as determined by it's
13+
checksum, as otherwise you are likely to run into problems when syncing against
14+
a lockfile.
15+
16+
Below we describe we describe how add overriding sources directly to the
17+
configuration file, but it is also possible to do through the command line
18+
interface with the [`sysand add`](../commands/add.md) command.
19+
20+
## Local projects
21+
22+
To specify the source of a project that you have locally in a directory
23+
`./path/to/project` by the identifier `urn:kpar:my-project`, is done by adding
24+
the following entry to your `sysand.toml`.
25+
26+
```toml
27+
[[project]]
28+
identifiers = [
29+
"urn:kpar:my-project",
30+
]
31+
sources = [
32+
{ src_path = "path/to/project" },
33+
]
34+
```
35+
36+
Note that the path to the project is given by path that is relative to the root
37+
of your project.
38+
39+
## Local KPARs
40+
41+
If you have a project locally available as a compressed KPAR this can be identified
42+
by `urn:kpar:my-kpar-project` by adding
43+
44+
```toml
45+
[[project]]
46+
identifiers = [
47+
"urn:kpar:my-kpar-project",
48+
]
49+
sources = [
50+
{ kpar_path = "path/to/project.kpar" },
51+
]
52+
```
53+
54+
to your `sysand.toml`.
55+
56+
## Remote projects and KPARs
57+
58+
To specify a remote project as a source, add
59+
60+
```toml
61+
[[project]]
62+
identifiers = [
63+
"urn:kpar:remote-project",
64+
]
65+
sources = [
66+
{ remote_src = "https://www.example.com/path/to/project" },
67+
]
68+
```
69+
70+
to your `sysand.toml`, or for a remote KPAR you add
71+
72+
```toml
73+
[[project]]
74+
identifiers = [
75+
"urn:kpar:remote-kpar-project",
76+
]
77+
sources = [
78+
{ remote_kpar = "https://www.example.com/path/to/project.kpar" },
79+
]
80+
```

sysand/src/cli.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,16 +1274,16 @@ pub struct ResolutionOptions {
12741274
#[derive(clap::Args, Debug, Clone)]
12751275
pub struct ProjectSourceOptions {
12761276
/// Path to local interchange project
1277-
#[arg(long, group = "source", help_heading = "Source options")]
1277+
#[arg(long, group = "source")]
12781278
pub local_src: Option<String>,
12791279
/// Path to local interchange project archive (KPAR)
1280-
#[arg(long, group = "source", help_heading = "Source options")]
1280+
#[arg(long, group = "source")]
12811281
pub local_kpar: Option<String>,
12821282
/// URL to remote interchange project
1283-
#[arg(long, group = "source", help_heading = "Source options")]
1283+
#[arg(long, group = "source")]
12841284
pub remote_src: Option<String>,
12851285
/// URL to remote interchange project archive (KPAR)
1286-
#[arg(long, group = "source", help_heading = "Source options")]
1286+
#[arg(long, group = "source")]
12871287
pub remote_kpar: Option<String>,
12881288
}
12891289

0 commit comments

Comments
 (0)