Skip to content

Commit

Permalink
Resolve issue with notarising using incorrect command
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmesamster authored and DmitryAstafyev committed Sep 19, 2024
1 parent 567ed84 commit b334aa0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 25 deletions.
7 changes: 4 additions & 3 deletions application/apps/indexer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions application/apps/rustcore/rs-bindings/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/codesign_config/macos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ single_paths = [
"chipmunk.app",
]
# Patterns to be used with glob to retrieve all matching files under that patterns.
glob_patterns = ["chipmunk.app/Contents/Frameworks/*.framework/Versions/A/**/**"]
glob_patterns = ["chipmunk.app/Contents/Frameworks/*.framework/Versions/A/**/*"]

# Represents the components for the final sign command (Command for deep and strict code signing)
[final_sign_command]
Expand Down
44 changes: 26 additions & 18 deletions cli/src/release/codesign/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,40 +104,48 @@ pub fn apply_codesign(config: &MacOsConfig) -> anyhow::Result<()> {
let app_root = Target::App.cwd();
let release_build_path = release_build_path();

let release_build_path_str = release_build_path.to_string_lossy();

// Retrieve sign paths
// First: single paths.
let mut sign_paths: Vec<_> = config
.sign_paths
.single_paths
.iter()
.map(|p| release_build_path.join(p))
.collect();
let mut sign_paths: Vec<_> = Vec::new();

// Second: glob paths.
// First: glob paths.
for glob_path in config
.sign_paths
.glob_patterns
.iter()
.map(|p| release_build_path.join(p))
.map(|p| format!("{release_build_path_str}/{p}"))
{
sign_paths.extend(
glob::glob(&glob_path.to_string_lossy())
.context("Error while retrieving file paths via glob")?
.flat_map(|p| p.ok())
.filter(|p| p.is_file())
.filter(|p| !p.is_symlink()),
);
let paths: Vec<_> = glob::glob(&glob_path)
.context("Error while retrieving file paths via glob")?
.flat_map(|p| p.ok())
.filter(|p| p.is_file())
.filter(|p| !p.is_symlink())
.collect();

sign_paths.extend(paths);
}

// Second: single paths.
sign_paths.extend(
config
.sign_paths
.single_paths
.iter()
.map(|p| release_build_path.join(p))
);


// Start signing files
let sign_id = env::var(&config.env_vars.signing_id)
.context("Error while retrieving signing ID environment variable")?;
for path in sign_paths {
let cmd = format!(
"codesign --sign \"{sign_id}\" {} {}",
"codesign --sign \"{sign_id}\" {} \"{}\"",
config.sign_cmd_options,
path.to_string_lossy()
);
println!("DEBUG: CodeSign CMD: '{cmd}'");
let cmd_status = std::process::Command::new("sh")
.arg("-c")
.arg(&cmd)
Expand Down Expand Up @@ -198,7 +206,7 @@ pub fn notarize(config: &MacOsConfig) -> anyhow::Result<()> {
let release_file_path = release_path().join(archname);

let cmd = format!(
"{} {} --apple-id {apple_id} --team-id {team_id} --password {team_id} --password {password}",
"{} \"{}\" --apple-id \"{apple_id}\" --team-id \"{team_id}\" --password \"{password}\"",
config.notarize_command.command,
release_file_path.to_string_lossy()
);
Expand Down

0 comments on commit b334aa0

Please sign in to comment.