Skip to content

Commit b47781d

Browse files
committed
Initial version with decent API and documentation
2 parents 1401e6f + 85f6e11 commit b47781d

18 files changed

+151
-194
lines changed

.github/workflows/pull-request.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Pull Request Check
2+
3+
on:
4+
pull_request:
5+
branches: [ dev ]
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Cache
19+
uses: actions/cache@v2
20+
with:
21+
path: |
22+
./target
23+
~/.cargo
24+
key: ${{ runner.os }}-${{ hashFiles('Cargo.toml') }}
25+
restore-keys: ${{ runner.os }}
26+
27+
- name: Build
28+
run: cargo build --verbose
29+
30+
- name: Run tests
31+
run: cargo test --verbose

.github/workflows/main.yml renamed to .github/workflows/push.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
name: Rust
1+
name: Build code, run tests and deploy doc
22

33
on:
44
push:
5-
branches: [ master, dev ]
6-
pull_request:
7-
branches: [ master ]
5+
branches: [ dev ]
86

97
env:
108
CARGO_TERM_COLOR: always
@@ -40,3 +38,4 @@ jobs:
4038
with:
4139
github_token: ${{ secrets.GITHUB_TOKEN }}
4240
publish_dir: ./target/doc
41+
force_orphan: true

Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
[package]
22
name = "pubgrub"
33
version = "0.1.0"
4-
authors = ["Matthieu Pizenberg <[email protected]>"]
4+
authors = ["Matthieu Pizenberg <[email protected]>", "Alex Tokarev <[email protected]>"]
55
edition = "2018"
6+
description = "PubGrub version solving algorithm"
7+
readme = "README.md"
8+
repository = "https://github.com/mpizenberg/pubgrub-rs"
9+
license = "MPL-2.0"
10+
keywords = ["dependency", "pubgrub", "semver", "solver", "version"]
11+
categories = ["algorithms"]
12+
include = ["Cargo.toml", "LICENSE", "README.md", "src/**", "tests/**", "examples/**"]
613

714
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
815

@@ -11,4 +18,3 @@ thiserror = "1.0"
1118

1219
[dev-dependencies]
1320
proptest = "0.10.1"
14-
anyhow = "1.0"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ that satisfy all the constraints of a given project dependencies.
77
In addition, when that is not possible,
88
PubGrub tries to provide a very human-readable and clear
99
explanation as to why that failed.
10-
Below is an example of explanation present in
11-
the introductory blog post about PubGrub
10+
Below is an example of an explanation present in
11+
the introductory blog post about PubGrub.
1212

1313
```txt
1414
Because dropdown >=2.0.0 depends on icons >=2.0.0 and
@@ -65,7 +65,7 @@ An introductory blog post was
6565

6666
The detailed explanation of the algorithm is
6767
[provided on GitHub][github-pubgrub].
68-
The foundation of the algorithm is based on ASP (Answer Set Programming)
68+
The foundation of the algorithm is based on ASP (Answer Set Programming),
6969
and a book called
7070
"[Answer Set Solving in Practice][potassco-book]"
7171
by Martin Gebser, Roland Kaminski, Benjamin Kaufmann and Torsten Schaub.

examples/branching_error_reporting.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
use pubgrub::cache::{Cache, SimpleCache};
21
use pubgrub::error::PubGrubError;
32
use pubgrub::range::Range;
43
use pubgrub::report::{DefaultStringReporter, Reporter};
5-
use pubgrub::solver::Solver;
4+
use pubgrub::solver::{OfflineSolver, Solver};
65
use pubgrub::version::SemanticVersion;
76

87
// https://github.com/dart-lang/pub/blob/master/doc/solver.md#branching-error-reporting
98
fn main() {
10-
let mut solver = SimpleCache::<&str, SemanticVersion>::new();
9+
let mut solver = OfflineSolver::<&str, SemanticVersion>::new();
1110
#[rustfmt::skip]
1211
// root 1.0.0 depends on foo ^1.0.0
1312
solver.add_dependencies(

examples/doc_interface.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use pubgrub::cache::{Cache, SimpleCache};
21
use pubgrub::range::Range;
3-
use pubgrub::solver::Solver;
2+
use pubgrub::solver::{OfflineSolver, Solver};
43
use pubgrub::version::NumberVersion;
54

65
// `root` depends on `menu` and `icons`
@@ -9,7 +8,7 @@ use pubgrub::version::NumberVersion;
98
// `icons` has no dependency
109
#[rustfmt::skip]
1110
fn main() {
12-
let mut solver = SimpleCache::<&str, NumberVersion>::new();
11+
let mut solver = OfflineSolver::<&str, NumberVersion>::new();
1312
solver.add_dependencies(
1413
"root", 1, vec![("menu", Range::any()), ("icons", Range::any())],
1514
);

examples/doc_interface_error.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
use pubgrub::cache::{Cache, SimpleCache};
21
use pubgrub::error::PubGrubError;
32
use pubgrub::range::Range;
43
use pubgrub::report::{DefaultStringReporter, Reporter};
5-
use pubgrub::solver::Solver;
4+
use pubgrub::solver::{OfflineSolver, Solver};
65
use pubgrub::version::SemanticVersion;
76

87
// `root` depends on `menu`, `icons 1.0.0` and `intl 5.0.0`
@@ -14,7 +13,7 @@ use pubgrub::version::SemanticVersion;
1413
// `intl` has no dependency
1514
#[rustfmt::skip]
1615
fn main() {
17-
let mut solver = SimpleCache::<&str, SemanticVersion>::new();
16+
let mut solver = OfflineSolver::<&str, SemanticVersion>::new();
1817
// Direct dependencies: menu and icons.
1918
solver.add_dependencies("root", (1, 0, 0), vec![
2019
("menu", Range::any()),

examples/doc_interface_semantic.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
use pubgrub::cache::{Cache, SimpleCache};
21
use pubgrub::error::PubGrubError;
32
use pubgrub::range::Range;
43
use pubgrub::report::{DefaultStringReporter, Reporter};
5-
use pubgrub::solver::Solver;
4+
use pubgrub::solver::{OfflineSolver, Solver};
65
use pubgrub::version::SemanticVersion;
76

87
// `root` depends on `menu` and `icons 1.0.0`
@@ -13,7 +12,7 @@ use pubgrub::version::SemanticVersion;
1312
// `icons` has no dependency
1413
#[rustfmt::skip]
1514
fn main() {
16-
let mut solver = SimpleCache::<&str, SemanticVersion>::new();
15+
let mut solver = OfflineSolver::<&str, SemanticVersion>::new();
1716
// Direct dependencies: menu and icons.
1817
solver.add_dependencies("root", (1, 0, 0), vec![
1918
("menu", Range::any()),

examples/linear_error_reporting.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
use pubgrub::cache::{Cache, SimpleCache};
21
use pubgrub::error::PubGrubError;
32
use pubgrub::range::Range;
43
use pubgrub::report::{DefaultStringReporter, Reporter};
5-
use pubgrub::solver::Solver;
4+
use pubgrub::solver::{OfflineSolver, Solver};
65
use pubgrub::version::SemanticVersion;
76

87
// https://github.com/dart-lang/pub/blob/master/doc/solver.md#linear-error-reporting
98
fn main() {
10-
let mut solver = SimpleCache::<&str, SemanticVersion>::new();
9+
let mut solver = OfflineSolver::<&str, SemanticVersion>::new();
1110
#[rustfmt::skip]
1211
// root 1.0.0 depends on foo ^1.0.0 and baz ^1.0.0
1312
solver.add_dependencies(

src/cache.rs

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)