Avoid using nightly by default.

Instead, use it only where needed, which at this time is Windows
for some nightly-only access to file-descriptors.
This commit is contained in:
Sebastian Thiel 2024-07-27 10:26:29 +02:00
parent b29229f3b6
commit ad3e15dae4
No known key found for this signature in database
GPG Key ID: 9CB5EE7895E8268B
11 changed files with 37 additions and 43 deletions

View File

@ -3,6 +3,16 @@ description: prepare runner for rust related tasks
runs:
using: "composite"
steps:
- name: Setup Nightly
if: runner.os == 'Windows'
shell: bash
run: |
mv rust-toolchain.toml.nightly rust-toolchain.toml
- name: Setup Stable
if: runner.os != 'Windows'
shell: bash
run: |
mv rust-toolchain.toml.stable rust-toolchain.toml
- name: Check versions
shell: bash
run: |

View File

@ -32,7 +32,6 @@ jobs:
- *workflows
- 'Cargo.lock'
- 'Cargo.toml'
- 'rust-toolchain.toml'
rust: &any-rust
- *rust
- 'crates/**'
@ -111,7 +110,6 @@ jobs:
- [devtools]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- uses: ./.github/actions/check-crate
with:
features: ${{ toJson(matrix.features) }}

View File

@ -18,9 +18,9 @@ you right. Let's get started.
- [Tokio](#tokio)
- [Building](#building)
- [Building on Windows](#building-on-windows)
- [File permissions](#file-permissions)
- [Perl](#perl)
- [Crosscompilation](#crosscompilation)
- [File permissions](#file-permissions)
- [Perl](#perl)
- [Crosscompilation](#crosscompilation)
- [Design](#design)
- [Contributing](#contributing)
- [Some Other Random Notes](#some-other-random-notes)
@ -162,7 +162,22 @@ This will make an asset similar to our nightly build.
Building on Windows is a bit of a tricky process. Here are some helpful tips.
### File permissions
#### Nightly Compiler
As a few crates require nightly features on Windows, it's easiest to set an override
to automatically use a nightly compiler.
```shell
rustup override add nightly-2024-07-01
```
If a stable nightly isn't desired or necessary, the latest nightly compiler can also be used:
```shell
rustup override add nightly
```
#### File permissions
We use `pnpm`, which requires a relatively recent version of Node.js.
Make sure that the latest stable version of Node.js is installed and
@ -184,7 +199,7 @@ npm config set prefix $env:APPDATA\npm
Afterwards, add this folder to your PATH.
### Perl
#### Perl
A Perl interpreter is required to be installed in order to configure the `openssl-sys`
crate. We've used [Strawberry Perl](https://strawberryperl.com/) without issue.
@ -196,7 +211,7 @@ Note that it might appear that the build has hung or frozen on the `openssl-sys`
It's not, it's just that Cargo can't report the status of a C/C++ build happening
under the hood, and openssl is _large_. It'll take a while to compile.
### Crosscompilation
#### Crosscompilation
This paragraph is about crosscompilation to x86_64-MSVC from ARM Windows,
a configuration typical for people with Apple Silicon and Parallels VMs,

View File

@ -6,9 +6,8 @@
//! a longer-term solution for managing Git operations.
#![deny(missing_docs, unsafe_code)]
#![allow(async_fn_in_trait)]
#![cfg_attr(test, feature(async_closure))]
#![allow(unknown_lints)]
#![cfg_attr(windows, feature(windows_by_handle))]
#![feature(impl_trait_in_assoc_type)]
#[cfg(all(not(debug_assertions), feature = "test-askpass-path"))]
compile_error!("BUG: in production code this flag should not be set, nor do we run test with `cargo test --release`");

View File

@ -1,5 +1,3 @@
#![feature(error_generic_member_access)]
#![cfg_attr(windows, feature(windows_by_handle))]
#![cfg_attr(
all(windows, not(test), not(debug_assertions)),
windows_subsystem = "windows"
@ -36,6 +34,3 @@ pub mod users;
pub mod virtual_branches;
pub mod zip;
#[cfg(target_os = "windows")]
pub mod windows;

View File

@ -1,5 +1,3 @@
#![feature(error_generic_member_access)]
#![cfg_attr(windows, feature(windows_by_handle))]
#![cfg_attr(
all(windows, not(test), not(debug_assertions)),
windows_subsystem = "windows"

View File

@ -1,24 +0,0 @@
use std::os::windows::fs::MetadataExt;
pub trait MetadataShim {
fn ino(&self) -> u64;
fn dev(&self) -> u64;
fn uid(&self) -> u32;
fn gid(&self) -> u32;
}
impl MetadataShim for std::fs::Metadata {
fn ino(&self) -> u64 {
self.file_index().expect("file metadata constructed based on directory listing instead of a file (see https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.file_index)")
}
#[allow(clippy::cast_lossless)]
fn dev(&self) -> u64 {
self.volume_serial_number().expect("file metadata constructed based on directory listing instead of a file (see https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.volume_serial_number)") as u64
}
fn uid(&self) -> u32 {
0
}
fn gid(&self) -> u32 {
0
}
}

View File

@ -1,7 +1,6 @@
//! Implement the file-monitoring agent that informs about changes in interesting locations.
#![deny(unsafe_code, rust_2018_idioms)]
#![allow(clippy::doc_markdown, clippy::missing_errors_doc)]
#![feature(slice_as_chunks)]
mod events;
use events::InternalEvent;

View File

@ -22,7 +22,7 @@
inherit system overlays;
};
rustToolchain = unstablePkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rustToolchain = "stable";
common = with unstablePkgs; [
gtk3

View File

@ -0,0 +1,4 @@
[toolchain]
channel = "stable"
components = [ "rustfmt", "clippy" ]
profile = "minimal"