Skip to content

Commit

Permalink
Remove unused deps, improve build script, update auth token name
Browse files Browse the repository at this point in the history
  • Loading branch information
DervexDev committed May 5, 2024
1 parent ef1fa02 commit 5e87351
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 175 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
branches:
- main

env:
RUSTFLAGS: "-D warnings"

jobs:
build-test:
name: Build and Test
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ jobs:
- name: Build
run: cargo build --all-features --release --verbose --target ${{ matrix.target }}
env:
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
ARGON_TOKEN: ${{ secrets.ARGON_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Archive
shell: bash
Expand Down
150 changes: 0 additions & 150 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ rbx_reflection_database = "0.2.10"
config-derive = { version = "*", path = "crates/config-derive" }
profiling = { version = "*", path = "crates/profiling/profiling" }

clap = { version = "4.4.1", features = ["derive", "cargo"] }
serde = { version = "1.0.189", features = ["derive"] }
tokio = { version = "1.32.0", features = ["full"] }
reqwest = { version = "0.11.23", features = ["blocking", "rustls-tls"] }
rmpv = {version = "1.3.0", features = ["with-serde"] }
self_update = { version = "0.39.0", features = [
clap = { version = "4.4.1", features = ["derive", "cargo"] }
reqwest = { version = "0.11.23", default-features = false, features = ["blocking", "rustls-tls"] }
self_update = { version = "0.39.0", default-features = false, features = [
"compression-zip-deflate",
"rustls",
] }
Expand Down Expand Up @@ -85,15 +84,10 @@ winsafe = { version = "0.0.20", features = ["user"] }

[build-dependencies]
anyhow = "1.0.79"
self_update = { version = "0.39.0", features = [
"compression-zip-deflate",
"rustls",
] }

self_update = { version = "0.39.0", default-features = false, features = ["rustls"]}

[patch.crates-io]
notify-debouncer-full = { path = "crates/notify-debouncer-full" }
self_update = { path = "crates/self_update" }

# Temporary until `InstanceBuilder::with_referent` is released
rbx_dom_weak = { path = "crates/rbx_dom_weak" }
19 changes: 15 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::Result;
use anyhow::{Context, Result};
use self_update::backends::github::Update;
use std::{env, fs::File, path::PathBuf};

Expand All @@ -10,14 +10,25 @@ fn main() -> Result<()> {
return Ok(());
}

Update::configure()
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("")
.target("");

builder
.build()?
.download()?;
.download()
.context("Failed to download Argon plugin from GitHub!")?;

Ok(())
}
4 changes: 2 additions & 2 deletions src/cli/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use reqwest::{blocking::Client, header::CONTENT_TYPE};
use serde::Serialize;
use std::{fs, path::MAIN_SEPARATOR};

use crate::{argon_error, argon_info, sessions, studio};
use crate::{argon_error, argon_info, sessions};

/// Execute Luau code in Roblox Studio (requires running session)
#[derive(Parser)]
Expand Down Expand Up @@ -71,7 +71,7 @@ impl Exec {

#[cfg(target_os = "windows")]
if self.focus {
studio::focus(None)?;
crate::studio::focus(None)?;
}
} else {
argon_error!("Code execution failed: running session does not have an address");
Expand Down
8 changes: 2 additions & 6 deletions src/server/stop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ use std::process;

use crate::util;

async fn stop() {
#[post("/stop")]
async fn main() -> impl Responder {
trace!("Stopping Argon!");
// We need to kill all child processes as well
util::kill_process(process::id());
}

#[post("/stop")]
async fn main() -> impl Responder {
tokio::spawn(stop());
HttpResponse::Ok().body("Argon stopped successfully")
}
4 changes: 2 additions & 2 deletions src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub fn track() -> Result<()> {
let mut tracker = get_tracker()?;

if tracker.last_synced.elapsed()?.as_secs() > 3600 && tracker.stats.total() > 10 {
if let Some(token) = option_env!("AUTH_TOKEN") {
if let Some(token) = option_env!("ARGON_TOKEN") {
let stats = tracker.stats;
let remainder = stats.minutes_used % 60;

Expand All @@ -138,7 +138,7 @@ pub fn track() -> Result<()> {

set_tracker(&tracker)?;
} else {
warn!("This Argon build has no `AUTH_TOKEN` set, stats will not be uploaded")
warn!("This Argon build has no `ARGON_TOKEN` set, stats will not be uploaded")
}
} else {
debug!("Stats already synced within the last hour or too few stats to sync");
Expand Down

0 comments on commit 5e87351

Please sign in to comment.