Skip to content

Commit

Permalink
Update cargo pack options to accommodate dirty crates
Browse files Browse the repository at this point in the history
Modified the cargo pack options to include two new fields, `allow_dirty` and `no_verify`. These options are now checked while executing the `.publish.diff` command and the `.publish` command when the `dry` option is enabled. This change allows for the packaging of crates even when they are in a "dirty" state, improving functionality by accommodating scenarios where perfection isn't strictly required.
  • Loading branch information
Barsik-sus committed Apr 8, 2024
1 parent c76beef commit b801802
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion module/move/willbe/src/action/publish_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod private
let name = &package.name()?;
let version = &package.version()?;

_ = cargo::pack( cargo::PackOptions::former().path( dir.as_ref() ).dry( false ).form() )?;
_ = cargo::pack( cargo::PackOptions::former().path( dir.as_ref() ).allow_dirty( true ).no_verify( true ).dry( false ).form() )?;
let l = CrateArchive::read( packed_crate::local_path( name, version, dir )? )?;
let r = CrateArchive::download_crates_io( name, version ).unwrap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod private
use std::borrow::Cow;
use std::fs::{ OpenOptions };
use std::io::{ Read, Seek, SeekFrom, Write };
use std::path::{Path, PathBuf};
use std::path::PathBuf;
use convert_case::{ Case, Casing };
use regex::Regex;
use crate::action::readme_health_table_renew::find_example_file;
Expand Down
1 change: 0 additions & 1 deletion module/move/willbe/src/entity/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ mod private
{
use crate::*;
use std::collections::{ BTreeSet, HashSet };
use error_tools::err;
// aaa : for Petro : don't use cargo_metadata and Package directly, use facade
// aaa : ✅
use error_tools::for_app::{ bail, Result };
Expand Down
2 changes: 2 additions & 0 deletions module/move/willbe/src/entity/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ mod private
let pack = cargo::PackOptions
{
path : crate_dir.as_ref().into(),
allow_dirty : self.dry,
no_verify : self.dry,
temp_path : self.base_temp_dir.clone(),
dry : self.dry,
};
Expand Down
6 changes: 6 additions & 0 deletions module/move/willbe/src/tool/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ mod private
pub struct PackOptions
{
pub( crate ) path : PathBuf,
#[ default( false ) ]
pub( crate ) allow_dirty : bool,
#[ default( false ) ]
pub( crate ) no_verify : bool,
pub( crate ) temp_path : Option< PathBuf >,
pub( crate ) dry : bool,
}
Expand All @@ -33,6 +37,8 @@ mod private
{
[ "package".to_string() ]
.into_iter()
.chain( if self.allow_dirty { Some( "--allow-dirty".to_string() ) } else { None } )
.chain( if self.no_verify { Some( "--no-verify".to_string() ) } else { None } )
.chain( self.temp_path.clone().map( | p | vec![ "--target-dir".to_string(), p.to_string_lossy().into() ] ).into_iter().flatten() )
.collect()
}
Expand Down

0 comments on commit b801802

Please sign in to comment.