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
2 changes: 1 addition & 1 deletion Copper6510/Copper6510.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<NoWarn>1701;1702;NU1900</NoWarn>
<PackageId>Copper6510</PackageId>
<Title>Copper6510</Title>
<Authors>CopperMod contributors</Authors>
<Authors>Ilkka Lehtoranta</Authors>
<Description>Reusable MOS 6510 CPU emulation core with cycle-aware bus callbacks and common undocumented opcode support.</Description>
<PackageVersion>1.1.0</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion CopperDisk/CopperDisk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>CopperDisk</PackageId>
<Title>CopperDisk</Title>
<Authors>CopperMod contributors</Authors>
<Authors>Ilkka Lehtoranta</Authors>
<Description>Managed Amiga ADF, extended ADF, ADZ, DMS, IPF, and SCP disk image library.</Description>
<PackageVersion>2.1.0</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion CopperMod.Abstractions/CopperMod.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>CopperMod.Abstractions</PackageId>
<Title>CopperMod.Abstractions</Title>
<Authors>CopperMod contributors</Authors>
<Authors>Ilkka Lehtoranta</Authors>
<Description>Reusable contracts for tracker and chip music format detection, loading, seeking, and PCM rendering.</Description>
<PackageVersion>1.0.0</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion CopperMod.Amiga.Emulator/CopperMod.Amiga.Emulator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>CopperMod.Amiga.Emulator</PackageId>
<Title>CopperMod.Amiga.Emulator</Title>
<Authors>CopperMod contributors</Authors>
<Authors>Ilkka Lehtoranta</Authors>
<Description>Full Amiga emulator host services, boot helpers, and disk media adapters layered on CopperMod.Amiga.</Description>
<PackageVersion>1.1.0</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion CopperMod.Cust/CopperMod.Cust.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>CopperMod.Cust</PackageId>
<Title>CopperMod.Cust</Title>
<Authors>CopperMod contributors</Authors>
<Authors>Ilkka Lehtoranta</Authors>
<Description>Native Amiga CUST Hunk loader with an A500 PAL MC68000/Paula playback sandbox.</Description>
<PackageVersion>1.1.0</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion CopperMod.Med/CopperMod.Med.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>CopperMod.Med</PackageId>
<Title>CopperMod.Med</Title>
<Authors>CopperMod contributors</Authors>
<Authors>Ilkka Lehtoranta</Authors>
<Description>MED/OctaMED MMD module parser and tick renderer for Amiga tracker modules.</Description>
<PackageVersion>1.0.0</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion CopperMod.ProTracker/CopperMod.ProTracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>CopperMod.ProTracker</PackageId>
<Title>CopperMod.ProTracker</Title>
<Authors>CopperMod contributors</Authors>
<Authors>Ilkka Lehtoranta</Authors>
<Description>ProTracker MOD parser and tick renderer for Amiga tracker modules.</Description>
<PackageVersion>1.0.0</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion CopperMod.Sid/CopperMod.Sid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>CopperMod.Sid</PackageId>
<Title>CopperMod.Sid</Title>
<Authors>CopperMod contributors</Authors>
<Authors>Ilkka Lehtoranta</Authors>
<Description>PSID/RSID parser and register-scheduled SID renderer.</Description>
<PackageVersion>1.1.0</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion CopperPad/CopperPad.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>CopperPad</PackageId>
<Title>CopperPad</Title>
<Authors>CopperMod contributors</Authors>
<Authors>Ilkka Lehtoranta</Authors>
<Description>Portable .NET game controller normalization library.</Description>
<PackageVersion>1.0.0</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ CopperDisk package automation lives under `scripts\nuget`:
.\scripts\nuget\publish-copperdisk.ps1 -PackagePath .\artifacts\packages\CopperDisk.1.0.0.nupkg -WhatIf
```

CopperPad is staged for future NuGet publishing with the same script layout:

```powershell
.\scripts\nuget\pack-copperpad.ps1
.\scripts\nuget\publish-copperpad.ps1 -PackagePath .\artifacts\packages\CopperPad.1.0.0.nupkg -WhatIf
```

## Run

```powershell
Expand Down
124 changes: 124 additions & 0 deletions scripts/nuget/pack-copperpad.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
param(
[string] $Configuration = "Release",
[string] $OutputDirectory = ".\artifacts\packages",
[string] $Version,
[switch] $NoRestore,
[switch] $SkipTests,
[switch] $SkipPackageContentValidation
)

$ErrorActionPreference = "Stop"

function Invoke-DotNet {
param(
[string[]] $Arguments
)

& dotnet @Arguments
if ($LASTEXITCODE -ne 0) {
throw "dotnet $($Arguments -join ' ') failed with exit code $LASTEXITCODE."
}
}

$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..")
$project = Join-Path $repoRoot "CopperPad\CopperPad.csproj"
$testProject = Join-Path $repoRoot "CopperPad.Tests\CopperPad.Tests.csproj"

if ([System.IO.Path]::IsPathRooted($OutputDirectory)) {
$packageDir = $OutputDirectory
}
else {
$packageDir = Join-Path $repoRoot $OutputDirectory
}

New-Item -ItemType Directory -Force -Path $packageDir | Out-Null

if (-not $NoRestore) {
Invoke-DotNet -Arguments @("restore", $project)
Invoke-DotNet -Arguments @("restore", $testProject)
}

