Skip to content

Commit 5324a3d

Browse files
committed
Release version 0.2.0
1 parent c124f61 commit 5324a3d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "buckle"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition = "2021"
55
description = "A lightweight launcher for buck2"
66
license = "MIT"

src/main.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
use anyhow::{anyhow, Error};
22
use serde::{Deserialize, Serialize};
3+
use std::io::Write;
34
use std::{
45
env,
56
fs::{self, File},
67
path::{Path, PathBuf},
78
process::{Command, Stdio},
89
};
9-
use std::{io::Write, time::SystemTime};
1010
use tempfile::NamedTempFile;
1111
use url::Url;
1212

1313
#[cfg(unix)]
1414
use std::os::unix::fs::PermissionsExt;
15+
#[cfg(unix)]
16+
use std::time::SystemTime;
1517

1618
const BASE_URL: &str = "https://github.com/facebook/buck2/releases/download";
1719
const BUCK_RELEASE_URL: &str = "https://github.com/facebook/buck2/tags";
@@ -100,6 +102,8 @@ fn get_releases(path: &Path) -> Result<Vec<Release>, Error> {
100102
let mut releases_json_path = path.to_path_buf();
101103
releases_json_path.push("releases.json");
102104

105+
// TODO support last last_modification_time for windows users
106+
#[cfg(unix)]
103107
if releases_json_path.exists() {
104108
use std::os::unix::fs::MetadataExt;
105109
let meta = fs::metadata(&releases_json_path)?;
@@ -177,8 +181,11 @@ fn download_http(version: String, output_dir: &Path) -> Result<PathBuf, Error> {
177181
let resp = reqwest::blocking::get(format!("{BASE_URL}/{version}/buck2-{arch}.zst"))?;
178182
zstd::stream::copy_decode(resp, &tmp_buck2_bin).unwrap();
179183
tmp_buck2_bin.flush()?;
180-
let permissions = fs::Permissions::from_mode(0o755);
181-
fs::set_permissions(&tmp_buck2_bin, permissions)?;
184+
#[cfg(unix)]
185+
{
186+
let permissions = fs::Permissions::from_mode(0o755);
187+
fs::set_permissions(&tmp_buck2_bin, permissions)?;
188+
}
182189
fs::rename(tmp_buck2_bin.path(), &buck2_path)?;
183190

184191
// Also fetch the prelude hash and store it

0 commit comments

Comments
 (0)