-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbuild.rs
More file actions
34 lines (27 loc) · 744 Bytes
/
build.rs
File metadata and controls
34 lines (27 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use anyhow::{Context, Result};
use self_update::backends::github::Update;
use std::{env, fs::File, path::PathBuf};
fn main() -> Result<()> {
let out_path = PathBuf::from(env::var("OUT_DIR")?).join("Argon.rbxm");
if !cfg!(feature = "plugin") {
File::create(out_path)?;
return Ok(());
}
let mut builder = Update::configure();
if let Ok(token) = env::var("GITHUB_TOKEN") {
builder.auth_token(&token);
} else {
println!("cargo:warning=GITHUB_TOKEN not set, rate limits may apply!")
}
builder
.repo_owner("argon-rbx")
.repo_name("argon-roblox")
.bin_name("Argon.rbxm")
.bin_install_path(out_path)
.target("");
builder
.build()?
.download()
.context("Failed to download Argon plugin from GitHub!")?;
Ok(())
}