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

Add workplace and remove linkage override from 'mix rustler.new' templates #672

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
See [`UPGRADE.md`](./UPGRADE.md) for additional help when upgrading to newer
versions.

## unreleased

### Added

- Create a workplace `Cargo.toml` file with `mix rustler.new` (#672)

### Fixed

### Changed

### Removed

- The linkage override for macOS is not needed anymore and has been removed from
the template (#672)


## [0.35.1] - 2024-12-18

### Fixed
Expand Down
9 changes: 7 additions & 2 deletions rustler_mix/lib/mix/tasks/rustler.new.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ defmodule Mix.Tasks.Rustler.New do
"""

@basic [
{:eex, "basic/.cargo/config.toml", ".cargo/config.toml"},
{:eex, "basic/README.md", "README.md"},
{:eex, "basic/Cargo.toml.eex", "Cargo.toml"},
{:eex, "basic/src/lib.rs", "src/lib.rs"},
Expand Down Expand Up @@ -68,8 +67,14 @@ defmodule Mix.Tasks.Rustler.New do

check_module_name_validity!(module)

path = Path.join([File.cwd!(), "native/", name])
path = Path.join([File.cwd!(), "native", name])
new(otp_app, path, module, name, opts)

# Create a Cargo workspace
File.write(
Path.join(path, "Cargo.toml"),
"[workspace]\nresolver = \"2\"\nmembers = [\"native/#{name}\"]\n"
)
end

defp new(otp_app, path, module, name, _opts) do
Expand Down
5 changes: 0 additions & 5 deletions rustler_mix/priv/templates/basic/.cargo/config.toml

This file was deleted.

1 change: 0 additions & 1 deletion rustler_mix/priv/templates/basic/Cargo.toml.eex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition = "2021"

[lib]
name = "<%= library_name %>"
path = "src/lib.rs"
crate-type = ["cdylib"]

[dependencies]
Expand Down
Loading