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

Improve vendor dep error handling for malformed files #229

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void setHwSimulation(boolean value) {
public static List<File> vendorFiles(File directory) {
if (directory.exists()) {
return List.of(directory.listFiles(pathname -> {
return pathname.getName().endsWith(".json");
return pathname.getName().endsWith(".json") && !pathname.isHidden();
}));
} else {
return List.of();
Expand Down Expand Up @@ -169,7 +169,7 @@ public void loadFrom(File directory) {
try {
load(dep);
} catch(Exception e) {
throw new BuildException("Failed to load dependency", e);
throw new BuildException("Failed to load vendor dependency: " + f.getName(), e);
}
}
}
Expand All @@ -182,8 +182,8 @@ public void loadFrom(Project project) {
private JsonDependency parse(File f) {
try (BufferedReader reader = Files.newBufferedReader(f.toPath())) {
return gson.fromJson(reader, JsonDependency.class);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (Exception e) {
throw new BuildException("Failed to parse vendor dependency: " + f.getName(), e);
}
}

Expand Down