Skip to content

Commit

Permalink
Replace tg-rust-g with rust_utils (#988)
Browse files Browse the repository at this point in the history
## Что этот PR делает

Удаляем `tg-rust-g` версию сс220 и заменяем его `rust_utils`

## Summary by Sourcery

Replace the `tg-rust-g` library with `rust_utils`.

Build:
- Update the CI configuration to install `rust_utils` instead of
`rust-g-ss220`.

Chores:
- Remove the now-unused `tg-rust-g` code and definitions.
  • Loading branch information
Gaxeer authored Jan 14, 2025
1 parent b53b6db commit e81add7
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 102 deletions.
2 changes: 1 addition & 1 deletion dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export BYOND_MINOR=1637

#rust_g git tag
export RUST_G_VERSION=3.5.1
export RUST_G_VERSION_SS220=3.0.0-ss220
export RUST_UTILS_VERSION=0.1.0-release

#node version
export NODE_VERSION_LTS=22.11.0
Expand Down
Binary file added librust_utils.dll
Binary file not shown.
4 changes: 4 additions & 0 deletions modular_bandastation/_rust_utils/_rust_utils.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/datum/modpack/rust_utils
name = "Rust Utils"
desc = "Набор утилит на rust"
author = "furior, gaxeer"
3 changes: 3 additions & 0 deletions modular_bandastation/_rust_utils/_rust_utils.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "_rust_utils.dm"

#include "code/rust_utils.dm"
27 changes: 27 additions & 0 deletions modular_bandastation/_rust_utils/code/rust_utils.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef RUST_UTILS

/* This comment bypasses grep checks */ /var/__rust_utils

/proc/__detect_rust_utils()
if(world.system_type == UNIX)
if(fexists("./librust_utils.so"))
// No need for LD_LIBRARY_PATH badness.
return __rust_utils = "./librust_utils.so"
else
// It's not in the current directory, so try others
return __rust_utils = "librust_utils.so"
else
return __rust_utils = "librust_utils"

#define RUST_UTILS (__rust_utils || __detect_rust_utils())
#endif

/// Gets the version of rust_utils
/proc/rust_utils_get_version() return RUSTG_CALL(RUST_UTILS, "get_version")()

#define rustutils_file_write_b64decode(text, fname) RUSTG_CALL(RUST_UTILS, "file_write")(text, fname, "true")

#define rustutils_regex_replace(text, re, re_params, replacement) RUSTG_CALL(RUST_UTILS, "regex_replace")(text, re, re_params, replacement)

#define rustutils_cyrillic_to_latin(text) RUSTG_CALL(RUST_UTILS, "cyrillic_to_latin")("[text]")
#define rustutils_latin_to_cyrillic(text) RUSTG_CALL(RUST_UTILS, "latin_to_cyrillic")("[text]")
1 change: 1 addition & 0 deletions modular_bandastation/modular_bandastation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "_defines220/_defines220.dme"
#include "_helpers220/_helpers220.dme"
#include "_rust_utils/_rust_utils.dme"
#include "_signals220/_signals220.dme"
#include "_singletons/_singletons.dme"
#include "title_screen/_title_screen.dme"
Expand Down
1 change: 0 additions & 1 deletion modular_bandastation/tts/_tts.dme
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "_tts.dm"

#include "code/_tts_rust_g_ss220.dm"
#include "code/numbers.dm"
#include "code/shell.dm"
#include "code/SSHttp.dm"
Expand Down
8 changes: 0 additions & 8 deletions modular_bandastation/tts/code/SSHttp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ SUBSYSTEM_DEF(http)
/// Total requests the SS has processed in a round
var/total_requests

/datum/controller/subsystem/http/PreInit()
. = ..()
rustgss220_create_async_http_client() // Open the door

/datum/controller/subsystem/http/fire(resumed)
for(var/r in active_async_requests)
var/datum/http_request/req = r
Expand Down Expand Up @@ -84,7 +80,3 @@ SUBSYSTEM_DEF(http)
/datum/http_request
/// Callback for executing after async requests. Will be called with an argument of [/datum/http_response] as first argument
var/datum/callback/cb

/world/Del()
rustgss220_close_async_http_client()
. = ..()
61 changes: 0 additions & 61 deletions modular_bandastation/tts/code/_tts_rust_g_ss220.dm

This file was deleted.

4 changes: 2 additions & 2 deletions modular_bandastation/tts/code/tts_subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ SUBSYSTEM_DEF(tts220)
if(!voice)
return

rustgss220_file_write_b64decode(voice, "[filename].ogg")
rustutils_file_write_b64decode(voice, "[filename].ogg")

if(!CONFIG_GET(flag/tts_cache_enabled))
addtimer(CALLBACK(src, PROC_REF(cleanup_tts_file), "[filename].ogg"), FILE_CLEANUP_DELAY)
Expand Down Expand Up @@ -466,7 +466,7 @@ SUBSYSTEM_DEF(tts220)
if(LAZYLEN(tts_job_replacements))
for(var/job in tts_job_replacements)
. = replacetext_char(., job, tts_job_replacements[job])
. = rustgss220_latin_to_cyrillic(.)
. = rustutils_latin_to_cyrillic(.)

var/static/regex/decimals = new(@"-?\d+\.\d+", "g")
. = replacetext_char(., decimals, GLOBAL_PROC_REF(dec_in_words))
Expand Down
15 changes: 0 additions & 15 deletions modular_bandastation/tts/code/~undefs/~undefs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@

#undef TTS_TRAIT_ROBOTIZE

#undef rustgss220_file_write_b64decode

#undef rustgss220_hash_string
#undef rustgss220_hash_file

#undef RUSTG_HASH_MD5

#ifdef RUSTG_OVERRIDE_BUILTINS
#undef md5
#endif

// Text Operations //
#undef rustgss220_cyrillic_to_latin
#undef rustgss220_latin_to_cyrillic

#undef TTS_CATEGORY_OTHER
#undef TTS_CATEGORY_WARCRAFT3
#undef TTS_CATEGORY_HALFLIFE2
Expand Down
Binary file removed rust_g_ss220.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions tools/ci/install_rust_g.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ wget -nv -O ~/.byond/bin/librust_g.so "https://github.com/tgstation/rust-g/relea
chmod +x ~/.byond/bin/librust_g.so
ldd ~/.byond/bin/librust_g.so

wget -nv -O ~/.byond/bin/librust_g_ss220.so "https://github.com/ss220club/rust-g-tg/releases/download/$RUST_G_VERSION_SS220/librust_g.so"
chmod +x ~/.byond/bin/librust_g_ss220.so
ldd ~/.byond/bin/librust_g_ss220.so
wget -nv -O ~/.byond/bin/librust_utils.so "https://github.com/ss220club/rust-utils/releases/download/$RUST_UTILS_VERSION/librust_utils.so"
chmod +x ~/.byond/bin/librust_utils.so
ldd ~/.byond/bin/librust_utils.so
22 changes: 11 additions & 11 deletions tools/tgs_scripts/PreCompile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --ignore-rust-version --re
mv target/i686-unknown-linux-gnu/release/librust_g.so "$1/librust_g.so"
cd ..

# update rust-g-tg s220
if [ ! -d "rust-g-tg" ]; then
echo "Cloning rust-g ss220..."
git clone https://github.com/ss220club/rust-g-tg
cd rust-g-tg
# update rust-utils
if [ ! -d "rust-utils" ]; then
echo "Cloning rust-utils..."
git clone https://github.com/ss220club/rust-utils
cd rust-utils
~/.cargo/bin/rustup target add i686-unknown-linux-gnu
else
echo "Fetching rust-g ss220..."
cd rust-g-tg
echo "Fetching rust-utils..."
cd rust-utils
git fetch
~/.cargo/bin/rustup target add i686-unknown-linux-gnu
fi

echo "Deploying rust-g ss220..."
git checkout master
~/.cargo/bin/cargo clean
echo "Deploying rust utils..."
git checkout "$RUST_UTILS_VERSION"
env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --ignore-rust-version --release --target=i686-unknown-linux-gnu
mv target/i686-unknown-linux-gnu/release/librust_g.so "$1/librust_g_ss220.so"
mv target/i686-unknown-linux-gnu/release/librust_utils.so "$1/librust_utils.so"
cd ..
#
cd "$original_dir"
# update dreamluau
Expand Down

0 comments on commit e81add7

Please sign in to comment.