Remove unused code & data-type 'UseManifest'
If it's unused, it shall be gone. It obfuscate what functions are doing and require managing extra complexity for no reason.
This commit is contained in:
parent
5381762e50
commit
15efeb3069
|
@ -133,12 +133,7 @@ impl From<&Manifest> for LocalPackages {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn download<T>(
|
||||
event_listener: &T,
|
||||
use_manifest: UseManifest,
|
||||
root_path: &Path,
|
||||
config: &Config,
|
||||
) -> Result<Manifest, Error>
|
||||
pub fn download<T>(event_listener: &T, root_path: &Path, config: &Config) -> Result<Manifest, Error>
|
||||
where
|
||||
T: EventListener,
|
||||
{
|
||||
|
@ -164,13 +159,7 @@ where
|
|||
|
||||
let runtime = tokio::runtime::Runtime::new().expect("Unable to start Tokio");
|
||||
|
||||
let (manifest, changed) = Manifest::load(
|
||||
runtime.handle().clone(),
|
||||
event_listener,
|
||||
config,
|
||||
use_manifest,
|
||||
root_path,
|
||||
)?;
|
||||
let (manifest, changed) = Manifest::load(event_listener, config, root_path)?;
|
||||
|
||||
let local = LocalPackages::load(root_path)?;
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ use crate::{
|
|||
telemetry::{Event, EventListener},
|
||||
};
|
||||
|
||||
use super::UseManifest;
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct Manifest {
|
||||
pub requirements: Vec<Dependency>,
|
||||
|
@ -22,10 +20,8 @@ pub struct Manifest {
|
|||
|
||||
impl Manifest {
|
||||
pub fn load<T>(
|
||||
runtime: tokio::runtime::Handle,
|
||||
event_listener: &T,
|
||||
config: &Config,
|
||||
use_manifest: UseManifest,
|
||||
root_path: &Path,
|
||||
) -> Result<(Self, bool), Error>
|
||||
where
|
||||
|
@ -35,15 +31,10 @@ impl Manifest {
|
|||
|
||||
// If there's no manifest (or we have been asked not to use it) then resolve
|
||||
// the versions anew
|
||||
let should_resolve = match use_manifest {
|
||||
_ if !manifest_path.exists() => true,
|
||||
UseManifest::No => true,
|
||||
UseManifest::Yes => false,
|
||||
};
|
||||
let should_resolve = !manifest_path.exists();
|
||||
|
||||
if should_resolve {
|
||||
let manifest = resolve_versions(runtime, config, None, event_listener)?;
|
||||
|
||||
let manifest = resolve_versions(config, event_listener)?;
|
||||
return Ok((manifest, true));
|
||||
}
|
||||
|
||||
|
@ -61,13 +52,12 @@ impl Manifest {
|
|||
help: e.to_string(),
|
||||
})?;
|
||||
|
||||
// If the config has unchanged since the manifest was written then it is up
|
||||
// If the config is unchanged since the manifest was written then it is up
|
||||
// to date so we can return it unmodified.
|
||||
if manifest.requirements == config.dependencies {
|
||||
Ok((manifest, false))
|
||||
} else {
|
||||
let manifest = resolve_versions(runtime, config, Some(&manifest), event_listener)?;
|
||||
|
||||
let manifest = resolve_versions(config, event_listener)?;
|
||||
Ok((manifest, true))
|
||||
}
|
||||
}
|
||||
|
@ -96,12 +86,7 @@ pub struct Package {
|
|||
pub source: Platform,
|
||||
}
|
||||
|
||||
fn resolve_versions<T>(
|
||||
_runtime: tokio::runtime::Handle,
|
||||
config: &Config,
|
||||
_manifest: Option<&Manifest>,
|
||||
event_listener: &T,
|
||||
) -> Result<Manifest, Error>
|
||||
fn resolve_versions<T>(config: &Config, event_listener: &T) -> Result<Manifest, Error>
|
||||
where
|
||||
T: EventListener,
|
||||
{
|
||||
|
|
|
@ -27,7 +27,6 @@ use aiken_lang::{
|
|||
tipo::TypeInfo,
|
||||
IdGenerator,
|
||||
};
|
||||
use deps::UseManifest;
|
||||
use indexmap::IndexMap;
|
||||
use miette::NamedSource;
|
||||
use options::{CodeGenMode, Options};
|
||||
|
@ -491,12 +490,7 @@ where
|
|||
}
|
||||
|
||||
fn compile_deps(&mut self) -> Result<(), Vec<Error>> {
|
||||
let manifest = deps::download(
|
||||
&self.event_listener,
|
||||
UseManifest::Yes,
|
||||
&self.root,
|
||||
&self.config,
|
||||
)?;
|
||||
let manifest = deps::download(&self.event_listener, &self.root, &self.config)?;
|
||||
|
||||
for package in manifest.packages {
|
||||
let lib = self.root.join(paths::build_deps_package(&package.name));
|
||||
|
|
Loading…
Reference in New Issue