Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/github_actions/actions/checkout-4
Browse files Browse the repository at this point in the history
  • Loading branch information
turboladen authored Apr 10, 2024
2 parents 9afe06d + c4d31a7 commit 74a7d40
Show file tree
Hide file tree
Showing 159 changed files with 4,127 additions and 1,109 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[registries]
crates-registry = { index = "ssh://git@github.com/telus-agcg/crates-registry.git" }
agrian-registry = { index = "ssh://git@github.com/telus-agcg/crates-registry.git" }
14 changes: 14 additions & 0 deletions .github/workflows/security-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,26 @@ on:

env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_AGRIAN_REGISTRY_INDEX: ${{ secrets.AGRIAN_CRATES_REGISTRY }}

jobs:
security-audit:
runs-on: ubuntu-latest
steps:
- name: Setup SSH
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.TELUS_AGCG_MACHINE_USER_KEY }}
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Security audit
uses: actions-rs/audit-check@v1
with:
Expand Down
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[workspace]
members = ["api", "atom_generator", "definition_fetcher", "ffi"]
members = ["crates/*"]
resolver = "2"

[workspace.package]
rust-version = "1.64.0"

[workspace.dependencies]
approx = "0.5"
ffi_common = { version = "0.7", registry = "crates-registry" }
ffi_common = { version = "0.7", registry = "agrian-registry" }
lazy_static = "1.4"
serde = { version = "1.0", features = ["derive"] }
55 changes: 0 additions & 55 deletions api/benches/measurements_benchmarks.rs

This file was deleted.

86 changes: 0 additions & 86 deletions api/src/parser/definition.rs

This file was deleted.

7 changes: 0 additions & 7 deletions api/src/reducible.rs

This file was deleted.

95 changes: 95 additions & 0 deletions bacon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# This is a configuration file for the bacon tool
#
# Bacon repository: https://github.com/Canop/bacon
# Complete help on configuration: https://dystroy.org/bacon/config/
# You can also check bacon's own bacon.toml file
# as an example: https://github.com/Canop/bacon/blob/main/bacon.toml

default_job = "check"

[jobs.check]
command = ["cargo", "check", "--color", "always"]
need_stdout = false

[jobs.check-all]
command = ["cargo", "check", "--all-targets", "--color", "always"]
need_stdout = false

[jobs.clippy]
command = ["cargo", "clippy", "--all-targets", "--color", "always"]
need_stdout = false

# This job lets you run
# - all tests: bacon test
# - a specific test: bacon test -- config::test_default_files
# - the tests of a package: bacon test -- -- -p config
[jobs.test]
command = [
"cargo",
"test",
"--color",
"always",
"--",
"--color",
"always", # see https://github.com/Canop/bacon/issues/124
]
need_stdout = true

[jobs.test-all]
command = [
"cargo",
"test",
"--all-features",
"--color",
"always",
"--",
"--color",
"always", # see https://github.com/Canop/bacon/issues/124
]
need_stdout = true

[jobs.doc]
command = ["cargo", "doc", "--color", "always", "--no-deps"]
need_stdout = false

# If the doc compiles, then it opens in your browser and bacon switches
# to the previous job
[jobs.doc-open]
command = ["cargo", "doc", "--color", "always", "--no-deps", "--open"]
need_stdout = false
on_success = "back" # so that we don't open the browser at each change

# You can run your application and have the result displayed in bacon,
# *if* it makes sense for this crate.
# Don't forget the `--color always` part or the errors won't be
# properly parsed.
# If your program never stops (eg a server), you may set `background`
# to false to have the cargo run output immediately displayed instead
# of waiting for program's end.
[jobs.run]
command = [
"cargo",
"run",
"--color",
"always",
# put launch parameters for your program behind a `--` separator
]
need_stdout = true
allow_warnings = true
background = true

# This parameterized job runs the example of your choice, as soon
# as the code compiles.
# Call it as
# bacon ex -- my-example
[jobs.ex]
command = ["cargo", "run", "--color", "always", "--example"]
need_stdout = true
allow_warnings = true

# You may define here keybindings that would be specific to
# a project, for example a shortcut to launch a specific job.
# Shortcuts to internal functions (scrolling, toggling, etc.)
# should go in your personal global prefs.toml file instead.
[keybindings]
# alt-m = "job:my-job"
38 changes: 37 additions & 1 deletion api/CHANGELOG.md → crates/api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,56 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Added

