Skip to content

Conversation

gagdiez
Copy link

@gagdiez gagdiez commented May 28, 2025

Currently contracts need to be compiled using cargo near build, since using cargo build will end up in a built contract that cannot be used

This PR adds a build.rs file that forces users to use cargo near build, and configures cargo near to set a unique ENVIRONMENTAL VARIABLE when building

Currently contracts need to be compiled using `cargo near build`, since
using `cargo build` will end up in a built contract that cannot be used

This commit adds a `build.rs` file that forces users to use `cargo near
build`, which will set a unique ENV VAR
@gagdiez gagdiez marked this pull request as draft May 28, 2025 20:43
@gagdiez
Copy link
Author

gagdiez commented May 28, 2025

Here is the main idea, but I need somebody to take over. I created the changes on a branch of this repo so anyone from the project can take over.

The only missing part is: making cargo near build create an env variable CARGO_NEAR which I do not know how to do, and I'm sure somebody with actual knowledge on Rust will be able to tackle in a matter of minutes

@dj8yfo
Copy link
Collaborator

dj8yfo commented May 28, 2025

Looks like building with plain cargo could get unblocked in the future near/nearcore#13602 (support of reference-types wasm feature), so i'd not try to enforce anything until it's clear if it's supported or not

@gagdiez
Copy link
Author

gagdiez commented May 28, 2025 via email

@gagdiez
Copy link
Author

gagdiez commented May 28, 2025

@frol has also asked to leave this as last resort, I'll close it now and only implement it in create-near-app until a better solution is found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants