diff --git a/Cargo.toml b/Cargo.toml index b2577407d..cc5484a89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,7 @@ default = ["composition-js"] # notably, it is disabled for x86_64-unknown-linux-musl builds # because of this GitHub issue: https://github.com/denoland/deno/issues/3711 composition-js = [] +dev-next = [] ### cross-workspace dependencies # these dependencies can be used by any other workspace crate by specifying the dependency like so: diff --git a/src/command/dev/compose.rs b/src/command/dev/legacy/compose.rs similarity index 98% rename from src/command/dev/compose.rs rename to src/command/dev/legacy/compose.rs index 5fd77e0c4..7b682c299 100644 --- a/src/command/dev/compose.rs +++ b/src/command/dev/legacy/compose.rs @@ -6,7 +6,7 @@ use apollo_federation_types::config::{FederationVersion, SupergraphConfig}; use camino::Utf8PathBuf; use rover_std::{errln, Fs}; -use crate::command::dev::do_dev::log_err_and_continue; +use crate::command::dev::legacy::do_dev::log_err_and_continue; use crate::command::supergraph::compose::{Compose, CompositionOutput}; use crate::options::PluginOpts; use crate::utils::client::StudioClientConfig; diff --git a/src/command/dev/do_dev.rs b/src/command/dev/legacy/do_dev.rs similarity index 98% rename from src/command/dev/do_dev.rs rename to src/command/dev/legacy/do_dev.rs index dc07577cc..4563b58ec 100644 --- a/src/command/dev/do_dev.rs +++ b/src/command/dev/legacy/do_dev.rs @@ -6,14 +6,13 @@ use futures::stream::StreamExt; use futures::FutureExt; use rover_std::warnln; -use crate::command::dev::protocol::FollowerMessage; +use crate::command::dev::{legacy::protocol::FollowerMessage, Dev}; use crate::utils::client::StudioClientConfig; use crate::utils::supergraph_config::get_supergraph_config; use crate::{RoverError, RoverOutput, RoverResult}; use super::protocol::{FollowerChannel, FollowerMessenger, LeaderChannel, LeaderSession}; use super::router::RouterConfigHandler; -use super::Dev; pub fn log_err_and_continue(err: RoverError) -> RoverError { let _ = err.print(); diff --git a/src/command/dev/introspect.rs b/src/command/dev/legacy/introspect.rs similarity index 98% rename from src/command/dev/introspect.rs rename to src/command/dev/legacy/introspect.rs index abd8ec970..612c3a799 100644 --- a/src/command/dev/introspect.rs +++ b/src/command/dev/legacy/introspect.rs @@ -4,7 +4,7 @@ use anyhow::anyhow; use reqwest::Client; use rover_std::Style; -use crate::command::dev::protocol::{SubgraphSdl, SubgraphUrl}; +use crate::command::dev::legacy::protocol::{SubgraphSdl, SubgraphUrl}; use crate::command::graph::Introspect as GraphIntrospect; use crate::command::subgraph::Introspect as SubgraphIntrospect; use crate::options::IntrospectOpts; diff --git a/src/command/dev/legacy/mod.rs b/src/command/dev/legacy/mod.rs new file mode 100644 index 000000000..234fc6ddf --- /dev/null +++ b/src/command/dev/legacy/mod.rs @@ -0,0 +1,26 @@ +#[cfg(feature = "composition-js")] +mod compose; + +#[cfg(feature = "composition-js")] +mod do_dev; + +#[cfg(feature = "composition-js")] +mod introspect; + +#[cfg(feature = "composition-js")] +mod protocol; + +#[cfg(feature = "composition-js")] +mod router; + +#[cfg(feature = "composition-js")] +mod schema; + +#[cfg(feature = "composition-js")] +mod netstat; + +#[cfg(not(feature = "composition-js"))] +mod no_dev; + +#[cfg(feature = "composition-js")] +mod watcher; diff --git a/src/command/dev/netstat.rs b/src/command/dev/legacy/netstat.rs similarity index 97% rename from src/command/dev/netstat.rs rename to src/command/dev/legacy/netstat.rs index ba86dd572..a34c63ae1 100644 --- a/src/command/dev/netstat.rs +++ b/src/command/dev/legacy/netstat.rs @@ -5,7 +5,7 @@ use std::{ }; use url::Host; -use crate::command::dev::protocol::SubgraphUrl; +use crate::command::dev::legacy::protocol::SubgraphUrl; pub fn normalize_loopback_urls(url: &SubgraphUrl) -> Vec { let hosts = match url.host() { diff --git a/src/command/dev/no_dev.rs b/src/command/dev/legacy/no_dev.rs similarity index 75% rename from src/command/dev/no_dev.rs rename to src/command/dev/legacy/no_dev.rs index 81cb46b09..4a3902478 100644 --- a/src/command/dev/no_dev.rs +++ b/src/command/dev/legacy/no_dev.rs @@ -1,8 +1,10 @@ -use super::Dev; -use crate::{utils::client::StudioClientConfig, RoverError, RoverOutput, RoverResult}; use anyhow::anyhow; use camino::Utf8PathBuf; +use crate::{ + command::dev::Dev, utils::client::StudioClientConfig, RoverError, RoverOutput, RoverResult, +}; + impl Dev { pub async fn run( &self, diff --git a/src/command/dev/protocol/follower/message.rs b/src/command/dev/legacy/protocol/follower/message.rs similarity index 98% rename from src/command/dev/protocol/follower/message.rs rename to src/command/dev/legacy/protocol/follower/message.rs index 3a72ccb67..46c7a50dc 100644 --- a/src/command/dev/protocol/follower/message.rs +++ b/src/command/dev/legacy/protocol/follower/message.rs @@ -3,7 +3,7 @@ use apollo_federation_types::javascript::SubgraphDefinition; use serde::{Deserialize, Serialize}; use std::fmt::Debug; -use crate::command::dev::protocol::{entry_from_definition, SubgraphEntry, SubgraphName}; +use crate::command::dev::legacy::protocol::{entry_from_definition, SubgraphEntry, SubgraphName}; use crate::{RoverError, RoverResult, PKG_VERSION}; #[derive(Serialize, Deserialize, Debug, Clone)] diff --git a/src/command/dev/protocol/follower/messenger.rs b/src/command/dev/legacy/protocol/follower/messenger.rs similarity index 99% rename from src/command/dev/protocol/follower/messenger.rs rename to src/command/dev/legacy/protocol/follower/messenger.rs index f73360dfb..2cc8eb917 100644 --- a/src/command/dev/protocol/follower/messenger.rs +++ b/src/command/dev/legacy/protocol/follower/messenger.rs @@ -5,7 +5,7 @@ use apollo_federation_types::javascript::SubgraphDefinition; use crossbeam_channel::{Receiver, Sender}; use interprocess::local_socket::traits::Stream; -use crate::command::dev::protocol::{ +use crate::command::dev::legacy::protocol::{ create_socket_name, socket_read, socket_write, FollowerMessage, LeaderMessageKind, SubgraphKeys, SubgraphName, }; diff --git a/src/command/dev/protocol/follower/mod.rs b/src/command/dev/legacy/protocol/follower/mod.rs similarity index 100% rename from src/command/dev/protocol/follower/mod.rs rename to src/command/dev/legacy/protocol/follower/mod.rs diff --git a/src/command/dev/protocol/leader.rs b/src/command/dev/legacy/protocol/leader.rs similarity index 99% rename from src/command/dev/protocol/leader.rs rename to src/command/dev/legacy/protocol/leader.rs index 15f287199..ead916789 100644 --- a/src/command/dev/protocol/leader.rs +++ b/src/command/dev/legacy/protocol/leader.rs @@ -21,9 +21,11 @@ use tracing::{info, warn}; use crate::{ command::dev::{ - compose::ComposeRunner, - do_dev::log_err_and_continue, - router::{RouterConfigHandler, RouterRunner}, + legacy::{ + compose::ComposeRunner, + do_dev::log_err_and_continue, + router::{RouterConfigHandler, RouterRunner}, + }, OVERRIDE_DEV_COMPOSITION_VERSION, }, options::PluginOpts, diff --git a/src/command/dev/protocol/mod.rs b/src/command/dev/legacy/protocol/mod.rs similarity index 100% rename from src/command/dev/protocol/mod.rs rename to src/command/dev/legacy/protocol/mod.rs diff --git a/src/command/dev/protocol/socket.rs b/src/command/dev/legacy/protocol/socket.rs similarity index 100% rename from src/command/dev/protocol/socket.rs rename to src/command/dev/legacy/protocol/socket.rs diff --git a/src/command/dev/protocol/types.rs b/src/command/dev/legacy/protocol/types.rs similarity index 100% rename from src/command/dev/protocol/types.rs rename to src/command/dev/legacy/protocol/types.rs diff --git a/src/command/dev/router/command.rs b/src/command/dev/legacy/router/command.rs similarity index 98% rename from src/command/dev/router/command.rs rename to src/command/dev/legacy/router/command.rs index 9fa0f8e6b..935b9ab92 100644 --- a/src/command/dev/router/command.rs +++ b/src/command/dev/legacy/router/command.rs @@ -11,7 +11,7 @@ use rover_std::warnln; use crate::options::ProfileOpt; use crate::utils::client::StudioClientConfig; -use crate::{command::dev::do_dev::log_err_and_continue, RoverError, RoverResult}; +use crate::{command::dev::legacy::do_dev::log_err_and_continue, RoverError, RoverResult}; #[derive(Debug)] pub struct BackgroundTask { diff --git a/src/command/dev/router/config.rs b/src/command/dev/legacy/router/config.rs similarity index 98% rename from src/command/dev/router/config.rs rename to src/command/dev/legacy/router/config.rs index fe2b6b828..7f0305a09 100644 --- a/src/command/dev/router/config.rs +++ b/src/command/dev/legacy/router/config.rs @@ -13,7 +13,7 @@ use rover_std::{warnln, Fs}; use crate::utils::expansion::expand; use crate::{ - command::dev::{do_dev::log_err_and_continue, SupergraphOpts}, + command::dev::{legacy::do_dev::log_err_and_continue, SupergraphOpts}, RoverError, RoverResult, }; @@ -295,7 +295,7 @@ mod tests { use rstest::rstest; - use crate::command::dev::router::RouterConfigHandler; + use crate::command::dev::legacy::router::RouterConfigHandler; #[rstest] #[cfg_attr(windows, case("\\\\.\\pipe\\supergraph-127.0.0.1:4000.sock"))] diff --git a/src/command/dev/router/mod.rs b/src/command/dev/legacy/router/mod.rs similarity index 100% rename from src/command/dev/router/mod.rs rename to src/command/dev/legacy/router/mod.rs diff --git a/src/command/dev/router/runner.rs b/src/command/dev/legacy/router/runner.rs similarity index 99% rename from src/command/dev/router/runner.rs rename to src/command/dev/legacy/router/runner.rs index 974980ffb..ab15cf53e 100644 --- a/src/command/dev/router/runner.rs +++ b/src/command/dev/legacy/router/runner.rs @@ -11,8 +11,10 @@ use std::net::SocketAddr; use std::time::{Duration, Instant}; use crate::command::dev::{ - do_dev::log_err_and_continue, - router::{BackgroundTask, BackgroundTaskLog}, + legacy::{ + do_dev::log_err_and_continue, + router::{BackgroundTask, BackgroundTaskLog}, + }, OVERRIDE_DEV_ROUTER_VERSION, }; use crate::command::install::Plugin; diff --git a/src/command/dev/schema.rs b/src/command/dev/legacy/schema.rs similarity index 97% rename from src/command/dev/schema.rs rename to src/command/dev/legacy/schema.rs index 999791268..f7f1f1937 100644 --- a/src/command/dev/schema.rs +++ b/src/command/dev/legacy/schema.rs @@ -9,8 +9,11 @@ use rover_client::blocking::StudioClient; use crate::options::ProfileOpt; use crate::{ command::dev::{ - netstat::normalize_loopback_urls, protocol::FollowerMessenger, - watcher::SubgraphSchemaWatcher, SupergraphOpts, + legacy::{ + netstat::normalize_loopback_urls, protocol::FollowerMessenger, + watcher::SubgraphSchemaWatcher, + }, + SupergraphOpts, }, options::OptionalSubgraphOpts, utils::client::StudioClientConfig, diff --git a/src/command/dev/watcher.rs b/src/command/dev/legacy/watcher.rs similarity index 99% rename from src/command/dev/watcher.rs rename to src/command/dev/legacy/watcher.rs index cace81a45..192b43b03 100644 --- a/src/command/dev/watcher.rs +++ b/src/command/dev/legacy/watcher.rs @@ -16,7 +16,7 @@ use rover_client::shared::GraphRef; use rover_std::{errln, Fs}; use crate::{ - command::dev::{ + command::dev::legacy::{ introspect::{IntrospectRunnerKind, UnknownIntrospectRunner}, protocol::{FollowerMessenger, SubgraphKey}, }, diff --git a/src/command/dev/mod.rs b/src/command/dev/mod.rs index 91af3000e..c862cad28 100644 --- a/src/command/dev/mod.rs +++ b/src/command/dev/mod.rs @@ -4,39 +4,18 @@ use apollo_federation_types::config::FederationVersion; use camino::Utf8PathBuf; use clap::Parser; use derive_getters::Getters; -use serde::Serialize; - use rover_client::shared::GraphRef; +use serde::Serialize; -use crate::options::{OptionalSubgraphOpts, PluginOpts}; -use crate::utils::parsers::FileDescriptorType; - -#[cfg(feature = "composition-js")] -mod compose; - -#[cfg(feature = "composition-js")] -mod do_dev; - -#[cfg(feature = "composition-js")] -mod introspect; - -#[cfg(feature = "composition-js")] -mod protocol; - -#[cfg(feature = "composition-js")] -mod router; - -#[cfg(feature = "composition-js")] -mod schema; - -#[cfg(feature = "composition-js")] -mod netstat; - -#[cfg(not(feature = "composition-js"))] -mod no_dev; +use crate::{ + options::{OptionalSubgraphOpts, PluginOpts}, + utils::parsers::FileDescriptorType, +}; -#[cfg(feature = "composition-js")] -mod watcher; +#[cfg(not(feature = "dev-next"))] +pub mod legacy; +#[cfg(feature = "dev-next")] +pub mod next; #[derive(Debug, Serialize, Parser)] pub struct Dev { diff --git a/src/command/dev/next/mod.rs b/src/command/dev/next/mod.rs new file mode 100644 index 000000000..e29a9a05c --- /dev/null +++ b/src/command/dev/next/mod.rs @@ -0,0 +1,13 @@ +use camino::Utf8PathBuf; + +use crate::{command::Dev, utils::client::StudioClientConfig, RoverOutput, RoverResult}; + +impl Dev { + pub async fn run( + &self, + _override_install_path: Option, + _client_config: StudioClientConfig, + ) -> RoverResult { + todo!() + } +} diff --git a/src/command/graph/mod.rs b/src/command/graph/mod.rs index 1de45ba45..90c831777 100644 --- a/src/command/graph/mod.rs +++ b/src/command/graph/mod.rs @@ -6,6 +6,7 @@ mod lint; mod publish; use clap::Parser; +#[cfg(not(feature = "dev-next"))] pub use introspect::Introspect; use serde::Serialize; diff --git a/src/command/subgraph/mod.rs b/src/command/subgraph/mod.rs index 2750f803e..a85b08e92 100644 --- a/src/command/subgraph/mod.rs +++ b/src/command/subgraph/mod.rs @@ -6,6 +6,7 @@ mod lint; mod list; mod publish; +#[cfg(not(feature = "dev-next"))] pub use introspect::Introspect; use clap::Parser; diff --git a/src/command/supergraph/compose/do_compose.rs b/src/command/supergraph/compose/do_compose.rs index d71af4762..7679b1ad9 100644 --- a/src/command/supergraph/compose/do_compose.rs +++ b/src/command/supergraph/compose/do_compose.rs @@ -6,8 +6,10 @@ use std::{ }; use anyhow::{anyhow, Context}; +#[cfg(not(feature = "dev-next"))] +use apollo_federation_types::config::FederationVersion::LatestFedTwo; use apollo_federation_types::{ - config::{FederationVersion, FederationVersion::LatestFedTwo, PluginVersion, SupergraphConfig}, + config::{FederationVersion, PluginVersion, SupergraphConfig}, rover::BuildResult, }; use camino::Utf8PathBuf; @@ -69,6 +71,7 @@ pub struct SupergraphComposeOpts { } impl Compose { + #[cfg(not(feature = "dev-next"))] pub fn new(compose_opts: PluginOpts) -> Self { Self { opts: SupergraphComposeOpts { diff --git a/src/options/compose.rs b/src/options/compose.rs index 6504ab167..9e54a75b2 100644 --- a/src/options/compose.rs +++ b/src/options/compose.rs @@ -4,7 +4,7 @@ use crate::options::LicenseAccepter; use clap::Parser; use serde::Serialize; -#[cfg(feature = "composition-js")] +#[cfg(all(feature = "composition-js", not(feature = "dev-next")))] use crate::{utils::client::StudioClientConfig, RoverResult}; #[derive(Debug, Clone, Serialize, Parser)] @@ -22,7 +22,7 @@ pub struct PluginOpts { pub skip_update: bool, } -#[cfg(feature = "composition-js")] +#[cfg(all(feature = "composition-js", not(feature = "dev-next")))] impl PluginOpts { pub fn prompt_for_license_accept(&self, client_config: &StudioClientConfig) -> RoverResult<()> { self.elv2_license_accepter diff --git a/src/options/subgraph.rs b/src/options/subgraph.rs index d31798713..b41cbd462 100644 --- a/src/options/subgraph.rs +++ b/src/options/subgraph.rs @@ -1,21 +1,22 @@ +#[cfg(not(feature = "dev-next"))] use std::io::{self, IsTerminal}; -#[cfg(feature = "composition-js")] +#[cfg(all(feature = "composition-js", not(feature = "dev-next")))] use anyhow::{Context, Result}; use camino::Utf8PathBuf; use clap::{self, Parser}; -#[cfg(feature = "composition-js")] +#[cfg(all(feature = "composition-js", not(feature = "dev-next")))] use clap::{error::ErrorKind as ClapErrorKind, CommandFactory}; -#[cfg(feature = "composition-js")] +#[cfg(all(feature = "composition-js", not(feature = "dev-next")))] use dialoguer::Input; -#[cfg(feature = "composition-js")] +#[cfg(all(feature = "composition-js", not(feature = "dev-next")))] use reqwest::Url; use serde::{Deserialize, Serialize}; -#[cfg(feature = "composition-js")] +#[cfg(all(feature = "composition-js", not(feature = "dev-next")))] use rover_std::{Fs, Style}; -#[cfg(feature = "composition-js")] +#[cfg(all(feature = "composition-js", not(feature = "dev-next")))] use crate::cli::Rover; #[derive(Debug, Clone, Serialize, Deserialize, Parser)] @@ -69,7 +70,7 @@ pub struct OptionalSubgraphOpts { pub subgraph_retries: u64, } -#[cfg(feature = "composition-js")] +#[cfg(all(feature = "composition-js", not(feature = "dev-next")))] impl OptionalSubgraphOpts { pub fn prompt_for_name(&self) -> Result { if let Some(name) = &self.subgraph_name {