-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b47099e
commit e4cb7bd
Showing
21 changed files
with
232 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use std::{path::Path, sync::Arc}; | ||
|
||
use anyhow::{Context, Result}; | ||
use futures::{stream, StreamExt, TryStreamExt}; | ||
|
||
use crate::api::{app::App, models::Addon}; | ||
|
||
impl App { | ||
pub async fn action_install_addons(self: Arc<Self>, base: &Path) -> Result<()> { | ||
let addons = self.collect_addons().await?; | ||
let base = Arc::new(base.to_owned()); | ||
|
||
const MAX_CONCURRENT_TASKS: usize = 20; | ||
Check warning on line 13 in src/api/app/actions/build/addons.rs GitHub Actions / clippyadding items after statements is confusing, since items exist from the start of the scope
|
||
|
||
stream::iter(addons).map(Ok).try_for_each_concurrent( | ||
Some(MAX_CONCURRENT_TASKS), | ||
move |addon| { | ||
let app = self.clone(); | ||
let base = base.clone(); | ||
async move { | ||
app.action_install_addon(&base, &addon).await | ||
.with_context(|| format!("{addon:#?}")) | ||
} | ||
} | ||
).await?; | ||
|
||
Ok(()) | ||
} | ||
|
||
pub async fn action_install_addon(self: Arc<Self>, base: &Path, addon: &Addon) -> Result<()> { | ||
let steps = addon.resolve_steps(&self).await?; | ||
let dir = base.join(addon.target.as_str()); | ||
self.execute_steps(&dir, &steps).await?; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use std::path::Path; | ||
|
||
use anyhow::Result; | ||
|
||
use crate::api::{app::App, models::Environment}; | ||
|
||
impl App { | ||
pub async fn action_install_jar(&self, base: &Path) -> Result<()> { | ||
if let Some(jar) = self.server.read().await.as_ref().map(|(_, server)| { | ||
server.jar.clone() | ||
}).flatten() { | ||
Check failure on line 11 in src/api/app/actions/build/server_jar.rs GitHub Actions / clippycalled `map(..).flatten()` on `Option`
|
||
println!("Installing server jar"); | ||
|
||
let steps = jar.resolve_steps(&self, Environment::Server).await?; | ||
Check failure on line 14 in src/api/app/actions/build/server_jar.rs GitHub Actions / clippythis expression creates a reference which is immediately dereferenced by the compiler
|
||
|
||
self.execute_steps(base, &steps).await?; | ||
} | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
mod addon_metadata; | ||
|
||
pub use addon_metadata::*; | ||
|
||
pub enum MetadataBlock { | ||
Addons(Vec<AddonMetadata>), | ||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub struct MetadataContainer { | ||
pub addons: Vec<AddonMetadata>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.