-
Notifications
You must be signed in to change notification settings - Fork 469
Don't panic when dev files are not found during clean. #7622
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
base: master
Are you sure you want to change the base?
Changes from all commits
cd7618b
91e12da
c47fa38
0bbe2f4
d12f37c
76199c0
2a729f4
a9248d6
8dda624
98e9e20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -501,7 +501,7 @@ pub fn get_source_files( | |
package_dir: &Path, | ||
filter: &Option<regex::Regex>, | ||
source: &config::PackageSource, | ||
build_dev_deps: bool, | ||
dev_deps: DevDeps, | ||
) -> AHashMap<PathBuf, SourceFileMeta> { | ||
let mut map: AHashMap<PathBuf, SourceFileMeta> = AHashMap::new(); | ||
|
||
|
@@ -515,17 +515,22 @@ pub fn get_source_files( | |
}; | ||
|
||
let path_dir = Path::new(&source.dir); | ||
match (build_dev_deps, type_) { | ||
(false, Some(type_)) if type_ == "dev" => (), | ||
let is_clean = match dev_deps { | ||
DevDeps::Clean => true, | ||
_ => false, | ||
}; | ||
match (dev_deps, type_) { | ||
(DevDeps::DontBuild, Some(type_)) if type_ == "dev" => (), | ||
_ => match read_folders(filter, package_dir, path_dir, recurse) { | ||
Ok(files) => map.extend(files), | ||
|
||
Err(_e) => log::error!( | ||
Err(_e) if !is_clean => log::error!( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why would this ever happen, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now, clean is trying to remove files that are listed as |
||
"Could not read folder: {:?}. Specified in dependency: {}, located {:?}...", | ||
path_dir.to_path_buf().into_os_string(), | ||
package_name, | ||
package_dir | ||
), | ||
Err(_) => {} | ||
}, | ||
}; | ||
|
||
|
@@ -537,22 +542,14 @@ pub fn get_source_files( | |
fn extend_with_children( | ||
filter: &Option<regex::Regex>, | ||
mut build: AHashMap<String, Package>, | ||
build_dev_deps: bool, | ||
dev_deps: DevDeps, | ||
) -> AHashMap<String, Package> { | ||
for (_key, package) in build.iter_mut() { | ||
let mut map: AHashMap<PathBuf, SourceFileMeta> = AHashMap::new(); | ||
package | ||
.source_folders | ||
.par_iter() | ||
.map(|source| { | ||
get_source_files( | ||
&package.name, | ||
Path::new(&package.path), | ||
filter, | ||
source, | ||
build_dev_deps, | ||
) | ||
}) | ||
.map(|source| get_source_files(&package.name, Path::new(&package.path), filter, source, dev_deps)) | ||
.collect::<Vec<AHashMap<PathBuf, SourceFileMeta>>>() | ||
.into_iter() | ||
.for_each(|source| map.extend(source)); | ||
|
@@ -582,6 +579,13 @@ fn extend_with_children( | |
build | ||
} | ||
|
||
#[derive(Clone, Copy)] | ||
pub enum DevDeps { | ||
Build, | ||
DontBuild, | ||
Clean, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this variant. We want to know if we need to build dev deps or not. Cleaning is a separate task, not a property of we need to build dev deps or not. Whether to clean can be derived from if we want to build or not (if we build we also need to clean). Or am I misunderstanding this? |
||
} | ||
|
||
/// Make turns a folder, that should contain a config, into a tree of Packages. | ||
/// It does so in two steps: | ||
/// 1. Get all the packages parsed, and take all the source folders from the config | ||
|
@@ -594,13 +598,13 @@ pub fn make( | |
root_folder: &Path, | ||
workspace_root: &Option<PathBuf>, | ||
show_progress: bool, | ||
build_dev_deps: bool, | ||
dev_deps: DevDeps, | ||
) -> Result<AHashMap<String, Package>> { | ||
let map = read_packages(root_folder, workspace_root, show_progress)?; | ||
|
||
/* Once we have the deduplicated packages, we can add the source files for each - to minimize | ||
* the IO */ | ||
let result = extend_with_children(filter, map, build_dev_deps); | ||
let result = extend_with_children(filter, map, dev_deps); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cleaning and building share this code. |
||
|
||
Ok(result) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "@testrepo/nonexisting-dev-files", | ||
"version": "0.0.1", | ||
"keywords": [ | ||
"rescript" | ||
], | ||
"author": "", | ||
"license": "MIT" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "@testrepo/nonexisting-dev-files", | ||
"sources": { | ||
"dir": "dev", | ||
"subdirs": true, | ||
"type": "dev" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to be
true
, sodev
files are included.Yet, these files never existed in the first place because they were never shipped as part of npm package.