Skip to content

Commit

Permalink
[SCRIPTS] Updated scripts for compatibility with LTSr1
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco Dias committed Mar 29, 2023
1 parent 01e9849 commit 8676a5b
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 29 deletions.
2 changes: 1 addition & 1 deletion source/GOG_gml/GOG.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/GOG_gml/extensions/gog/GOG.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion source/GOG_gml/extensions/gog/post_build_step.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ call %Utils% scriptInit
call %Utils% optionGetValue "versionStable" RUNTIME_VERSION_STABLE
call %Utils% optionGetValue "versionBeta" RUNTIME_VERSION_BETA
call %Utils% optionGetValue "versionDev" RUNTIME_VERSION_DEV
call %Utils% optionGetValue "versionLTS" RUNTIME_VERSION_LTS

:: SDK Hash
call %Utils% optionGetValue "sdkHashWin" SDK_HASH_WIN
Expand All @@ -24,7 +25,7 @@ call %Utils% optionGetValue "sdkVersion" SDK_VERSION
set ERROR_SDK_HASH="Invalid GOG SDK version, sha256 hash mismatch (expected v%SDK_VERSION%)."

:: Checks IDE and Runtime versions
call %Utils% versionLockCheck "%YYruntimeVersion%" %RUNTIME_VERSION_STABLE% %RUNTIME_VERSION_BETA% %RUNTIME_VERSION_DEV%
call %Utils% versionLockCheck "%YYruntimeVersion%" %RUNTIME_VERSION_STABLE% %RUNTIME_VERSION_BETA% %RUNTIME_VERSION_DEV% %RUNTIME_VERSION_LTS%

:: Resolve the SDK path (must exist)
call %Utils% pathResolveExisting "%YYprojectDir%" "%SDK_PATH%" SDK_PATH
Expand Down
3 changes: 2 additions & 1 deletion source/GOG_gml/extensions/gog/post_build_step.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ scriptInit
optionGetValue "versionStable" RUNTIME_VERSION_STABLE
optionGetValue "versionBeta" RUNTIME_VERSION_BETA
optionGetValue "versionDev" RUNTIME_VERSION_DEV
optionGetValue "versionLTS" RUNTIME_VERSION_LTS

# SDK Hash
optionGetValue "sdkHashWin" SDK_HASH_WIN
Expand All @@ -43,7 +44,7 @@ optionGetValue "sdkVersion" SDK_VERSION
ERROR_SDK_HASH="Invalid GOG SDK version, sha256 hash mismatch (expected v$SDK_VERSION)."

# Checks IDE and Runtime versions
versionLockCheck "$YYruntimeVersion" $RUNTIME_VERSION_STABLE $RUNTIME_VERSION_BETA $RUNTIME_VERSION_RED
versionLockCheck "$YYruntimeVersion" $RUNTIME_VERSION_STABLE $RUNTIME_VERSION_BETA $RUNTIME_VERSION_DEV $RUNTIME_VERSION_LTS

# Resolve the SDK path (must exist)
pathResolveExisting "$YYprojectDir" "$SDK_PATH" SDK_PATH
Expand Down
57 changes: 38 additions & 19 deletions source/GOG_gml/extensions/gog/scriptUtils.bat
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,23 @@ exit /b 0

call :pathResolve "%cd%" "%~2" destination

