Skip to content

Commit 47660c3

Browse files
committed
Merge remote-tracking branch 'upstream/main' into compiler-warns-experimental
2 parents 26726fe + 7097a84 commit 47660c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2585
-3111
lines changed

.github/workflows/compile.yml

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
PTERODACTYL_RESTART_SLEEPTIME: "0"
7373
PTERODACTYL_RESTART: "true"
7474
BUILD_CACHE: "true"
75+
NO_SAVE_CACHE: "true" # Cache will only be updated by main compiles in build_plugin_linux job
7576

7677
build_testingarea_dev2: # Could make this use the already created artifact but I'm too lazy rn
7778
name: "Build 32x (Testing Area - Public)"
@@ -95,6 +96,7 @@ jobs:
9596
PTERODACTYL_RESTART_SLEEPTIME: "0"
9697
PTERODACTYL_RESTART: "true"
9798
BUILD_CACHE: "true"
99+
NO_SAVE_CACHE: "true" # Cache will only be updated by main compiles in build_plugin_linux job
98100

99101
build_testingarea_64x:
100102
name: "Build 64x (Testing Area - 64x)"
@@ -119,6 +121,7 @@ jobs:
119121
PTERODACTYL_RESTART_SLEEPTIME: "0"
120122
PTERODACTYL_RESTART: "true"
121123
BUILD_CACHE: "true"
124+
NO_SAVE_CACHE: "true" # Cache will only be updated by main compiles in build_plugin_linux job
122125

123126
build_ghostinj:
124127
name: "Build GhostInj"
@@ -137,6 +140,65 @@ jobs:
137140
GARRYSMOD_COMMON: "RaphaelIT7/garrysmod_common"
138141
BUILD_CACHE: "true"
139142

143+
build_stripped_module:
144+
# This saves us useless compiles when it would already fail
145+
# + This way we always use the newest cache reducing compile time.
146+
# Update: NEVERMIND, this turned out to slow down the entire build process simply because we hit the runner limit
147+
# And less stuff could run in parallel.
148+
# Doing this paralle to the main builds gives us at minimim 1min time with ~34 runners available to run parallel
149+
# needs: build_plugin_linux
150+
name: "Build Stripped modules"
151+
uses: RaphaelIT7/gmod-common-module-base/.github/workflows/compile.yml@workflow
152+
strategy:
153+
fail-fast: false
154+
matrix:
155+
module:
156+
- autorefresh
157+
- holylib
158+
- gameevent
159+
- serverplugin
160+
- sourcetv
161+
- stringtable
162+
- precachefix
163+
- pvs
164+
- surffix
165+
- filesystem
166+
- util
167+
- concommand
168+
- vprof
169+
- cvars
170+
- bitbuf
171+
- networking
172+
- steamworks
173+
- pas
174+
- bass
175+
- systimer
176+
- voicechat
177+
- physenv
178+
- net
179+
- entitylist
180+
- httpserver
181+
- gameserver
182+
- soundscape
183+
- luajit
184+
- holylua
185+
with:
186+
PROJECT_NAME: "holylib"
187+
BUILD_64x: "true"
188+
REALM: "sv"
189+
LINUX_FILEEXTENTION: "so"
190+
BUILD_WINDOWS: "false"
191+
ARTIFACT_EXPIRE: "7"
192+
UPLOAD: "none"
193+
BUILD_CACHE: "true"
194+
NO_SAVE_CACHE: "true"
195+
SOURCESDK_MINIMAL: "RaphaelIT7/sourcesdk-minimal"
196+
SOURCESDK_MINIMAL_BRANCH: "patch-7"
197+
SOURCESDK_MINIMAL_64XBRANCH: "x86-64-patch-3"
198+
GARRYSMOD_COMMON: "RaphaelIT7/garrysmod_common"
199+
ADDITIONAL_LINUX_32_SETUP: 'rm -rf source/ivp && cd source/modules/ && ls | grep -xvF ${{ matrix.module }}.cpp | xargs rm -f -- && cd ../../'
200+
ADDITIONAL_LINUX_64_SETUP: 'rm -rf source/ivp && cd source/modules/ && ls | grep -xvF ${{ matrix.module }}.cpp | xargs rm -f -- && cd ../../'
201+
140202
setup_artifacts: # Having this as a matrix won't hurt concurrency since both 32x & 64x finish around the same time
141203
name: "Setup ${{ matrix.arch }} Artifact"
142204
needs: [build_plugin_linux, build_ghostinj]
@@ -373,7 +435,7 @@ jobs:
373435
run: |
374436
cd source/_prebuildtools
375437
chmod +x luajit_64
376-
./luajit_64 _workflow_summary.lua "${{github.repository}}" "${{env.LOKI_PUBLIC}}" "${{secrets.LOKI_HOST}}" "${{secrets.LOKI_APIKEY}}" "${{github.run_number}}"
438+
./luajit_64 _workflow_summary.lua "${{github.repository}}" "${{env.LOKI_PUBLIC}}" "${{secrets.LOKI_HOST}}" "${{secrets.LOKI_APIKEY}}" "${{github.run_number}}" "0" "${{github.event_name}}"
377439
378440
echo "$(cat generated_summary.md)" > $GITHUB_STEP_SUMMARY
379441
@@ -559,12 +621,12 @@ jobs:
559621
strategy:
560622
fail-fast: false
561623
matrix:
562-
module:
624+
module:
625+
- autorefresh
563626
- holylib
564627
- gameevent
565628
- serverplugin
566629
- sourcetv
567-
- threadpoolfix
568630
- stringtable
569631
- precachefix
570632
- pvs
@@ -599,7 +661,7 @@ jobs:
599661
# -------
600662

