Selaa lähdekoodia

cli: Fix `anchor build --no-docs` (#2575)

acheron 2 vuotta sitten
vanhempi
sitoutus
8309bb3ed5
2 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  1. 2 1
      CHANGELOG.md
  2. 5 2
      cli/src/lib.rs

+ 2 - 1
CHANGELOG.md

@@ -22,7 +22,8 @@ The minor version will be incremented upon a breaking change and the patch versi
 - ts: Packages no longer depend on `assert` ([#2535](https://github.com/coral-xyz/anchor/pull/2535)).
 - lang: Support for `const` in the `InitSpace` macro ([#2555](https://github.com/coral-xyz/anchor/pull/2555)).
 - cli: Support workspace inheritence ([#2570](https://github.com/coral-xyz/anchor/pull/2570)).
-- client: Compile with Solana `1.14`([#2572](https://github.com/coral-xyz/anchor/pull/2572)).
+- client: Compile with Solana `1.14` ([#2572](https://github.com/coral-xyz/anchor/pull/2572)).
+- cli: Fix `anchor build --no-docs` adding docs to the IDL ([#2575](https://github.com/coral-xyz/anchor/pull/2575)).
 
 ### Breaking
 

+ 5 - 2
cli/src/lib.rs

@@ -1120,7 +1120,9 @@ fn build_rust_cwd(
         Some(p) => std::env::set_current_dir(p)?,
     };
     match build_config.verifiable {
-        false => _build_rust_cwd(cfg, idl_out, idl_ts_out, skip_lint, arch, cargo_args),
+        false => _build_rust_cwd(
+            cfg, idl_out, idl_ts_out, skip_lint, no_docs, arch, cargo_args,
+        ),
         true => build_cwd_verifiable(
             cfg,
             cargo_toml,
@@ -1484,6 +1486,7 @@ fn _build_rust_cwd(
     idl_out: Option<PathBuf>,
     idl_ts_out: Option<PathBuf>,
     skip_lint: bool,
+    no_docs: bool,
     arch: &ProgramArch,
     cargo_args: Vec<String>,
 ) -> Result<()> {
@@ -1500,7 +1503,7 @@ fn _build_rust_cwd(
     }
 
     // Always assume idl is located at src/lib.rs.
-    if let Some(idl) = extract_idl(cfg, "src/lib.rs", skip_lint, false)? {
+    if let Some(idl) = extract_idl(cfg, "src/lib.rs", skip_lint, no_docs)? {
         // JSON out path.
         let out = match idl_out {
             None => PathBuf::from(".").join(&idl.name).with_extension("json"),