mirror of
https://github.com/tribufu/sdk-rust
synced 2025-06-16 19:14:18 +00:00
Generate native bindings from rust crate
This commit is contained in:
12
scripts/windows/build.ps1
Normal file
12
scripts/windows/build.ps1
Normal file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
echo "Building for win-x64"
|
||||
cargo build --workspace
|
||||
|
||||
New-Item "bin/win-x64" -ItemType Directory -Force
|
||||
Remove-Item -Path "bin/win-x64/*" -Force -Recurse
|
||||
|
||||
Copy-Item -Path "target/debug/tribufu_sdk.dll.lib" -Destination "bin/win-x64/tribufu_sdk.lib"
|
||||
Copy-Item -Path "target/debug/tribufu_sdk.dll" -Destination "bin/win-x64/tribufu_sdk.dll"
|
||||
|
||||
msbuild /p:Configuration="debug" /p:Platform="win-x64"
|
10
scripts/windows/generate.ps1
Normal file
10
scripts/windows/generate.ps1
Normal file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
java -jar ./vendor/openapi-generator/openapi-generator-cli.jar generate `
|
||||
-i https://api.tribufu.com/openapi.json `
|
||||
-g rust `
|
||||
-o . `
|
||||
--global-property apis,models,supportingFiles,apiDocs=false,modelDocs=false,apiTests=false,modelTests=false `
|
||||
--additional-properties=packageName=tribufu,library=reqwest-trait,supportAsync=true,preferUnsignedInt=true `
|
||||
--openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=TribufuGenerated `
|
||||
--skip-validate-spec
|
3
scripts/windows/premake.bat
Normal file
3
scripts/windows/premake.bat
Normal file
@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
|
||||
call .\vendor\premake-core\windows\premake5.exe vs2022
|
34
scripts/windows/publish.ps1
Normal file
34
scripts/windows/publish.ps1
Normal file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
$crates = @(
|
||||
"tribufu-types",
|
||||
"tribufu-constants",
|
||||
"tribufu-api",
|
||||
"tribufu"
|
||||
)
|
||||
|
||||
$batchSize = 6
|
||||
$waitTime = 300
|
||||
|
||||
function Process-Batch {
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[array]$batch
|
||||
)
|
||||
|
||||
foreach ($element in $batch) {
|
||||
Write-Output "Processing element $element"
|
||||
cargo publish --package $element
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i -lt $crates.Count; $i += $batchSize) {
|
||||
$currentBatch = $crates[$i..($i + $batchSize - 1)]
|
||||
|
||||
Process-Batch -batch $currentBatch
|
||||
|
||||
if ($i -lt ($crates.Count - $batchSize)) {
|
||||
Write-Output "Waiting for $waitTime seconds..."
|
||||
Start-Sleep -Seconds $waitTime
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user