601663
build_exampledll_linux:
602-
name: "Build Plugin"
664+
name: "Build ExampleDLL"
603665
uses: RaphaelIT7/gmod-common-module-base/.github/workflows/compile.yml@workflow
604666
with:
605667
PROJECT_PATH: "example-module-dll/"
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Build Custom Version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
modules:
7+
description: 'Space-separated list of modules to keep (e.g., holylib gameevent)'
8+
required: true
9+
type: string
10+
custom_vphysics:
11+
description: 'Include custom vphysics build'
12+
required: false
13+
default: false
14+
type: boolean
15+
16+
env:
17+
MODULES_LIST: "autorefresh holylib gameevent serverplugin sourcetv stringtable precachefix pvs surffix filesystem util concommand vprof cvars bitbuf networking steamworks pas bass systimer voicechat physenv net entitylist httpserver gameserver soundscape luajit holylua"
18+
19+
jobs:
20+
build_custom_version:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
COMMAND: ${{ steps.construct_command.outputs.COMMAND }}
24+
25+
steps:
26+
- name: Construct the removal command and output it
27+
id: construct_command
28+
run: |
29+
MODULES_SELECTED=(${{ inputs.modules }})
30+
31+
COMMAND="${{ inputs.custom_vphysics == false && 'rm -rf source/ivp &&' || '' }} cd source/modules && ls | grep -vF -e 'none'"
32+
33+
for MODULE in "${MODULES_SELECTED[@]}"; do
34+
if [[ " $MODULES_LIST " =~ " $MODULE " ]]; then
35+
COMMAND="$COMMAND -e $MODULE.cpp"
36+
fi
37+
done
38+
39+
COMMAND="$COMMAND | xargs rm -f -- && cd ../../"
40+
41+
echo "Generated Command: $COMMAND"
42+
echo "::set-output name=COMMAND::$COMMAND"
43+
44+
build_holylib:
45+
needs: build_custom_version
46+
uses: RaphaelIT7/gmod-common-module-base/.github/workflows/compile.yml@workflow
47+
with:
48+
PROJECT_NAME: "holylib"
49+
BUILD_64x: "true"
50+
REALM: "sv"
51+
LINUX_FILEEXTENTION: "so"
52+
BUILD_WINDOWS: "false"
53+
ARTIFACT_EXPIRE: "7"
54+
SOURCESDK_MINIMAL: "RaphaelIT7/sourcesdk-minimal"
55+
SOURCESDK_MINIMAL_BRANCH: "patch-7"
56+
SOURCESDK_MINIMAL_64XBRANCH: "x86-64-patch-3"
57+
GARRYSMOD_COMMON: "RaphaelIT7/garrysmod_common"
58+
ADDITIONAL_DATA: "1"
59+
ADDITIONAL_LINUX_32_SETUP: ${{ needs.build_custom_version.outputs.COMMAND }}
60+
ADDITIONAL_LINUX_64_SETUP: ${{ needs.build_custom_version.outputs.COMMAND }}
61+
62+
build_ghostinj:
63+
uses: RaphaelIT7/gmod-common-module-base/.github/workflows/compile.yml@workflow
64+
with:
65+
PROJECT_PATH: "ghostinj-dll/"
66+
PROJECT_NAME: "ghostinj"
67+
BUILD_64x: "true"
68+
LINUX_FILEEXTENTION: "dll"
69+
BUILD_WINDOWS: "false"
70+
USE_PREFIX: "false"
71+
ARTIFACT_EXPIRE: "7"
72+
ADDITIONAL_DATA: "1"
73+
SOURCESDK_MINIMAL: "RaphaelIT7/sourcesdk-minimal"
74+
SOURCESDK_MINIMAL_BRANCH: "patch-7"
75+
SOURCESDK_MINIMAL_64XBRANCH: "x86-64-patch-3"
76+
GARRYSMOD_COMMON: "RaphaelIT7/garrysmod_common"

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ If you already had a `ghostinj.dll`, you can rename it to `ghostinj2.dll` and it
2727
2. Put the `holylib.vdf` into the `garrysmod/addons/` directory.<br>
2828
3. Put the `gmsv_holylib_linux.so` into the `garrysmod/lua/bin/` directory.<br>
2929

