Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge rc to release #150

Merged
merged 214 commits into from
May 20, 2022
Merged
Changes from all commits
Commits
Show all changes
214 commits
Select commit Hold shift + click to select a range
3d9e6be
shared: Add resource class
LeonMrBonnie Jan 25, 2022
418ccb2
shared: Update SDK
LeonMrBonnie Jan 25, 2022
ee03a86
shared: Add ConfigNodeToV8 helper
LeonMrBonnie Jan 25, 2022
6be825d
server: Add resource.config getter
LeonMrBonnie Jan 25, 2022
cb7abfa
server: Add alt.getServerConfig
LeonMrBonnie Jan 25, 2022
a5b9e36
shared: Check for number in scalar config nodes
LeonMrBonnie Jan 25, 2022
81ea00a
client: Add hasLocalMeta and getLocalMeta
LeonMrBonnie Jan 25, 2022
3cdc642
Revert "client: Add hasLocalMeta and getLocalMeta"
LeonMrBonnie Jan 26, 2022
028f7a1
general: Fix test-client workflow submodule pull
LeonMrBonnie Jan 26, 2022
4f410d2
shared: Fix missing exception description
LeonMrBonnie Jan 26, 2022
af47dd3
server: Fix missing voice channel constructor check
LeonMrBonnie Jan 27, 2022
042c1c6
shared: Add SetLazyAccessor helper
LeonMrBonnie Jan 30, 2022
7732017
client: Use SetLazyAccessor helper for rml element style
LeonMrBonnie Jan 30, 2022
c8c35e3
client: Add netOwnerChange event
LeonMrBonnie Feb 1, 2022
0987121
client: Implement support for synthetic modules
LeonMrBonnie Feb 2, 2022
dd0e06f
client: Use synthetic module for JSON modules
LeonMrBonnie Feb 2, 2022
251a1c4
client: Fix crash on worker destroy
LeonMrBonnie Feb 3, 2022
422ace5
client: Fix json import assertion
LeonMrBonnie Feb 5, 2022
a129954
client: Only lock when needed
LeonMrBonnie Feb 5, 2022
8e8756f
client: Fix worker.pause and worker.resume
LeonMrBonnie Feb 4, 2022
b2974c5
shared: Change throw to console warning when clearing invalid timer
LeonMrBonnie Feb 4, 2022
e53ba61
shared: Add missing return
LeonMrBonnie Feb 4, 2022
a828d13
shared: Show source location in invalid timer warning
LeonMrBonnie Feb 4, 2022
5c17824
shared: Update SDK
LeonMrBonnie Feb 5, 2022
57261e2
client: Add windowFocusChange event
LeonMrBonnie Feb 5, 2022
b573561
client: Move unlock
LeonMrBonnie Feb 5, 2022
b074dc3
shared: Update SDK
LeonMrBonnie Feb 6, 2022
c1bc61c
client: Update TakeScreenshot and TakeScreenshotGameOnly
LeonMrBonnie Feb 6, 2022
9bf26ff
client: Improve take screenshot functions
LeonMrBonnie Feb 6, 2022
5dbcd20
client: Add no flush bytecode flag to fix bytecode module
LeonMrBonnie Feb 6, 2022
8c15998
server: Fix linux build
LeonMrBonnie Feb 10, 2022
e622ee6
shared: Fix linux build
LeonMrBonnie Feb 10, 2022
498edb5
client: Add setMinimapComponentPosition
LeonMrBonnie Feb 12, 2022
f15271d
client: Add setMinimapIsRectangle
LeonMrBonnie Feb 13, 2022
a8b8cef
shared: Fix crash in GetCurrentSourceOrigin
LeonMrBonnie Feb 15, 2022
68a1d79
shared: Implement async event callback waiting
LeonMrBonnie Feb 15, 2022
55c96ce
shared: Enable async event callback wait for resourceStart and resour…
LeonMrBonnie Feb 15, 2022
8bba37a
Fixed up, down, forward, back Vector3 static fields (#112)
zziger Feb 16, 2022
6e2c863
shared: Update SDK
LeonMrBonnie Feb 19, 2022
993bd41
server: Add serverStarted event
LeonMrBonnie Feb 19, 2022
217b7d8
Merge branch 'dev' of github.com:altmp/altv-js-module into dev
LeonMrBonnie Feb 19, 2022
71341d2
client: Shut down V8 in runtime OnDispose
LeonMrBonnie Feb 21, 2022
a903e19
client: Adjustments for module reloading
LeonMrBonnie Feb 21, 2022
db3b25e
shared: Allow catching errors from V8Class::New
LeonMrBonnie Feb 22, 2022
c59fa5a
shared: Update SDK
LeonMrBonnie Feb 22, 2022
47c0517
client: Add alt.getScreenResolution
LeonMrBonnie Feb 22, 2022
2a3bd52
shared: Update SDK
LeonMrBonnie Feb 22, 2022
5a77783
client: Add normalized param to getCursorPos
LeonMrBonnie Feb 22, 2022
303e058
shared: Update SDK
LeonMrBonnie Feb 22, 2022
a90e534
client: Add windowResolutionChange event
LeonMrBonnie Feb 22, 2022
49ffc6b
shared: Update SDK
LeonMrBonnie Feb 22, 2022
8b29203
client: Add normalized param to setCursorPos
LeonMrBonnie Feb 22, 2022
b26fbca
shared: Update SDK
LeonMrBonnie Feb 22, 2022
f8e80c3
client: Fix setCursorPos type
LeonMrBonnie Feb 22, 2022
94969e5
shared/client/server: Refactor raw emits (go brrr now)
LeonMrBonnie Feb 24, 2022
57b9718
shared: Update sdk
C0kkie Feb 27, 2022
b4b46aa
server: add boat anchor
C0kkie Feb 27, 2022
7aa3483
Updated for latest SDK changes
vadzz-dev Feb 28, 2022
c4af0b8
Updated SDK
vadzz-dev Feb 28, 2022
0bb886b
general: Add shared folder to test workflows
LeonMrBonnie Feb 28, 2022
46787c3
shared: Remove EventHandler reference debug log
LeonMrBonnie Mar 1, 2022
a0c2b34
client: Adjust for SDK changes
LeonMrBonnie Mar 1, 2022
7da7b71
client: Fix path to C++ SDK
LeonMrBonnie Mar 1, 2022
0581399
client: Only include alt-sdk in dynamic builds
LeonMrBonnie Mar 1, 2022
3948839
client: Adjust export for new sdk
LeonMrBonnie Mar 1, 2022
5d27971
shared: Update SDK
LeonMrBonnie Mar 1, 2022
b9ca01a
shared: Add support for Vector2i and Vector3i in bind helpers
LeonMrBonnie Mar 1, 2022
64a8073
client: Add webview size and pos property
LeonMrBonnie Mar 1, 2022
57201b1
general: Fix test client workflow
LeonMrBonnie Mar 2, 2022
0f9d630
server: Refactor node initilization and add inspector config option
LeonMrBonnie Mar 3, 2022
1d3d553
server: Add source-maps config option
LeonMrBonnie Mar 4, 2022
9560ddd
server: Add custom-loader config option
LeonMrBonnie Mar 4, 2022
4459ef5
server: Add comment for each config option
LeonMrBonnie Mar 4, 2022
8a7747c
server: Add heap-profiler config option
LeonMrBonnie Mar 4, 2022
8086b5e
server: Fix blip attachedTo getter (#117)
xxshady Mar 5, 2022
c468014
shared: Add performance profiler
LeonMrBonnie Mar 5, 2022
9edc842
server: Add performance profiler support
LeonMrBonnie Mar 5, 2022
4e9229e
Merge branch 'dev' of github.com:altmp/altv-js-module into dev
LeonMrBonnie Mar 5, 2022
c73277f
shared: Add missing header
LeonMrBonnie Mar 6, 2022
f62e8fb
shared: Update SDK
LeonMrBonnie Mar 6, 2022
78729f4
server: Return result for clothes & props setting
LeonMrBonnie Mar 6, 2022
f3c8c72
client: Fix dynamic import (fixes #116)
LeonMrBonnie Mar 6, 2022
dc716c6
shared: Write all profiler samples to file
LeonMrBonnie Mar 7, 2022
2fa6969
general: Add profiler tool
LeonMrBonnie Mar 7, 2022
6e03a62
general: Unfuck formatting
LeonMrBonnie Mar 7, 2022
441d454
shared: Fix raw value emits sending invalid entity types (fixes #119)
LeonMrBonnie Mar 8, 2022
1673cdd
shared: Fix raw value instance check
LeonMrBonnie Mar 8, 2022
2556fce
shared: Move invalid raw value type to enum start
LeonMrBonnie Mar 8, 2022
49a489d
shared: Update SDK
LeonMrBonnie Mar 8, 2022
1964cb8
shared: Add base path arg to profiler dump method
LeonMrBonnie Mar 9, 2022
4cf9162
server: Fix missing base path arg
LeonMrBonnie Mar 9, 2022
a491372
shared: Update SDK
LeonMrBonnie Mar 9, 2022
038a331
client: Enable profiler if set in config
LeonMrBonnie Mar 9, 2022
1e4d8f1
Update NodeJS to v17 (#121)
LeonMrBonnie Mar 12, 2022
045b4a6
general: Fix Linux deploy
LeonMrBonnie Mar 12, 2022
b5a6d31
server: Remove dead code from bootstrapper
LeonMrBonnie Mar 13, 2022
65b267b
server: Move NodeJS binaries to CDN
LeonMrBonnie Mar 13, 2022
2f234fa
server: Fix NodeJS download from CDN
LeonMrBonnie Mar 14, 2022
1ebe93c
server: Remove left over binaries
LeonMrBonnie Mar 14, 2022
c361018
server: Fix bootstrapper typo
LeonMrBonnie Mar 14, 2022
848dbc2
server: Stop NodeJS event loop on resource stop
LeonMrBonnie Mar 14, 2022
06f90dc
server: Remove usage of some deprecated NodeJS APIs
LeonMrBonnie Mar 14, 2022
2fcd39e
server: Remove Vector2 check from ColshapePolygon ctor
LeonMrBonnie Mar 15, 2022
41581bb
shared: Update SDK
LeonMrBonnie Mar 15, 2022
d2bafc4
shared: Add alt.stringToSHA256
LeonMrBonnie Mar 15, 2022
d780480
server: Fix server build task on Linux
LeonMrBonnie Mar 16, 2022
f563327
server: Display deps version
LeonMrBonnie Mar 16, 2022
26ab601
shared/client/server: Refactor deps download
LeonMrBonnie Mar 17, 2022
27fc54e
Add client bootstrapper (#124)
LeonMrBonnie Mar 19, 2022
e61f042
client/server/shared: Add support for JS bindings
LeonMrBonnie Mar 19, 2022
3064f9d
client: Use alt functions instead of global variable
LeonMrBonnie Mar 19, 2022
690f948
shared: Move Vector3 bindings to JS
LeonMrBonnie Mar 19, 2022
c351989
shared: Add Vector3 angleTo and angleToDegrees (Thanks zziger)
LeonMrBonnie Mar 19, 2022
25f559b
shared: Add RGBA JS bindings
LeonMrBonnie Mar 20, 2022
8e2999f
shared: Add Vector2 JS bindings
LeonMrBonnie Mar 20, 2022
5c24116
shared: Fix Vector2 bindings typo
LeonMrBonnie Mar 20, 2022
18b24c3
shared: Remove redundant newline
LeonMrBonnie Mar 20, 2022
1422066
shared: Fix RGBA toInt
LeonMrBonnie Mar 20, 2022
0000045
general: Add intellisense to JS bindings files
LeonMrBonnie Mar 20, 2022
4479608
shared: Add Vector3 and Vector2 distanceToSquared
LeonMrBonnie Mar 20, 2022
5cacf15
client: Fix bootstrapper
LeonMrBonnie Mar 20, 2022
ad08e6d
shared/client: Add main bindings and Utils class
LeonMrBonnie Mar 20, 2022
05813ae
Merge pull request #126 from altmp/js-bindings
LeonMrBonnie Mar 20, 2022
27c9bba
shared: Rename Main bindings to Utils bindings
LeonMrBonnie Mar 20, 2022
36413d5
shared: Cache Resource class instances
LeonMrBonnie Mar 20, 2022
73333cd
shared/client/server: Cleanup in shared resource class on stop
LeonMrBonnie Mar 23, 2022
b8c9b46
shared: Add more JS util functions (#127)
yannbcf Mar 24, 2022
35ea0f7
shared/server/client: Remove some alt::String usages
LeonMrBonnie Mar 24, 2022
e7ad74d
Merge branch 'dev' of github.com:altmp/altv-js-module into dev
LeonMrBonnie Mar 24, 2022
374535b
shared: Add RGBA toArray method
LeonMrBonnie Mar 25, 2022
d5b0e6e
shared: Add RGBA constructor overloads
LeonMrBonnie Mar 25, 2022
d597494
server: Improve bootstrapper
LeonMrBonnie Mar 25, 2022
0b09ade
fix client js compilation
FabianTerhorst Mar 27, 2022
356d2a7
shared/server: Add config option to disable profiler logs
LeonMrBonnie Mar 27, 2022
d437140
shared: Add frozen and collision property (#131)
JustCup Mar 28, 2022
d0182c6
shared: Fixed float parse in Vector methods (#132)
zziger Mar 28, 2022
b5bc782
shared: Don't mark rejected promise in events as handled
LeonMrBonnie Mar 28, 2022
afc4be8
shared: Update SDK
LeonMrBonnie Mar 30, 2022
a4c5a02
server: Fix server hang on exit
LeonMrBonnie Apr 1, 2022
803f86b
shared: Update SDK
LeonMrBonnie Apr 1, 2022
32469c2
client: Add blip.isRemote
LeonMrBonnie Apr 1, 2022
577f543
client: Add world-screen overloads (#134)
xxshady Apr 2, 2022
3af4cfe
shared: Start timer ids at 1
LeonMrBonnie Apr 3, 2022
0bed6fc
Merge branch 'dev' of github.com:altmp/altv-js-module into dev
LeonMrBonnie Apr 3, 2022
819c6cf
general: Use require instead of import in profiler script
LeonMrBonnie Apr 4, 2022
fad2df5
shared: Update SDK
LeonMrBonnie Apr 5, 2022
72d2a94
client: Fix exceptions in top level code stack trace
LeonMrBonnie Apr 5, 2022
b261510
shared/client: Add new JS utils (#136)
xxshady Apr 7, 2022
4a6dff5
shared/client/server: Exterminate alt::String and alt::StringView (#137)
LeonMrBonnie Apr 7, 2022
add99d0
shared: Update SDK
LeonMrBonnie Apr 7, 2022
ae28e87
shared: Update SDK
LeonMrBonnie Apr 9, 2022
1a26041
server: Add playerRequestControl event
LeonMrBonnie Apr 9, 2022
82db4af
server: Fix inspector config options
LeonMrBonnie Apr 10, 2022
4437f2f
shared: Fix RGBA constructor
LeonMrBonnie Apr 11, 2022
0629a75
shared: Add CreateCustomObject helper
LeonMrBonnie Apr 11, 2022
b11be27
shared: Add V8_GET_DATA macro
LeonMrBonnie Apr 11, 2022
1f37645
client: Update rml element style object code
LeonMrBonnie Apr 11, 2022
121d22b
shared: Track benchmark timers per resource (Closes #135)
LeonMrBonnie Apr 12, 2022
b3ed0c1
Add alt.isCursorVisible method (#139)
zziger Apr 12, 2022
b3cc189
shared: Add enumerator and query callback to CreateCustomObject
LeonMrBonnie Apr 12, 2022
1f685a7
shared: Allow converting all v8::Name values to string with helper
LeonMrBonnie Apr 12, 2022
15f3c53
shared: Freeze custom objects
LeonMrBonnie Apr 12, 2022
d993f6d
server: Return responsive object for vehicle.neon (Closes #138)
LeonMrBonnie Apr 12, 2022
7439467
Merge branch 'dev' of github.com:altmp/altv-js-module into dev
LeonMrBonnie Apr 12, 2022
99e8086
shared: Add missing CppValue overloads
LeonMrBonnie Apr 14, 2022
6074731
client/server/shared: Do more cleanup in resource stop
LeonMrBonnie Apr 14, 2022
171d464
server: Don't use deprecated way of creating uv loop
LeonMrBonnie Apr 14, 2022
de71680
shared: Fix RGBA constructor uninitialized variables
LeonMrBonnie Apr 14, 2022
6b13c63
client/shared: Fix small errors
LeonMrBonnie Apr 14, 2022
de08c68
client: Fix workers
LeonMrBonnie Apr 14, 2022
9fa4a4e
client: More thread safety in CEventHandler
LeonMrBonnie Apr 14, 2022
77aeddb
client: Add context info to alt.Profiler.heapStats
LeonMrBonnie Apr 16, 2022
e1d1eb7
client: Add global handle size to alt.Profiler.heapStats and heap cmd
LeonMrBonnie Apr 16, 2022
cf78551
shared: Fix conversion of 33-53bit integer values
LeonMrBonnie Apr 17, 2022
f3f7451
shared: Fix some compiler warnings
LeonMrBonnie Apr 17, 2022
8c41acf
server: Use consistent string specifiers in bootstrapper
LeonMrBonnie Apr 20, 2022
a3b2d97
server: Bootstrapper cleanup
LeonMrBonnie Apr 20, 2022
54d53d0
update cpp-sdk
martonp96 Apr 21, 2022
f0f3686
update cpp-sdk
martonp96 Apr 21, 2022
7534de4
client: add discord api functions
martonp96 Apr 21, 2022
d699d33
server: add hasAutoAttachTrailer to GetVehicleModelByHash
C0kkie Apr 21, 2022
b4e4025
server: Fix bootstrapper
LeonMrBonnie Apr 21, 2022
7bff1d1
client: Fix potential memory leak
LeonMrBonnie Apr 21, 2022
7e46256
shared: Update SDK
LeonMrBonnie Apr 21, 2022
0e97a3b
client: Refactor Discord OAuth2 API
LeonMrBonnie Apr 21, 2022
c0e459c
shared: Don't log error in Utils.waitFor
LeonMrBonnie Apr 22, 2022
07dbef1
client: Reject with error instead of string
LeonMrBonnie Apr 22, 2022
8197a32
shared: Set original stack to new error
LeonMrBonnie Apr 22, 2022
eed6e3e
client: Fix resource import/export
LeonMrBonnie Apr 23, 2022
aa8d486
client: Add timeout to resource start
LeonMrBonnie Apr 24, 2022
9627faa
client: Add (unfinished) exception handler for V8 JIT code
LeonMrBonnie Apr 25, 2022
264677c
server: Add discordUserID property to beforeConnect connection info obj
LeonMrBonnie Apr 25, 2022
b991197
shared: Update SDK
LeonMrBonnie Apr 25, 2022
9cdd96c
server: Proper connection info object management
LeonMrBonnie Apr 25, 2022
c4b9efe
server: Pass connection info instance in beforePlayerConnect event
LeonMrBonnie Apr 25, 2022
df7cb61
server: Add isAccepted getter to ConnectionInfo
LeonMrBonnie Apr 25, 2022
4c07578
Revert "client: Add (unfinished) exception handler for V8 JIT code"
martonp96 Apr 26, 2022
25d301c
client: Remove redundant TODOs
LeonMrBonnie Apr 26, 2022
5ac0f0f
shared: Fix conversion for big integer values
LeonMrBonnie Apr 28, 2022
32e280d
shared: Remove debug logs
LeonMrBonnie Apr 28, 2022
0396bea
shared/client: Add V8_CHECK_NORETN & fix emitClient return (#142)
tastydev Apr 28, 2022
16274f5
Removed debug log (#144)
zziger Apr 30, 2022
f5615e0
shared: Throw error instead of warning when clearing invalid timer
LeonMrBonnie May 1, 2022
79b81e6
general/client: Delete some unused files
LeonMrBonnie May 2, 2022
0763108
server/shared: Deprecate some outdated resource functions
LeonMrBonnie May 2, 2022
39c8476
client: Disable webview pos setter for now
LeonMrBonnie May 3, 2022
cff695f
Merge branch 'rc' into dev
martonp96 May 6, 2022
cc549ed
shared: Fix rc into dev merge
C0kkie May 6, 2022
9406b80
Merge pull request #146 from altmp/dev
martonp96 May 6, 2022
d2c35c1
client: Fix workers (kinda...)
LeonMrBonnie May 7, 2022
854ed25
shared: Emit resourceError event even when source file is unknown
LeonMrBonnie May 13, 2022
cf0a6f0
client/shared: Add stack trace argument to resourceError event
LeonMrBonnie May 13, 2022
45c2391
server: Temp fix for NodeJS version
LeonMrBonnie May 20, 2022
d3b0d76
Revert "server: Temp fix for NodeJS version"
LeonMrBonnie May 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -101,7 +101,7 @@ jobs:
cd ..
mkdir -p dist/modules/js-module
cp ./build-linux/libjs-module.so dist/modules/js-module
cp ./deps/nodejs/lib/libnode.so.83 dist/modules/js-module
cp ./deps/nodejs/lib/libnode.so.102 dist/modules/js-module
env:
VERSION: ${{ steps.version.outputs.VERSION }}

9 changes: 7 additions & 2 deletions .github/workflows/test-client.yml
Original file line number Diff line number Diff line change
@@ -3,9 +3,11 @@ on:
push:
paths:
- "client/**"
- "shared/**"
pull_request:
paths:
- "client/**"
- "shared/**"

env:
BUILD_TYPE: Release
@@ -16,7 +18,10 @@ jobs:
runs-on: windows-2019

steps:
- uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive

- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
@@ -41,7 +46,7 @@ jobs:
shell: bash
run: |
cd client
cmake . -BBUILD
cmake . -BBUILD -DDYNAMIC_BUILD=1

- name: Build
shell: bash
2 changes: 2 additions & 0 deletions .github/workflows/test-server.yml
Original file line number Diff line number Diff line change
@@ -3,9 +3,11 @@ on:
push:
paths:
- "server/**"
- "shared/**"
pull_request:
paths:
- "server/**"
- "shared/**"

jobs:
test-server-windows:
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Generated
*.gen

node_modules/
14 changes: 0 additions & 14 deletions .vscode/launch.json

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -76,7 +76,8 @@
"format": "cpp",
"forward_list": "cpp",
"optional": "cpp",
"stop_token": "cpp"
"stop_token": "cpp",
"*.gen": "cpp"
},
"editor.defaultFormatter": "xaver.clang-format",
"editor.formatOnSave": true
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
{
"label": "Build server",
"type": "shell",
"command": "cd server && ./build",
"command": "cd server && ./build.sh",
"windows": {
"command": "cd server && build.bat"
},
9 changes: 9 additions & 0 deletions bindings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference types="@altv/types-shared"/>
/// <reference types="@altv/types-natives"/>
import * as altShared from "alt-shared";
import * as altNatives from "natives";

declare global {
export const alt: typeof altShared;
export const native: typeof altNatives;
}
14 changes: 11 additions & 3 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 3.19)
include(cmake/GitUtils.cmake)
include(FetchContent)
include(cmake/DepsDownload.cmake)
include(../shared/cmake/GenerateBindings.cmake)

project(altv-client-js)

@@ -10,8 +10,7 @@ set(ALTV_JS_DEPS_DIR ${PROJECT_SOURCE_DIR}/deps)
# Fetch deps
# v8
message("alt:V JS - Fetching v8 deps, can take a while")

DownloadDeps(${ALTV_JS_DEPS_DIR})
DownloadDeps()

# cpp-sdk
if(NOT ALTV_JS_CPP_SDK)
@@ -42,6 +41,9 @@ endmacro()
GroupSources(${PROJECT_SOURCE_DIR}/src "Source Files")
GroupSources("../shared" "Shared Files")

make_includable("src/bootstrap.js" "src/bootstrap.js.gen")
GenerateBindings()

include_directories(
${ALTV_JS_CPP_SDK}
${ALTV_JS_DEPS_DIR}/v8/include
@@ -86,6 +88,8 @@ if(WIN32 AND MSVC)
endif()

if(DYNAMIC_BUILD)
include(${ALTV_JS_CPP_SDK}/cpp-sdk/CMakeLists.txt)

## SHARED
add_library(
${PROJECT_NAME} SHARED
@@ -102,6 +106,8 @@ if(DYNAMIC_BUILD)
target_link_libraries(${PROJECT_NAME} PRIVATE
${ALTV_JS_LINKS}
)

add_dependencies(${PROJECT_NAME} alt-sdk)
else()
## STATIC
add_library(
@@ -118,6 +124,8 @@ else()
target_link_libraries(${PROJECT_NAME}-static PRIVATE
${ALTV_JS_LINKS}
)

add_dependencies(${PROJECT_NAME}-static alt-sdk)
endif()

if(ALTV_JS_DEINIT_CPPSDK)
63 changes: 22 additions & 41 deletions client/cmake/DepsDownload.cmake
Original file line number Diff line number Diff line change
@@ -1,55 +1,36 @@
include(../shared/cmake/DepsHelpers.cmake)

# Set this to false, when using a custom v8 build for testing
set(__deps_check_enabled true)

function(DownloadDeps basePath)
set(__deps_release_lib "${basePath}/v8/lib/Release/v8_monolith.lib")
set(__deps_debug_lib "${basePath}/v8/lib/Debug/v8_monolith.lib")
set(__deps_headers "${basePath}/v8/include/headers.zip")
set(__deps_update_file "${basePath}/v8/update.json")
function(DownloadDeps)
set(__base_path "${PROJECT_SOURCE_DIR}/deps/v8")

GetBranchAndOS(__deps_branch __deps_os_path_name)
set(__deps_url_base_path "https://cdn.altv.mp/deps/v8/dev") # TODO: Use actual branch?

if(__deps_check_enabled)
file(DOWNLOAD "https://cdn.altv.mp/deps/v8/dev/update.json" ${__deps_update_file})
file(READ ${__deps_update_file} __deps_update_json)
string(JSON __deps_hashes GET ${__deps_update_json} hashList)
file(REMOVE ${__deps_update_file})

if(EXISTS ${__deps_release_lib})
file(SHA1 ${__deps_release_lib} __deps_release_checksum)
else()
set(__deps_release_checksum 0)
endif()
string(JSON __deps_release_checksum_cdn GET ${__deps_hashes} v8_monolith.lib)
if(NOT ${__deps_release_checksum} STREQUAL ${__deps_release_checksum_cdn})
message("Downloading release binary...")
file(DOWNLOAD "https://cdn.altv.mp/deps/v8/dev/v8_monolith.lib" ${__deps_release_lib})
endif()
message("Checking release binaries...")

GetCDNInfo("${__deps_url_base_path}/${__deps_os_path_name}/Release" __deps_release_hashes __deps_current_version)

DownloadFile("v8_monolith.lib" "${__base_path}/lib/Release" "${__deps_os_path_name}/Release" ${__deps_release_hashes})

# Only download debug binary in Debug builds
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(EXISTS ${__deps_debug_lib})
file(SHA1 ${__deps_debug_lib} __deps_debug_checksum)
else()
set(__deps_debug_checksum 0)
endif()
string(JSON __deps_debug_checksum_cdn GET ${__deps_hashes} v8_monolithd.lib)
if(NOT ${__deps_debug_checksum} STREQUAL ${__deps_debug_checksum_cdn})
message("Downloading debug binary...")
file(DOWNLOAD "https://cdn.altv.mp/deps/v8/dev/v8_monolithd.lib" ${__deps_debug_lib})
endif()
endif()
message("Checking debug binaries...")

GetCDNInfo("${__deps_url_base_path}/${__deps_os_path_name}/Debug" __deps_debug_hashes __deps_current_version)

if(EXISTS ${__deps_headers})
file(SHA1 ${__deps_headers} __deps_headers_checksum)
else()
set(__deps_headers_checksum 0)
DownloadFile("v8_monolith.lib" "${__base_path}/lib/Debug" "${__deps_os_path_name}/Debug" ${__deps_debug_hashes})
endif()
string(JSON __deps_headers_checksum_cdn GET ${__deps_hashes} headers.zip)
if(NOT ${__deps_headers_checksum} STREQUAL ${__deps_headers_checksum_cdn})
message("Downloading headers...")
file(DOWNLOAD "https://cdn.altv.mp/deps/v8/dev/headers.zip" ${__deps_headers})
message("Extracting headers...")
file(ARCHIVE_EXTRACT INPUT ${__deps_headers} DESTINATION "${basePath}")

GetCDNInfo("${__deps_url_base_path}" __deps_headers_hashes __deps_current_version)
DownloadFile("headers.zip" "${__base_path}/include" "" ${__deps_headers_hashes})
file(ARCHIVE_EXTRACT INPUT "${__base_path}/include/headers.zip" DESTINATION "${__base_path}/..")

if(__deps_current_version)
message("V8 deps version: ${__deps_current_version}")
endif()
endif()
endfunction()
Loading