Generate lzma nuget.config when needed

This commit is contained in:
Piotr Puszkiewicz 2017-01-24 02:30:24 -08:00
parent b31b2f429d
commit 131c63ae27
3 changed files with 30 additions and 2 deletions

View file

@ -3,7 +3,6 @@
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="configurable.source" value="%CLI_PACKAGE_SOURCE%" />
<add key="templating" value="https://dotnet.myget.org/F/templating/api/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="cli-deps" value="https://dotnet.myget.org/F/cli-deps/api/v3/index.json" />

View file

@ -67,15 +67,31 @@
<NuGetPackagesArchiveDirectory Include="$(NuGetPackagesArchiveFolder)" />
</ItemGroup>
<PropertyGroup>
<NuGetConfigContent>
&lt;configuration&gt;
&lt;packageSources&gt;
&lt;add key="configurable.source" value="%CLI_LZMA_PACKAGE_SOURCE%" /&gt;
&lt;/packageSources&gt;
&lt;/configuration&gt;
</NuGetConfigContent>
<LZMANuGetConfigFilePath>$(NuGetPackagesArchiveProject)/Nuget.config</LZMANuGetConfigFilePath>
</PropertyGroup>
<Delete Files="@(FilesToClean)" />
<RemoveDir Directories="@(NuGetPackagesArchiveDirectory)" />
<MakeDir Directories="@(NuGetPackagesArchiveDirectory)"/>
<WriteLinesToFile Condition=" 'CLI_LZMA_PACKAGE_SOURCE' != '' "
File="$(LZMANuGetConfigFilePath)"
Lines="$(NuGetConfigContent)" />
<DotNetNew ToolPath="$(Stage2Directory)"
TemplateType="Web"
WorkingDirectory="$(NuGetPackagesArchiveProject)/Web" />
<DotNetRestore ToolPath="$(Stage2Directory)"
IgnoreMissingSources="True"
Packages="$(NuGetPackagesArchiveFolder)"
SkipInvalidConfigurations="True"
WorkingDirectory="$(NuGetPackagesArchiveProject)/Web" />
@ -85,6 +101,7 @@
WorkingDirectory="$(NuGetPackagesArchiveProject)/Web1.1" />
<DotNetRestore ToolPath="$(Stage2Directory)"
IgnoreMissingSources="True"
Packages="$(NuGetPackagesArchiveFolder)"
SkipInvalidConfigurations="True"
WorkingDirectory="$(NuGetPackagesArchiveProject)/Web1.1" />

View file

@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli.Build
protected override string Args
{
get { return $"{GetProjectPath()} {GetConfigFile()} {GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()} {GetRuntime()} {GetAdditionalParameters()}"; }
get { return $"{GetProjectPath()} {GetConfigFile()} {GetSource()} {GetPackages()} {GetIgnoreMissingSources()} {GetSkipInvalidConfigurations()} {GetRuntime()} {GetAdditionalParameters()}"; }
}
public string ConfigFile { get; set; }
@ -26,6 +26,8 @@ namespace Microsoft.DotNet.Cli.Build
public string Packages { get; set; }
public bool SkipInvalidConfigurations { get; set; }
public bool IgnoreMissingSources { get; set; }
public string Runtime { get; set; }
@ -78,6 +80,16 @@ namespace Microsoft.DotNet.Cli.Build
return null;
}
private string GetIgnoreMissingSources()
{
if (IgnoreMissingSources)
{
return "--ignore-failed-sources";
}
return null;
}
private string GetRuntime()
{