Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dotdat committed Sep 17, 2024
1 parent 34ab027 commit b14c615
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 67 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ crossbeam-channel = { workspace = true }
ctrlc = { workspace = true }
derive-getters = { workspace = true }
dialoguer = { workspace = true }
derive-getters = { workspace = true }
flate2 = { workspace = true }
futures = { workspace = true }
graphql_client = { workspace = true }
Expand Down
29 changes: 6 additions & 23 deletions src/composition/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ use camino::Utf8PathBuf;
use derive_getters::Getters;
use events::CompositionEvent;
use futures::{stream::BoxStream, StreamExt};
use supergraph::{binary::SupergraphBinary, config::ResolvedSupergraphConfig};
use supergraph::binary::SupergraphBinary;
use tokio::task::AbortHandle;
use tokio_stream::wrappers::UnboundedReceiverStream;
use watchers::{
subtask::{Subtask, SubtaskHandleUnit, SubtaskRunUnit},
watcher::{router_config::RouterConfigMessage, supergraph_config::SupergraphConfigDiff},
};

use self::supergraph::config::FinalSupergraphConfig;

Check warning on line 19 in src/composition/mod.rs

View workflow job for this annotation

GitHub Actions / Build Rover for macOS x86-64

unused import: `self::supergraph::config::FinalSupergraphConfig`

pub mod events;
pub mod supergraph;

Expand Down Expand Up @@ -108,17 +110,6 @@ struct WatchResultBetterName {
composition_events: UnboundedReceiverStream<CompositionEvent>,
}

fn blah() -> ! {
let (mut supergraph_stream, supergraph_subtask) = Subtask::new(supergraph_config_watcher);
supergraph_subtask.run();

let composition = Composition::new();

composition.with_supergraph_config_events(supergraph_stream);
// do all the rest; like subgraph watchers
composition.watch()
}

// NB: this is where we'll bring it all together to actually watch incoming events from watchers to
// decide whether we need to recompose/etc
impl SubtaskHandleUnit for Composition {
Expand All @@ -142,18 +133,10 @@ impl SubtaskHandleUnit for Composition {
InputEvent::SupergraphConfig(mut events) => {
while let Some(event) = events.next().await {
sender.send(CompositionEvent::Started);
let supergraph_config = event.current();

let resolved_supergraph_config = ResolvedSupergraphConfig {
inner: supergraph_config.clone(),
path: event.path().clone(),
};
let current_supergraph_config = event.current();

Check warning on line 136 in src/composition/mod.rs

View workflow job for this annotation

GitHub Actions / Build Rover for macOS x86-64

unused variable: `current_supergraph_config`

match self
.supergraph_binary
.compose(resolved_supergraph_config)
.await
{
// TODO: write current_supergraph_config to a path
match self.supergraph_binary.compose(&Utf8PathBuf::new()).await {
Ok(success) => sender.send(CompositionEvent::Success(success)),
Err(failure) => sender.send(CompositionEvent::Error(failure)),
};
Expand Down
12 changes: 2 additions & 10 deletions src/composition/supergraph/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,9 @@ impl SupergraphBinary {

pub async fn compose(
&self,
exec: &impl ExecCommand,
read_file: &impl ReadFile,
supergraph_config: FinalSupergraphConfig,
output_target: OutputTarget,
supergraph_config_path: &Utf8PathBuf,
) -> Result<CompositionSuccess, CompositionError> {
let output_target = output_target.align_to_version(&self.version);
let mut args = vec!["compose", supergraph_config.path().as_ref()];
if let OutputTarget::File(output_path) = &output_target {
args.push(output_path.as_ref());
}
let args = self.prepare_compose_args(supergraph_config.path());
let args = self.prepare_compose_args(supergraph_config_path);

let args: Vec<&str> = args.iter().map(|arg| arg.as_ref()).collect();

Expand Down
30 changes: 0 additions & 30 deletions src/composition/supergraph/config.rs

This file was deleted.

4 changes: 1 addition & 3 deletions src/composition/supergraph/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use rover_std::{Fs, RoverStdError};

use crate::{
utils::{
effect::{
fetch_remote_subgraph::FetchRemoteSubgraph, introspect::IntrospectSubgraph,
},
effect::{fetch_remote_subgraph::FetchRemoteSubgraph, introspect::IntrospectSubgraph},
parsers::FileDescriptorType,
},
RoverError,
Expand Down

0 comments on commit b14c615

Please sign in to comment.