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

CLI - Better module language inference #2218

Merged
merged 1 commit into from
Feb 6, 2025
Merged

Conversation

bfops
Copy link
Collaborator

@bfops bfops commented Feb 6, 2025

Description of Changes

We used to assume a project was a rust project if it had a Cargo.toml, and otherwise assume that it's a .NET project. Now we do something slightly smarter, where we only assume it's a .NET project if there's a *.csproj file (and error otherwise).

Fixes #2136 .

API and ABI breaking changes

No, not for projects that are in any format we expect.

Expected complexity level and risk

1

Testing

  • No Cargo.toml or *.csproj causes an error:
$ mkdir test-project && cd test-project
$ spacetimedb-cli publish -s local foo
Error: Could not detect the language of the module. Are you in a SpacetimeDB project directory?
  • A .csproj file causes the project to be treated as .NET
$ mkdir test-project && cd test-project
$ touch Foo.csproj
$ spacetimedb-cli publish -s local foo
MSBuild version 17.8.5+b5265ef37 for .NET
/mnt/nutera/work/foo/Foo.csproj : error MSB4025: The project file could not be loaded. Root element is missing.
Error: command ["dotnet", "publish", "-c", "Release", "-v", "quiet"] exited with code 1
  • A Cargo.toml causes the project to be treated as Rust:
$ mkdir test-project && cd test-project
$ touch Cargo.toml && mkdir src
$ spacetimedb-cli publish -s local foo
error: failed to parse manifest at `/mnt/nutera/work/foo/Cargo.toml`

Caused by:
  manifest is missing either a `[package]` or a `[workspace]`
Error: command ["cargo", "build", "--config=net.git-fetch-with-cli=true", "--target=wasm32-unknown-unknown", "--release", "--message-format=json-render-diagnostics"] exited with code 101

@bfops bfops marked this pull request as ready for review February 6, 2025 21:02
@bfops bfops requested a review from cloutiertyler as a code owner February 6, 2025 21:02
Copy link
Contributor

@cloutiertyler cloutiertyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise the heavens! Or in this case @bfops

@bfops bfops enabled auto-merge February 6, 2025 21:18
@bfops bfops added this pull request to the merge queue Feb 6, 2025
Merged via the queue into master with commit 09fe275 Feb 6, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants