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

feat: change compile unit for base.k in konfig #675

Merged
merged 1 commit into from
Aug 21, 2023
Merged
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
15 changes: 0 additions & 15 deletions kclvm/driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ pub fn lookup_kcl_yaml(dir: &PathBuf) -> io::Result<PathBuf> {
/// to find a `compile unit` that contains all definitions
/// Given a file path, search for the nearest "kcl.yaml" file or the nearest "project.yaml" file.
/// If a "kcl.yaml" file is found, return the path of the directory containing the file.
/// If a "project.yaml" file is found, return the path of the first directory containing a "kcl.yaml" file in that project.
/// If none of these files are found, return an error indicating that the files were not found.
///
/// Example:
Expand All @@ -219,7 +218,6 @@ pub fn lookup_kcl_yaml(dir: &PathBuf) -> io::Result<PathBuf> {
/// | | +-- stack.yaml
/// | +-- project.yaml
///
/// If the input file is project/base/base.k, it will return Path("project/prod")
/// If the input file is project/prod/main.k or project/test/main.k, it will return
/// Path("project/prod") or Path("project/test")
pub fn lookup_compile_unit_path(file: &str) -> io::Result<PathBuf> {
Expand All @@ -233,19 +231,6 @@ pub fn lookup_compile_unit_path(file: &str) -> io::Result<PathBuf> {
// If find "kcl.yaml", the input file is in a stack, return the
// path of this stack
return Ok(PathBuf::from(p));
} else if entry.file_name() == DEFAULT_PROJECT_FILE {
// If find "project.yaml", the input file may be in the `base`
// directory of a project, return the path of the first stack
// of this project
let project_path = PathBuf::from(p);
for e in read_dir(project_path)? {
if let Ok(entry) = e {
let path = entry.path();
if path.is_dir() && lookup_kcl_yaml(&path).is_ok() {
return Ok(path);
}
}
}
}
}
}
Expand Down
Loading