Workaround peculiar caching behaviors in NuGetSdkResovler when NUGET_PACKAGES is set

This commit is contained in:
Nate McMaster 2018-05-01 15:41:24 -07:00
Родитель a1ff4a711a
Коммит 383f44bf9f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: A778D9601BD78810
8 изменённых файлов: 27 добавлений и 7 удалений

Просмотреть файл

@ -7,7 +7,7 @@ branches:
- /^release\/.*/ - /^release\/.*/
- /^(.*\/)?ci-.*$/ - /^(.*\/)?ci-.*$/
build_script: build_script:
- ps: .\build.ps1 - ps: .\build.ps1 -ci
clone_depth: 1 clone_depth: 1
test: off test: off
deploy: off deploy: off

1
.gitignore поставляемый
Просмотреть файл

@ -25,3 +25,4 @@ global.json
launchSettings.json launchSettings.json
korebuild-lock.txt korebuild-lock.txt
*.binlog *.binlog
.dotnet/

Просмотреть файл

@ -18,4 +18,4 @@ branches:
- /^release\/.*/ - /^release\/.*/
- /^(.*\/)?ci-.*$/ - /^(.*\/)?ci-.*$/
script: script:
- ./build.sh - ./build.sh --ci

Просмотреть файл

@ -4,6 +4,8 @@
<# <#
.DESCRIPTION .DESCRIPTION
Builds this repository Builds this repository
.PARAMETER CI
Treat build as a CI build
.PARAMETER SkipTests .PARAMETER SkipTests
Skip tests Skip tests
.PARAMETER DotNetHome .PARAMETER DotNetHome
@ -21,6 +23,7 @@
#> #>
[CmdletBinding(PositionalBinding = $false)] [CmdletBinding(PositionalBinding = $false)]
param( param(
[switch]$CI,
[switch]$SkipTests, [switch]$SkipTests,
[string]$DotNetHome = $null, [string]$DotNetHome = $null,
[string]$ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools', [string]$ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools',
@ -62,7 +65,7 @@ try {
$MSBuildArguments += "-p:DotNetRestoreSources=$RestoreSources" $MSBuildArguments += "-p:DotNetRestoreSources=$RestoreSources"
} }
Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $PSScriptRoot -ConfigFile $ConfigFile Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $PSScriptRoot -ConfigFile $ConfigFile -CI:$CI
Invoke-KoreBuildCommand "default-build" @MSBuildArguments Invoke-KoreBuildCommand "default-build" @MSBuildArguments
} }
finally { finally {

Просмотреть файл

@ -14,6 +14,7 @@ __usage() {
echo " -v|--verbose Show verbose output." echo " -v|--verbose Show verbose output."
echo " -d|--dotnet-home <DIR> The directory where .NET Core tools will be stored. Defaults to '$DOTNET_HOME'." echo " -d|--dotnet-home <DIR> The directory where .NET Core tools will be stored. Defaults to '$DOTNET_HOME'."
echo " -s|--tools-source <URL> The base url where build tools can be downloaded. Defaults to '$tools_source'." echo " -s|--tools-source <URL> The base url where build tools can be downloaded. Defaults to '$tools_source'."
echo " --ci Apply CI specific settings and environment variables."
exit 2 exit 2
} }
@ -25,6 +26,7 @@ __usage() {
config_file="$DIR/korebuild.json" config_file="$DIR/korebuild.json"
tools_source='https://aspnetcore.blob.core.windows.net/buildtools' tools_source='https://aspnetcore.blob.core.windows.net/buildtools'
verbose=false verbose=false
ci=false
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
-\?|-h|--help) -\?|-h|--help)
@ -43,6 +45,9 @@ while [[ $# -gt 0 ]]; do
-v|--verbose) -v|--verbose)
verbose=true verbose=true
;; ;;
--ci|-[Cc][Ii])
ci=true
;;
--) --)
shift shift
break break
@ -54,6 +59,6 @@ while [[ $# -gt 0 ]]; do
shift shift
done done
set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$DIR" "$config_file" set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$DIR" "$config_file" "$ci"
invoke_korebuild_command "default-build" "$@" invoke_korebuild_command "default-build" "$@"

Просмотреть файл

@ -23,21 +23,25 @@
<BundledPackageRestorerContent> <BundledPackageRestorerContent>
<![CDATA[ <![CDATA[
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Sdk Name="Microsoft.DotNet.GlobalTools.Sdk" Version="$(Version)" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences> <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Internal.AspNetCore.Sdk" Version="$(Version)" /> <PackageReference Include="Internal.AspNetCore.Sdk" Version="$(Version)" />
<PackageReference Include="Microsoft.DotNet.GlobalTools.Sdk" Version="$(Version)" />
</ItemGroup> </ItemGroup>
</Project> </Project>
]]> ]]>
</BundledPackageRestorerContent> </BundledPackageRestorerContent>
</PropertyGroup> </PropertyGroup>
<WriteLinesToFile File="$(PublishDir)BundledPackageRestorer.csproj" Lines="$(BundledPackageRestorerContent)" Overwrite="true" /> <WriteLinesToFile File="$(PublishDir)BundledPackageRestorer.csproj" Lines="$(BundledPackageRestorerContent)" Overwrite="true" />
<Copy SourceFiles="module.props;module.targets" DestinationFolder="$(PublishDir)" /> <Copy SourceFiles="module.props;module.targets;NuGet.config" DestinationFolder="$(PublishDir)" />
</Target> </Target>
</Project> </Project>

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="LocalFolder" value="./" />
</packageSources>
</configuration>

Просмотреть файл

@ -186,7 +186,7 @@ while [[ $# -gt 0 ]]; do
--reinstall|-[Rr]einstall) --reinstall|-[Rr]einstall)
reinstall=true reinstall=true
;; ;;
--ci) --ci|-[Cc][Ii])
ci=true ci=true
;; ;;
--verbose|-Verbose) --verbose|-Verbose)