From 78b3c453561f633455ac3ab1100b1ab3bb96aa23 Mon Sep 17 00:00:00 2001 From: Brian George Date: Wed, 16 Oct 2024 16:23:59 -0400 Subject: [PATCH 1/6] Initial scaffold for rover dev rewrite --- Cargo.toml | 1 + src/command/dev/dev_two/do_dev.rs | 13 +++++++++++++ src/command/dev/dev_two/mod.rs | 1 + src/command/dev/do_dev.rs | 1 + src/command/dev/mod.rs | 3 +++ 5 files changed, 19 insertions(+) create mode 100644 src/command/dev/dev_two/do_dev.rs create mode 100644 src/command/dev/dev_two/mod.rs diff --git a/Cargo.toml b/Cargo.toml index b2577407d..e66054329 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-two = [] ### 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/dev_two/do_dev.rs b/src/command/dev/dev_two/do_dev.rs new file mode 100644 index 000000000..1e51dabc3 --- /dev/null +++ b/src/command/dev/dev_two/do_dev.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/dev/dev_two/mod.rs b/src/command/dev/dev_two/mod.rs new file mode 100644 index 000000000..e8729d0f6 --- /dev/null +++ b/src/command/dev/dev_two/mod.rs @@ -0,0 +1 @@ +pub mod do_dev; diff --git a/src/command/dev/do_dev.rs b/src/command/dev/do_dev.rs index dc07577cc..c2c921b78 100644 --- a/src/command/dev/do_dev.rs +++ b/src/command/dev/do_dev.rs @@ -21,6 +21,7 @@ pub fn log_err_and_continue(err: RoverError) -> RoverError { } impl Dev { + #[cfg(not(feature = "dev-two"))] pub async fn run( &self, override_install_path: Option, diff --git a/src/command/dev/mod.rs b/src/command/dev/mod.rs index 91af3000e..1ccac9536 100644 --- a/src/command/dev/mod.rs +++ b/src/command/dev/mod.rs @@ -14,6 +14,9 @@ use crate::utils::parsers::FileDescriptorType; #[cfg(feature = "composition-js")] mod compose; +#[cfg(feature = "dev-two", feature = "composition-js")] +mod dev_two; + #[cfg(feature = "composition-js")] mod do_dev; From ecd880831cb63925f3104a7226fc90bc8ca8227c Mon Sep 17 00:00:00 2001 From: Brian George Date: Wed, 16 Oct 2024 17:01:37 -0400 Subject: [PATCH 2/6] Test --- Cargo.toml | 2 +- src/command/dev/dev_two/mod.rs | 1 - src/command/dev/{ => legacy}/compose.rs | 2 +- src/command/dev/{ => legacy}/do_dev.rs | 4 +- src/command/dev/{ => legacy}/introspect.rs | 2 +- src/command/dev/legacy/mod.rs | 30 ++++++++++++++ src/command/dev/{ => legacy}/netstat.rs | 2 +- src/command/dev/{ => legacy}/no_dev.rs | 0 .../{ => legacy}/protocol/follower/message.rs | 2 +- .../protocol/follower/messenger.rs | 2 +- .../dev/{ => legacy}/protocol/follower/mod.rs | 0 .../dev/{ => legacy}/protocol/leader.rs | 8 ++-- src/command/dev/{ => legacy}/protocol/mod.rs | 0 .../dev/{ => legacy}/protocol/socket.rs | 0 .../dev/{ => legacy}/protocol/types.rs | 0 .../dev/{ => legacy}/router/command.rs | 2 +- src/command/dev/{ => legacy}/router/config.rs | 2 +- src/command/dev/{ => legacy}/router/mod.rs | 0 src/command/dev/{ => legacy}/router/runner.rs | 6 ++- src/command/dev/{ => legacy}/schema.rs | 7 +++- src/command/dev/{ => legacy}/watcher.rs | 2 +- src/command/dev/mod.rs | 39 +++---------------- .../dev/{dev_two/do_dev.rs => next/mod.rs} | 4 +- 23 files changed, 62 insertions(+), 55 deletions(-) delete mode 100644 src/command/dev/dev_two/mod.rs rename src/command/dev/{ => legacy}/compose.rs (98%) rename src/command/dev/{ => legacy}/do_dev.rs (98%) rename src/command/dev/{ => legacy}/introspect.rs (98%) create mode 100644 src/command/dev/legacy/mod.rs rename src/command/dev/{ => legacy}/netstat.rs (97%) rename src/command/dev/{ => legacy}/no_dev.rs (100%) rename src/command/dev/{ => legacy}/protocol/follower/message.rs (98%) rename src/command/dev/{ => legacy}/protocol/follower/messenger.rs (99%) rename src/command/dev/{ => legacy}/protocol/follower/mod.rs (100%) rename src/command/dev/{ => legacy}/protocol/leader.rs (99%) rename src/command/dev/{ => legacy}/protocol/mod.rs (100%) rename src/command/dev/{ => legacy}/protocol/socket.rs (100%) rename src/command/dev/{ => legacy}/protocol/types.rs (100%) rename src/command/dev/{ => legacy}/router/command.rs (98%) rename src/command/dev/{ => legacy}/router/config.rs (99%) rename src/command/dev/{ => legacy}/router/mod.rs (100%) rename src/command/dev/{ => legacy}/router/runner.rs (99%) rename src/command/dev/{ => legacy}/schema.rs (97%) rename src/command/dev/{ => legacy}/watcher.rs (99%) rename src/command/dev/{dev_two/do_dev.rs => next/mod.rs} (69%) diff --git a/Cargo.toml b/Cargo.toml index e66054329..cc5484a89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +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-two = [] +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/dev_two/mod.rs b/src/command/dev/dev_two/mod.rs deleted file mode 100644 index e8729d0f6..000000000 --- a/src/command/dev/dev_two/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod do_dev; 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 c2c921b78..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(); @@ -21,7 +20,6 @@ pub fn log_err_and_continue(err: RoverError) -> RoverError { } impl Dev { - #[cfg(not(feature = "dev-two"))] pub async fn run( &self, override_install_path: Option, 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..4f826b52e --- /dev/null +++ b/src/command/dev/legacy/mod.rs @@ -0,0 +1,30 @@ +#[cfg(feature = "composition-js")] +mod compose; + +#[cfg(all(feature = "dev-next", feature = "composition-js"))] +mod next; + +#[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 100% rename from src/command/dev/no_dev.rs rename to src/command/dev/legacy/no_dev.rs 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 99% rename from src/command/dev/router/config.rs rename to src/command/dev/legacy/router/config.rs index fe2b6b828..cd094af69 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, }; 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 1ccac9536..68a922ade 100644 --- a/src/command/dev/mod.rs +++ b/src/command/dev/mod.rs @@ -4,42 +4,15 @@ 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 = "dev-two", feature = "composition-js")] -mod dev_two; - -#[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::{PluginOpts, OptionalSubgraphOpts}, utils::parsers::FileDescriptorType}; -#[cfg(feature = "composition-js")] -mod watcher; +#[cfg(feature = "dev-next")] +pub mod next; +#[cfg(not(feature = "dev-next"))] +pub mod legacy; #[derive(Debug, Serialize, Parser)] pub struct Dev { diff --git a/src/command/dev/dev_two/do_dev.rs b/src/command/dev/next/mod.rs similarity index 69% rename from src/command/dev/dev_two/do_dev.rs rename to src/command/dev/next/mod.rs index 1e51dabc3..e29a9a05c 100644 --- a/src/command/dev/dev_two/do_dev.rs +++ b/src/command/dev/next/mod.rs @@ -5,8 +5,8 @@ use crate::{command::Dev, utils::client::StudioClientConfig, RoverOutput, RoverR impl Dev { pub async fn run( &self, - override_install_path: Option, - client_config: StudioClientConfig, + _override_install_path: Option, + _client_config: StudioClientConfig, ) -> RoverResult { todo!() } From e053b9a0e25fb85187611df565d796799ad33ab8 Mon Sep 17 00:00:00 2001 From: Brian George Date: Wed, 16 Oct 2024 17:03:34 -0400 Subject: [PATCH 3/6] Update --- src/command/dev/legacy/router/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command/dev/legacy/router/config.rs b/src/command/dev/legacy/router/config.rs index cd094af69..7f0305a09 100644 --- a/src/command/dev/legacy/router/config.rs +++ b/src/command/dev/legacy/router/config.rs @@ -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"))] From dd3479c8b629799f60302ffde261949da278c8ee Mon Sep 17 00:00:00 2001 From: Brian George Date: Wed, 16 Oct 2024 17:15:38 -0400 Subject: [PATCH 4/6] Fix lint errors --- src/command/dev/legacy/no_dev.rs | 6 ++++-- src/command/graph/mod.rs | 1 + src/command/subgraph/mod.rs | 1 + src/command/supergraph/compose/do_compose.rs | 5 ++++- src/options/compose.rs | 4 ++-- src/options/subgraph.rs | 15 ++++++++------- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/command/dev/legacy/no_dev.rs b/src/command/dev/legacy/no_dev.rs index 81cb46b09..4a3902478 100644 --- a/src/command/dev/legacy/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/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 { From f4ea2781fec4a89a4be9484d6fcc29fb72e5e0ee Mon Sep 17 00:00:00 2001 From: Brian George Date: Wed, 16 Oct 2024 17:26:25 -0400 Subject: [PATCH 5/6] Remove `mod next` from `legacy` --- src/command/dev/legacy/mod.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/command/dev/legacy/mod.rs b/src/command/dev/legacy/mod.rs index 4f826b52e..234fc6ddf 100644 --- a/src/command/dev/legacy/mod.rs +++ b/src/command/dev/legacy/mod.rs @@ -1,9 +1,6 @@ #[cfg(feature = "composition-js")] mod compose; -#[cfg(all(feature = "dev-next", feature = "composition-js"))] -mod next; - #[cfg(feature = "composition-js")] mod do_dev; @@ -27,4 +24,3 @@ mod no_dev; #[cfg(feature = "composition-js")] mod watcher; - From de023e19f2314a75d164d638eae9dd8881eb34b2 Mon Sep 17 00:00:00 2001 From: Brian George Date: Wed, 16 Oct 2024 17:36:24 -0400 Subject: [PATCH 6/6] Fix linter --- src/command/dev/mod.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/command/dev/mod.rs b/src/command/dev/mod.rs index 68a922ade..c862cad28 100644 --- a/src/command/dev/mod.rs +++ b/src/command/dev/mod.rs @@ -7,12 +7,15 @@ use derive_getters::Getters; use rover_client::shared::GraphRef; use serde::Serialize; -use crate::{options::{PluginOpts, OptionalSubgraphOpts}, utils::parsers::FileDescriptorType}; +use crate::{ + options::{OptionalSubgraphOpts, PluginOpts}, + utils::parsers::FileDescriptorType, +}; -#[cfg(feature = "dev-next")] -pub mod next; #[cfg(not(feature = "dev-next"))] pub mod legacy; +#[cfg(feature = "dev-next")] +pub mod next; #[derive(Debug, Serialize, Parser)] pub struct Dev {