GithubHelp home page GithubHelp logo

Comments (5)

sagiegurari avatar sagiegurari commented on June 15, 2024 1

by default cargo-make uses rust-script to invoke these. so checkout if its possible to do it there and if not, ask for changes that can be reflected in the script/env.
one thing that might resolve your issue is the RUST_SCRIPT_BASE_PATH env but i'm not sure.

from cargo-make.

wmmc88 avatar wmmc88 commented on June 15, 2024 1

Turns out rust-script added --base-path in v0.30.0: fornwall/rust-script#109

from cargo-make.

sagiegurari avatar sagiegurari commented on June 15, 2024

closing for now.

from cargo-make.

wmmc88 avatar wmmc88 commented on June 15, 2024

@JohnScience were you able to find a solution to using local path dependencies with rust-script?

I was recently playing around with this today and RUST_SCRIPT_BASE_PATH is something that rust-script provides as the base path for local dependency resolution, but its not something that the user can modify.

Since rust-script dependencies are doc comments at the top of the script file, there seems like no simple built-in way for someone to modify something like this:

//! ```cargo
//! [dependencies]
//! my-local-crate = { path = "./crates/my-local-crate" }
//! ```

to something like this:

//! ```cargo
//! [dependencies]
//! my-local-crate = { path = "some/absolute/path/based/on/CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY /crates/my-local-crate" }
//! ```

Since the dependency is in a doc comment in a script block, it can't expand something like CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY or read the environment. Is the best thing to do here to pre-process the script block with a cargo-make plugin?

from cargo-make.

JohnScience avatar JohnScience commented on June 15, 2024

@JohnScience were you able to find a solution to using local path dependencies with rust-script?

I was recently playing around with this today and RUST_SCRIPT_BASE_PATH is something that rust-script provides as the base path for local dependency resolution, but its not something that the user can modify.

Since rust-script dependencies are doc comments at the top of the script file, there seems like no simple built-in way for someone to modify something like this:

//! ```cargo
//! [dependencies]
//! my-local-crate = { path = "./crates/my-local-crate" }
//! ```

to something like this:

//! ```cargo
//! [dependencies]
//! my-local-crate = { path = "some/absolute/path/based/on/CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY /crates/my-local-crate" }
//! ```

Since the dependency is in a doc comment in a script block, it can't expand something like CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY or read the environment. Is the best thing to do here to pre-process the script block with a cargo-make plugin?

[tasks.ensure_cfg]
script_runner = "@shell"
cwd = "./"
script = '''
cargo run --manifest-path ./cargo-make-scripts/ensure_cfg/Cargo.toml

from cargo-make.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.