Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions movil/publicar.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
# Compila el APK, lo firma con tu clave y lo publica en una release «celu-vX.Y.Z».
# Correlo en tu propia ventana de PowerShell: apksigner pide la contraseña y no queda guardada en ningún lado.
param([switch]$SinSubir)
# Correlo en tu propia ventana de PowerShell: apksigner pide la contraseña, salvo que la hayas guardado
# con -GuardarClave (queda cifrada para tu usuario de Windows en ~/.sloth-keys/celu.pass).
param([switch]$SinSubir, [switch]$GuardarClave)
$ErrorActionPreference = 'Stop'

$clave = "$env:USERPROFILE\.sloth-keys\celu.jks"
$guardada = "$env:USERPROFILE\.sloth-keys\celu.pass"
if (-not (Test-Path $clave)) { throw "Falta la clave de firma: $clave" }
if (-not $env:JAVA_HOME) { $env:JAVA_HOME = 'C:\Program Files\Microsoft\jdk-17.0.21.102-hotspot' }
if (-not $env:ANDROID_HOME) { $env:ANDROID_HOME = 'D:\Android\Sdk' }
if (-not $env:NDK_HOME) { $env:NDK_HOME = "$env:ANDROID_HOME\ndk\28.2.13676358" }

# La contraseña viaja a keytool y apksigner por una variable de entorno que vive solo mientras corren.
function Invoke-ConClave([securestring]$secreta, [scriptblock]$accion) {
$env:SLOTH_CELU_PASS = [System.Net.NetworkCredential]::new('', $secreta).Password
try { & $accion } finally { Remove-Item Env:SLOTH_CELU_PASS }
}

if ($GuardarClave) {
$secreta = Read-Host 'Contraseña de celu.jks' -AsSecureString
Invoke-ConClave $secreta { & "$env:JAVA_HOME\bin\keytool.exe" -list -keystore $clave -alias sloth -storepass:env SLOTH_CELU_PASS | Out-Null }
if ($LASTEXITCODE) { throw 'Esa contraseña no abre la clave. No se guardó nada.' }
ConvertFrom-SecureString $secreta | Set-Content $guardada -Encoding ascii
Write-Host "Contraseña guardada en $guardada. Para olvidarla, borrá ese archivo." -ForegroundColor Green
return
}

$version = (Get-Content "$PSScriptRoot\src-tauri\tauri.conf.json" -Raw | ConvertFrom-Json).version
Push-Location $PSScriptRoot
try { npm run tauri -- android build --apk --target aarch64; if ($LASTEXITCODE) { throw 'Falló la compilación.' } }
Expand All @@ -19,7 +36,12 @@ $salida = "$PSScriptRoot\dist"
New-Item -ItemType Directory -Force $salida | Out-Null
$apk = "$salida\Sloth-celu-$version.apk"
$firmador = "$env:ANDROID_HOME\build-tools\36.0.0\apksigner.bat"
& $firmador sign --ks $clave --ks-key-alias sloth --out $apk $sin
if (Test-Path $guardada) {
$secreta = Get-Content $guardada | ConvertTo-SecureString
Invoke-ConClave $secreta { & $firmador sign --ks $clave --ks-key-alias sloth --ks-pass env:SLOTH_CELU_PASS --out $apk $sin }
} else {
& $firmador sign --ks $clave --ks-key-alias sloth --out $apk $sin
}
if ($LASTEXITCODE) { throw 'No se pudo firmar.' }
& $firmador verify $apk
if ($LASTEXITCODE) { throw 'La firma no verifica.' }
Expand Down
7 changes: 6 additions & 1 deletion movil/src-tauri/gen/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

# ML Kit (lector de QR) arma sus componentes por reflexión: si R8 los recorta o renombra,
# la app se cierra al abrir el lector, y solo en la versión compilada para publicar.
-keep class com.google.mlkit.** { *; }
-keep class com.google.android.gms.internal.mlkit_** { *; }
2 changes: 1 addition & 1 deletion movil/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Sloth",
"version": "0.2.0",
"version": "0.2.1",
"identifier": "com.toomasmg.sloth.celu",
"build": { "frontendDist": "../ui" },
"app": {
Expand Down
Loading