- PCC-174: Derive `Hash` for `Atom`.
- PLCC-287: `impl num_traits::Inv for Measurement`, `Unit`, and `Term`.
- PLCC-287: `impl num_traits::One for Measurement`.
- PLCC-287: `impl From<&Measurement> for f64`.
- PLCC-287: `impl num_traits::ToPrimitive for Measurement`, `Prefix`.
- PLCC-287: `impl num_traits::FromPrimitive for Measurement`, `Prefix`.
- PLCC-287: `impl num_traits::NumCast for Measurement`.
- PLCC-287: `impl num_traits::Pow<i32> for Measurement`, `Unit`, `Term`.
- PLCC-287: `impl std::ops::Neg for Measurement`.
- Added `Unit::into_terms()` for cases where you only need the `Term`s of the `Unit`.
- Added `unit` constant: `UNITY`
- Added `term` constants: `UNITY`, `UNITY_ARRAY`, and `UNITY_ARRAY_REF`.
- Added `measurement!()` macro for wrapping `Measurement::try_new().unwrap()`.
- Added `crate::term::Factor` type alias for `u32`.
- Added `crate::term::Exponent` type alias for `i32`.
- (Internal) Added constants for many but not all internal `Definition`s.

### Changed

- Rust minimum version updated to `1.64.0`.
- (Internal) Rust Codegen is now using `quote` instead of `handlebars` (the pest parser grammar is
still generated using `handlebars`).
- (Internal) `Definition` is now an enum and is generic over value type `V`.
- (Internal) `Definition` resolution uses `uncreachable!()` for all `Definition` unit strings.
- (Internal) Moved the following modules from `crate::parser::` to `crate::`:
- `annotation_composition`
- `atom`
- `classification`
- `composable`
- `composition`
- `dimension`
- `prefix`
- `property`
- `term`
- `ucum_symbol`
- (Internal) Moved `crate::parser` to `crate::unit::parser`.

### Deprecated

- PLCC-287: Deprecated traits `Invert`, `ToInverse`, `IntoInverse`; implementations of
`num_traits::Inv` cover these now.
- The new `unit::UNITY` constant deprecates `Unit::is_unity()`.
- The new `term::UNITY*` constants deprecate `Term::is_unity()`.

## [0.22.0] — 2022-03-23

### Added

- Implemented `AsRef<Self>` for `Measurement` and `Unit`. Allows for downstream wrapper types to
implement other functionality for all types via the `AsRef` implementation.
- Implemented `TryFrom<&str> for Unit` (which just calls `from_str()`) to allow for downstream
- Implemented `TryFrom<&str> for Unit` (which only calls `from_str()`) to allow for downstream
wrapper implementations around `Unit`.
- New `const` `Composition` methods: `new_dimless()`, `new_any()`.
- New `composition` `const`s for common dimensional compositions.
Expand Down
3 changes: 2 additions & 1 deletion api/Cargo.toml → crates/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ repository = "https://github.com/agrian-inc/wise_units"
license = "MIT"
authors = ["Steve Loveless <steve@agrian.com>"]
edition = "2021"
publish = ["crates-registry"]
publish = ["agrian-registry"]

[dependencies]
approx.workspace = true
ffi_common = { workspace = true, optional = true }
num-traits = "0.2"
pest = "^2.1"
pest_derive = "^2.1"
serde = { workspace = true, optional = true }
Expand Down
4 changes: 2 additions & 2 deletions api/benches/common.rs → crates/api/benches/common.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub static UNIT_STRINGS: [&str; 25] = [
pub const UNIT_STRINGS: [&str; 25] = [
// The unity
"1",
// base, factor*base, factor*base^exponent
Expand Down Expand Up @@ -39,7 +39,7 @@ pub static UNIT_STRINGS: [&str; 25] = [
"10m3/5s2",
];

pub static UNIT_PAIRS: [(&str, &str); 19] = [
pub const UNIT_PAIRS: [(&str, &str); 19] = [
("m", "m"),
("m", "cm"),
("m", "[in_i]"),
Expand Down
Loading

0 comments on commit 74a7d40

Please sign in to comment.