diff --git a/xtask/src/commands/release/publish_plan.rs b/xtask/src/commands/release/publish_plan.rs index d7896117f..c5fa4b648 100644 --- a/xtask/src/commands/release/publish_plan.rs +++ b/xtask/src/commands/release/publish_plan.rs @@ -1,6 +1,6 @@ use std::{path::Path, process::Command}; -use anyhow::{Context, Result, bail, ensure}; +use anyhow::{bail, ensure, Context, Result}; use clap::Args; use crate::{ @@ -63,11 +63,12 @@ pub fn publish_plan(workspace: &Path, args: PublishPlanArgs) -> Result<()> { // Actually publish the packages. for (step, toml) in plan.packages.iter().zip(tomls.iter()) { - let mut publish_args = if step.package.has_chip_features() { - vec!["--no-verify"] - } else { - vec![] - }; + let mut publish_args = + if step.package.has_chip_features() || step.package.has_inline_assembly(workspace) { + vec!["--no-verify"] + } else { + vec![] + }; if !args.no_dry_run { publish_args.push("--dry-run"); diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index fea6dae53..ac9ae3d6f 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs @@ -3,7 +3,7 @@ use std::{ path::{Path, PathBuf}, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use cargo::CargoAction; use clap::ValueEnum; use esp_metadata::{Chip, Config}; @@ -84,6 +84,28 @@ impl Package { ) } + /// Does the package have inline assembly? + pub fn has_inline_assembly(&self, workspace: &Path) -> bool { + // feature(asm_experimental_arch) is enabled in all crates that use Xtensa + // assembly, which covers crates that use assembly AND are used for both + // architectures (e.g. esp-backtrace). + // But RISC-V doesn't need this feature, so we can either scrape the crate + // source, or check in a list of packages. + if matches!(self, Package::EspRiscvRt | Package::EspLpHal) { + return true; + } + + let lib_rs_path = workspace.join(self.to_string()).join("src").join("lib.rs"); + let Ok(source) = std::fs::read_to_string(&lib_rs_path) else { + return false; + }; + + source + .lines() + .filter(|line| line.starts_with("#![")) + .any(|line| line.contains("asm_experimental_arch")) + } + pub fn needs_build_std(&self) -> bool { use Package::*;