mirror of
https://github.com/storytold/lightcraft.git
synced 2026-12-05 00:11:17 -05:00
nightly: ship Inter's OFL inside the Windows Nightly ZIP
`Copy-NightlyNotices` copied the root notices and the craft-fonts OFLs but not `assets/fonts/OFL-Inter.txt`, so the Nightly ZIP redistributed the embedded Inter font without its licence while `NOTICE` says it ships. Copy it beside them, require it to be there, and assert it in the staged directory and inside the ZIP. The suite needs pwsh, so it runs in the Windows job.
This commit is contained in:
@@ -49,12 +49,16 @@ try {
|
||||
$fontRepo = Join-Path $testRoot 'craft-fonts'
|
||||
$family = Join-Path $fontRepo 'fonts\ExampleFamily'
|
||||
$stage = Join-Path $testRoot 'stage'
|
||||
New-Item -ItemType Directory -Force -Path $repo, $family, $stage | Out-Null
|
||||
$interDir = Join-Path $repo 'assets\fonts'
|
||||
New-Item -ItemType Directory -Force -Path $repo, $family, $stage, $interDir | Out-Null
|
||||
$rootNames = @('README.md', 'LICENSE', 'LICENSE-MIT', 'LICENSE-APACHE', 'NOTICE', 'ATTRIBUTION.md')
|
||||
foreach ($name in $rootNames) { Set-Content -LiteralPath (Join-Path $repo $name) -Value "root-notice-$name" }
|
||||
# Inter is embedded in every build, so its OFL must reach the stage and the ZIP.
|
||||
Set-Content -LiteralPath (Join-Path $interDir 'OFL-Inter.txt') -Value 'inter-notice-example'
|
||||
Set-Content -LiteralPath (Join-Path $family 'OFL.txt') -Value 'font-notice-example'
|
||||
$notices = @($rootNames) + @('OFL-Inter.txt', 'OFL-ExampleFamily.txt')
|
||||
Copy-NightlyNotices $repo $fontRepo $stage
|
||||
foreach ($name in @($rootNames) + @('OFL-ExampleFamily.txt')) {
|
||||
foreach ($name in $notices) {
|
||||
Assert (Test-Path -LiteralPath (Join-Path $stage $name)) "missing staged notice $name"
|
||||
}
|
||||
$zip = Join-Path $testRoot 'notices.zip'
|
||||
@@ -62,8 +66,11 @@ try {
|
||||
$archive = [IO.Compression.ZipFile]::OpenRead($zip)
|
||||
try {
|
||||
$names = @($archive.Entries | ForEach-Object { $_.FullName })
|
||||
foreach ($name in @($rootNames) + @('OFL-ExampleFamily.txt')) { Assert ($name -in $names) "missing archived notice $name" }
|
||||
foreach ($name in $notices) { Assert ($name -in $names) "missing archived notice $name" }
|
||||
foreach ($forbidden in @('portable.txt', 'lightcraft-cli.exe')) { Assert ($forbidden -notin $names) "unexpected payload $forbidden" }
|
||||
$interEntry = $archive.GetEntry('OFL-Inter.txt')
|
||||
$interReader = [IO.StreamReader]::new($interEntry.Open())
|
||||
try { Assert ($interReader.ReadToEnd().Contains('inter-notice-example')) 'wrong Inter license bytes in ZIP' } finally { $interReader.Dispose() }
|
||||
$entry = $archive.GetEntry('OFL-ExampleFamily.txt')
|
||||
$reader = [IO.StreamReader]::new($entry.Open())
|
||||
try { Assert ($reader.ReadToEnd().Contains('font-notice-example')) 'wrong font license bytes in ZIP' } finally { $reader.Dispose() }
|
||||
|
||||
@@ -56,6 +56,12 @@ function Copy-NightlyNotices([string] $RepositoryRoot, [string] $FontRepository,
|
||||
$source = Join-Path $RepositoryRoot $name
|
||||
if (Test-Path -LiteralPath $source) { Copy-Item -LiteralPath $source -Destination $Destination }
|
||||
}
|
||||
# Inter is embedded in every GUI build (crates/ui-egui/src/theme.rs), so its OFL ships with the
|
||||
# executable as OFL-Inter.txt beside the craft-fonts OFLs - the same set the stable FONT-LICENCES.txt
|
||||
# collects. NOTICE names it, so a ZIP without it distributes the font unlicensed.
|
||||
$inter = Join-Path $RepositoryRoot 'assets\fonts\OFL-Inter.txt'
|
||||
if (-not (Test-Path -LiteralPath $inter -PathType Leaf)) { throw 'the app has no assets/fonts/OFL-Inter.txt to ship with the embedded Inter font' }
|
||||
Copy-Item -LiteralPath $inter -Destination (Join-Path $Destination 'OFL-Inter.txt')
|
||||
if ($FontRepository) {
|
||||
$fonts = Join-Path $FontRepository 'fonts'
|
||||
if (-not (Test-Path -LiteralPath $fonts -PathType Container)) { throw 'CRAFT_FONTS_DIR has no fonts directory for the bundled notices' }
|
||||
|
||||
Reference in New Issue
Block a user