Skip to content
Open
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
5 changes: 5 additions & 0 deletions changelog.d/418-behaviour-changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
section: behaviour-changes
---

- **`projections doctor` fails a .NET projection whose SDK isn't there** (#418). A projection using `dotnet-di`, `dotnet-public-api`, `efcore-schema` or `nuget-dependencies` (other than from a snapshot or restored assets) now gets a failing `.NET SDK` item when `dotnet` isn't on `PATH` or `inputs.dotnet` doesn't exist. One that builds or restores a project also fails when no installed SDK satisfies the `global.json` that its project's directory, or a project file's, resolves. Install the SDK the item names, or change `global.json`.
7 changes: 7 additions & 0 deletions changelog.d/418.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
section: fixes
---

- **`projections explore` proposes built-ins whose subject is a generated file** (#418). Files `.gitattributes` marks `linguist-generated` no longer hide the file a built-in reads, so a Rails application whose `db/schema.rb` or `db/structure.sql` is marked generated (as every new Rails application's `.gitattributes` does) gets a `rails-schema` proposal. Vendored files still propose nothing, and a projection of the whole repository still skips generated files.
- **`projections explore` finds EF Core contexts by their base class** (#418). `efcore-schema` is proposed for any C# file declaring a class that derives from `DbContext` or `IdentityDbContext<…>`, such as one in `DatabaseContext.cs`, rather than only for files named `*DbContext.cs`.
- **`projections doctor` and `projections explore` report a .NET SDK that `global.json` pins but isn't installed** (#418). For a .NET built-in, both read the nearest `global.json` (`sdk.version`, `rollForward`, `allowPrerelease` and `paths`) and check it against `dotnet --list-sdks`. Doctor fails the projection and explore lists an install need that names the pin and the SDKs it accepts, instead of reporting nothing missing until every extraction fails with "A compatible .NET SDK was not found". A missing `dotnet` is reported too, and explore's Rust proposals now list a `rust-toolchain.toml` toolchain that rustup doesn't have.
2 changes: 1 addition & 1 deletion docs/builtins/extractors/efcore-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and which keys or relationships move.
- Drawn by default with: [`database`](../renderers/database.md)
- Needs `--trust`: When it runs ecosystem tools or repository code
(`when-executing-tools`)
- Suggested when the repository has: `**/*DbContext.cs`
- Suggested when the repository has: `**/*.cs`

<!-- end generated: facts -->

Expand Down
9 changes: 6 additions & 3 deletions packages/cli/src/doctor.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
//! `projections doctor`: what this checkout needs to run its projections,
//! without running any of them. It reads definitions and looks up programs
//! (asking a Python launcher only for its version), and never executes
//! repository code, installs anything or changes files.
//! (asking a Python launcher only for its version, and `dotnet` only for the
//! SDKs it has), and never executes repository code, installs anything or
//! changes files.

use crate::{browser, dev_server, extractors, runtime::Runner, scaffold, workspace};
use serde_json::{Value, json};
use std::path::{Path, PathBuf};

pub(crate) mod dotnet;
mod paths;
mod toolchains;
pub(crate) mod toolchains;

fn item(status: &str, title: &str, message: impl Into<String>) -> Value {
json!({"status": status, "title": title, "message": message.into()})
Expand Down Expand Up @@ -59,6 +61,7 @@ fn projection(root: &Path, definition: &Value, catalog: &Value) -> Value {
toolchains::pinned_toolchain(&project),
toolchains::granted(definition, variable),
));
items.extend(dotnet::need(root, &project, definition).map(|message| item("fail", ".NET SDK", message)));
if let Some(bundle) = definition["renderer"]["bundle"].as_str() {
items.push(custom_renderer(root, definition, bundle));
if let Some(message) = renderer_package(root, definition) {
Expand Down
Loading