diff --git a/build.ps1 b/build.ps1 index 34b8af8a..5ba9b118 100644 --- a/build.ps1 +++ b/build.ps1 @@ -2,17 +2,20 @@ $ErrorActionPreference = "Stop" +$ProjFile = Join-Path $PSScriptRoot "gregCore.csproj" +$OutDir = Join-Path $PSScriptRoot "publish_out" + Write-Host "Restoring NuGet packages..." -ForegroundColor Cyan -dotnet restore src/gregCore.csproj +dotnet restore $ProjFile if ($LASTEXITCODE -ne 0) { Write-Error "Restore failed." exit 1 } -Write-Host "Building and packing gregCore.dll via ILRepack..." -ForegroundColor Cyan -dotnet build src/gregCore.csproj --configuration Release +Write-Host "Building and publishing gregCore and dependencies..." -ForegroundColor Cyan +dotnet publish $ProjFile --configuration Release -o $OutDir if ($LASTEXITCODE -ne 0) { - Write-Error "Build failed." + Write-Error "Publish failed." exit 1 } @@ -22,14 +25,40 @@ if (!(Test-Path $GameDir)) { Write-Host "Data Center directory not found at default location. Skipping deploy." -ForegroundColor Yellow } else { $ModsDir = Join-Path $GameDir "Mods" + $UserLibsDir = Join-Path $GameDir "UserLibs" + if (!(Test-Path $ModsDir)) { New-Item -ItemType Directory -Force -Path $ModsDir | Out-Null } + if (!(Test-Path $UserLibsDir)) { + New-Item -ItemType Directory -Force -Path $UserLibsDir | Out-Null + } - $SourceDll = "src/bin/Release/net6.0/gregCore.dll" + $SourceDll = Join-Path $OutDir "gregCore.dll" if (Test-Path $SourceDll) { - Write-Host "Deploying to $ModsDir..." -ForegroundColor Cyan + Write-Host "Deploying gregCore.dll to $ModsDir..." -ForegroundColor Cyan Copy-Item -Path $SourceDll -Destination $ModsDir -Force + + Write-Host "Deploying dependencies to $UserLibsDir..." -ForegroundColor Cyan + $Deps = @( + "Acornima.dll", + "Jint.dll", + "LiteDB.dll", + "MoonSharp.Interpreter.dll", + "Newtonsoft.Json.dll", + "Python.Runtime.dll" + ) + + foreach ($dep in $Deps) { + $depPath = Join-Path $OutDir $dep + if (Test-Path $depPath) { + Copy-Item -Path $depPath -Destination $UserLibsDir -Force + Write-Host " -> $dep" -ForegroundColor Gray + } else { + Write-Host " Warning: Dependency $dep not found in $OutDir" -ForegroundColor Yellow + } + } + Write-Host "Deployment successful." -ForegroundColor Green } else { Write-Error "Built DLL not found at $SourceDll" diff --git a/publish/Acornima.dll b/publish/Acornima.dll deleted file mode 100644 index 58d5bd39..00000000 Binary files a/publish/Acornima.dll and /dev/null differ diff --git a/publish/Jint.dll b/publish/Jint.dll deleted file mode 100644 index b0a0d7f2..00000000 Binary files a/publish/Jint.dll and /dev/null differ diff --git a/publish/LiteDB.dll b/publish/LiteDB.dll deleted file mode 100644 index e56e0fdd..00000000 Binary files a/publish/LiteDB.dll and /dev/null differ diff --git a/publish/Mono.Cecil.Mdb.dll b/publish/Mono.Cecil.Mdb.dll deleted file mode 100644 index 55f9ee25..00000000 Binary files a/publish/Mono.Cecil.Mdb.dll and /dev/null differ diff --git a/publish/Mono.Cecil.Pdb.dll b/publish/Mono.Cecil.Pdb.dll deleted file mode 100644 index 0462a8f2..00000000 Binary files a/publish/Mono.Cecil.Pdb.dll and /dev/null differ diff --git a/publish/Mono.Cecil.Rocks.dll b/publish/Mono.Cecil.Rocks.dll deleted file mode 100644 index 561b0d74..00000000 Binary files a/publish/Mono.Cecil.Rocks.dll and /dev/null differ diff --git a/publish/Mono.Cecil.dll b/publish/Mono.Cecil.dll deleted file mode 100644 index 488bd5cb..00000000 Binary files a/publish/Mono.Cecil.dll and /dev/null differ diff --git a/publish/MoonSharp.Interpreter.dll b/publish/MoonSharp.Interpreter.dll deleted file mode 100644 index 37cfd2ef..00000000 Binary files a/publish/MoonSharp.Interpreter.dll and /dev/null differ diff --git a/publish/Newtonsoft.Json.dll b/publish/Newtonsoft.Json.dll deleted file mode 100644 index d035c38b..00000000 Binary files a/publish/Newtonsoft.Json.dll and /dev/null differ diff --git a/publish/Python.Runtime.dll b/publish/Python.Runtime.dll deleted file mode 100644 index 35e6367a..00000000 Binary files a/publish/Python.Runtime.dll and /dev/null differ diff --git a/publish/greg-go-sdk.zip b/publish/greg-go-sdk.zip new file mode 100644 index 00000000..4870776c Binary files /dev/null and b/publish/greg-go-sdk.zip differ diff --git a/publish/greg-js-sdk.zip b/publish/greg-js-sdk.zip new file mode 100644 index 00000000..ddba6346 Binary files /dev/null and b/publish/greg-js-sdk.zip differ diff --git a/publish/greg-lua-sdk.zip b/publish/greg-lua-sdk.zip new file mode 100644 index 00000000..cf65d927 Binary files /dev/null and b/publish/greg-lua-sdk.zip differ diff --git a/publish/greg-python-sdk.zip b/publish/greg-python-sdk.zip new file mode 100644 index 00000000..a65b2e6d Binary files /dev/null and b/publish/greg-python-sdk.zip differ diff --git a/publish/greg-rust-sdk.zip b/publish/greg-rust-sdk.zip new file mode 100644 index 00000000..a1df6317 Binary files /dev/null and b/publish/greg-rust-sdk.zip differ diff --git a/publish/gregCore-v1.0.0.33.zip b/publish/gregCore-v1.0.0.33.zip index 90a5517d..1712167e 100644 Binary files a/publish/gregCore-v1.0.0.33.zip and b/publish/gregCore-v1.0.0.33.zip differ diff --git a/publish/gregCore.deps.json b/publish/gregCore.deps.json deleted file mode 100644 index 3f42d248..00000000 --- a/publish/gregCore.deps.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v6.0", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v6.0": { - "gregCore/1.0.0": { - "dependencies": { - "Jint": "4.8.0", - "LiteDB": "5.0.21", - "Mono.Cecil": "0.11.6", - "MoonSharp": "2.0.0", - "Newtonsoft.Json": "13.0.3", - "pythonnet": "3.0.5" - }, - "runtime": { - "gregCore.dll": {} - } - }, - "Acornima/1.4.0": { - "runtime": { - "lib/netstandard2.1/Acornima.dll": { - "assemblyVersion": "1.4.0.0", - "fileVersion": "1.4.0.0" - } - } - }, - "Jint/4.8.0": { - "dependencies": { - "Acornima": "1.4.0" - }, - "runtime": { - "lib/netstandard2.1/Jint.dll": { - "assemblyVersion": "4.8.0.0", - "fileVersion": "4.5.0.0" - } - } - }, - "LiteDB/5.0.21": { - "runtime": { - "lib/netstandard2.0/LiteDB.dll": { - "assemblyVersion": "5.0.21.0", - "fileVersion": "5.0.21.0" - } - } - }, - "Mono.Cecil/0.11.6": { - "runtime": { - "lib/netstandard2.0/Mono.Cecil.Mdb.dll": { - "assemblyVersion": "0.11.6.0", - "fileVersion": "0.11.6.0" - }, - "lib/netstandard2.0/Mono.Cecil.Pdb.dll": { - "assemblyVersion": "0.11.6.0", - "fileVersion": "0.11.6.0" - }, - "lib/netstandard2.0/Mono.Cecil.Rocks.dll": { - "assemblyVersion": "0.11.6.0", - "fileVersion": "0.11.6.0" - }, - "lib/netstandard2.0/Mono.Cecil.dll": { - "assemblyVersion": "0.11.6.0", - "fileVersion": "0.11.6.0" - } - } - }, - "MoonSharp/2.0.0": { - "runtime": { - "lib/netstandard1.6/MoonSharp.Interpreter.dll": { - "assemblyVersion": "2.0.0.0", - "fileVersion": "2.0.0.0" - } - } - }, - "Newtonsoft.Json/13.0.3": { - "runtime": { - "lib/net6.0/Newtonsoft.Json.dll": { - "assemblyVersion": "13.0.0.0", - "fileVersion": "13.0.3.27908" - } - } - }, - "pythonnet/3.0.5": { - "runtime": { - "lib/netstandard2.0/Python.Runtime.dll": { - "assemblyVersion": "3.0.5.0", - "fileVersion": "3.0.5.0" - } - } - } - } - }, - "libraries": { - "gregCore/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Acornima/1.4.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-3M7NpnhKL//pf7HkSfLJaGQ37uksibdqfa9YuUov1VOX0QXapZeYCUpURZ9an4VMt9wJ70MU/PeAsjhw8DwtJw==", - "path": "acornima/1.4.0", - "hashPath": "acornima.1.4.0.nupkg.sha512" - }, - "Jint/4.8.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-JlXh13WDivP2izPgS9jeUlzyP//hsHUGhGb33EQHLuRiLhdwJ0ajaYjVETnqnkIQay/qP6NHglxx/40bL0/ihQ==", - "path": "jint/4.8.0", - "hashPath": "jint.4.8.0.nupkg.sha512" - }, - "LiteDB/5.0.21": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ykJ7ffFl7P9YQKR/PLci6zupiLrsSCNkOTiw6OtzntH7d2kCYp5L1+3a/pksKgTEHcJBoPXFtg7VZSGVBseN9w==", - "path": "litedb/5.0.21", - "hashPath": "litedb.5.0.21.nupkg.sha512" - }, - "Mono.Cecil/0.11.6": { - "type": "package", - "serviceable": true, - "sha512": "sha512-f33RkDtZO8VlGXCtmQIviOtxgnUdym9xx/b1p9h91CRGOsJFxCFOFK1FDbVt1OCf1aWwYejUFa2MOQyFWTFjbA==", - "path": "mono.cecil/0.11.6", - "hashPath": "mono.cecil.0.11.6.nupkg.sha512" - }, - "MoonSharp/2.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-uiAcRh7d+53k3xW9pFDJfAFVw4RnjHVCJG05M3oPAVEVwPtFavhg1H/IpC6So4X1j9kJlzuLlA3OghhPcIvc5A==", - "path": "moonsharp/2.0.0", - "hashPath": "moonsharp.2.0.0.nupkg.sha512" - }, - "Newtonsoft.Json/13.0.3": { - "type": "package", - "serviceable": true, - "sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==", - "path": "newtonsoft.json/13.0.3", - "hashPath": "newtonsoft.json.13.0.3.nupkg.sha512" - }, - "pythonnet/3.0.5": { - "type": "package", - "serviceable": true, - "sha512": "sha512-20UVeB1uDpvCHZi8yNv7VCSUKVRRaxPZWFYhkO+BjfBB9GgOh2vEeucy3U7zTY8xEVCHf2XHpRNfAU/3quxXZw==", - "path": "pythonnet/3.0.5", - "hashPath": "pythonnet.3.0.5.nupkg.sha512" - } - } -} \ No newline at end of file diff --git a/publish/gregCore.dll b/publish/gregCore.dll deleted file mode 100644 index d0b16f8b..00000000 Binary files a/publish/gregCore.dll and /dev/null differ diff --git a/publish/gregCore.pdb b/publish/gregCore.pdb deleted file mode 100644 index 905909a1..00000000 Binary files a/publish/gregCore.pdb and /dev/null differ diff --git a/publish_out/gregCore.dll b/publish_out/gregCore.dll index 259efd6d..9786607c 100644 Binary files a/publish_out/gregCore.dll and b/publish_out/gregCore.dll differ diff --git a/publish_out/gregCore.pdb b/publish_out/gregCore.pdb index f5dc9c71..96372c1e 100644 Binary files a/publish_out/gregCore.pdb and b/publish_out/gregCore.pdb differ diff --git a/scripts/Build-Release.ps1 b/scripts/Build-Release.ps1 index 87257170..72880552 100644 --- a/scripts/Build-Release.ps1 +++ b/scripts/Build-Release.ps1 @@ -15,7 +15,7 @@ New-Item -ItemType Directory -Path $publishDir | Out-Null # 2. Build Write-Host "Building gregCore (Release)..." -ForegroundColor Yellow -dotnet build "$repoRoot\src\gregCore.csproj" -c Release -o "$buildDir" +dotnet build "$repoRoot\gregCore.csproj" -c Release -o "$buildDir" # 3. Check output $dllPath = "$buildDir\gregCore.dll" @@ -23,7 +23,10 @@ if (-not (Test-Path $dllPath)) { Write-Error "Build failed: gregCore.dll not found at $dllPath" } -# 4. Package +# 4. Package SDK Assets +& "$PSScriptRoot\Package-SdkAssets.ps1" + +# 5. Package release $version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($dllPath).FileVersion $zipName = "gregCore-v$version.zip" $zipPath = "$publishDir\$zipName" @@ -36,7 +39,7 @@ if (Test-Path $tmpDir) { Remove-Item -Recurse -Force $tmpDir } New-Item -ItemType Directory -Path $tmpDir | Out-Null Copy-Item $dllPath -Destination $tmpDir Copy-Item "$repoRoot\README.md" -Destination $tmpDir -Copy-Item "C:\Users\marvi\source\repos\gregFramework\CHANGELOG.md" -Destination $tmpDir +Copy-Item "$repoRoot\CHANGELOG.md" -Destination $tmpDir Copy-Item "$repoRoot\assets\greg_hooks.json" -Destination $tmpDir # Create zip @@ -44,5 +47,9 @@ Compress-Archive -Path "$tmpDir\*" -DestinationPath $zipPath -Force Remove-Item -Recurse -Force $tmpDir +# Copy SDK packs to publish dir for release workflow +Write-Host "Copying SDK packs to $publishDir..." -ForegroundColor Yellow +Copy-Item -Path "$repoRoot\sdk\packs\*.zip" -Destination $publishDir -ErrorAction SilentlyContinue + Write-Host "--- Successfully packaged gregCore to $zipPath ---" -ForegroundColor Green diff --git a/scripts/Package-SdkAssets.ps1 b/scripts/Package-SdkAssets.ps1 new file mode 100644 index 00000000..8f34204b --- /dev/null +++ b/scripts/Package-SdkAssets.ps1 @@ -0,0 +1,38 @@ +# Package-SdkAssets.ps1 +# Creates SDK release assets for all supported languages. + +$ErrorActionPreference = "Stop" + +$repoRoot = Resolve-Path "$PSScriptRoot\..\.." +$coreRoot = "$repoRoot\gregCore" +$packsDir = "$coreRoot\sdk\packs" + +Write-Host "Creating SDK packs in $packsDir" -ForegroundColor Cyan + +if (Test-Path $packsDir) { + Remove-Item -Recurse -Force $packsDir +} +New-Item -ItemType Directory -Path $packsDir | Out-Null + +# 1. Package greg-rust-sdk +$rustSdkDir = "$repoRoot\greg-rust-sdk" +if (Test-Path $rustSdkDir) { + Write-Host "Packaging Rust SDK..." + Compress-Archive -Path "$rustSdkDir\*" -DestinationPath "$packsDir\greg-rust-sdk.zip" -Force +} + +# 2. Package other languages from examples +$examplesDir = "$coreRoot\examples" +if (Test-Path $examplesDir) { + $langs = @("Go", "Js", "Lua", "Python", "Rust") + foreach ($lang in $langs) { + $langDir = "$examplesDir\$lang" + if (Test-Path $langDir) { + Write-Host "Packaging $lang SDK/Example..." + $destZip = "$packsDir\greg-${lang}-sdk.zip".ToLower() + Compress-Archive -Path "$langDir\*" -DestinationPath $destZip -Force + } + } +} + +Write-Host "SDK packs created successfully!" -ForegroundColor Green diff --git a/sdk/packs/greg-go-sdk.zip b/sdk/packs/greg-go-sdk.zip new file mode 100644 index 00000000..4870776c Binary files /dev/null and b/sdk/packs/greg-go-sdk.zip differ diff --git a/sdk/packs/greg-js-sdk.zip b/sdk/packs/greg-js-sdk.zip new file mode 100644 index 00000000..ddba6346 Binary files /dev/null and b/sdk/packs/greg-js-sdk.zip differ diff --git a/sdk/packs/greg-lua-sdk.zip b/sdk/packs/greg-lua-sdk.zip new file mode 100644 index 00000000..cf65d927 Binary files /dev/null and b/sdk/packs/greg-lua-sdk.zip differ diff --git a/sdk/packs/greg-python-sdk.zip b/sdk/packs/greg-python-sdk.zip new file mode 100644 index 00000000..a65b2e6d Binary files /dev/null and b/sdk/packs/greg-python-sdk.zip differ diff --git a/sdk/packs/greg-rust-sdk.zip b/sdk/packs/greg-rust-sdk.zip new file mode 100644 index 00000000..a1df6317 Binary files /dev/null and b/sdk/packs/greg-rust-sdk.zip differ