tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
78.1k stars 2.31k forks source link

[feat][v2] add cli option to switch to +stable compiler #9679

Closed pronebird closed 1 week ago

pronebird commented 1 week ago

Describe the problem

It occurred to a colleague of mine that npm run tauri build uses a default rust compiler. Would it be possible to have an option to add a flag to build with +stable compiler? Since most devs run nightly, it's a bit cumbersome to switch to stable each time when running a build script, people tend to forget and half of our script that prebuilds other binaries simply runs compilation with cargo +stable, but we have no control over tauri build.

Describe the solution you'd like

Maybe a --stable option to enforce compilation with stable rust

Alternatives considered

Doing rustup default toolchain switcheroo but it's a bit tricky as it changes it system wide.

Currently using a --runner option with a proxy script towards cargo +stable.

On Unix:

#!/bin/bash
cargo +stable $@

On Windows:

@echo off
cargo +stable %*

Additional context

No response

RoDmitry commented 1 week ago

Maybe when building for production, you must use the stable channel by default. And only if --nightly is passed, then use nightly. Or maybe add --default-channel to use the current implementation of using the default channel.

amrbashir commented 1 week ago

You can override it using the environment variable RUSTUP_TOOLCHAIN see https://rust-lang.github.io/rustup/overrides.html