feat: prepare Pro licensing and Android API 36
This commit is contained in:
1 parent
b600412285
commit
11a91863a3
25 files changed
+2447
-62
No files matched your search
@@ -0,0 +1,92 @@
|
||||
param(
|
||||
[string]$Configuration = "Release"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$dotnet = Join-Path $env:USERPROFILE ".dotnet10\dotnet.exe"
|
||||
$androidSdk = Join-Path $env:LOCALAPPDATA "Android\Sdk"
|
||||
$keytool = "C:\Program Files\Microsoft\jdk-17.0.19.10-hotspot\bin\keytool.exe"
|
||||
$signingDirectory = Join-Path $env:LOCALAPPDATA "LME\Signing"
|
||||
$keyStore = Join-Path $signingDirectory "lme-pro-test.keystore"
|
||||
$passwordFile = Join-Path $signingDirectory "lme-pro-test-password.dpapi"
|
||||
$outputDirectory = Join-Path $projectRoot "artifacts\android-test"
|
||||
|
||||
foreach ($requiredPath in @($dotnet, $keytool, $androidSdk)) {
|
||||
if (-not (Test-Path -LiteralPath $requiredPath)) {
|
||||
throw "Componente richiesto non trovato: $requiredPath"
|
||||
}
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $signingDirectory, $outputDirectory | Out-Null
|
||||
|
||||
if (-not (Test-Path -LiteralPath $passwordFile)) {
|
||||
$passwordBytes = [System.Security.Cryptography.RandomNumberGenerator]::GetBytes(36)
|
||||
$password = [Convert]::ToBase64String($passwordBytes).TrimEnd('=').Replace('+', '-').Replace('/', '_')
|
||||
$password | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Set-Content -LiteralPath $passwordFile
|
||||
}
|
||||
|
||||
$securePassword = (Get-Content -Raw -LiteralPath $passwordFile).Trim() | ConvertTo-SecureString
|
||||
$credential = [System.Net.NetworkCredential]::new("lme-pro-test", $securePassword)
|
||||
$plainPassword = $credential.Password
|
||||
|
||||
if (-not (Test-Path -LiteralPath $keyStore)) {
|
||||
& $keytool -genkeypair -noprompt `
|
||||
-keystore $keyStore `
|
||||
-storepass $plainPassword `
|
||||
-keypass $plainPassword `
|
||||
-alias "lme-pro-test" `
|
||||
-keyalg RSA `
|
||||
-keysize 3072 `
|
||||
-validity 3650 `
|
||||
-dname "CN=LME Pro Test, OU=Testing, O=LME, L=Rome, C=IT"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Creazione della chiave di test non riuscita."
|
||||
}
|
||||
}
|
||||
|
||||
$env:LME_ANDROID_TEST_STORE_PASS = $plainPassword
|
||||
$env:LME_ANDROID_TEST_KEY_PASS = $plainPassword
|
||||
$copiedPackages = [System.Collections.Generic.List[System.IO.FileInfo]]::new()
|
||||
try {
|
||||
foreach ($format in @("apk", "aab")) {
|
||||
& $dotnet publish (Join-Path $projectRoot "LMEMappeCatastaliApp.csproj") `
|
||||
-f net10.0-android `
|
||||
-c $Configuration `
|
||||
-p:AndroidSdkDirectory=$androidSdk `
|
||||
-p:AndroidPackageFormat=$format `
|
||||
-p:AndroidKeyStore=true `
|
||||
-p:AndroidSigningKeyStore=$keyStore `
|
||||
-p:AndroidSigningKeyAlias=lme-pro-test `
|
||||
-p:AndroidSigningStorePass=env:LME_ANDROID_TEST_STORE_PASS `
|
||||
-p:AndroidSigningKeyPass=env:LME_ANDROID_TEST_KEY_PASS
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Pubblicazione Android $format non riuscita."
|
||||
}
|
||||
|
||||
$publishDirectory = Join-Path $projectRoot "bin\$Configuration\net10.0-android\publish"
|
||||
$package = Get-ChildItem -LiteralPath $publishDirectory -Filter "*-Signed.$format" -File |
|
||||
Sort-Object LastWriteTime -Descending |
|
||||
Select-Object -First 1
|
||||
if ($null -eq $package) {
|
||||
throw "Nessun pacchetto $format firmato prodotto in $publishDirectory"
|
||||
}
|
||||
|
||||
$destination = Join-Path $outputDirectory "LME-Mappe-Catastali-Pro-1.0.0-test.$format"
|
||||
Copy-Item -LiteralPath $package.FullName -Destination $destination -Force
|
||||
$copiedPackages.Add((Get-Item -LiteralPath $destination))
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Remove-Item Env:LME_ANDROID_TEST_STORE_PASS -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:LME_ANDROID_TEST_KEY_PASS -ErrorAction SilentlyContinue
|
||||
$plainPassword = $null
|
||||
$credential = $null
|
||||
}
|
||||
|
||||
$hashLines = $copiedPackages | ForEach-Object {
|
||||
$hash = Get-FileHash -Algorithm SHA256 -LiteralPath $_.FullName
|
||||
"$($hash.Hash.ToLowerInvariant()) $($_.Name)"
|
||||
}
|
||||
$hashLines | Set-Content -LiteralPath (Join-Path $outputDirectory "SHA256SUMS.txt")
|
||||
$copiedPackages | Select-Object Name, Length, LastWriteTime
|
||||
@@ -0,0 +1,33 @@
|
||||
param(
|
||||
[string]$Configuration = "Release"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$dotnet = Join-Path $env:USERPROFILE ".dotnet10\dotnet.exe"
|
||||
$project = Join-Path $projectRoot "tools\LmeLicenseManager\LmeLicenseManager.csproj"
|
||||
$publishDirectory = Join-Path $projectRoot "tools\LmeLicenseManager\bin\$Configuration\net10.0-windows\win-x64\publish"
|
||||
$outputDirectory = Join-Path $projectRoot "artifacts\android-test"
|
||||
$archive = Join-Path $outputDirectory "LME-Pro-LicenseManager-win-x64.zip"
|
||||
|
||||
if (-not (Test-Path -LiteralPath $dotnet)) {
|
||||
throw "SDK .NET 10 non trovato: $dotnet"
|
||||
}
|
||||
|
||||
& $dotnet run --project $project -- --self-test
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Self-test del gestore licenze non riuscito."
|
||||
}
|
||||
|
||||
& $dotnet publish $project -c $Configuration -r win-x64 --self-contained true
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Pubblicazione del gestore licenze non riuscita."
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $outputDirectory | Out-Null
|
||||
if (Test-Path -LiteralPath $archive) {
|
||||
Remove-Item -LiteralPath $archive -Force
|
||||
}
|
||||
|
||||
Compress-Archive -Path (Join-Path $publishDirectory "*") -DestinationPath $archive -CompressionLevel Optimal
|
||||
Get-Item -LiteralPath $archive | Select-Object Name, Length, LastWriteTime
|
||||
Reference in new issue
Block a user