Skip to content

Commit

Permalink
Fix desjarlais#95: Implement solution-local NuGet registry
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetsait committed May 5, 2024
1 parent 02ef651 commit d595db8
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/registry/

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand Down
2 changes: 1 addition & 1 deletion Scintilla.NET.TestApp/Scintilla.NET.TestApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<ProjectReference Include="..\Scintilla.NET\Scintilla.NET.csproj" />
<PackageReference Include="Scintilla5.NET" Version="*-*" />
<Compile Update="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
Expand Down
3 changes: 3 additions & 0 deletions Scintilla.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Scintilla.NET", "Scintilla.NET\Scintilla.NET.csproj", "{22AE2386-60F1-476E-9303-61CDB0AAC4CF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Scintilla.NET.TestApp", "Scintilla.NET.TestApp\Scintilla.NET.TestApp.csproj", "{F25685EC-098A-4080-95A9-445268609806}"
ProjectSection(ProjectDependencies) = postProject
{22AE2386-60F1-476E-9303-61CDB0AAC4CF} = {22AE2386-60F1-476E-9303-61CDB0AAC4CF}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BE874649-2B00-415E-8C80-82A42D949696}"
ProjectSection(SolutionItems) = preProject
Expand Down
3 changes: 3 additions & 0 deletions Scintilla.NET/Scintilla.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="PostPack" AfterTargets="Pack">
<Exec Command="cd &quot;$(ProjectDir)&quot; &amp;&amp; powershell .\nupkg.ps1 -NuGetPackageRoot '$(NuGetPackageRoot)' -NuGetPackageSourceDir '$(SolutionDir)\registry' -PackageOutputPath '$(PackageOutputPath)' -PackageId '$(PackageId)' -PackageVersion '$(PackageVersion)'" />
</Target>
</Project>
24 changes: 24 additions & 0 deletions Scintilla.NET/nupkg.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
param (
[Parameter(Mandatory=$true)][string]$NuGetPackageRoot,
[Parameter(Mandatory=$true)][string]$NuGetPackageSourceDir,
[Parameter(Mandatory=$true)][string]$PackageOutputPath,
[Parameter(Mandatory=$true)][string]$PackageId,
[Parameter(Mandatory=$true)][string]$PackageVersion
)

$PackageVersionList = $PackageVersion.Split('.')

if ($PackageVersionList.Count -Eq 4 -And [int]::Parse($PackageVersionList[3]) -Eq 0) {
$PackageVersion = [string]::Join('.', $PackageVersionList[0..2])
}

$LocalNuGetPackageRegistry = [System.IO.Path]::GetFullPath((Join-Path $NuGetPackageSourceDir ..\registry))
$PackagePath = Join-Path $PackageOutputPath "$PackageId.$PackageVersion.nupkg"

$PackageInRegistry = Join-Path $LocalNuGetPackageRegistry $PackageId
$PackageInRoot = Join-Path $NuGetPackageRoot $PackageId

Remove-Item $PackageInRegistry -Recurse -Force -ErrorAction Ignore
Remove-Item $PackageInRoot -Recurse -Force -ErrorAction Ignore

nuget add $PackagePath -Source $LocalNuGetPackageRegistry
6 changes: 6 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="ScintillaLocalNuGetSource" value="registry" />
</packageSources>
</configuration>

0 comments on commit d595db8

Please sign in to comment.