Package standalone source CLI with verified runtime and notices
This commit is contained in:
@@ -20,7 +20,7 @@ $null = Write-Fixture 'rust/share/doc/rust/COPYRIGHT.html' 'Synthetic Rust distr
|
||||
$null = Write-Fixture 'rust/share/doc/rust/COPYRIGHT-library.html' 'Synthetic Rust library notice'
|
||||
$null = Write-Fixture 'rust/lib/fake.rlib' 'Synthetic target library'
|
||||
$packages = @(); $nodes = @(); $lock = @()
|
||||
foreach ($name in @('oa-desktop', 'oa-server', 'normal', 'build', 'dev-only', 'unreachable')) {
|
||||
foreach ($name in @('oa-desktop', 'oa-server', 'oa-cli', 'normal', 'build', 'dev-only', 'unreachable')) {
|
||||
$external = $name -notlike 'oa-*'
|
||||
$root = if ($external) { "registry/src/test/$name-1.0.0" } else { "workspace/$name" }
|
||||
$manifest = Write-Fixture "$root/Cargo.toml" "[package]`nname = `"$name`"`nversion = `"1.0.0`""
|
||||
@@ -40,10 +40,13 @@ foreach ($name in @('oa-desktop', 'oa-server', 'normal', 'build', 'dev-only', 'u
|
||||
$deps += [pscustomobject]@{ pkg = $pair[0]; dep_kinds = @([pscustomobject]@{ kind = $pair[1] }) }
|
||||
}
|
||||
}
|
||||
if ($name -eq 'oa-cli') {
|
||||
$deps += [pscustomobject]@{ pkg = 'normal'; dep_kinds = @([pscustomobject]@{ kind = $null }) }
|
||||
}
|
||||
$nodes += [pscustomobject]@{ id = $id; deps = $deps; features = @() }
|
||||
}
|
||||
$null = Write-Fixture 'Cargo.lock' ($lock -join "`n")
|
||||
$script:FixtureMetadata = [pscustomobject]@{ packages = $packages; workspace_members = @('oa-desktop', 'oa-server'); resolve = [pscustomobject]@{ nodes = $nodes } }
|
||||
$script:FixtureMetadata = [pscustomobject]@{ packages = $packages; workspace_members = @('oa-desktop', 'oa-server', 'oa-cli'); resolve = [pscustomobject]@{ nodes = $nodes } }
|
||||
$script:FixtureTarget = 'x86_64-pc-windows-msvc'
|
||||
function cargo {
|
||||
if (($args -join ' ') -notmatch '--locked --offline' -or ($args -join ' ') -notmatch "--filter-platform $script:FixtureTarget") { throw 'Unexpected Cargo command' }
|
||||
@@ -60,6 +63,12 @@ function rustc {
|
||||
$manifestPath = Write-Fixture 'supplements/manifest.json' '{"packages":[],"assets":[],"runtimes":[]}'
|
||||
function Collect { Get-WindowsNotices $fixture x86_64-pc-windows-msvc $manifestPath '' }
|
||||
function Assert([bool]$Condition, [string]$Message) { if (-not $Condition) { throw $Message } }
|
||||
$defaultRoots = (Collect).Inventory.root_packages -join ','
|
||||
Assert ($defaultRoots -eq 'oa-desktop,oa-server') 'Desktop/server default roots changed'
|
||||
$cliOnly = Get-ArcadiaNotices $fixture x86_64-pc-windows-msvc $manifestPath '' @('oa-cli')
|
||||
Assert (($cliOnly.Inventory.root_packages -join ',') -eq 'oa-cli') 'CLI root declaration missing'
|
||||
Assert ((@($cliOnly.Inventory.packages.name | Sort-Object) -join ',') -eq 'normal,oa-cli') 'CLI notice graph leaked desktop/server/dev dependencies'
|
||||
try { $null = Get-ArcadiaNotices $fixture x86_64-pc-windows-msvc $manifestPath '' @('unknown'); throw 'Expected root refusal' } catch { Assert ($_.ToString() -match 'Notice roots must') 'Unknown root was not rejected before metadata' }
|
||||
function Refuses([string]$Pattern) {
|
||||
try { $null = Collect; throw 'Expected preflight refusal' } catch {
|
||||
if ($_.Exception.Message -notmatch $Pattern) { throw }
|
||||
|
||||
Reference in New Issue
Block a user