30+
## Custom Builds (Linux Only)
31+
You can fork this repository and use the `Build Custom Version` to create a custom HolyLib version which only contains specific functions.<br>
32+
I heard from some that they don't want a huge DLL of which they only use a few functions of,<br>
33+
so by making a custom build anyone can include just the stuff they actually want and need, nothing else.<br>
34+
3035
## How to update (Newer GhostInj)
3136

3237
> [!NOTE]
@@ -88,6 +93,7 @@ This is done by first deleting the current `gmsv_holylib_linux[64].so` and then
8893
\- [+] Added `bitbuf.CreateStackReadBuffer` & `bitbuf.CreateStackWriteBuffer` to `bitbuf` module.<br>
8994
\- [+] Added a fallback method for HolyLib's internal `Util::PushEntity` function in case a Gmod update breaks our offsets which previously lead to undefined behavior<br>
9095
\- [+] Added a `ILuaThreadedCall` to call all modules Think function when HolyLib is loaded as a binary module/loaded using `require("holylib")`<br>
96+
\- [+] Added a new DLL system if anything wants to be loaded with HolyLib. (See: [example-module-dll](https://github.com/RaphaelIT7/gmod-holylib/tree/f937ba454b4d86edfc72df9cb3f8a689d7de2571/example-module-dll))<br>
9197
\- [#] Added some more safeguards to `IPhysicsEnvironment:Simulate` to prevent one from simulating a environment that is already being simulated.<br>
9298
\- [#] Highly optimized `util` module's json code to be noticably faster and use noticably less memory.<br>
9399
\- [#] Better support for multiple Lua states<br>
@@ -127,6 +133,16 @@ This is done by first deleting the current `gmsv_holylib_linux[64].so` and then
127133
\- [#] Tried to improve out of memory handling of `bitbuf.Create[Read/Write]Buffer` and `bf_read:ReadString()` functions<br>
128134
\- [#] Fixed a regression with `util.FancyTableToJSON` crashing with the `0.8-pre` build when it falsely tried to become sequential while being already non-sequential. (Reported by @Noahbg)<br>
129135
\- [#] Fixed absolute search cache causing files from any search path to be returned / destroying seperation between search paths (See https://github.com/RaphaelIT7/gmod-holylib/issues/83)<br>
136+
\- [#] Fixed HolyLua being unable to register any metatable causing crashes when trying to use them.<br>
137+
\- [#] Fixed some small memory leaks in HolyLibs CLuaInterface class<br>
138+
\- [#] Fixed `steamworks.ForceAuthenticate` being silently broken<br>
139+
\- [#] Fully seperated HolyLib's core from all modules allowing anyone to remove modules they don't want.<br>
140+
\- [#] Removed all dependencies modules had on each other allowing each module to compile without requiring another one.<br>
141+
\- [#] Fixed some issues in `luathreads` module that caused either crashes or simply were bugs<br>
142+
\- [#] Fixed lua error handler used by any `CLuaInterface` created by HolyLib failing (`error in error handler`)<br>
143+
\- [#] Moved `HolyLua` from HolyLib's core into a module to seperate it and allow anyone to remove it<br>
144+
\- [#] Fixed some memory leaks from our own `CLuaInterface` since on shutdown they never cleared up on removal/shutdown<br>
145+
\- [#] Added a speedup for pushing networked entities to Lua (On 64x pushing entities became 2.6x faster)<br>
130146
\- [-] Removed some unused code of former fixes that were implemented into Gmod<br>
131147

132148
You can see all changes/commits here:<br>

example-module-dll/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ This is an interface provided by HolyLib, which you can find here: https://githu
3232
Using this interface, you can for example, register your own module to HolyLib.
3333

3434
> [!WARNING]
35-
> If you use dev builds of HolyLib, interfaces will most likely change, ensure that your DLLs either use the newest interface of HolyLib, or
35+
> If you use dev builds of HolyLib, interfaces will most likely change, ensure that your DLLs either use the newest interface of HolyLib, or properly use the config

gluatests/lua/autorun/gmod_tests_init.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,11 @@ hook.Add("GLuaTest_Finished", "ChangeLevel", function()
1616
RunConsoleCommand("changelevel", game.GetMap())
1717
end
1818
end)
19+
20+
hook.Add("Initialize", "SetupBots", function()
21+
RunConsoleCommand("bot_zombie", "1")
22+
RunConsoleCommand("sv_stressbots", "1")
23+
for k=1, math.Clamp(math.ceil(game.MaxPlayers() / 4), 1, 4) do
24+
RunConsoleCommand("bot")
25+
end
26+
end)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
return {
2+
groupName = "HolyLib manages to properly clear the Lua table of HolyLib UserData",
3+
cases = {
4+
{
5+
name = "Is _HOLYLIB_CORE.ClearLuaTable function existent",
6+
func = function()
7+
expect( _HOLYLIB_CORE.ClearLuaTable ).to.beA( "function" )
8+
end
9+
},
10+
{
11+
name = "Clears Lua Table correctly",
12+
func = function()
13+
local userdata = _HOLYLIB_CORE.PushTestUserData()
14+
userdata.example = "Test"
15+
expect( userdata.example ).to.equal( "Test" )
16+
17+
_HOLYLIB_CORE.ClearLuaTable(userdata)
18+
expect( userdata.example ).to.beNil()
19+
end
20+
},
21+
{
22+
name = "Performance",
23+
func = function()
24+
local userdata = _HOLYLIB_CORE.PushTestUserData()
25+
HolyLib_RunPerformanceTest("_HOLYLIB_CORE.ClearLuaTable", _HOLYLIB_CORE.ClearLuaTable, userdata)
26+
end
27+
},
28+
}
29+
}

gluatests/lua/tests/core/GetEntity.lua

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@ return {
22
groupName = "HolyLib manages to properly Get Entities from Lua",
33
cases = {
44
{
5-
name = "Is HolyLib.__GetEntity function existent",
5+
name = "Is _HOLYLIB_CORE.GetEntity function existent",
66
func = function()
7-
expect( HolyLib.__GetEntity ).to.beA( "function" )
7+
expect( _HOLYLIB_CORE.GetEntity ).to.beA( "function" )
88
end
99
},
1010
{
1111
name = "Pushes an Entity to Lua correctly",
1212
func = function()
13-
local success = HolyLib.__GetEntity(game.GetWorld()) -- Returns false or crashes if anything was wrong
13+
local success = _HOLYLIB_CORE.GetEntity(game.GetWorld()) -- Returns false or crashes if anything was wrong
1414

1515
expect( success ).to.beTrue()
1616
end
1717
},
18+
{
19+
name = "Performance",
20+
func = function()
21+
HolyLib_RunPerformanceTest("_HOLYLIB_CORE.RawGetEntity", _HOLYLIB_CORE.RawGetEntity, game.GetWorld())
22+
end
23+
},
1824
}
1925
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
return {
2+
groupName = "HolyLib manages to properly Get GMod UserData from Lua",
3+
cases = {
4+
{
5+
name = "Is _HOLYLIB_CORE.GetGModVector function existent",
6+
func = function()
7+
expect( _HOLYLIB_CORE.GetGModVector ).to.beA( "function" )
8+
end
9+
},
10+
{
11+
name = "Pushes an Entity to Lua correctly",
12+
func = function()
13+
local success = _HOLYLIB_CORE.GetGModVector(Vector(1, 2, 3)) -- Returns false or crashes if anything was wrong. We check for x = 1, y = 2, z = 3
14+
15+
expect( success ).to.beTrue()
16+
end
17+
},
18+
{
19+
name = "Performance",
20+
func = function()
21+
HolyLib_RunPerformanceTest("_HOLYLIB_CORE.RawGetGModVector", _HOLYLIB_CORE.RawGetGModVector, Vector(1, 2, 3))
22+
end
23+
},
24+
}
25+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
return {
2+
groupName = "HolyLib manages to properly Push Entities to Lua",
3+
cases = {
4+
{
5+
name = "Is _HOLYLIB_CORE.GetModuleData function existent",
6+
func = function()
7+
expect( _HOLYLIB_CORE.GetModuleData ).to.beA( "function" )
8+
end
9+
},
10+
{
11+
name = "Internally verifies the pointer it got",
12+
func = function()
13+
-- If we got a garbage pointer, this will return false or crash.
14+
expect( _HOLYLIB_CORE.GetModuleData() ).to.beTrue()
15+
end
16+
},
17+
{
18+
name = "Performance",
19+
func = function()
20+
HolyLib_RunPerformanceTest("_HOLYLIB_CORE.GetModuleData", _HOLYLIB_CORE.RawGetModuleData)
21+
end
22+
},
23+
}
24+
}

gluatests/lua/tests/core/GetPlayer.lua

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
return {
2-
groupName = "HolyLib manages to properly Get Entities from Lua",
2+
groupName = "HolyLib manages to properly Get Players from Lua",
33
cases = {
44
{
5-
name = "Is HolyLib.__GetEntity function existent",
5+
name = "Is _HOLYLIB_CORE.GetPlayer function existent",
66
func = function()
7-
expect( HolyLib.__GetEntity ).to.beA( "function" )
8-
end
9-
},
10-
{
11-
name = "Pushes an Entity to Lua correctly",
12-
func = function()
13-
local success = HolyLib.__GetEntity(game.GetWorld()) -- Returns false or crashes if anything was wrong
14-
15-
expect( success ).to.beTrue()
7+
expect( _HOLYLIB_CORE.GetPlayer ).to.beA( "function" )
168
end
179
},
1810
}

0 commit comments

Comments
 (0)