2022-11-29 02:21:44 -05:00
|
|
|
use std::collections::BTreeMap;
|
2021-12-17 00:17:40 -05:00
|
|
|
|
2022-11-29 02:21:44 -05:00
|
|
|
use api::OutputReleases;
|
2023-05-16 12:15:01 -04:00
|
|
|
use color_eyre::eyre::{Context, Result};
|
|
|
|
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
|
2021-12-17 00:17:40 -05:00
|
|
|
|
2022-11-29 02:21:44 -05:00
|
|
|
use crate::api::AdoptiumAPI;
|
2021-12-23 13:11:49 -05:00
|
|
|
|
2022-11-29 02:21:44 -05:00
|
|
|
/// API Abstraction
|
|
|
|
pub mod api;
|
2021-12-17 00:17:40 -05:00
|
|
|
|
2021-12-23 13:11:49 -05:00
|
|
|
#[async_std::main]
|
|
|
|
async fn main() -> Result<()> {
|
|
|
|
color_eyre::install()?;
|
2023-05-16 12:15:01 -04:00
|
|
|
|
|
|
|
tracing_subscriber::registry()
|
|
|
|
.with(fmt::layer().pretty().with_writer(std::io::stderr))
|
|
|
|
.with(EnvFilter::from_default_env())
|
|
|
|
.init();
|
|
|
|
|
2022-11-29 02:21:44 -05:00
|
|
|
let mut output: BTreeMap<String, BTreeMap<String, OutputReleases>> = BTreeMap::new();
|
|
|
|
// Create the api instances
|
|
|
|
let adoptium = AdoptiumAPI::adoptium().context("Creating api")?;
|
|
|
|
let semeru = AdoptiumAPI::semeru().context("Creating api")?;
|
2023-05-16 15:58:42 -04:00
|
|
|
// Fill in x86_64-linux first
|
2022-11-29 02:21:44 -05:00
|
|
|
{
|
|
|
|
let x86_64 = output.entry("x86_64-linux".to_string()).or_default();
|
|
|
|
x86_64.insert(
|
|
|
|
"temurin".to_string(),
|
|
|
|
adoptium
|
2023-05-16 15:41:54 -04:00
|
|
|
.get_all("x64", "linux")
|
2022-11-29 02:21:44 -05:00
|
|
|
.await
|
|
|
|
.context("Failed getting x86_64 adopt releases")?,
|
|
|
|
);
|
|
|
|
x86_64.insert(
|
|
|
|
"semeru".to_string(),
|
|
|
|
semeru
|
2023-05-16 15:41:54 -04:00
|
|
|
.get_all("x64", "linux")
|
2022-11-29 02:21:44 -05:00
|
|
|
.await
|
|
|
|
.context("Failed getting x86_64 adopt releases")?,
|
|
|
|
);
|
|
|
|
}
|
2023-05-16 15:58:42 -04:00
|
|
|
// Then aarch64-linux
|
2022-11-29 02:21:44 -05:00
|
|
|
{
|
|
|
|
let aarch64 = output.entry("aarch64-linux".to_string()).or_default();
|
|
|
|
aarch64.insert(
|
|
|
|
"temurin".to_string(),
|
|
|
|
adoptium
|
2023-05-16 15:41:54 -04:00
|
|
|
.get_all("aarch64", "linux")
|
2022-11-29 02:21:44 -05:00
|
|
|
.await
|
|
|
|
.context("Failed getting aarch64 adopt releases")?,
|
|
|
|
);
|
|
|
|
aarch64.insert(
|
|
|
|
"semeru".to_string(),
|
|
|
|
semeru
|
2023-05-16 15:41:54 -04:00
|
|
|
.get_all("aarch64", "linux")
|
2022-11-29 02:21:44 -05:00
|
|
|
.await
|
|
|
|
.context("Failed getting aarch64 adopt releases")?,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
let output = serde_json::to_string_pretty(&output).context("Failed to serialize output")?;
|
|
|
|
println!("{output}");
|
2021-12-23 13:11:49 -05:00
|
|
|
Ok(())
|
2021-12-17 00:17:40 -05:00
|
|
|
}
|