Invoke-DotNet -Arguments @("build", $project, "-c", $Configuration, "--no-restore")

if (-not $SkipTests) {
Invoke-DotNet -Arguments @("test", $testProject, "-c", $Configuration, "--no-restore")
}

$packProperties = @("/p:EnablePackageValidation=true")
if ($Version) {
$packProperties += "/p:PackageVersion=$Version"
}

$packArguments = @("pack", $project, "-c", $Configuration, "--no-restore", "-o", $packageDir) + $packProperties
Invoke-DotNet -Arguments $packArguments

if (-not $Version) {
[xml] $projectXml = Get-Content $project
$Version = ($projectXml.Project.PropertyGroup |
Where-Object { $_.PackageVersion } |
Select-Object -First 1).PackageVersion
}

$packagePath = Join-Path $packageDir "CopperPad.$Version.nupkg"
$symbolPackagePath = Join-Path $packageDir "CopperPad.$Version.snupkg"

if (-not (Test-Path $packagePath)) {
throw "Package was not created at '$packagePath'."
}

if (-not $SkipPackageContentValidation) {
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [System.IO.Compression.ZipFile]::OpenRead($packagePath)
try {
$requiredEntries = @(
"README.md",
"lib/net10.0/CopperPad.dll",
"lib/net10.0/CopperPad.xml"
)

foreach ($entryName in $requiredEntries) {
if (-not $zip.GetEntry($entryName)) {
throw "Package '$packagePath' is missing required entry '$entryName'."
}
}

$readmeReader = New-Object System.IO.StreamReader($zip.GetEntry("README.md").Open())
try {
$readmeFirstLine = $readmeReader.ReadLine()
}
finally {
$readmeReader.Dispose()
}

if ($readmeFirstLine -ne "# CopperPad") {
throw "Package README starts with '$readmeFirstLine', expected '# CopperPad'."
}

$nuspecEntry = $zip.Entries | Where-Object { $_.FullName.EndsWith(".nuspec", [StringComparison]::OrdinalIgnoreCase) } | Select-Object -First 1
if (-not $nuspecEntry) {
throw "Package '$packagePath' is missing a nuspec entry."
}
}
finally {
$zip.Dispose()
}

if (Test-Path $symbolPackagePath) {
$symbolZip = [System.IO.Compression.ZipFile]::OpenRead($symbolPackagePath)
try {
if (-not $symbolZip.GetEntry("lib/net10.0/CopperPad.pdb")) {
throw "Symbol package '$symbolPackagePath' is missing 'lib/net10.0/CopperPad.pdb'."
}
}
finally {
$symbolZip.Dispose()
}
}
}

Write-Host ""
Write-Host "Created package:"
Write-Host " $packagePath"
if (Test-Path $symbolPackagePath) {
Write-Host " $symbolPackagePath"
}
88 changes: 88 additions & 0 deletions scripts/nuget/publish-copperpad.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Medium")]
param(
[Parameter(Mandatory = $true)]
[string] $PackagePath,

[string] $ApiKey = $env:NUGET_API_KEY,
[string] $Source = "https://api.nuget.org/v3/index.json",
[switch] $NoSymbols,
[switch] $NoSkipDuplicate
)

$ErrorActionPreference = "Stop"
$cmdlet = $PSCmdlet

function Invoke-DotNet {
param(
[string[]] $Arguments
)

& dotnet @Arguments
if ($LASTEXITCODE -ne 0) {
throw "dotnet $($Arguments -join ' ') failed with exit code $LASTEXITCODE."
}
}

$resolvedPackage = Resolve-Path -LiteralPath $PackagePath
$packageFile = Get-Item -LiteralPath $resolvedPackage.Path

if ($packageFile.Extension -ne ".nupkg") {
throw "PackagePath must point to a .nupkg file."
}

if ($packageFile.Name.EndsWith(".symbols.nupkg", [StringComparison]::OrdinalIgnoreCase)) {
throw "PackagePath must point to the main .nupkg package, not a symbols package."
}

if (-not $packageFile.Name.StartsWith("CopperPad.", [StringComparison]::OrdinalIgnoreCase)) {
throw "PackagePath must point to a CopperPad package."
}

if (-not $ApiKey -and -not $WhatIfPreference) {
throw "NuGet API key is required. Pass -ApiKey or set the NUGET_API_KEY environment variable."
}

if (-not $ApiKey) {
$ApiKey = "WHATIF"
}

function Invoke-NuGetPush {
param(
[string] $Path,
[string] $Label
)

$arguments = @(
"nuget",
"push",
$Path,
"--api-key",
$ApiKey,
"--source",
$Source
)

if ($Path.EndsWith(".nupkg", [StringComparison]::OrdinalIgnoreCase)) {
$arguments += "--no-symbols"
}

if (-not $NoSkipDuplicate) {
$arguments += "--skip-duplicate"
}

if ($cmdlet.ShouldProcess($Path, "Publish $Label to $Source")) {
Invoke-DotNet -Arguments $arguments
}
}

Invoke-NuGetPush -Path $packageFile.FullName -Label "CopperPad package"

if (-not $NoSymbols) {
$symbolPackagePath = [System.IO.Path]::ChangeExtension($packageFile.FullName, ".snupkg")
if (Test-Path $symbolPackagePath) {
Invoke-NuGetPush -Path $symbolPackagePath -Label "CopperPad symbol package"
}
else {
Write-Host "No matching symbol package found at '$symbolPackagePath'."
}
}
Loading