Skip to content

Commit 9a5c136

Browse files
committed
Support multiple edition releases for older Android versions
1 parent c0b0233 commit 9a5c136

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

Build-ModulePackage.ps1

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ param(
1414

1515
[string]$OutDir = $(Join-Path $PSScriptRoot 'out'),
1616

17+
[string]$BuildSuffix = '',
18+
1719
[switch]$KeepStageDir
1820
)
1921
begin {
@@ -50,8 +52,12 @@ process {
5052
$CustomiseScriptFile = Join-Path (Split-Path $OutDir) 'module_template/customize.sh'
5153
$InstallScripts = Join-Path (Split-Path $OutDir) 'module_template/META-INF'
5254

53-
$ModuleProps = Get-Content $ModulePropFile | ConvertFrom-StringData
55+
$ModuleProps = Get-Content $ModulePropFile -Raw | ConvertFrom-StringData
5456
if (-not $?) { return }
57+
if (-not [string]::IsNullOrWhiteSpace($BuildSuffix)) {
58+
$ModuleProps.id = $ModuleProps.id, $BuildSuffix -join '-'
59+
$ModuleProps.updateJson = $ModuleProps.updateJson -replace '\.json$', "-$BuildSuffix.json"
60+
}
5561

5662
Write-Host -fo White "Packaging module for SQLite $($ModuleProps.version) SDK $FirstVer-$LastVer"
5763

@@ -68,8 +74,17 @@ process {
6874
Set-Content (Join-Path $StageDir 'customize.sh') $CustomiseScript -NoNewline
6975
if (-not $?) { return }
7076

71-
Write-Host -fo White ' Copy module.prop metadata...'
72-
Copy-Item $ModulePropFile $StageDir
77+
Write-Host -fo White ' Create module.prop metadata...'
78+
$ModulePropTarget = Join-Path $StageDir 'module.prop'
79+
Set-Content $ModulePropTarget -Value @"
80+
id=$($ModuleProps.id)
81+
name=$($ModuleProps.name)
82+
version=$($ModuleProps.version)
83+
versionCode=$($ModuleProps.versionCode)
84+
author=$($ModuleProps.author)
85+
description=$($ModuleProps.description)
86+
updateJson=$($ModuleProps.updateJson)
87+
"@
7388
if (-not $?) { return }
7489

7590
Write-Host -fo White ' Copy module installer scripts...'
@@ -126,6 +141,8 @@ end {
126141
.PARAMETER KeepStageDir
127142
Prevents the script from deleting the staging directory where module files are copied before compression.
128143
Staging dirs are always a GUID/UUID e.g. 'a96d3ea2-b602-45f3-af67-d294a7871255'
144+
.PARAMETER BuildSuffix
145+
Changes the module updateJson URL target and module ID to include a suffix.
129146
.LINK
130147
https://github.com/TheFreeman193/sqlite3-android-module/blob/main/README.md
131148
.EXAMPLE

module-update-legacy.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": "3.50.2",
3+
"versionCode": 3500200,
4+
"zipUrl": "https://github.com/TheFreeman193/sqlite3-android-module/releases/download/v3.50.2/SQLite3-3.50.2-Android-1.5-To-7.0.zip",
5+
"changelog": "https://raw.githubusercontent.com/TheFreeman193/sqlite3-android-module/main/CHANGELOG.md"
6+
}

module-update.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": "3.50.2",
33
"versionCode": 3500200,
4-
"zipUrl": "https://github.com/TheFreeman193/sqlite3-android-module/releases/download/v3.50.2/sqlite3-android_3.50.2.zip",
4+
"zipUrl": "https://github.com/TheFreeman193/sqlite3-android-module/releases/download/v3.50.2/SQLite3-3.50.2-Android-5.0-To-16.zip",
55
"changelog": "https://raw.githubusercontent.com/TheFreeman193/sqlite3-android-module/main/CHANGELOG.md"
66
}

0 commit comments

Comments
 (0)