Skip to content

Commit

Permalink
[crater] Actually run gftools mode
Browse files Browse the repository at this point in the history
This will only run gftools mode for fonts using the default
recipeProvider.
  • Loading branch information
cmyr committed Oct 28, 2024
1 parent f181c18 commit e1f41ac
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fontc_crater/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readme = "README.md"
[dependencies]
fontc = { version = "0.0.1", path = "../fontc" }

google-fonts-sources = "0.5.0"
google-fonts-sources = "0.5.1"
maud = "0.26.0"
tidier = "0.5.3"

Expand Down
44 changes: 39 additions & 5 deletions fontc_crater/src/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
args::CiArgs,
error::Error,
ttx_diff_runner::{DiffError, DiffOutput},
Results, Target,
BuildType, Results, Target,
};

mod html;
Expand Down Expand Up @@ -176,12 +176,46 @@ fn make_targets(cache_dir: &Path, repos: &[RepoInfo]) -> (Vec<Target>, BTreeMap<
.expect("source is always in cache dir")
.to_path_buf();
repo_list.insert(src_path.clone(), repo.repo_url.clone());
targets.push(Target {
_config: config_path.to_owned(),
source: src_path,
})
targets.extend(targets_for_source(&src_path, &config_path, &config))
}
}
}
(targets, repo_list)
}

fn targets_for_source(
src_path: &Path,
config_path: &Path,
config: &Config,
) -> impl Iterator<Item = Target> {
let default = Some(Target {
config: config_path.to_owned(),
source: src_path.to_owned(),
build: BuildType::Default,
});

let gftools = should_build_in_gftools_mode(src_path, config).then(|| Target {
config: config_path.to_owned(),
source: src_path.to_owned(),
build: BuildType::GfTools,
});
[default, gftools].into_iter().flatten()
}

fn should_build_in_gftools_mode(src_path: &Path, config: &Config) -> bool {
// skip noto, which have an implicitly different recipe provider
if src_path
.file_stem()
.and_then(|stem| stem.to_str().map(|s| s.to_lowercase().contains("noto")))
.unwrap_or(false)
{
return false;
}

// if there is a recipe provider other than googlefonts, we skip
config
.recipe_provider
.as_ref()
.filter(|provider| *provider != "googlefonts")
.is_none()
}

0 comments on commit e1f41ac

Please sign in to comment.