Skip to content

Commit

Permalink
Use NuGet.config, not RestoreSources
Browse files Browse the repository at this point in the history
Commit migrated from dotnet/core-setup@65dc046
  • Loading branch information
dagood committed Sep 12, 2019
1 parent 2497e97 commit 6b0f799
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
10 changes: 0 additions & 10 deletions src/installer/test/Assets/TestProjects/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), TestProjects.props))\TestProjects.props" />

<ItemGroup>
<RestoreTestFallbackSource Include="$(ArtifactsShippingPackagesDir)" />
<RestoreTestFallbackSource Include="$(ArtifactsNonShippingPackagesDir)" />
<RestoreTestFallbackSource Include="$(TestStabilizedLegacyPackagesDir)" />
<RestoreTestSource Include="$(RestoreSources)" />
<RestoreTestSource Include="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<RestoreTestSource Include="https://api.nuget.org/v3/index.json" />
</ItemGroup>

<PropertyGroup>
<RestoreSources>@(RestoreTestSource);@(RestoreTestFallbackSource)</RestoreSources>
<RestorePackagesPath>$(TestRestorePackagesPath)</RestorePackagesPath>
<RestoreNoCache>true</RestoreNoCache>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/installer/test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<TestAssetsDir>$(TestDir)Assets\</TestAssetsDir>
<TestStabilizedLegacyPackagesDir>$(ObjDir)TestStabilizedPackages\</TestStabilizedLegacyPackagesDir>
<TestRestorePackagesPath>$(ObjDir)TestPackageCache\</TestRestorePackagesPath>
<TestRestoreNuGetConfigFile>$(ObjDir)TestNuGetConfig\NuGet.config</TestRestoreNuGetConfigFile>
<TestArchitectures>$(TargetArchitecture)</TestArchitectures>
<TestInfraTargetFramework>netcoreapp3.0</TestInfraTargetFramework>
</PropertyGroup>
Expand Down
28 changes: 25 additions & 3 deletions src/installer/test/PrepareTestAssets/PrepareTestAssets.proj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
GetNETCoreAppInternalPackageVersion;
GetNETCoreAppRuntimePackVersion;
CleanTestAssets;
GenerateTestRestoreSourcesNuGetConfig;
PrepareStabilizedLegacyPackages;
RestoreTestAssetProjects" />

Expand Down Expand Up @@ -42,6 +43,29 @@
<MakeDir Directories="$(TestStabilizedLegacyPackagesDir)" />
</Target>

<Target Name="GenerateTestRestoreSourcesNuGetConfig">
<ItemGroup>
<RestoreTestSource Include="$(ArtifactsShippingPackagesDir)" Key="artifacts-shipping-packages" />
<RestoreTestSource Include="$(ArtifactsNonShippingPackagesDir)" Key="artifacts-nonshipping-packages" />
<RestoreTestSource Include="$(TestStabilizedLegacyPackagesDir)" Key="stabilized-legacy-packages" />
</ItemGroup>

<PropertyGroup>
<TemplateNuGetConfigFile>$(ProjectDir)NuGet.config</TemplateNuGetConfigFile>

<RestoreTestSourceConfigLines>@(RestoreTestSource -> '&lt;add key="%(Key)" value="%(Identity)" /&gt;', '%0A ')</RestoreTestSourceConfigLines>

<TestRestoreNuGetConfigContent>$([System.IO.File]::ReadAllText('$(TemplateNuGetConfigFile)').Replace(
'&lt;!-- TEST_RESTORE_SOURCES_INSERTION_LINE --&gt;',
'$(RestoreTestSourceConfigLines)'))</TestRestoreNuGetConfigContent>
</PropertyGroup>

<WriteLinesToFile
File="$(TestRestoreNuGetConfigFile)"
Lines="$(TestRestoreNuGetConfigContent)"
Overwrite="true" />
</Target>

<Target Name="PrepareStabilizedLegacyPackages"
Condition="'$(NETCoreAppInternalPackageVersion)' != '$(NETCoreAppRuntimePackVersion)'">
<ItemGroup>
Expand Down Expand Up @@ -74,9 +98,7 @@
Projects="@(TestAssetProjectToRestore)"
Targets="Restore"
Properties="
ArtifactsShippingPackagesDir=$(ArtifactsShippingPackagesDir);
ArtifactsNonShippingPackagesDir=$(ArtifactsNonShippingPackagesDir);
TestStabilizedLegacyPackagesDir=$(TestStabilizedLegacyPackagesDir);
RestoreConfigFile=$(TestRestoreNuGetConfigFile);
TestRestorePackagesPath=$(TestRestorePackagesPath);
TestTargetRid=$(TestTargetRid);
MNAVersion=$(NETCoreAppRuntimePackVersion)" />
Expand Down

0 comments on commit 6b0f799

Please sign in to comment.