Skip to content

Commit 45491d2

Browse files
committed
Rearrange so that spin-cli isn't a dependency
Signed-off-by: Ryan Levick <[email protected]>
1 parent 3ce559f commit 45491d2

File tree

14 files changed

+290
-4644
lines changed

14 files changed

+290
-4644
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,12 @@ spin-build = { path = "crates/build" }
4848
spin-common = { path = "crates/common" }
4949
spin-doctor = { path = "crates/doctor" }
5050
spin-expressions = { path = "crates/expressions" }
51-
spin-factors = { path = "crates/factors" }
52-
spin-factors-executor = { path = "crates/factors-executor" }
5351
spin-http = { path = "crates/http" }
5452
spin-loader = { path = "crates/loader" }
5553
spin-locked-app = { path = "crates/locked-app" }
5654
spin-manifest = { path = "crates/manifest" }
5755
spin-oci = { path = "crates/oci" }
5856
spin-plugins = { path = "crates/plugins" }
59-
spin-runtime-config = { path = "crates/runtime-config" }
6057
spin-runtime-factors = { path = "crates/runtime-factors" }
6158
spin-telemetry = { path = "crates/telemetry", features = [
6259
"tracing-log-compat",

crates/runtime-config/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ spin-factor-sqlite = { path = "../factor-sqlite" }
2525
spin-factor-variables = { path = "../factor-variables" }
2626
spin-factor-wasi = { path = "../factor-wasi" }
2727
spin-factors = { path = "../factors" }
28-
spin-runtime-factors = { path = "../runtime-factors" }
2928
spin-sqlite = { path = "../sqlite" }
3029
spin-trigger = { path = "../trigger" }
3130
toml = "0.8"

crates/runtime-config/src/lib.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@ where
160160
}
161161
}
162162

163-
impl From<ResolvedRuntimeConfig<TriggerFactorsRuntimeConfig>> for TriggerFactorsRuntimeConfig {
164-
fn from(value: ResolvedRuntimeConfig<TriggerFactorsRuntimeConfig>) -> Self {
165-
value.runtime_config
166-
}
167-
}
168-
169163
#[derive(Clone, Debug)]
170164
/// Resolves runtime configuration from a TOML file.
171165
pub struct TomlResolver<'a> {
@@ -434,11 +428,3 @@ fn sqlite_config_resolver(
434428
local_database_dir,
435429
))
436430
}
437-
438-
impl TryFrom<TomlRuntimeConfigSource<'_, '_>> for TriggerFactorsRuntimeConfig {
439-
type Error = anyhow::Error;
440-
441-
fn try_from(value: TomlRuntimeConfigSource<'_, '_>) -> Result<Self, Self::Error> {
442-
Self::from_source(value)
443-
}
444-
}

crates/runtime-factors/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ spin-factor-sqlite = { path = "../factor-sqlite" }
2929
spin-factor-variables = { path = "../factor-variables" }
3030
spin-factor-wasi = { path = "../factor-wasi" }
3131
spin-factors = { path = "../factors" }
32+
spin-factors-executor = { path = "../factors-executor" }
33+
spin-runtime-config = { path = "../runtime-config" }
34+
spin-trigger = { path = "../trigger" }
3235
spin-telemetry = { path = "../telemetry" }
3336
terminal = { path = "../terminal" }
37+
toml = "0.8"
3438
tracing = { workspace = true }
3539

3640
[lints]

crates/runtime-factors/src/lib.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
mod runtime_factors;
2+
3+
pub use runtime_factors::FactorsBuilder;
4+
15
use std::path::PathBuf;
26

37
use anyhow::Context as _;
@@ -14,6 +18,7 @@ use spin_factor_sqlite::SqliteFactor;
1418
use spin_factor_variables::VariablesFactor;
1519
use spin_factor_wasi::{spin::SpinFilesMounter, WasiFactor};
1620
use spin_factors::RuntimeFactors;
21+
use spin_runtime_config::{ResolvedRuntimeConfig, TomlRuntimeConfigSource};
1722

1823
#[derive(RuntimeFactors)]
1924
pub struct TriggerFactors {
@@ -99,3 +104,17 @@ pub struct TriggerAppOptions {
99104
#[clap(long = "sqlite")]
100105
pub sqlite_statements: Vec<String>,
101106
}
107+
108+
impl From<ResolvedRuntimeConfig<TriggerFactorsRuntimeConfig>> for TriggerFactorsRuntimeConfig {
109+
fn from(value: ResolvedRuntimeConfig<TriggerFactorsRuntimeConfig>) -> Self {
110+
value.runtime_config
111+
}
112+
}
113+
114+
impl TryFrom<TomlRuntimeConfigSource<'_, '_>> for TriggerFactorsRuntimeConfig {
115+
type Error = anyhow::Error;
116+
117+
fn try_from(value: TomlRuntimeConfigSource<'_, '_>) -> Result<Self, Self::Error> {
118+
Self::from_source(value)
119+
}
120+
}

src/runtime_factors.rs renamed to crates/runtime-factors/src/runtime_factors.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
use std::path::{Path, PathBuf};
22

3+
use super::{TriggerAppOptions, TriggerFactors, TriggerFactorsRuntimeConfig};
4+
35
use anyhow::Context as _;
46
use spin_common::ui::quoted_path;
57
use spin_factors_executor::FactorsExecutor;
68
use spin_runtime_config::ResolvedRuntimeConfig;
7-
use spin_runtime_factors::{TriggerAppOptions, TriggerFactors, TriggerFactorsRuntimeConfig};
89
use spin_trigger::cli::{
910
CommonTriggerOptions, InitialKvSetterHook, KeyValueDefaultStoreSummaryHook,
1011
RuntimeFactorsBuilder, SqlStatementExecutorHook, SqliteDefaultStoreSummaryHook,
1112
StdioLoggingExecutorHooks,
1213
};
1314
use toml::Value;
1415

16+
/// A [`RuntimeFactorsBuilder`] for [`TriggerFactors`].
1517
pub struct FactorsBuilder;
1618

1719
impl RuntimeFactorsBuilder for FactorsBuilder {

0 commit comments

Comments
 (0)