@@ -91,7 +91,6 @@ public static class BuildParameters
91
91
public static string StrongNameDependentAssembliesInputPath { get ; private set ; }
92
92
public static string AssemblyNamesRegexPattern { get ; private set ; }
93
93
public static bool UseChocolateyGuiStrongNameKey { get ; private set ; }
94
- public static FilePath NuGetConfig { get ; private set ; }
95
94
public static ICollection < string > NuGetSources { get ; private set ; }
96
95
public static DirectoryPath RestorePackagesDirectory { get ; private set ; }
97
96
public static Func < FilePathCollection > GetFilesToObfuscate { get ; private set ; }
@@ -162,7 +161,6 @@ public static class BuildParameters
162
161
context . Information ( "BuildAgentOperatingSystem: {0}" , BuildAgentOperatingSystem ) ;
163
162
context . Information ( "RepositoryOwner: {0}" , RepositoryOwner ) ;
164
163
context . Information ( "RepositoryName: {0}" , RepositoryName ) ;
165
- context . Information ( "NuGetConfig: {0} ({1})" , NuGetConfig , context . FileExists ( NuGetConfig ) ) ;
166
164
context . Information ( "Build Counter: {0}" , BuildCounter ) ;
167
165
context . Information ( "Test Execution Type: {0}" , TestExecutionType ) ;
168
166
context . Information ( "RestorePackagesDirectory: {0}" , RestorePackagesDirectory ) ;
@@ -278,7 +276,6 @@ public static class BuildParameters
278
276
bool useChocolateyGuiStrongNameKey = false ,
279
277
string strongNameDependentAssembliesInputPath = null ,
280
278
string assemblyNamesRegexPattern = null ,
281
- FilePath nugetConfig = null ,
282
279
ICollection < string > nuGetSources = null ,
283
280
bool treatWarningsAsErrors = true ,
284
281
DirectoryPath restorePackagesDirectory = null ,
@@ -379,7 +376,6 @@ public static class BuildParameters
379
376
AssemblyNamesRegexPattern = assemblyNamesRegexPattern ?? "chocolatey.lib|chocolatey-licensed.lib|ChocolateyGui.Common|ChocolateyGui.Common.Windows" ;
380
377
UseChocolateyGuiStrongNameKey = useChocolateyGuiStrongNameKey ;
381
378
382
- NuGetConfig = context . MakeAbsolute ( nugetConfig ?? ( FilePath ) "./NuGet.Config" ) ;
383
379
NuGetSources = nuGetSources ;
384
380
RestorePackagesDirectory = restorePackagesDirectory ;
385
381
GetFilesToObfuscate = getFilesToObfuscate ;
@@ -402,47 +398,35 @@ public static class BuildParameters
402
398
403
399
if ( nuGetSources == null )
404
400
{
405
- if ( context . FileExists ( NuGetConfig ) )
401
+ var primaryNuGetSource = context . EnvironmentVariable ( "PRIMARY_NUGET_SOURCE" ) ;
402
+
403
+ if ( ! string . IsNullOrEmpty ( primaryNuGetSource ) )
406
404
{
407
- NuGetSources = (
408
- from configuration in System . Xml . Linq . XDocument . Load ( NuGetConfig . FullPath ) . Elements ( "configuration" )
409
- from packageSources in configuration . Elements ( "packageSources" )
410
- from add in packageSources . Elements ( "add" )
411
- from value in add . Attributes ( "value" )
412
- select value . Value
413
- ) . ToArray ( ) ;
414
-
415
- context . Information ( "NuGet Sources configured from nuget.config file." ) ;
405
+ NuGetSources = new [ ] {
406
+ primaryNuGetSource
407
+ } ;
408
+
409
+ context . Information ( "NuGet Sources configured using primary NuGet Source." ) ;
416
410
}
417
411
else
418
412
{
419
- var primaryNuGetSource = context . EnvironmentVariable ( "PRIMARY_NUGET_SOURCE " ) ;
413
+ var nuGetDevRestoreNuGetSource = context . EnvironmentVariable ( "NUGETDEVRESTORE_SOURCE " ) ;
420
414
421
- if ( ! string . IsNullOrEmpty ( primaryNuGetSource ) )
415
+ var devNuGetSources = new List < string >
422
416
{
423
- NuGetSources = new [ ] {
424
- primaryNuGetSource
425
- } ;
417
+ "https://www.nuget.org/api/v2/" ,
418
+ "https://api.nuget.org/v3/index.json"
419
+ } ;
426
420
427
- context . Information ( "NuGet Sources configured using primary NuGet Source." ) ;
428
- }
429
- else
421
+ if ( ! string . IsNullOrEmpty ( nuGetDevRestoreNuGetSource ) )
430
422
{
431
- var devNuGetSources = new List < string >
432
- {
433
- "https://www.nuget.org/api/v2/" ,
434
- "https://api.nuget.org/v3/index.json"
435
- } ;
436
-
437
- if ( context . HasEnvironmentVariable ( "NUGETDEVRESTORE_SOURCE" ) )
438
- {
439
- devNuGetSources . Add ( context . EnvironmentVariable ( "NUGETDEVRESTORE_SOURCE" ) ) ;
440
- }
423
+ context . Information ( "Adding source to default values: {0}" , nuGetDevRestoreNuGetSource ) ;
424
+ devNuGetSources . Add ( nuGetDevRestoreNuGetSource ) ;
425
+ }
441
426
442
- NuGetSources = devNuGetSources ;
427
+ NuGetSources = devNuGetSources ;
443
428
444
- context . Information ( "NuGet Sources configured using default values." ) ;
445
- }
429
+ context . Information ( "NuGet Sources configured using default values." ) ;
446
430
}
447
431
}
448
432
0 commit comments