-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2158861
Showing
12 changed files
with
638 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# This workflow is based on tg-rust-g/.github/workflows/rust.yml | ||
# It has very minor modifications to be compatible with this | ||
name: rust-g | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
build-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: "Apply Paradise Patches" | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "CI User" | ||
./apply_patches.sh | ||
shell: bash | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: i686-pc-windows-msvc | ||
- name: Check (all features) | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
toolchain: stable | ||
command: check | ||
args: --manifest-path paradise-rust-g/Cargo.toml --target i686-pc-windows-msvc --all-features | ||
- name: Build (release) (default features) | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
toolchain: stable | ||
command: build | ||
args: --manifest-path paradise-rust-g/Cargo.toml --target i686-pc-windows-msvc --release | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: rust_g.dll | ||
path: paradise-rust-g/target/i686-pc-windows-msvc/release/rust_g.dll | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
env: | ||
BYOND_MAJOR: 513 | ||
BYOND_MINOR: 1536 | ||
PKG_CONFIG_ALLOW_CROSS: 1 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: "Apply Paradise Patches" | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "CI User" | ||
./apply_patches.sh | ||
- run: | | ||
sudo dpkg --add-architecture i386 | ||
sudo apt-get update | ||
sudo apt-get install g++-multilib zlib1g-dev:i386 libssl-dev:i386 pkg-config:i386 | ||
./paradise-rust-g/scripts/install_byond.sh | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: i686-unknown-linux-gnu | ||
- name: Check (all features) | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
toolchain: stable | ||
command: check | ||
args: --manifest-path paradise-rust-g/Cargo.toml --target i686-unknown-linux-gnu --all-features | ||
- name: Build (Debug) (all features) | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
toolchain: stable | ||
command: build | ||
args: --manifest-path paradise-rust-g/Cargo.toml --target i686-unknown-linux-gnu --all-features | ||
- name: Run tests (all features) | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
toolchain: stable | ||
command: test | ||
args: --manifest-path paradise-rust-g/Cargo.toml --target i686-unknown-linux-gnu --all-features | ||
env: | ||
BYOND_BIN: /home/runner/BYOND/byond/bin | ||
- name: Build (release) (default features) | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
toolchain: stable | ||
command: build | ||
args: --manifest-path paradise-rust-g/Cargo.toml --target i686-unknown-linux-gnu --release | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: rust_g | ||
path: paradise-rust-g/target/i686-unknown-linux-gnu/release/librust_g.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
paradise-rust-g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "tg-rust-g"] | ||
path = tg-rust-g | ||
url = https://github.com/tgstation/rust-g.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# ParadiseSS13 RUST-G | ||
|
||
This repository holds ParadiseSS13 modifications of [rust-g](https://github.com/tgstation/rust-g) libraries from /tg/station. | ||
|
||
This works by keeping an up-to-date copy of /tg/station's code, and a folder of Paradise patches to be applied. This reduces our need for major reworks to code, as we can just use patches to achieve what we need without cluttering the main tree. | ||
|
||
## License | ||
|
||
The license for RUST-G itself can be found inside the `tg-rust-g` directory. Code for the Paradise modifications falls under the same license. | ||
|
||
## How to (Compiling) | ||
|
||
1. You **must** have a copy of `Git Bash` or some other bash emulator on windows, and a git identity setup. This will not work otherwise. | ||
2. Run the `apply_patches.sh` file to autocreate a clone of `tg-rust-g`, and apply the patches to it. | ||
3. Paradise RUST-G requires all features to be enabled. | ||
- To build on windows, run `cargo build --release --all-features --target=i686-pc-windows-msvc`. This will generate a 32-bit `.dll` file that is compatible with BYOND. | ||
- To build on linux, run `cargo build --release --all-features --target=i686-unknown-linux-gnu`. This will generate a 32-bit `.so` file that is compatible with BYOND. | ||
|
||
If you are still stuck, check `tg-rust-g/README.md` for more detailed instructions. | ||
|
||
## How to (Developing) | ||
|
||
1. You **must** have a copy of `Git Bash` or some other bash emulator on windows, and a git identity setup. This will not work otherwise. | ||
2. Run the `apply_patches.sh` file to autocreate a clone of `tg-rust-g`, and apply the patches to it. | ||
3. Open the folder called `paradise-rust-g` inside an IDE of your choice. Make your edits in here. | ||
4. Save your edits as a single commit inside `paradise-rust-g`. Do not push changes. Do not modify `tg-rust-g`. | ||
5. Run the `rebuild_patches.sh` script to convert your commit into a patch that will be saved in the `paradise_patches` directory | ||
|
||
## Credits | ||
|
||
- /tg/station for the original RUST-G works. | ||
- SpigotMC for the patching logic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
|
||
PS1="$" | ||
basedir=`pwd` | ||
echo "Rebuilding projects.... " | ||
|
||
apply_patch() { | ||
what=$1 | ||
target=$2 | ||
branch=$3 | ||
|
||
cd "$basedir" | ||
if [ ! -d "$target" ]; then | ||
git clone $what $target | ||
fi | ||
cd "$basedir/$target" | ||
echo "Resetting $target to $what..." | ||
git config commit.gpgSign false | ||
git remote rm origin >/dev/null 2>&1 | ||
git remote add origin ../$what >/dev/null 2>&1 | ||
git checkout master >/dev/null 2>&1 | ||
git fetch origin >/dev/null 2>&1 | ||
git reset --hard $branch | ||
|
||
echo " Applying patches to $target..." | ||
git am --abort >/dev/null 2>&1 | ||
git am --3way --ignore-space-change --ignore-whitespace "../${target}-patches/"*.patch | ||
if [ "$?" != "0" ]; then | ||
echo " Something did not apply cleanly to $target." | ||
echo " Please review above details and finish the apply then" | ||
echo " save the changes with rebuild_patches.sh" | ||
exit 1 | ||
else | ||
echo " Patches applied cleanly to $target" | ||
fi | ||
} | ||
|
||
apply_patch tg-rust-g paradise-rust-g origin/master |
41 changes: 41 additions & 0 deletions
41
paradise-rust-g-patches/0001-Paradise-Version-Changes.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From 7a73222a05051a5b839034a65f9575adf052e29d Mon Sep 17 00:00:00 2001 | ||
From: AffectedArc07 <[email protected]> | ||
Date: Wed, 13 Oct 2021 22:04:30 +0100 | ||
Subject: [PATCH] Paradise Version Changes | ||
|
||
|
||
diff --git a/Cargo.lock b/Cargo.lock | ||
index 94f4437..9f52312 100644 | ||
--- a/Cargo.lock | ||
+++ b/Cargo.lock | ||
@@ -1502,7 +1502,7 @@ dependencies = [ | ||
|
||
[[package]] | ||
name = "rust-g" | ||
-version = "0.5.0" | ||
+version = "0.5.0-P" | ||
dependencies = [ | ||
"base64 0.13.0", | ||
"chrono", | ||
diff --git a/Cargo.toml b/Cargo.toml | ||
index 785f036..6fac5ec 100644 | ||
--- a/Cargo.toml | ||
+++ b/Cargo.toml | ||
@@ -1,11 +1,11 @@ | ||
[package] | ||
name = "rust-g" | ||
edition = "2018" | ||
-version = "0.5.0" | ||
+version = "0.5.0-P" | ||
authors = ["Bjorn Neergaard <[email protected]>"] | ||
-repository = "https://github.com/tgstation/rust-g" | ||
+repository = "https://github.com/ParadiseSS13/rust-g" | ||
license-file = "LICENSE" | ||
-description = "Offloaded task library for the /tg/ Space Station 13 codebase" | ||
+description = "Offloaded task library for the ParadiseSS13 Space Station 13 codebase" | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
-- | ||
2.33.0.windows.2 | ||
|
55 changes: 55 additions & 0 deletions
55
paradise-rust-g-patches/0002-Paradise-Logging-Changes.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
From a5fb0665885e2c297d4c4d2accf58dd34afac723 Mon Sep 17 00:00:00 2001 | ||
From: AffectedArc07 <[email protected]> | ||
Date: Wed, 13 Oct 2021 22:04:37 +0100 | ||
Subject: [PATCH] Paradise Logging Changes | ||
|
||
|
||
diff --git a/dmsrc/log.dm b/dmsrc/log.dm | ||
index d0380a5..9faa561 100644 | ||
--- a/dmsrc/log.dm | ||
+++ b/dmsrc/log.dm | ||
@@ -1,2 +1,2 @@ | ||
-#define rustg_log_write(fname, text, format) call(RUST_G, "log_write")(fname, text, format) | ||
+#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")() | ||
diff --git a/src/log.rs b/src/log.rs | ||
index 41e86aa..8e43147 100644 | ||
--- a/src/log.rs | ||
+++ b/src/log.rs | ||
@@ -14,7 +14,7 @@ thread_local! { | ||
static FILE_MAP: RefCell<HashMap<OsString, File>> = RefCell::new(HashMap::new()); | ||
} | ||
|
||
-byond_fn! { log_write(path, data, ...rest) { | ||
+byond_fn! { log_write(path, data) { | ||
FILE_MAP.with(|cell| -> Result<()> { | ||
// open file | ||
let mut map = cell.borrow_mut(); | ||
@@ -24,20 +24,10 @@ byond_fn! { log_write(path, data, ...rest) { | ||
Entry::Vacant(elem) => elem.insert(open(path)?), | ||
}; | ||
|
||
- if rest.first().map(|x| &**x) == Some("false") { | ||
- // Write the data to the file with no accoutrements. | ||
- write!(file, "{}", data)?; | ||
- } else { | ||
- // write first line, timestamped | ||
- let mut iter = data.split('\n'); | ||
- if let Some(line) = iter.next() { | ||
- write!(file, "[{}] {}\n", Utc::now().format("%F %T%.3f"), line)?; | ||
- } | ||
- | ||
- // write remaining lines | ||
- for line in iter { | ||
- write!(file, " - {}\n", line)?; | ||
- } | ||
+ // write all lines timestamped | ||
+ let iter = data.split('\n'); | ||
+ for line in iter { | ||
+ write!(file, "[{}] {}\n", Utc::now().format("%FT%T"), line)?; | ||
} | ||
|
||
Ok(()) | ||
-- | ||
2.33.0.windows.2 | ||
|
Oops, something went wrong.