Update RustG + Minor Travis Updates (#14742)

* RustG Update

* Formatting

* Removes compiled linux binary by default

* Adds to gitignore

* Travis optimisations

* New commit to force a travis update

* *sigh*

* Deps are pain

* We going bionic

* Nukes some old deps

* PHPPPPPPPPPPP

* Adds some more log ends

* Disambiguation
This commit is contained in:
AffectedArc07
2020-10-27 14:15:12 -04:00
committed by GitHub
parent 5f9c790507
commit 4d9e7cc60d
11 changed files with 91 additions and 50 deletions
+2 -1
View File
@@ -37,4 +37,5 @@ stddef.dm
# ignore midi2piano build cache
/tools/midi2piano/midi2piano/obj/*
# ignore RUSTG linux binary, since linux dependencies vary with pretty much every single install
librust_g.so
+3 -2
View File
@@ -1,5 +1,5 @@
language: generic
dist: xenial
dist: bionic
os: linux
git:
@@ -50,10 +50,10 @@ jobs:
packages:
- python3
- libstdc++6:i386
- libssl-dev:i386
- gcc-multilib
- pkg-config:i386
- zlib1g-dev:i386
- libssl1.1:i386
cache:
directories:
- $HOME/.cargo
@@ -63,6 +63,7 @@ jobs:
- 'sudo apt-get -qq update'
install:
- tools/travis/install_byond.sh
- tools/travis/install_rustg.sh
- source $HOME/BYOND/byond/bin/byondsetup
- python3 tools/travis/generate_sql_scripts.py
before_script:
+3 -1
View File
@@ -4,8 +4,10 @@ export SPACEMANDMM_TAG=suite-1.6
# For NanoUI + TGUI
export NODE_VERSION=12
# For the scripts in tools
export PHP_VERSION=5.6
export PHP_VERSION=7.2
# Byond Major
export BYOND_MAJOR=513
# Byond Minor
export BYOND_MINOR=1526
# For the RUSTG library
export RUSTG_VERSION=2.0
+40
View File
@@ -0,0 +1,40 @@
/// Locator for the RUSTG DLL or SO depending on system type
#define RUST_G (world.system_type == UNIX ? "./librust_g.so" : "./rust_g.dll")
// Defines for internal job subsystem //
#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET"
#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB"
#define RUSTG_JOB_ERROR "JOB PANICKED"
// DMI related operations //
#define rustg_dmi_strip_metadata(fname) call(RUST_G, "dmi_strip_metadata")(fname)
#define rustg_dmi_create_png(path, width, height, data) call(RUST_G, "dmi_create_png")(path, width, height, data)
#define rustg_noise_get_at_coordinates(seed, x, y) call(RUST_G, "noise_get_at_coordinates")(seed, x, y)
// Git related operations // - AA TODO: Add in in-code revision parsing
#define rustg_git_revparse(rev) call(RUST_G, "rg_git_revparse")(rev)
#define rustg_git_commit_date(rev) call(RUST_G, "rg_git_commit_date")(rev)
// Logging stuff //
#define rustg_log_write(fname, text) call(RUST_G, "log_write")(fname, text)
/proc/rustg_log_close_all() return call(RUST_G, "log_close_all")()
// HTTP library stuff // - AA TODO: Add in SShttp
#define RUSTG_HTTP_METHOD_GET "get"
#define RUSTG_HTTP_METHOD_PUT "put"
#define RUSTG_HTTP_METHOD_DELETE "delete"
#define RUSTG_HTTP_METHOD_PATCH "patch"
#define RUSTG_HTTP_METHOD_HEAD "head"
#define RUSTG_HTTP_METHOD_POST "post"
#define rustg_http_request_blocking(method, url, body, headers) call(RUST_G, "http_request_blocking")(method, url, body, headers)
#define rustg_http_request_async(method, url, body, headers) call(RUST_G, "http_request_async")(method, url, body, headers)
#define rustg_http_check_request(req_id) call(RUST_G, "http_check_request")(req_id)
// SQL stuff // - AA TODO: Async SQL + SSdbcore
#define rustg_sql_connect_pool(options) call(RUST_G, "sql_connect_pool")(options)
#define rustg_sql_query_async(handle, query, params) call(RUST_G, "sql_query_async")(handle, query, params)
#define rustg_sql_query_blocking(handle, query, params) call(RUST_G, "sql_query_blocking")(handle, query, params)
#define rustg_sql_connected(handle) call(RUST_G, "sql_connected")(handle)
#define rustg_sql_disconnect_pool(handle) call(RUST_G, "sql_disconnect_pool")(handle)
#define rustg_sql_check_query(job_id) call(RUST_G, "sql_check_query")("[job_id]")
+31 -41
View File
@@ -1,18 +1,15 @@
//location of the rust-g library
#define RUST_G (world.system_type == UNIX ? "./librust_g.so" : "./rust_g.dll")
// On Linux/Unix systems the line endings are LF, on windows it's CRLF, admins that don't use notepad++
// will get logs that are one big line if the system is Linux and they are using notepad. This solves it by adding CR to every line ending
// in the logs. ascii character 13 = CR
GLOBAL_VAR_INIT(log_end, (world.system_type == UNIX ? ascii2text(13) : ""))
GLOBAL_PROTECT(log_end)
#define DIRECT_OUTPUT(A, B) A << B
#define SEND_IMAGE(target, image) DIRECT_OUTPUT(target, image)
#define SEND_SOUND(target, sound) DIRECT_OUTPUT(target, sound)
#define SEND_TEXT(target, text) DIRECT_OUTPUT(target, text)
#define WRITE_FILE(file, text) DIRECT_OUTPUT(file, text)
#define WRITE_LOG(log, text) call(RUST_G, "log_write")(log, text)
/proc/error(msg)
log_world("## ERROR: [msg]")
@@ -32,11 +29,11 @@ GLOBAL_VAR_INIT(log_end, (world.system_type == UNIX ? ascii2text(13) : ""))
/proc/log_admin(text)
GLOB.admin_log.Add(text)
if(config.log_admin)
WRITE_LOG(GLOB.world_game_log, "ADMIN: [text][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "ADMIN: [text][GLOB.log_end]")
/proc/log_debug(text)
if(config.log_debug)
WRITE_LOG(GLOB.world_game_log, "DEBUG: [text][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "DEBUG: [text][GLOB.log_end]")
for(var/client/C in GLOB.admins)
if(check_rights(R_DEBUG, 0, C.mob) && (C.prefs.toggles & PREFTOGGLE_CHAT_DEBUGLOGS))
@@ -44,107 +41,107 @@ GLOBAL_VAR_INIT(log_end, (world.system_type == UNIX ? ascii2text(13) : ""))
/proc/log_game(text)
if(config.log_game)
WRITE_LOG(GLOB.world_game_log, "GAME: [text][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "GAME: [text][GLOB.log_end]")
/proc/log_vote(text)
if(config.log_vote)
WRITE_LOG(GLOB.world_game_log, "VOTE: [text][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "VOTE: [text][GLOB.log_end]")
/proc/log_access_in(client/new_client)
if(config.log_access)
var/message = "[key_name(new_client)] - IP:[new_client.address] - CID:[new_client.computer_id] - BYOND v[new_client.byond_version]"
WRITE_LOG(GLOB.world_game_log, "ACCESS IN: [message][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "ACCESS IN: [message][GLOB.log_end]")
/proc/log_access_out(mob/last_mob)
if(config.log_access)
var/message = "[key_name(last_mob)] - IP:[last_mob.lastKnownIP] - CID:[last_mob.computer_id] - BYOND Logged Out"
WRITE_LOG(GLOB.world_game_log, "ACCESS OUT: [message][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "ACCESS OUT: [message][GLOB.log_end]")
/proc/log_say(text, mob/speaker)
if(config.log_say)
WRITE_LOG(GLOB.world_game_log, "SAY: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "SAY: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
/proc/log_whisper(text, mob/speaker)
if(config.log_whisper)
WRITE_LOG(GLOB.world_game_log, "WHISPER: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "WHISPER: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
/proc/log_ooc(text, client/user)
if(config.log_ooc)
WRITE_LOG(GLOB.world_game_log, "OOC: [user.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "OOC: [user.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
/proc/log_aooc(text, client/user)
if(config.log_ooc)
WRITE_LOG(GLOB.world_game_log, "AOOC: [user.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "AOOC: [user.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
/proc/log_looc(text, client/user)
if(config.log_ooc)
WRITE_LOG(GLOB.world_game_log, "LOOC: [user.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "LOOC: [user.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
/proc/log_emote(text, mob/speaker)
if(config.log_emote)
WRITE_LOG(GLOB.world_game_log, "EMOTE: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "EMOTE: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
/proc/log_attack(attacker, defender, message)
if(config.log_attack)
WRITE_LOG(GLOB.world_game_log, "ATTACK: [attacker] against [defender]: [message][GLOB.log_end]") //Seperate attack logs? Why?
rustg_log_write(GLOB.world_game_log, "ATTACK: [attacker] against [defender]: [message][GLOB.log_end]") //Seperate attack logs? Why?
/proc/log_adminsay(text, mob/speaker)
if(config.log_adminchat)
WRITE_LOG(GLOB.world_game_log, "ADMINSAY: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "ADMINSAY: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
/proc/log_qdel(text)
WRITE_LOG(GLOB.world_qdel_log, "QDEL: [text]")
rustg_log_write(GLOB.world_qdel_log, "QDEL: [text][GLOB.log_end]")
/proc/log_mentorsay(text, mob/speaker)
if(config.log_adminchat)
WRITE_LOG(GLOB.world_game_log, "MENTORSAY: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "MENTORSAY: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
/proc/log_ghostsay(text, mob/speaker)
if(config.log_say)
WRITE_LOG(GLOB.world_game_log, "DEADCHAT: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "DEADCHAT: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
/proc/log_ghostemote(text, mob/speaker)
if(config.log_emote)
WRITE_LOG(GLOB.world_game_log, "DEADEMOTE: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "DEADEMOTE: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
/proc/log_adminwarn(text)
if(config.log_adminwarn)
WRITE_LOG(GLOB.world_game_log, "ADMINWARN: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "ADMINWARN: [html_decode(text)][GLOB.log_end]")
/proc/log_pda(text, mob/speaker)
if(config.log_pda)
WRITE_LOG(GLOB.world_game_log, "PDA: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "PDA: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
/proc/log_chat(text, mob/speaker)
if(config.log_pda)
WRITE_LOG(GLOB.world_game_log, "CHAT: [speaker.simple_info_line()] [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "CHAT: [speaker.simple_info_line()] [html_decode(text)][GLOB.log_end]")
/proc/log_misc(text)
WRITE_LOG(GLOB.world_game_log, "MISC: [text][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "MISC: [text][GLOB.log_end]")
/proc/log_world(text)
SEND_TEXT(world.log, text)
if(config && config.log_world_output)
WRITE_LOG(GLOB.world_game_log, "WORLD: [html_decode(text)][GLOB.log_end]")
rustg_log_write(GLOB.world_game_log, "WORLD: [html_decode(text)][GLOB.log_end]")
/proc/log_runtime_txt(text) // different from /tg/'s log_runtime because our error handler has a log_runtime proc already that does other stuff
WRITE_LOG(GLOB.world_runtime_log, text)
rustg_log_write(GLOB.world_runtime_log, "[text][GLOB.log_end]")
/proc/log_config(text)
WRITE_LOG(GLOB.config_error_log, text)
rustg_log_write(GLOB.config_error_log, "[text][GLOB.log_end]")
SEND_TEXT(world.log, text)
/proc/log_href(text)
WRITE_LOG(GLOB.world_href_log, "HREF: [html_decode(text)]")
rustg_log_write(GLOB.world_href_log, "HREF: [html_decode(text)][GLOB.log_end]")
/proc/log_asset(text)
WRITE_LOG(GLOB.world_asset_log, "ASSET: [text]")
rustg_log_write(GLOB.world_asset_log, "ASSET: [text][GLOB.log_end]")
/proc/log_runtime_summary(text)
WRITE_LOG(GLOB.runtime_summary_log, "[text]")
rustg_log_write(GLOB.runtime_summary_log, "[text][GLOB.log_end]")
/proc/log_tgui(text)
WRITE_LOG(GLOB.tgui_log, "[text]")
rustg_log_write(GLOB.tgui_log, "[text][GLOB.log_end]")
/**
* Standardized method for tracking startup times.
@@ -162,11 +159,7 @@ GLOBAL_VAR_INIT(log_end, (world.system_type == UNIX ? ascii2text(13) : ""))
/* For logging round startup. */
/proc/start_log(log)
WRITE_LOG(log, "Starting up.\n-------------------------")
/* Close open log handles. This should be called as late as possible, and no logging should hapen after. */
/proc/shutdown_logging()
call(RUST_G, "log_close_all")()
rustg_log_write(log, "Starting up.\n-------------------------[GLOB.log_end]")
// Helper procs for building detailed log lines
@@ -192,6 +185,3 @@ GLOBAL_VAR_INIT(log_end, (world.system_type == UNIX ? ascii2text(13) : ""))
/client/proc/simple_info_line()
return "[key_name(src)] ([mob.x],[mob.y],[mob.z])"
//this is only used here (for now)
#undef RUST_G
+2 -2
View File
@@ -302,7 +302,7 @@ GLOBAL_VAR_INIT(world_topic_spam_protect_time, world.timeofday)
log_admin("[key_name(usr)] has requested an immediate world restart via client side debugging tools")
spawn(0)
to_chat(world, "<span class='boldannounce'>Rebooting world immediately due to host request</span>")
shutdown_logging() // Past this point, no logging procs can be used, at risk of data loss.
rustg_log_close_all() // Past this point, no logging procs can be used, at risk of data loss.
if(config && config.shutdown_on_reboot)
sleep(0)
if(GLOB.shutdown_shell_command)
@@ -340,7 +340,7 @@ GLOBAL_VAR_INIT(world_topic_spam_protect_time, world.timeofday)
Master.Shutdown() //run SS shutdowns
GLOB.dbcon.Disconnect() // DCs cleanly from the database
shutdown_logging() // Past this point, no logging procs can be used, at risk of data loss.
rustg_log_close_all() // Past this point, no logging procs can be used, at risk of data loss.
#ifdef UNIT_TESTS
FinishTestRun()
BIN
View File
Binary file not shown.
+1
View File
@@ -68,6 +68,7 @@
#include "code\__DEFINES\reagents.dm"
#include "code\__DEFINES\role_preferences.dm"
#include "code\__DEFINES\rolebans.dm"
#include "code\__DEFINES\rust_g.dm"
#include "code\__DEFINES\shuttle.dm"
#include "code\__DEFINES\sight.dm"
#include "code\__DEFINES\sound.dm"
BIN
View File
Binary file not shown.
-3
View File
@@ -8,7 +8,4 @@ nvm install $NODE_VERSION
nvm use $NODE_VERSION
npm install --global yarn
pip install --user PyYaml -q
pip install --user beautifulsoup4 -q
phpenv global $PHP_VERSION
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
source _build_dependencies.sh
mkdir -p ~/.byond/bin
wget -O ~/.byond/bin/librust_g.so "https://github.com/ParadiseSS13/rust-g/releases/download/$RUSTG_VERSION/librust_g.so"
chmod +x ~/.byond/bin/librust_g.so
ldd ~/.byond/bin/librust_g.so