if exist "%~1\" (
:: Is a folder
powershell -NoLogo -NoProfile -Command "New-Item -ItemType Directory -Force -Path '%destination%'; Copy-Item -Path '%~1' -Destination '%destination%' -Recurse"
) else if exist "%~1" (
:: Is a file
powershell -NoLogo -NoProfile -Command "New-Item -ItemType Directory -Force -Path (Split-Path -Parent '%destination%'); Copy-Item -Path '%~1' -Destination '%destination%' -Force"
) else (
call :logError "Failed to copy '%~1' to '%destination%'."
if not exist "%~1" (
call :logError "Failed to copy '%~1' to '%destination%' (source doesn't exist)."
exit /b 1
)

for /f "delims=" %%a in ('dir /b /a:d "%~1" 2^>nul') do (
if "%%~a" == "%~nx1" (
powershell -NoLogo -NoProfile -Command "New-Item -ItemType Directory -Force -Path '%destination%'; Copy-Item -Path '%~1' -Destination '%destination%' -Recurse"
)
)

for /f "delims=" %%a in ('dir /b /a:-d "%~1" 2^>nul') do (
if "%%~a" == "%~nx1" (
powershell -NoLogo -NoProfile -Command "New-Item -ItemType Directory -Force -Path (Split-Path -Parent '%destination%'); Copy-Item -Path '%~1' -Destination '%destination%' -Force"
)
)

:: Check if the copy operation succeeded
if %errorlevel% neq 0 (
call :logError "Failed to copy '%~1' to '%destination%'."
Expand Down Expand Up @@ -197,24 +203,37 @@ exit /b 0
exit /b 0

:: Check minimum required versions for STABLE|BETA|DEV releases
:versionLockCheck version stableVersion betaVersion devVersion
:versionLockCheck version stableVersion betaVersion devVersion ltsVersion

call :versionExtract "%~1" Major majorVersion
call :versionExtract "%~1" Minor minorVersion

if %majorVersion% geq 2020 (
if %minorVersion% geq 100 (
:: Beta version
call :assertVersionRequired "%~1" "%~3" "The runtime version needs to be at least v%~3."
set "runnerBuild="

if %minorVersion% equ 0 (
:: LTS version
set "runnerBuild=LTS"
call :assertVersionRequired "%~1" "%~5" "The %%runnerBuild%% runtime version needs to be at least v%~5."

) else (
if %majorVersion% geq 2020 (
if %minorVersion% geq 100 (
:: Beta version
set "runnerBuild=BETA"
call :assertVersionRequired "%~1" "%~3" "The %%runnerBuild%% runtime version needs to be at least v%~3."
) else (
:: Stable version
set "runnerBuild=STABLE"
call :assertVersionRequired "%~1" "%~2" "The %%runnerBuild%% runtime version needs to be at least v%~2."
)
) else (
:: Stable version
call :assertVersionRequired "%~1" "%~2" "The runtime version needs to be at least v%~2."
:: Dev version
set "runnerBuild=DEV"
call :assertVersionRequired "%~1" "%~4" "The %%runnerBuild%% runtime version needs to be at least v%~4."
)
) else (
:: Dev version
call :assertVersionRequired "%~1" "%~4" "The runtime version needs to be at least v%~4."
)
call :logInformation "Version lock check passed successfully, with version '%~1'."

call :logInformation "Version lock check passed successfully, with %%runnerBuild%% version '%~1'."
exit /b 0

:: ASSERTS
Expand Down
22 changes: 16 additions & 6 deletions source/GOG_gml/extensions/gog/scriptUtils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -318,24 +318,34 @@ versionLockCheck() {
local stableVersion="$2"
local betaVersion="$3"
local devVersion="$4"
local ltsVersion="$5"

# Extract the major and minor version numbers from the given version
local runnerBuild=
local majorVersion=
local minorVersion=
versionExtract "$version" 1 majorVersion
versionExtract "$version" 2 minorVersion

if [ "$majorVersion" -ge 2020 ]; then
if [ "$minorVersion" -eq 0 ]; then
# LTS version
runnerBuild=LTS
assertVersionRequired "$version" "$ltsVersion" "The $runnerBuild runtime version needs to be at least v$ltsVersion."

elif [ "$majorVersion" -ge 2020 ]; then
if [ "$minorVersion" -ge 100 ]; then
# Beta version
assertVersionRequired "$version" "$betaVersion" "The runtime version needs to be at least v$betaVersion."
# Beta version
runnerBuild=BETA
assertVersionRequired "$version" "$betaVersion" "The $runnerBuild runtime version needs to be at least v$betaVersion."
else
# Stable version
assertVersionRequired "$version" "$stableVersion" "The runtime version needs to be at least v$stableVersion."
# Stable version
runnerBuild=STABLE
assertVersionRequired "$version" "$stableVersion" "The $runnerBuild runtime version needs to be at least v$stableVersion."
fi
else
# Dev version
assertVersionRequired "$version" "$devVersion" "The runtime version needs to be at least v$devVersion."
runnerBuild=DEV
assertVersionRequired "$version" "$devVersion" "The $runnerBuild runtime version needs to be at least v$devVersion."
fi

logInformation "Version lock check passed successfully, with version '$version'."
Expand Down
5 changes: 5 additions & 0 deletions source/GOG_gml/notes/changelog/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

v1.2.0
- This is a compatibility version ready to work with LTSr1
NOTE: The github repo will on be compatible with latest Stable, to use in LTS import
the release version local package or use the marketplace asset.

v1.1.0
- Updated script control system to version 2.0
- ISSUES: Storage module is not working at the moment
Expand Down

0 comments on commit 8676a5b

Please sign in to comment.