Skip to content

Commit

Permalink
rename src/ to lib/
Browse files Browse the repository at this point in the history
  • Loading branch information
drmorr0 committed Mar 13, 2024
1 parent 6419975 commit 789fdaf
Show file tree
Hide file tree
Showing 59 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ comment_width = 100
condense_wildcard_suffixes = true
fn_call_width = 100
group_imports = "StdExternalCrate"
ignore = ["src/metrics/api"]
ignore = ["lib/metrics/api"]
imports_layout = "Vertical"
imports_granularity = "Module"
match_block_trailing_comma = true
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ path = "tracer/main.rs"

[lib]
name = "simkube"
path = "src/lib.rs"
path = "lib/lib.rs"

[profile.dev.package."*"]
debug = false
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ cover:
--ignore '/*' \
--ignore '*/tests/*' \
--ignore '*_test.rs' \
--ignore 'src/api/v1/*' \
--ignore 'src/metrics/api/*' \
--ignore 'src/testutils/*' \
--ignore 'lib/api/v1/*' \
--ignore 'lib/metrics/api/*' \
--ignore 'lib/testutils/*' \
--ignore '.build/*' \
--excl-line '#\[derive' \
--excl-start '#\[cfg\((test|feature = "testutils")'
Expand Down
6 changes: 3 additions & 3 deletions docs/dev/api_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ template: docs.html

## SimKube Custom Resource Definition changes

The Simulation CRD is auto-generated from the Rust structs in `./src/api/v1/(simulations|simulation_roots).rs`
The Simulation CRD is auto-generated from the Rust structs in `./lib/api/v1/(simulations|simulation_roots).rs`
If these structs change, you will need to regenerate the CRD yaml by running `make crd`; the resulting CRDs are stored
in `./k8s/raw/`. A pre-commit check as well as a GitHub action will complain if you have not updated the CRD yaml
before committing.
Expand All @@ -20,8 +20,8 @@ specification in `./api/v1/simkube.yml`. I haven't _yet_ figured out how to wir
from this file. This process is currently quite manual. The steps look something like the following:

1. `make api`
2. In `src/api/v1/*.rs`, add `use super::*` to the top of each generated file
3. In `src/api/v1/*.rs`, replace all the k8s-generated types with the correct imports from `k8s-openapi`.
2. In `lib/api/v1/*.rs`, add `use super::*` to the top of each generated file
3. In `lib/api/v1/*.rs`, replace all the k8s-generated types with the correct imports from `k8s-openapi`.

Once you've made all of these changes, you will need to check the diff quite carefully to ensure that nothing is broken.

Expand Down
8 changes: 4 additions & 4 deletions docs/dev/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ The SimKube repo is organized as follows:
/driver - Rust code for the `sk-driver` Simulation runner
/images - Dockerfiles for all components
/k8s - 🔥Config Python scripts for Kubernetes manifest generation
/src - shared library code
/lib - shared library code
/tracer - Rust code for the `sk-tracer` Kubernetes object
```

In general, code that is specific to a single artifact should go in the subdirectory for that artifact, but code that
needs to be shared between multiple artifacts should go in either `src/`.
needs to be shared between multiple artifacts should go in either `lib/`.

> [!NOTE]
> If you are planning to make changes to the API (either the Custom Resource Definition or the SimKube API), please read
Expand Down Expand Up @@ -144,7 +144,7 @@ builds.

### Writing new tests

There is a suite of utility functions for tests in `src/testutils` that provide additional fixtures and helper
There is a suite of utility functions for tests in `lib/testutils` that provide additional fixtures and helper
functions for writing tests. Feel free to add more utilities in here if it would be helpful.

Tests should in most cases be put into a separate submodule called `tests` and included with a
Expand All @@ -156,7 +156,7 @@ mod tests;

block at the bottom of the main module.

In order to make `src/testutils` accessible outside the `src/` crate, they are not included with `#[cfg(test)]`, but
In order to make `lib/testutils` accessible outside the `lib/` crate, they are not included with `#[cfg(test)]`, but
instead with an optional `testutils` feature.

## Making a PR
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 789fdaf

Please sign in to comment.