Skip to content

Commit 0c76ca4

Browse files
committed
Create script to sync nuget.config files
1 parent 0234bdf commit 0c76ca4

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

nuget.config

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!--
3-
This file is used when building solution files.
4-
The copies inside project directories exist for `cf push`.
3+
The `nuget.config` file in the repository root is typically used by IDEs,
4+
whereas a copy in a samples directory is used by `cf push`.
5+
6+
Use the script /tools/sync-nuget-config.ps1 to keep these files in sync.
7+
Do not commit changes to this file directly.
58
-->
69
<configuration>
710
<packageSources>
811
<clear />
912
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
10-
<add key="SteeltoeCI" value="https://pkgs.dev.azure.com/dotnet/Steeltoe/_packaging/ci/nuget/v3/index.json" />
13+
<add key="Steeltoe-ci" value="https://pkgs.dev.azure.com/dotnet/Steeltoe/_packaging/ci/nuget/v3/index.json" />
1114
</packageSources>
1215
<packageSourceMapping>
1316
<packageSource key="nuget.org">
1417
<package pattern="*" />
1518
</packageSource>
16-
<packageSource key="SteeltoeCI">
19+
<packageSource key="Steeltoe-ci">
1720
<package pattern="Steeltoe.*" />
1821
</packageSource>
1922
</packageSourceMapping>

tools/sync-nuget-config.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This script copies the nuget.config file from the repository root into the sample directories.
2+
# While IDEs typically ignore the copies, they are needed for cf push.
3+
4+
Set-StrictMode -version 2.0
5+
$ErrorActionPreference = 'Stop'
6+
7+
$repoRoot = "$PSScriptRoot/.."
8+
$sourceFilePath = Resolve-Path -Path "$repoRoot/nuget.config"
9+
10+
foreach ($targetFilePath in Get-ChildItem -Path $repoRoot -Recurse -Filter 'nuget.config') {
11+
if ([string]$targetFilePath -ne $sourceFilePath) {
12+
$targetDir = Split-Path -Parent $targetFilePath
13+
Copy-Item $sourceFilePath $targetDir -Force
14+
}
15+
}

0 commit comments

Comments
 (0)