Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving project build speed #44

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ debug = true
clap = { version = "4.5.20", features = ["derive"] }
clap_derive = "4.5.18"
error-stack = "0.5.0"
glob-match = "0.2.1"
fast-glob = "0.4.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't fix any bugs, but is at least maintained

ignore = "0.4.23"
itertools = "0.13.0"
path-clean = "1.0.1"
lazy_static = "1.5.0"
num_cpus = "1.16.0"
rayon = "1.10.0"
regex = "1.11.1"
serde = { version = "1.0.214", features = ["derive"] }
Expand Down
8 changes: 5 additions & 3 deletions src/common_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub mod tests {

use tempfile::tempdir;

use crate::{ownership::Ownership, project::Project};
use crate::{ownership::Ownership, project_builder::ProjectBuilder};

macro_rules! ownership {
($($test_files:expr),+) => {{
Expand Down Expand Up @@ -110,13 +110,15 @@ pub mod tests {
let config = serde_yaml::from_reader(config_file)?;

let codeowners_file_path = &test_config.temp_dir_path.join(".github/CODEOWNERS");
let project = Project::build(&test_config.temp_dir_path, codeowners_file_path, &config)?;
let mut builder = ProjectBuilder::new(&config, test_config.temp_dir_path.clone(), codeowners_file_path.clone());
let project = builder.build()?;
let ownership = Ownership::build(project);
if test_config.generate_codeowners {
std::fs::write(codeowners_file_path, ownership.generate_file())?;
}
// rebuild project to ensure new codeowners file is read
let project = Project::build(&test_config.temp_dir_path, codeowners_file_path, &config)?;
let mut builder = ProjectBuilder::new(&config, test_config.temp_dir_path.clone(), codeowners_file_path.clone());
let project = builder.build()?;
Ok(Ownership::build(project))
}

Expand Down
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ownership::{FileOwner, Ownership};

use crate::project::Project;
use crate::project_builder::ProjectBuilder;
use clap::{Parser, Subcommand};
use core::fmt;
use error_stack::{Context, Result, ResultExt};
Expand All @@ -15,6 +15,7 @@ mod common_test;
mod config;
mod ownership;
mod project;
mod project_builder;

#[derive(Subcommand, Debug)]
enum Command {
Expand Down Expand Up @@ -114,7 +115,9 @@ fn cli() -> Result<(), Error> {

let config = serde_yaml::from_reader(config_file).change_context(Error::Io)?;

let ownership = Ownership::build(Project::build(&project_root, &codeowners_file_path, &config).change_context(Error::Io)?);
let mut builder = ProjectBuilder::new(&config, project_root, codeowners_file_path.clone());
let project = builder.build().change_context(Error::Io)?;
let ownership = Ownership::build(project);

match args.command {
Command::Validate => ownership.validate().change_context(Error::ValidationFailed)?,
Expand Down
2 changes: 1 addition & 1 deletion src/ownership/mapper.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use glob_match::glob_match;
use fast_glob::glob_match;
use std::{
collections::HashMap,
fmt::{self, Display},
Expand Down
Loading
Loading