diff options
| author | Ulf Lilleengen <[email protected]> | 2025-08-16 11:14:15 +0200 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2025-08-25 19:44:50 +0200 |
| commit | 1f229f745c0ccee926ae5c4cf6732d41c4beb531 (patch) | |
| tree | c6d757d2cf2e46b317c1b2a398d8043103409932 /release/src | |
| parent | 0d8f9614a1af5a45b695e6f63b0337fc3bccba76 (diff) | |
fix: use patched versions
Diffstat (limited to 'release/src')
| -rw-r--r-- | release/src/cargo.rs | 37 | ||||
| -rw-r--r-- | release/src/main.rs | 1 | ||||
| -rw-r--r-- | release/src/semver_check.rs | 11 | ||||
| -rw-r--r-- | release/src/types.rs | 3 |
4 files changed, 10 insertions, 42 deletions
diff --git a/release/src/cargo.rs b/release/src/cargo.rs index 826a3a8b2..498dfeb97 100644 --- a/release/src/cargo.rs +++ b/release/src/cargo.rs | |||
| @@ -4,18 +4,10 @@ use std::ffi::OsStr; | |||
| 4 | use std::path::{Path, PathBuf}; | 4 | use std::path::{Path, PathBuf}; |
| 5 | use std::process::{Command, Stdio}; | 5 | use std::process::{Command, Stdio}; |
| 6 | 6 | ||
| 7 | use anyhow::{bail, Context as _, Result}; | 7 | use anyhow::{bail, Result}; |
| 8 | use clap::ValueEnum as _; | ||
| 9 | use serde::{Deserialize, Serialize}; | 8 | use serde::{Deserialize, Serialize}; |
| 10 | use toml_edit::{DocumentMut, Formatted, Item, Value}; | ||
| 11 | 9 | ||
| 12 | use crate::{windows_safe_path, Crate}; | 10 | use crate::windows_safe_path; |
| 13 | |||
| 14 | #[derive(Clone, Debug, PartialEq)] | ||
| 15 | pub enum CargoAction { | ||
| 16 | Build(PathBuf), | ||
| 17 | Run, | ||
| 18 | } | ||
| 19 | 11 | ||
| 20 | #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | 12 | #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] |
| 21 | pub struct Artifact { | 13 | pub struct Artifact { |
| @@ -23,12 +15,6 @@ pub struct Artifact { | |||
| 23 | } | 15 | } |
| 24 | 16 | ||
| 25 | /// Execute cargo with the given arguments and from the specified directory. | 17 | /// Execute cargo with the given arguments and from the specified directory. |
| 26 | pub fn run(args: &[String], cwd: &Path) -> Result<()> { | ||
| 27 | run_with_env::<[(&str, &str); 0], _, _>(args, cwd, [], false)?; | ||
| 28 | Ok(()) | ||
| 29 | } | ||
| 30 | |||
| 31 | /// Execute cargo with the given arguments and from the specified directory. | ||
| 32 | pub fn run_with_env<I, K, V>(args: &[String], cwd: &Path, envs: I, capture: bool) -> Result<String> | 18 | pub fn run_with_env<I, K, V>(args: &[String], cwd: &Path, envs: I, capture: bool) -> Result<String> |
| 33 | where | 19 | where |
| 34 | I: IntoIterator<Item = (K, V)> + core::fmt::Debug, | 20 | I: IntoIterator<Item = (K, V)> + core::fmt::Debug, |
| @@ -167,25 +153,6 @@ impl CargoArgsBuilder { | |||
| 167 | } | 153 | } |
| 168 | 154 | ||
| 169 | #[must_use] | 155 | #[must_use] |
| 170 | pub fn args<S>(mut self, args: &[S]) -> Self | ||
| 171 | where | ||
| 172 | S: Clone + Into<String>, | ||
| 173 | { | ||
| 174 | for arg in args { | ||
| 175 | self.args.push(arg.clone().into()); | ||
| 176 | } | ||
| 177 | self | ||
| 178 | } | ||
| 179 | |||
| 180 | pub fn add_arg<S>(&mut self, arg: S) -> &mut Self | ||
| 181 | where | ||
| 182 | S: Into<String>, | ||
| 183 | { | ||
| 184 | self.args.push(arg.into()); | ||
| 185 | self | ||
| 186 | } | ||
| 187 | |||
| 188 | #[must_use] | ||
| 189 | pub fn build(&self) -> Vec<String> { | 156 | pub fn build(&self) -> Vec<String> { |
| 190 | let mut args = vec![]; | 157 | let mut args = vec![]; |
| 191 | 158 | ||
diff --git a/release/src/main.rs b/release/src/main.rs index f1949dd37..cd3e094f1 100644 --- a/release/src/main.rs +++ b/release/src/main.rs | |||
| @@ -5,7 +5,6 @@ use std::process::Command as ProcessCommand; | |||
| 5 | 5 | ||
| 6 | use anyhow::{anyhow, bail, Result}; | 6 | use anyhow::{anyhow, bail, Result}; |
| 7 | use clap::{Parser, Subcommand}; | 7 | use clap::{Parser, Subcommand}; |
| 8 | use log::info; | ||
| 9 | use petgraph::graph::{Graph, NodeIndex}; | 8 | use petgraph::graph::{Graph, NodeIndex}; |
| 10 | use petgraph::visit::Bfs; | 9 | use petgraph::visit::Bfs; |
| 11 | use petgraph::{Directed, Direction}; | 10 | use petgraph::{Directed, Direction}; |
diff --git a/release/src/semver_check.rs b/release/src/semver_check.rs index a70c56376..9a4edd09a 100644 --- a/release/src/semver_check.rs +++ b/release/src/semver_check.rs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | use std::path::PathBuf; | 1 | use std::path::PathBuf; |
| 2 | 2 | ||
| 3 | use cargo_semver_checks::{Check, GlobalConfig, ReleaseType, Rustdoc}; | 3 | use cargo_semver_checks::{Check, GlobalConfig, LintConfig, LintLevel, ReleaseType, RequiredSemverUpdate, Rustdoc}; |
| 4 | 4 | ||
| 5 | use crate::cargo::CargoArgsBuilder; | 5 | use crate::cargo::CargoArgsBuilder; |
| 6 | use crate::types::{BuildConfig, Crate}; | 6 | use crate::types::{BuildConfig, Crate}; |
| @@ -8,12 +8,9 @@ use crate::types::{BuildConfig, Crate}; | |||
| 8 | /// Return the minimum required bump for the next release. | 8 | /// Return the minimum required bump for the next release. |
| 9 | /// Even if nothing changed this will be [ReleaseType::Patch] | 9 | /// Even if nothing changed this will be [ReleaseType::Patch] |
| 10 | pub fn minimum_update(krate: &Crate) -> Result<ReleaseType, anyhow::Error> { | 10 | pub fn minimum_update(krate: &Crate) -> Result<ReleaseType, anyhow::Error> { |
| 11 | println!("Crate = {:?}", krate); | ||
| 12 | |||
| 13 | let config = krate.configs.first().unwrap(); // TODO | 11 | let config = krate.configs.first().unwrap(); // TODO |
| 14 | 12 | ||
| 15 | let package_name = krate.name.clone(); | 13 | let package_name = krate.name.clone(); |
| 16 | let package_path = krate.path.clone(); | ||
| 17 | let current_path = build_doc_json(krate, config)?; | 14 | let current_path = build_doc_json(krate, config)?; |
| 18 | 15 | ||
| 19 | let baseline = Rustdoc::from_registry_latest_crate_version(); | 16 | let baseline = Rustdoc::from_registry_latest_crate_version(); |
| @@ -30,8 +27,12 @@ pub fn minimum_update(krate: &Crate) -> Result<ReleaseType, anyhow::Error> { | |||
| 30 | } | 27 | } |
| 31 | let mut cfg = GlobalConfig::new(); | 28 | let mut cfg = GlobalConfig::new(); |
| 32 | cfg.set_log_level(Some(log::Level::Trace)); | 29 | cfg.set_log_level(Some(log::Level::Trace)); |
| 30 | |||
| 31 | let mut lint_cfg = LintConfig::new(); | ||
| 32 | // Disable this lint because we provide the rustdoc json only, so it can't do feature comparison. | ||
| 33 | lint_cfg.set("feature_missing", LintLevel::Allow, RequiredSemverUpdate::Minor, 0); | ||
| 34 | cfg.set_lint_config(lint_cfg); | ||
| 33 | let result = semver_check.check_release(&mut cfg)?; | 35 | let result = semver_check.check_release(&mut cfg)?; |
| 34 | log::info!("Result {:?}", result); | ||
| 35 | 36 | ||
| 36 | let mut min_required_update = ReleaseType::Patch; | 37 | let mut min_required_update = ReleaseType::Patch; |
| 37 | for (_, report) in result.crate_reports() { | 38 | for (_, report) in result.crate_reports() { |
diff --git a/release/src/types.rs b/release/src/types.rs index 4d9d440d8..be0a883f1 100644 --- a/release/src/types.rs +++ b/release/src/types.rs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | use std::collections::{BTreeMap, HashMap}; | 1 | use std::collections::BTreeMap; |
| 2 | use std::path::PathBuf; | 2 | use std::path::PathBuf; |
| 3 | 3 | ||
| 4 | use serde::Deserialize; | 4 | use serde::Deserialize; |
| @@ -29,6 +29,7 @@ pub struct Metadata { | |||
| 29 | pub embassy: MetadataEmbassy, | 29 | pub embassy: MetadataEmbassy, |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | #[allow(dead_code)] | ||
| 32 | #[derive(Debug, Deserialize, Default)] | 33 | #[derive(Debug, Deserialize, Default)] |
| 33 | pub struct MetadataEmbassy { | 34 | pub struct MetadataEmbassy { |
| 34 | #[serde(default)] | 35 | #[serde(default)] |
