Replace KoreBuild with Arcade (#11122)

* Replace usages of $(CI) with $(ContinuousIntegrationBuild)

* Move RepoTasks to eng/tools/

* Remove dead code

* Update build.sh/ps1 to invoke Arcade instead of KoreBuild

* build/repo.props => eng/Build.props

* build/CodeSign.{props,targets} => eng/Signing.props

* build/repo.targets => eng/Build.props, eng/CodeGen.proj, and eng/AfterSolutionBuild.targets

* Remove AddAllProjectRefsToSolution.ps1

* Put selenium process tracking into artifacts/tmp/

* build/docker => eng/docker

* Move content from korebuild.json to global.json

* Remove cibuild.{sh,cmd} and update ci.yml

* Ensure vswhere detects BuildTools installations

* Remove sign check exclusions (Arcade does not support)

* list VS required components in global.json

* Update CodeCheck.ps1

* Update arcade (#11143)

* Fixups to broken build

* capture test results in xunit form
* attempt to fix code check
* restore before linux build
* remove duplicate signinfos

* More build fixes

* exclude node_modules from unique project check
* fixup signing props

* More build fixes

* Remove unused NoWarns
* Skip building site extension
* Suppress xunit color in console output
* Install x86 runtime

* Run KillProcesses.ps1 at end of build on CI

* activate env vars in codecheck.ps1

* Fix signing and generate build manifests

* Fixup code check and linux installers build

* Remove custom restore targets

* Import flaky test props

* Restore original manifest generation code and set warnAsErrors=false

* Alwasy restore the toolset

* More attempts at build fixes

* run restore before building deb/rpm packages
* pre-install Yarn.MSBuild
* Remove WIX workaround

* Attempt to fix RPM installers and x86 build

* Fix helix tests, java auto-detection, and code gen steps

* Globally disable MSBuild node resuse and capture MSbuild crash logs

* Cleanup build invocation for installers

* Set max time on xunit tests to 15 min

* Update helix-test.yml

* Fix Hosting tests

* Fix TestHost

* Fix Negotiate.Test

* Fix Mvc tests

* Capture results

* Fix Hosting tests

* Fix Kestrel tests

* Fix ServerComparison tests

* Fix DefaultBuilder functional tests

* Skip template tests

Need to run pack before running tests on mac/linux now

* Fix Identity test

* Fix ServerComparison tests

* Verify nginx installation on ubuntu

* Verify nginx installation?

* Try adding to path

* Try symlink

* Sudo?

* Woot it works

* Disable timeout

Template tests require more than 15 mins

* list env vars

* Use correct dotnet_home

* Prepent path instead

* Fix npmproj tests

* Fix CORS tests

* Debug signalr tests

* Debug signalr

* Capture bin

* Try building templates sequentially

* Debug signalr

* Cleanup

* Disable signalr npm tests

* Debug template test

* Try to fix templates again and make steps more reliable

* Cleanup

* Feedback
This commit is contained in:
Nate McMaster 2019-06-19 10:03:38 -07:00 committed by John Luo
parent 730c3e0053
commit 4fde84a7ad
110 changed files with 1371 additions and 1335 deletions

View File

@ -25,7 +25,7 @@ variables:
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- name: _BuildArgs - name: _BuildArgs
value: /p:TeamName=$(_TeamName) value: /p:TeamName=$(_TeamName)
/p:OfficialBuildId=$(Build.BuildNumber) /p:OfficialBuildId=$(Build.BuildNumber)
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- name: _BuildArgs - name: _BuildArgs
value: '' value: ''
@ -58,10 +58,12 @@ jobs:
# if they have already been signed. This results in slower builds due to re-submitting the same .nupkg many times for signing. # if they have already been signed. This results in slower builds due to re-submitting the same .nupkg many times for signing.
# The sign settings have been configured to # The sign settings have been configured to
- script: ./eng/scripts/cibuild.cmd - script: ./build.cmd
-ci
-arch x64 -arch x64
-BuildNative -pack
/p:DisableCodeSigning=true -all
-buildNative
/bl:artifacts/log/build.x64.binlog /bl:artifacts/log/build.x64.binlog
$(_BuildArgs) $(_BuildArgs)
displayName: Build x64 displayName: Build x64
@ -69,64 +71,49 @@ jobs:
# This is going to actually build x86 native assets. See https://github.com/aspnet/AspNetCore/issues/7196 # This is going to actually build x86 native assets. See https://github.com/aspnet/AspNetCore/issues/7196
# Build the x86 shared framework # Build the x86 shared framework
# Set DisableSignCheck because we'll run sign check in an explicit step after installers build - script: ./build.cmd
- script: ./eng/scripts/cibuild.cmd -ci
-arch x86 -arch x86
-NoRestore -pack
-BuildNative -all
/t:BuildSharedFx -buildNative
-noBuildJava
/p:OnlyPackPlatformSpecificPackages=true /p:OnlyPackPlatformSpecificPackages=true
/p:DisableCodeSigning=true
/bl:artifacts/log/build.x86.binlog /bl:artifacts/log/build.x86.binlog
$(_BuildArgs) $(_BuildArgs)
displayName: Build x86 displayName: Build x86
# This is in a separate build step with -forceCoreMsbuild to workaround MAX_PATH limitations - https://github.com/Microsoft/msbuild/issues/53 # This is in a separate build step with -forceCoreMsbuild to workaround MAX_PATH limitations - https://github.com/Microsoft/msbuild/issues/53
- script: ./build.cmd # TODO: need to figure out how to make site extensions build with Arcade. See https://github.com/aspnet/AspNetCore/issues/11186
-ci # - script: ./build.cmd
-sign # -ci
-forceCoreMsbuild # -pack
/p:DisableCodeSigning=true # -forceCoreMsbuild
-projects ./src/SiteExtensions/LoggingAggregate/src/Microsoft.AspNetCore.AzureAppServices.SiteExtension/Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj # -noBuildDeps
$(_BuildArgs) # /p:BuildSiteExtensions=true
displayName: Build SiteExtension # $(_BuildArgs)
# displayName: Build SiteExtension
# Remove all task build output
- script: rmdir /s /q build\tasks\bin
displayName: Clear task build output
# This runs code-signing on all packages, zips, and jar files as defined in build/CodeSign.targets. If https://github.com/dotnet/arcade/issues/1957 is resolved, # This runs code-signing on all packages, zips, and jar files as defined in build/CodeSign.targets. If https://github.com/dotnet/arcade/issues/1957 is resolved,
# consider running code-signing inline with the other previous steps. # consider running code-signing inline with the other previous steps.
# Sign check is disabled because it is run in a separate step below, after installers are built. # Sign check is disabled because it is run in a separate step below, after installers are built.
- script: ./build.cmd - script: ./build.cmd
-ci -ci
-noBuild
-noRestore
-sign -sign
-NoRestore
/t:CodeSign
/p:SignType=$(_SignType)
/p:DisableSignCheck=true
/bl:artifacts/log/build.codesign.binlog /bl:artifacts/log/build.codesign.binlog
$(_BuildArgs) $(_BuildArgs)
displayName: Code sign packages displayName: Code sign packages
# Windows installers bundle both x86 and x64 assets # Windows installers bundle both x86 and x64 assets
- powershell: ./src/Installers/Windows/build.ps1
-ci
/p:SignType=$(_SignType)
$(_BuildArgs)
displayName: Build Installers
# Run sign check to verify everything was code signed.
- script: ./build.cmd - script: ./build.cmd
-ci -ci
-sign -sign
-NoRestore -buildInstallers
/t:SignCheck /bl:artifacts/log/installers.msbuild.binlog
/p:SignType=$(_SignType) $(_BuildArgs)
/bl:artifacts/log/build.signcheck.binlog displayName: Build Installers
$(_BuildArgs)
displayName: Run sign check
condition: and(succeeded(), eq(variables['_SignType'], 'real'))
artifacts: artifacts:
- name: Windows_Logs - name: Windows_Logs
@ -150,12 +137,13 @@ jobs:
jobName: Windows_arm_build jobName: Windows_arm_build
jobDisplayName: "Build: Windows ARM" jobDisplayName: "Build: Windows ARM"
agentOs: Windows agentOs: Windows
buildScript: ./eng/scripts/cibuild.cmd buildArgs:
buildArgs: -arch arm -arch arm
-NoBuildNodeJS -sign
-NoBuildJava -pack
-noBuildNodeJS
-noBuildJava
/p:OnlyPackPlatformSpecificPackages=true /p:OnlyPackPlatformSpecificPackages=true
/p:SignType=$(_SignType)
/bl:artifacts/log/build.win-arm.binlog /bl:artifacts/log/build.win-arm.binlog
$(_BuildArgs) $(_BuildArgs)
installNodeJs: false installNodeJs: false
@ -177,8 +165,10 @@ jobs:
jobName: MacOs_x64_build jobName: MacOs_x64_build
jobDisplayName: "Build: macOS" jobDisplayName: "Build: macOS"
agentOs: macOs agentOs: macOs
buildScript: ./eng/scripts/cibuild.sh buildArgs:
buildArgs: --no-build-nodejs --pack
--all
--no-build-nodejs
--no-build-java --no-build-java
-p:OnlyPackPlatformSpecificPackages=true -p:OnlyPackPlatformSpecificPackages=true
-bl:artifacts/log/build.macos.binlog -bl:artifacts/log/build.macos.binlog
@ -206,24 +196,24 @@ jobs:
agentOs: Linux agentOs: Linux
installNodeJs: false installNodeJs: false
steps: steps:
- script: ./eng/scripts/cibuild.sh - script: ./build.sh
--ci
--arch x64 --arch x64
--pack
--all
--no-build-nodejs --no-build-nodejs
--no-build-java --no-build-java
-p:OnlyPackPlatformSpecificPackages=true -p:OnlyPackPlatformSpecificPackages=true
-bl:artifacts/log/build.linux-x64.binlog -bl:artifacts/log/build.linux-x64.binlog
$(_BuildArgs) $(_BuildArgs)
displayName: Run cibuild.sh displayName: Run build.sh
- script: | - script: |
rm -rf .dotnet/ git clean -xfd src/**/obj/
git clean -xfd src/
./dockerbuild.sh bionic \ ./dockerbuild.sh bionic \
--ci --pack --all --no-build-nodejs --no-build-java \ --ci \
--arch x64 \ --arch x64 \
-e KOREBUILD_SKIP_INSTALL_NETFX=0 \ --build-installers \
--no-restore \
--no-build-deps \ --no-build-deps \
-t:BuildSharedFx \
-p:OnlyPackPlatformSpecificPackages=true \ -p:OnlyPackPlatformSpecificPackages=true \
-p:BuildRuntimeArchive=false \ -p:BuildRuntimeArchive=false \
-p:LinuxInstallerType=deb \ -p:LinuxInstallerType=deb \
@ -231,15 +221,12 @@ jobs:
$(_BuildArgs) $(_BuildArgs)
displayName: Build Debian installers displayName: Build Debian installers
- script: | - script: |
rm -rf .dotnet/ git clean -xfd src/**/obj/
git clean -xfd src/
./dockerbuild.sh rhel \ ./dockerbuild.sh rhel \
--ci --pack --all --no-build-nodejs --no-build-java \ --ci \
--arch x64 \ --arch x64 \
-e KOREBUILD_SKIP_INSTALL_NETFX=0 \ --build-installers \
--no-restore \
--no-build-deps \ --no-build-deps \
-t:BuildSharedFx \
-p:OnlyPackPlatformSpecificPackages=true \ -p:OnlyPackPlatformSpecificPackages=true \
-p:BuildRuntimeArchive=false \ -p:BuildRuntimeArchive=false \
-p:LinuxInstallerType=rpm \ -p:LinuxInstallerType=rpm \
@ -266,8 +253,10 @@ jobs:
jobName: Linux_arm_build jobName: Linux_arm_build
jobDisplayName: "Build: Linux ARM" jobDisplayName: "Build: Linux ARM"
agentOs: Linux agentOs: Linux
buildScript: ./eng/scripts/cibuild.sh buildArgs:
buildArgs: --arch arm --arch arm
--pack
--all
--no-build-nodejs --no-build-nodejs
--no-build-java --no-build-java
-p:OnlyPackPlatformSpecificPackages=true -p:OnlyPackPlatformSpecificPackages=true
@ -294,8 +283,10 @@ jobs:
jobName: Linux_arm64_build jobName: Linux_arm64_build
jobDisplayName: "Build: Linux ARM64" jobDisplayName: "Build: Linux ARM64"
agentOs: Linux agentOs: Linux
buildScript: ./eng/scripts/cibuild.sh buildArgs:
buildArgs: --arch arm64 --arch arm64
--all
--pack
--no-build-nodejs --no-build-nodejs
--no-build-java --no-build-java
-p:OnlyPackPlatformSpecificPackages=true -p:OnlyPackPlatformSpecificPackages=true
@ -323,12 +314,12 @@ jobs:
jobDisplayName: "Build: Linux Musl x64" jobDisplayName: "Build: Linux Musl x64"
agentOs: Linux agentOs: Linux
buildScript: ./dockerbuild.sh alpine buildScript: ./dockerbuild.sh alpine
buildArgs: --ci buildArgs:
--pack --ci
--all
-e KOREBUILD_SKIP_INSTALL_NETFX=0
--arch x64 --arch x64
--os-name linux-musl --os-name linux-musl
--pack
--all
--no-build-nodejs --no-build-nodejs
--no-build-java --no-build-java
-p:OnlyPackPlatformSpecificPackages=true -p:OnlyPackPlatformSpecificPackages=true
@ -356,12 +347,12 @@ jobs:
jobDisplayName: "Build: Linux Musl ARM64" jobDisplayName: "Build: Linux Musl ARM64"
agentOs: Linux agentOs: Linux
buildScript: ./dockerbuild.sh ubuntu-alpine37 buildScript: ./dockerbuild.sh ubuntu-alpine37
buildArgs: --ci buildArgs:
--pack --ci
--all
-e KOREBUILD_SKIP_INSTALL_NETFX=0
--arch arm64 --arch arm64
--os-name linux-musl --os-name linux-musl
--pack
--all
--no-build-nodejs --no-build-nodejs
--no-build-java --no-build-java
-p:OnlyPackPlatformSpecificPackages=true -p:OnlyPackPlatformSpecificPackages=true
@ -390,8 +381,7 @@ jobs:
jobDisplayName: "Test: Windows Server 2016 x64" jobDisplayName: "Test: Windows Server 2016 x64"
agentOs: Windows agentOs: Windows
isTestingJob: true isTestingJob: true
buildScript: ./eng/scripts/cibuild.cmd buildArgs: -all -pack -test -BuildNative "/p:SkipIISNewHandlerTests=true /p:SkipIISTests=true /p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true /p:RunTemplateTests=false"
buildArgs: -test -BuildNative "/p:SkipIISNewHandlerTests=true /p:SkipIISTests=true /p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true /p:RunTemplateTests=false /p:BuildSiteExtensions=false"
beforeBuild: beforeBuild:
- powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1; & ./src/Servers/IIS/tools/update_schema.ps1" - powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1; & ./src/Servers/IIS/tools/update_schema.ps1"
displayName: Setup IISExpress test certificates and schema displayName: Setup IISExpress test certificates and schema
@ -403,6 +393,9 @@ jobs:
- name: Windows_Test_Logs - name: Windows_Test_Logs
path: artifacts/log/ path: artifacts/log/
publishOnError: true publishOnError: true
- name: Windows_Test_Results
path: artifacts/TestResults/
publishOnError: true
- template: jobs/default-build.yml - template: jobs/default-build.yml
parameters: parameters:
@ -411,15 +404,20 @@ jobs:
jobDisplayName: "Test: Templates - Windows Server 2016 x64" jobDisplayName: "Test: Templates - Windows Server 2016 x64"
agentOs: Windows agentOs: Windows
isTestingJob: true isTestingJob: true
buildScript: ./src/ProjectTemplates/build.cmd steps:
buildArgs: -ci -test -NoRestore -NoBuild -NoBuilddeps "/p:RunTemplateTests=true /p:BuildSiteExtensions=false" - script: ./build.cmd -ci -all -pack
beforeBuild:
- powershell: ./eng/scripts/cibuild.cmd
displayName: Build Repo displayName: Build Repo
- script: ./src/ProjectTemplates/build.cmd -ci -pack -NoRestore -NoBuilddeps "/p:RunTemplateTests=true /bl:artifacts/log/template.pack.binlog"
displayName: Pack Templates
- script: ./src/ProjectTemplates/build.cmd -ci -test -NoRestore -NoBuild -NoBuilddeps "/p:RunTemplateTests=true /bl:artifacts/log/template.test.binlog"
displayName: Test Templates
artifacts: artifacts:
- name: Windows_Test_Templates_Logs - name: Windows_Test_Templates_Logs
path: artifacts/log/ path: artifacts/log/
publishOnError: true publishOnError: true
- name: Windows_Test_Templates_Results
path: artifacts/TestResults/
publishOnError: true
- template: jobs/default-build.yml - template: jobs/default-build.yml
parameters: parameters:
@ -428,8 +426,7 @@ jobs:
jobDisplayName: "Test: macOS 10.13" jobDisplayName: "Test: macOS 10.13"
agentOs: macOs agentOs: macOs
isTestingJob: true isTestingJob: true
buildScript: ./eng/scripts/cibuild.sh buildArgs: --all --test "/p:RunTemplateTests=false"
buildArgs: --test
beforeBuild: beforeBuild:
- bash: "./eng/scripts/install-nginx-mac.sh" - bash: "./eng/scripts/install-nginx-mac.sh"
displayName: Installing Nginx displayName: Installing Nginx
@ -441,6 +438,9 @@ jobs:
- name: MacOS_Test_Logs - name: MacOS_Test_Logs
path: artifacts/log/ path: artifacts/log/
publishOnError: true publishOnError: true
- name: MacOS_Test_Results
path: artifacts/TestResults/
publishOnError: true
- template: jobs/default-build.yml - template: jobs/default-build.yml
parameters: parameters:
@ -449,8 +449,7 @@ jobs:
jobDisplayName: "Test: Ubuntu 16.04 x64" jobDisplayName: "Test: Ubuntu 16.04 x64"
agentOs: Linux agentOs: Linux
isTestingJob: true isTestingJob: true
buildScript: ./eng/scripts/cibuild.sh buildArgs: --all --test "/p:RunTemplateTests=false"
buildArgs: --test
beforeBuild: beforeBuild:
- bash: "./eng/scripts/install-nginx-linux.sh" - bash: "./eng/scripts/install-nginx-linux.sh"
displayName: Installing Nginx displayName: Installing Nginx
@ -464,3 +463,6 @@ jobs:
- name: Linux_Test_Logs - name: Linux_Test_Logs
path: artifacts/log/ path: artifacts/log/
publishOnError: true publishOnError: true
- name: Linux_Test_Results
path: artifacts/TestResults/
publishOnError: true

View File

@ -15,7 +15,9 @@ jobs:
agentOs: Windows agentOs: Windows
timeoutInMinutes: 240 timeoutInMinutes: 240
steps: steps:
- script: .\build.cmd -all -ci /p:BuildNative=true /t:Helix /p:IsHelixJob=true /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\SendToHelix.binlog - script: .\restore.cmd -ci
displayName: Restore
- script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsHelixJob=true /p:BuildAllProjects=true /p:BuildNative=true -bl
displayName: Run build.cmd helix target displayName: Run build.cmd helix target
env: env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops

View File

@ -113,7 +113,7 @@ jobs:
variables: variables:
AgentOsName: ${{ parameters.agentOs }} AgentOsName: ${{ parameters.agentOs }}
ASPNETCORE_TEST_LOG_MAXPATH: "200" # Keep test log file name length low enough for artifact zipping ASPNETCORE_TEST_LOG_MAXPATH: "200" # Keep test log file name length low enough for artifact zipping
DOTNET_HOME: $(Agent.BuildDirectory)/.dotnet DOTNET_HOME: $(Build.SourcesDirectory)/.dotnet
BuildScript: ${{ parameters.buildScript }} BuildScript: ${{ parameters.buildScript }}
BuildScriptArgs: ${{ parameters.buildArgs }} BuildScriptArgs: ${{ parameters.buildArgs }}
BuildConfiguration: ${{ parameters.configuration }} BuildConfiguration: ${{ parameters.configuration }}
@ -150,7 +150,7 @@ jobs:
displayName: Install JDK 11 displayName: Install JDK 11
- ${{ if eq(parameters.isTestingJob, true) }}: - ${{ if eq(parameters.isTestingJob, true) }}:
- powershell: | - powershell: |
Write-Host "##vso[task.setvariable variable=SeleniumProcessTrackingFolder]$(BuildDirectory)\obj\selenium\" Write-Host "##vso[task.setvariable variable=SeleniumProcessTrackingFolder]$(BuildDirectory)\artifacts\tmp\selenium\"
./eng/scripts/InstallGoogleChrome.ps1 ./eng/scripts/InstallGoogleChrome.ps1
displayName: Install Chrome displayName: Install Chrome
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.agentOs, 'Windows'), eq(parameters.codeSign, 'true')) }}: - ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.agentOs, 'Windows'), eq(parameters.codeSign, 'true')) }}:
@ -169,13 +169,13 @@ jobs:
- ${{ if eq(parameters.steps, '')}}: - ${{ if eq(parameters.steps, '')}}:
- ${{ if eq(parameters.buildScript, '') }}: - ${{ if eq(parameters.buildScript, '') }}:
- ${{ if eq(parameters.agentOs, 'Windows') }}: - ${{ if eq(parameters.agentOs, 'Windows') }}:
- script: .\$(BuildDirectory)\build.cmd -ci /p:SignType=$(_SignType) /p:Configuration=$(BuildConfiguration) $(BuildScriptArgs) - script: .\$(BuildDirectory)\build.cmd -ci /p:DotNetSignType=$(_SignType) -Configuration $(BuildConfiguration) $(BuildScriptArgs)
displayName: Run build.cmd displayName: Run build.cmd
- ${{ if ne(parameters.agentOs, 'Windows') }}: - ${{ if ne(parameters.agentOs, 'Windows') }}:
- script: ./$(BuildDirectory)/build.sh -ci -p:Configuration=$(BuildConfiguration) $(BuildScriptArgs) - script: ./$(BuildDirectory)/build.sh -ci -configuration $(BuildConfiguration) $(BuildScriptArgs)
displayName: Run build.sh displayName: Run build.sh
- ${{ if ne(parameters.buildScript, '') }}: - ${{ if ne(parameters.buildScript, '') }}:
- script: $(BuildScript) /p:Configuration=$(BuildConfiguration) $(BuildScriptArgs) - script: $(BuildScript) -Configuration $(BuildConfiguration) $(BuildScriptArgs)
displayName: run $(BuildScript) displayName: run $(BuildScript)
- ${{ parameters.afterBuild }} - ${{ parameters.afterBuild }}
@ -208,33 +208,46 @@ jobs:
artifactType: Container artifactType: Container
parallel: true parallel: true
- task: PublishTestResults@2 - ${{ if eq(parameters.isTestingJob, true) }}:
displayName: Publish test results - task: PublishTestResults@2
condition: always() displayName: Publish test results
continueOnError: true condition: always()
inputs: continueOnError: true
testRunTitle: $(AgentOsName)-$(BuildConfiguration) inputs:
testRunner: vstest testRunTitle: $(AgentOsName)-$(BuildConfiguration)
testResultsFiles: '**/artifacts/**/*.trx' testRunner: vstest
mergeTestResults: true testResultsFiles: '**/artifacts/**/*.trx'
buildConfiguration: $(BuildConfiguration) mergeTestResults: true
buildPlatform: $(AgentOsName) buildConfiguration: $(BuildConfiguration)
- task: PublishTestResults@2 buildPlatform: $(AgentOsName)
displayName: Publish js test results - task: PublishTestResults@2
condition: always() displayName: Publish test results
inputs: condition: always()
testRunner: junit continueOnError: true
testResultsFiles: '**/artifacts/log/**/*.junit.xml' inputs:
buildConfiguration: $(BuildConfiguration) testRunTitle: $(AgentOsName)-$(BuildConfiguration)
buildPlatform: $(AgentOsName) testRunner: xunit
- task: PublishTestResults@2 testResultsFiles: '**/artifacts/TestResults/**/*.xml'
displayName: Publish Java test results mergeTestResults: true
condition: always() buildConfiguration: $(BuildConfiguration)
inputs: buildPlatform: $(AgentOsName)
testRunner: junit - task: PublishTestResults@2
testResultsFiles: '**/TEST-com.microsoft.signalr*.xml' displayName: Publish js test results
buildConfiguration: $(BuildConfiguration) condition: always()
buildPlatform: $(AgentOsName) inputs:
testRunner: junit
testResultsFiles: '**/artifacts/log/**/*.junit.xml'
buildConfiguration: $(BuildConfiguration)
buildPlatform: $(AgentOsName)
- task: PublishTestResults@2
displayName: Publish Java test results
condition: always()
inputs:
testRunner: junit
testResultsFiles: '**/TEST-com.microsoft.signalr*.xml'
buildConfiguration: $(BuildConfiguration)
buildPlatform: $(AgentOsName)
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.agentOs, 'Windows')) }}: - ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.agentOs, 'Windows')) }}:
- task: MicroBuildCleanup@1 - task: MicroBuildCleanup@1

View File

@ -1,4 +1,9 @@
<Project> <Project>
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<RepositoryUrl>https://github.com/aspnet/AspNetCore</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
<!-- Defines project type conventions. --> <!-- Defines project type conventions. -->
<PropertyGroup> <PropertyGroup>
@ -18,10 +23,11 @@
<IsShipping Condition="'$(IsSampleProject)' == 'true' or '$(IsTestAssetProject)' == 'true' or '$(IsBenchmarkProject)' == 'true' or '$(IsUnitTestProject)' == 'true'">false</IsShipping> <IsShipping Condition="'$(IsSampleProject)' == 'true' or '$(IsTestAssetProject)' == 'true' or '$(IsBenchmarkProject)' == 'true' or '$(IsUnitTestProject)' == 'true'">false</IsShipping>
</PropertyGroup> </PropertyGroup>
<Import Project="eng\FlakyTests.BeforeArcade.props" />
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" /> <Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="eng\FlakyTests.AfterArcade.props" />
<PropertyGroup> <PropertyGroup>
<Product>Microsoft ASP.NET Core</Product> <Product>Microsoft ASP.NET Core</Product>
<StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId> <StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>
@ -51,16 +57,13 @@
<!-- Source code settings --> <!-- Source code settings -->
<PropertyGroup> <PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<RepositoryUrl>https://github.com/aspnet/AspNetCore</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<SharedSourceRoot>$(MSBuildThisFileDirectory)src\Shared\</SharedSourceRoot> <SharedSourceRoot>$(MSBuildThisFileDirectory)src\Shared\</SharedSourceRoot>
<GoogleTestSubmoduleRoot>$(RepoRoot)src\submodules\googletest\</GoogleTestSubmoduleRoot> <GoogleTestSubmoduleRoot>$(RepoRoot)src\submodules\googletest\</GoogleTestSubmoduleRoot>
<!-- Embed source files that are not tracked by the source control manager in the PDB. --> <!-- Embed source files that are not tracked by the source control manager in the PDB. -->
<EmbedUntrackedSources>true</EmbedUntrackedSources> <EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- These project types are disabled because the presence of a PackageReference causes issues for NuGet. --> <!-- Disable source link on local builds for faster local builds. -->
<DisableSourceLink Condition="'$(MSBuildProjectExtension)' == '.debproj' OR '$(MSBuildProjectExtension)' == '.rpmproj'">true</DisableSourceLink> <EnableSourceLink Condition="'$(ContinuousIntegrationBuild)' != 'true' and '$(OfficialBuildId)' == ''">false</EnableSourceLink>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
@ -133,10 +136,9 @@
<NetCoreTargetingPackRoot>$(LocalDotNetRoot)packs\</NetCoreTargetingPackRoot> <NetCoreTargetingPackRoot>$(LocalDotNetRoot)packs\</NetCoreTargetingPackRoot>
</PropertyGroup> </PropertyGroup>
<Import Project="build\tasks\RepoTasks.tasks" Condition="'$(MSBuildProjectName)' != 'RepoTasks' AND '$(DesignTimeBuild)' != 'true'" /> <Import Project="eng\tools\RepoTasks\RepoTasks.tasks" Condition="'$(MSBuildProjectName)' != 'RepoTasks' AND '$(DesignTimeBuild)' != 'true'" />
<PropertyGroup> <PropertyGroup>
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
<!-- <!--
Disable deterministic source paths in test assets and samples. Disable deterministic source paths in test assets and samples.
In order for the debugger to find source files when debugging a locally built binary the PDB must contain original, unmapped local paths In order for the debugger to find source files when debugging a locally built binary the PDB must contain original, unmapped local paths

341
build.ps1
View File

@ -24,6 +24,9 @@ Suppress re-compile projects. (Implies -NoRestore)
.PARAMETER NoBuildDeps .PARAMETER NoBuildDeps
Do not build project-to-project references and only build the specified project. Do not build project-to-project references and only build the specified project.
.PARAMETER NoBuildRepoTasks
Skip building eng/tools/RepoTasks/
.PARAMETER Pack .PARAMETER Pack
Produce packages. Produce packages.
@ -33,6 +36,9 @@ Run tests.
.PARAMETER Sign .PARAMETER Sign
Run code signing. Run code signing.
.PARAMETER Configuration
Debug or Release
.PARAMETER Architecture .PARAMETER Architecture
The CPU architecture to build for (x64, x86, arm). Default=x64 The CPU architecture to build for (x64, x86, arm). Default=x64
@ -62,6 +68,12 @@ You can also use -NoBuildJava to suppress this project type.
Build Windows Installers. Required .NET 3.5 to be installed (WiX toolset requirement). Build Windows Installers. Required .NET 3.5 to be installed (WiX toolset requirement).
You can also use -NoBuildInstallers to suppress this project type. You can also use -NoBuildInstallers to suppress this project type.
.PARAMETER BinaryLog
Enable the binary logger
.PARAMETER Verbosity
MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]
.PARAMETER MSBuildArguments .PARAMETER MSBuildArguments
Additional MSBuild arguments to be passed through. Additional MSBuild arguments to be passed through.
@ -73,7 +85,7 @@ Building both native and managed projects.
.EXAMPLE .EXAMPLE
Building a subfolder of code. Building a subfolder of code.
build.ps1 "$(pwd)/src/SomeFolder/**/*.csproj" build.ps1 -projects "$(pwd)/src/SomeFolder/**/*.csproj"
.EXAMPLE .EXAMPLE
Running tests. Running tests.
@ -96,6 +108,10 @@ param(
[switch]$Test, # Run tests [switch]$Test, # Run tests
[switch]$Sign, # Code sign [switch]$Sign, # Code sign
[Alias('c')]
[ValidateSet('Debug', 'Release')]
$Configuration,
[ValidateSet('x64', 'x86', 'arm')] [ValidateSet('x64', 'x86', 'arm')]
$Architecture = 'x64', $Architecture = 'x64',
@ -119,12 +135,18 @@ param(
[switch]$NoBuildJava, [switch]$NoBuildJava,
[switch]$NoBuildInstallers, [switch]$NoBuildInstallers,
[switch]$NoBuildRepoTasks,
# By default, Windows builds will use MSBuild.exe. Passing this will force the build to run on # By default, Windows builds will use MSBuild.exe. Passing this will force the build to run on
# dotnet.exe instead, which may cause issues if you invoke build on a project unsupported by # dotnet.exe instead, which may cause issues if you invoke build on a project unsupported by
# MSBuild for .NET Core # MSBuild for .NET Core
[switch]$ForceCoreMsbuild, [switch]$ForceCoreMsbuild,
# Diagnostics # Diagnostics
[Alias('bl')]
[switch]$BinaryLog,
[Alias('v')]
[string]$Verbosity = 'minimal',
[switch]$DumpProcesses, # Capture all running processes and dump them to a file. [switch]$DumpProcesses, # Capture all running processes and dump them to a file.
# Other lifecycle targets # Other lifecycle targets
@ -138,122 +160,16 @@ param(
Set-StrictMode -Version 2 Set-StrictMode -Version 2
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
#
# Functions
#
function Get-KoreBuild {
if (!(Test-Path $LockFile)) {
Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $LockFile
}
$version = Get-Content $LockFile | Where-Object { $_ -like 'version:*' } | Select-Object -first 1
if (!$version) {
Write-Error "Failed to parse version from $LockFile. Expected a line that begins with 'version:'"
}
$version = $version.TrimStart('version:').Trim()
$korebuildPath = Join-Paths $DotNetHome ('buildtools', 'korebuild', $version)
if (!(Test-Path $korebuildPath)) {
Write-Host -ForegroundColor Magenta "Downloading KoreBuild $version"
New-Item -ItemType Directory -Path $korebuildPath | Out-Null
$remotePath = "$ToolsSource/korebuild/artifacts/$version/korebuild.$version.zip"
try {
$tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip"
Get-RemoteFile $remotePath $tmpfile
if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) {
# Use built-in commands where possible as they are cross-plat compatible
Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath
}
else {
# Fallback to old approach for old installations of PowerShell
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($tmpfile, $korebuildPath)
}
}
catch {
Remove-Item -Recurse -Force $korebuildPath -ErrorAction Ignore
throw
}
finally {
Remove-Item $tmpfile -ErrorAction Ignore
}
}
return $korebuildPath
}
function Join-Paths([string]$path, [string[]]$childPaths) {
$childPaths | ForEach-Object { $path = Join-Path $path $_ }
return $path
}
function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) {
if ($RemotePath -notlike 'http*') {
Copy-Item $RemotePath $LocalPath
return
}
$retries = 10
while ($retries -gt 0) {
$retries -= 1
try {
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath
return
}
catch {
Write-Verbose "Request failed. $retries retries remaining"
}
}
Write-Error "Download failed: '$RemotePath'."
}
#
# Main
#
# Load configuration or set defaults
if ($Help) { if ($Help) {
Get-Help $PSCommandPath Get-Help $PSCommandPath
exit 1 exit 1
} }
$Channel = 'master' if ($DumpProcesses -or $CI) {
$ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools'
$ConfigFile = Join-Path $PSScriptRoot 'korebuild.json'
$LockFile = Join-Path $PSScriptRoot 'korebuild-lock.txt'
if (Test-Path $ConfigFile) {
try {
$config = Get-Content -Raw -Encoding UTF8 -Path $ConfigFile | ConvertFrom-Json
if ($config) {
if (Get-Member -Name 'channel' -InputObject $config) { [string] $Channel = $config.channel }
if (Get-Member -Name 'toolsSource' -InputObject $config) { [string] $ToolsSource = $config.toolsSource}
}
} catch {
Write-Warning "$ConfigFile could not be read. Its settings will be ignored."
Write-Warning $Error[0]
}
}
$DotNetHome = Join-Path $PSScriptRoot '.dotnet'
$env:DOTNET_HOME = $DotNetHome
# Execute
if ($DumpProcesses -or $CI)
{
# Dump running processes # Dump running processes
Start-Job -Name DumpProcesses -FilePath $PSScriptRoot\eng\scripts\dump_process.ps1 -ArgumentList $PSScriptRoot Start-Job -Name DumpProcesses -FilePath $PSScriptRoot\eng\scripts\dump_process.ps1 -ArgumentList $PSScriptRoot
} }
$korebuildPath = Get-KoreBuild
# Project selection # Project selection
if ($All) { if ($All) {
$MSBuildArguments += '/p:BuildAllProjects=true' $MSBuildArguments += '/p:BuildAllProjects=true'
@ -263,7 +179,7 @@ elseif ($Projects) {
{ {
$Projects = Join-Path (Get-Location) $Projects $Projects = Join-Path (Get-Location) $Projects
} }
$MSBuildArguments += "/p:Projects=$Projects" $MSBuildArguments += "/p:ProjectToBuild=$Projects"
} }
# When adding new sub-group build flags, add them to this check. # When adding new sub-group build flags, add them to this check.
elseif((-not $BuildNative) -and (-not $BuildManaged) -and (-not $BuildNodeJS) -and (-not $BuildInstallers) -and (-not $BuildJava)) { elseif((-not $BuildNative) -and (-not $BuildManaged) -and (-not $BuildNodeJS) -and (-not $BuildInstallers) -and (-not $BuildJava)) {
@ -299,98 +215,167 @@ $RunRestore = if ($NoRestore) { $false }
else { $true } else { $true }
# Target selection # Target selection
if ($RunRestore) { $MSBuildArguments += "/p:Restore=$RunRestore"
$MSBuildArguments += "/restore" $MSBuildArguments += "/p:Build=$RunBuild"
if (-not $RunBuild) {
$MSBuildArguments += "/p:NoBuild=true"
} }
$MSBuildArguments += "/p:Pack=$Pack"
$MSBuildArguments += "/p:_RunBuild=$RunBuild" $MSBuildArguments += "/p:Test=$Test"
$MSBuildArguments += "/p:_RunPack=$Pack" $MSBuildArguments += "/p:Sign=$Sign"
$MSBuildArguments += "/p:_RunTests=$Test"
$MSBuildArguments += "/p:_RunSign=$Sign"
$MSBuildArguments += "/p:TargetArchitecture=$Architecture" $MSBuildArguments += "/p:TargetArchitecture=$Architecture"
$MSBuildArguments += "/p:TargetOsName=win" $MSBuildArguments += "/p:TargetOsName=win"
if ($RunBuild -and ($All -or $BuildJava) -and -not $NoBuildJava) { if (-not $Configuration) {
$foundJdk = $false $Configuration = if ($CI) { 'Release' } else { 'Debug' }
$javac = Get-Command javac -ErrorAction Ignore -CommandType Application }
$localJdkPath = "$PSScriptRoot\.tools\jdk\win-x64\" $MSBuildArguments += "/p:Configuration=$Configuration"
if (Test-Path "$localJdkPath\bin\javac.exe") {
$foundJdk = $true $foundJdk = $false
Write-Host -f Magenta "Detected JDK in $localJdkPath (via local repo convention)" $javac = Get-Command javac -ErrorAction Ignore -CommandType Application
$env:JAVA_HOME = $localJdkPath $localJdkPath = "$PSScriptRoot\.tools\jdk\win-x64\"
} if (Test-Path "$localJdkPath\bin\javac.exe") {
elseif ($env:JAVA_HOME) { $foundJdk = $true
if (-not (Test-Path "${env:JAVA_HOME}\bin\javac.exe")) { Write-Host -f Magenta "Detected JDK in $localJdkPath (via local repo convention)"
Write-Error "The environment variable JAVA_HOME was set, but ${env:JAVA_HOME}\bin\javac.exe does not exist. Remove JAVA_HOME or update it to the correct location for the JDK. See https://www.bing.com/search?q=java_home for details." $env:JAVA_HOME = $localJdkPath
} }
else { elseif ($env:JAVA_HOME) {
Write-Host -f Magenta "Detected JDK in ${env:JAVA_HOME} (via JAVA_HOME)" if (-not (Test-Path "${env:JAVA_HOME}\bin\javac.exe")) {
$foundJdk = $true Write-Error "The environment variable JAVA_HOME was set, but ${env:JAVA_HOME}\bin\javac.exe does not exist. Remove JAVA_HOME or update it to the correct location for the JDK. See https://www.bing.com/search?q=java_home for details."
}
}
elseif ($javac) {
$foundJdk = $true
$javaHome = Split-Path -Parent (Split-Path -Parent $javac.Path)
$env:JAVA_HOME = $javaHome
Write-Host -f Magenta "Detected JDK in $javaHome (via PATH)"
} }
else { else {
try { Write-Host -f Magenta "Detected JDK in ${env:JAVA_HOME} (via JAVA_HOME)"
$jdkRegistryKeys = @( $foundJdk = $true
"HKLM:\SOFTWARE\JavaSoft\JDK", # for JDK 10+ }
"HKLM:\SOFTWARE\JavaSoft\Java Development Kit" # fallback for JDK 8 }
) elseif ($javac) {
$jdkRegistryKey = $jdkRegistryKeys | Where-Object { Test-Path $_ } | Select-Object -First 1 $foundJdk = $true
if ($jdkRegistryKey) { $javaHome = Split-Path -Parent (Split-Path -Parent $javac.Path)
$jdkVersion = (Get-Item $jdkRegistryKey | Get-ItemProperty -name CurrentVersion).CurrentVersion $env:JAVA_HOME = $javaHome
$javaHome = (Get-Item $jdkRegistryKey\$jdkVersion | Get-ItemProperty -Name JavaHome).JavaHome Write-Host -f Magenta "Detected JDK in $javaHome (via PATH)"
if (Test-Path "${javaHome}\bin\javac.exe") { }
$env:JAVA_HOME = $javaHome else {
Write-Host -f Magenta "Detected JDK $jdkVersion in $env:JAVA_HOME (via registry)" try {
$foundJdk = $true $jdkRegistryKeys = @(
} "HKLM:\SOFTWARE\JavaSoft\JDK", # for JDK 10+
"HKLM:\SOFTWARE\JavaSoft\Java Development Kit" # fallback for JDK 8
)
$jdkRegistryKey = $jdkRegistryKeys | Where-Object { Test-Path $_ } | Select-Object -First 1
if ($jdkRegistryKey) {
$jdkVersion = (Get-Item $jdkRegistryKey | Get-ItemProperty -name CurrentVersion).CurrentVersion
$javaHome = (Get-Item $jdkRegistryKey\$jdkVersion | Get-ItemProperty -Name JavaHome).JavaHome
if (Test-Path "${javaHome}\bin\javac.exe") {
$env:JAVA_HOME = $javaHome
Write-Host -f Magenta "Detected JDK $jdkVersion in $env:JAVA_HOME (via registry)"
$foundJdk = $true
} }
} }
catch {
Write-Verbose "Failed to detect Java: $_"
}
} }
catch {
if ($env:PATH -notlike "*${env:JAVA_HOME}*") { Write-Verbose "Failed to detect Java: $_"
$env:PATH = "$(Join-Path $env:JAVA_HOME bin);${env:PATH}"
}
if (-not $foundJdk) {
Write-Error "Could not find the JDK. Either run $PSScriptRoot\eng\scripts\InstallJdk.ps1 to install for this repo, or install the JDK globally on your machine (see $PSScriptRoot\docs\BuildFromSource.md for details)."
} }
} }
Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1') if ($env:PATH -notlike "*${env:JAVA_HOME}*") {
$env:PATH = "$(Join-Path $env:JAVA_HOME bin);${env:PATH}"
}
if (-not $foundJdk -and $RunBuild -and ($All -or $BuildJava) -and -not $NoBuildJava) {
Write-Error "Could not find the JDK. Either run $PSScriptRoot\eng\scripts\InstallJdk.ps1 to install for this repo, or install the JDK globally on your machine (see $PSScriptRoot\docs\BuildFromSource.md for details)."
}
# Initialize global variables need to be set before the import of Arcade is imported
$restore = $RunRestore
# Disable node reuse - Workaround perpetual issues in node reuse and custom task assemblies
$nodeReuse = $false
$env:MSBUILDDISABLENODEREUSE=1
# Our build often has warnings that we can't fix, like "MSB3026: Could not copy" due to race
# conditions in building C++
# Fixing this is tracked by https://github.com/aspnet/AspNetCore-Internal/issues/601
$warnAsError = $false
if ($ForceCoreMsbuild) {
$msbuildEngine = 'dotnet'
}
# Workaround Arcade check which asserts BinaryLog is true on CI.
# We always use binlogs on CI, but we customize the name of the log file
$tmpBinaryLog = $BinaryLog
if ($CI) {
$BinaryLog = $true
}
# tools.ps1 corrupts global state, so reset these values in case they carried over from a previous build
rm variable:global:_BuildTool -ea Ignore
rm variable:global:_DotNetInstallDir -ea Ignore
rm variable:global:_ToolsetBuildProj -ea Ignore
rm variable:global:_MSBuildExe -ea Ignore
# Import Arcade
. "$PSScriptRoot/eng/common/tools.ps1"
if ($tmpBinaryLog) {
$MSBuildArguments += "/bl:$LogDir/Build.binlog"
}
# Capture MSBuild crash logs
$env:MSBUILDDEBUGPATH = $LogDir
try { try {
$env:KOREBUILD_KEEPGLOBALJSON = 1 # Import custom tools configuration, if present in the repo.
$env:KOREBUILD_DISABLE_DOTNET_ARCH = 1 # Note: Import in global scope so that the script set top-level variables without qualification.
Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $PSScriptRoot -ConfigFile $ConfigFile -CI:$CI $configureToolsetScript = Join-Path $EngRoot "configure-toolset.ps1"
if ($ForceCoreMsbuild) { if (Test-Path $configureToolsetScript) {
$global:KoreBuildSettings.MSBuildType = 'core' . $configureToolsetScript
} }
Invoke-KoreBuildCommand 'default-build' @MSBuildArguments
# Set this global property so Arcade will always initialize the toolset. The error message you get when you build on a clean machine
# with -norestore is not obvious about what to do to fix it. As initialization takes very little time, we think always initializing
# the toolset is a better default behavior.
$tmpRestore = $restore
$restore = $true
$toolsetBuildProj = InitializeToolset
$restore = $tmpRestore
if (-not $NoBuildRepoTasks) {
MSBuild $toolsetBuildProj `
/p:RepoRoot=$RepoRoot `
/p:Projects=$EngRoot\tools\RepoTasks\RepoTasks.csproj `
/p:Configuration=Release `
/p:Restore=$RunRestore `
/p:Build=true `
/clp:NoSummary
}
MSBuild $toolsetBuildProj `
/p:RepoRoot=$RepoRoot `
@MSBuildArguments
}
catch {
Write-Host $_.ScriptStackTrace
Write-PipelineTaskError -Message $_
ExitWithExitCode 1
} }
finally { finally {
Remove-Module 'KoreBuild' -ErrorAction Ignore # tools.ps1 corrupts global state, so reset these values so they don't carry between invocations of build.ps1
Remove-Item env:DOTNET_HOME rm variable:global:_BuildTool -ea Ignore
Remove-Item env:KOREBUILD_KEEPGLOBALJSON rm variable:global:_DotNetInstallDir -ea Ignore
rm variable:global:_ToolsetBuildProj -ea Ignore
rm variable:global:_MSBuildExe -ea Ignore
if ($DumpProcesses -or $CI) if ($DumpProcesses -or $ci) {
{
Stop-Job -Name DumpProcesses Stop-Job -Name DumpProcesses
Remove-Job -Name DumpProcesses Remove-Job -Name DumpProcesses
} }
if ($CI) { if ($ci) {
& "$PSScriptRoot/eng/scripts/KillProcesses.ps1" & "$PSScriptRoot/eng/scripts/KillProcesses.ps1"
} }
Write-Host "build.ps1 completed"
} }
ExitWithExitCode 0

321
build.sh
View File

@ -9,29 +9,26 @@ set -euo pipefail
RESET="\033[0m" RESET="\033[0m"
RED="\033[0;31m" RED="\033[0;31m"
YELLOW="\033[0;33m" YELLOW="\033[0;33m"
MAGENTA="\033[0;95m"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
verbose=false
update=false
reinstall=false
lockfile_path="$DIR/korebuild-lock.txt"
config_file="$DIR/korebuild.json"
channel='master'
tools_source='https://aspnetcore.blob.core.windows.net/buildtools'
target_os_name='' target_os_name=''
ci=false ci=false
use_default_binary_log=false
verbosity='minimal'
run_restore='' run_restore=''
run_build=true run_build=true
run_pack=false run_pack=false
run_tests=false run_tests=false
build_all=false build_all=false
build_deps=true build_deps=true
build_repo_tasks=true
build_managed='' build_managed=''
build_native='' build_native=''
build_nodejs='' build_nodejs=''
build_java='' build_java=''
build_installers=''
build_projects='' build_projects=''
target_arch='x64' target_arch='x64'
configuration=''
if [ "$(uname)" = "Darwin" ]; then if [ "$(uname)" = "Darwin" ]; then
target_os_name='osx' target_os_name='osx'
@ -48,29 +45,33 @@ __usage() {
echo "Usage: $(basename "${BASH_SOURCE[0]}") [options] [[--] <Arguments>...] echo "Usage: $(basename "${BASH_SOURCE[0]}") [options] [[--] <Arguments>...]
Arguments: Arguments:
<Arguments>... Arguments passed to the command. Variable number of arguments allowed. <Arguments>... Arguments passed to the command. Variable number of arguments allowed.
Options: Options:
--arch The CPU architecture to build for (x64, arm, arm64). Default=$target_arch --configuration|-c The build configuration (Debug, Release). Default=Debug
--os-name The base runtime identifier to build for (linux, osx, linux-musl). Default=$target_os_name --arch The CPU architecture to build for (x64, arm, arm64). Default=$target_arch
--os-name The base runtime identifier to build for (linux, osx, linux-musl). Default=$target_os_name
--[no-]restore Run restore. --[no-]restore Run restore.
--[no-]build Compile projects. (Implies --no-restore) --[no-]build Compile projects. (Implies --no-restore)
--[no-]pack Produce packages. --[no-]pack Produce packages.
--[no-]test Run tests. --[no-]test Run tests.
--projects A list of projects to build. (Must be an absolute path.) --projects A list of projects to build. (Must be an absolute path.)
Globbing patterns are supported, such as \"$(pwd)/**/*.csproj\". Globbing patterns are supported, such as \"$(pwd)/**/*.csproj\".
--no-build-deps Do not build project-to-project references and only build the specified project. --no-build-deps Do not build project-to-project references and only build the specified project.
--no-build-repo-tasks Suppress building RepoTasks.
--all Build all project types. --all Build all project types.
--[no-]build-native Build native projects (C, C++). --[no-]build-native Build native projects (C, C++).
--[no-]build-managed Build managed projects (C#, F#, VB). --[no-]build-managed Build managed projects (C#, F#, VB).
--[no-]build-nodejs Build NodeJS projects (TypeScript, JS). --[no-]build-nodejs Build NodeJS projects (TypeScript, JS).
--[no-]build-java Build Java projects. --[no-]build-java Build Java projects.
--[no-]build-installers Build Java projects.
--ci Apply CI specific settings and environment variables. --ci Apply CI specific settings and environment variables.
--verbose Show verbose output. --binarylog|-bl Use a binary logger
--verbosity|-v MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]
Description: Description:
This build script installs required tools and runs an MSBuild command on this repository This build script installs required tools and runs an MSBuild command on this repository
@ -83,41 +84,6 @@ Description:
fi fi
} }
get_korebuild() {
local version
if [ ! -f "$lockfile_path" ]; then
__get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lockfile_path"
fi
version="$(grep 'version:*' -m 1 "$lockfile_path")"
if [[ "$version" == '' ]]; then
__error "Failed to parse version from $lockfile_path. Expected a line that begins with 'version:'"
return 1
fi
version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version"
{
if [ ! -d "$korebuild_path" ]; then
mkdir -p "$korebuild_path"
local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip"
tmpfile="$(mktemp)"
echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}"
if __get_remote_file "$remote_path" "$tmpfile"; then
unzip -q -d "$korebuild_path" "$tmpfile"
fi
rm "$tmpfile" || true
fi
source "$korebuild_path/KoreBuild.sh"
} || {
if [ -d "$korebuild_path" ]; then
echo "Cleaning up after failed installation"
rm -rf "$korebuild_path" || true
fi
return 1
}
}
__error() { __error() {
echo -e "${RED}error: $*${RESET}" 1>&2 echo -e "${RED}error: $*${RESET}" 1>&2
} }
@ -126,124 +92,112 @@ __warn() {
echo -e "${YELLOW}warning: $*${RESET}" echo -e "${YELLOW}warning: $*${RESET}"
} }
__machine_has() {
hash "$1" > /dev/null 2>&1
return $?
}
__get_remote_file() {
local remote_path=$1
local local_path=$2
if [[ "$remote_path" != 'http'* ]]; then
cp "$remote_path" "$local_path"
return 0
fi
local failed=false
if __machine_has wget; then
wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true
else
failed=true
fi
if [ "$failed" = true ] && __machine_has curl; then
failed=false
curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true
fi
if [ "$failed" = true ]; then
__error "Download failed: $remote_path" 1>&2
return 1
fi
}
# #
# main # main
# #
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
-\?|-h|--help) case "$opt" in
-\?|-h|-help)
__usage --no-exit __usage --no-exit
exit 0 exit 0
;; ;;
--arch) -configuration|-c)
shift
configuration="${1:-}"
[ -z "$configuration" ] && __error "Missing value for parameter --configuration" && __usage
;;
-arch)
shift shift
target_arch="${1:-}" target_arch="${1:-}"
[ -z "$target_arch" ] && __error "Missing value for parameter --arch" && __usage [ -z "$target_arch" ] && __error "Missing value for parameter --arch" && __usage
;; ;;
--os-name) -os-name|-osname)
shift shift
target_os_name="${1:-}" target_os_name="${1:-}"
[ -z "$target_os_name" ] && __error "Missing value for parameter --os-name" && __usage [ -z "$target_os_name" ] && __error "Missing value for parameter --os-name" && __usage
;; ;;
--restore|-[Rr]estore) -restore|-r)
run_restore=true run_restore=true
;; ;;
--no-restore) -no-restore|-norestore)
run_restore=false run_restore=false
;; ;;
--build|-[Bb]build) -build|-b)
run_build=true run_build=true
;; ;;
--no-build) -no-build|-nobuild)
run_build=false run_build=false
# --no-build implies --no-restore # --no-build implies --no-restore
[ -z "$run_restore" ] && run_restore=false [ -z "$run_restore" ] && run_restore=false
;; ;;
--no-build-deps) -no-build-deps|-nobuilddeps)
build_deps=false build_deps=false
;; ;;
--pack|-[Pp]ack) -pack)
run_pack=true run_pack=true
;; ;;
--no-pack) -no-pack|-nopack)
run_pack=false run_pack=false
;; ;;
--test|-[Tt]est) -test|-t)
run_tests=true run_tests=true
;; ;;
--no-test) -no-test|-notest)
run_tests=false run_tests=false
;; ;;
--projects|-[Pp]rojects) -projects)
shift shift
build_projects="${1:-}" build_projects="${1:-}"
[ -z "$build_projects" ] && __error "Missing value for parameter --projects" && __usage [ -z "$build_projects" ] && __error "Missing value for parameter --projects" && __usage
;; ;;
--all|-[Aa]ll) -all)
build_all=true build_all=true
;; ;;
--build-managed|-BuildManaged) -build-managed|-buildmanaged)
build_managed=true build_managed=true
;; ;;
--no-build-managed|-NoBuildManaged) -no-build-managed|-nobuildmanaged)
build_managed=false build_managed=false
;; ;;
--build-nodejs|-BuildNodeJs) -build-nodejs|-buildnodejs)
build_nodejs=true build_nodejs=true
;; ;;
--no-build-nodejs|-NoBuildNodeJs) -no-build-nodejs|-nobuildnodejs)
build_nodejs=false build_nodejs=false
;; ;;
--build-java|-BuildJava) -build-java|-buildjava)
build_java=true build_java=true
;; ;;
--no-build-java|-NoBuildJava) -no-build-java|-nobuildjava)
build_java=false build_java=false
;; ;;
--build-native|-BuildNative) -build-native|-buildnative)
build_native=true build_native=true
;; ;;
--no-build-native|-NoBuildNative) -no-build-native|-nobuildnative)
build_native=false build_native=false
;; ;;
--ci|-[Cc][Ii]) -build-installers|-buildinstallers)
build_installers=true
;;
-no-build-installers|-nobuildinstallers)
build_installers=false
;;
-no-build-repo-tasks|-nobuildrepotasks)
build_repo_tasks=false
;;
-ci)
ci=true ci=true
;; ;;
--verbose|-[Vv]erbose) -binarylog|-bl)
verbose=true use_default_binary_log=true
;;
-verbosity|-v)
shift
[ -z "${1:-}" ] && __error "Missing value for parameter --verbosity" && __usage
verbosity="${1:-}"
;; ;;
*) *)
msbuild_args[${#msbuild_args[*]}]="$1" msbuild_args[${#msbuild_args[*]}]="$1"
@ -252,54 +206,14 @@ while [[ $# -gt 0 ]]; do
shift shift
done done
if ! __machine_has unzip; then
__error 'Missing required command: unzip'
exit 1
fi
if ! __machine_has curl && ! __machine_has wget; then
__error 'Missing required command. Either wget or curl is required.'
exit 1
fi
if [ -f "$config_file" ]; then
if __machine_has jq ; then
if jq '.' "$config_file" >/dev/null ; then
config_channel="$(jq -r 'select(.channel!=null) | .channel' "$config_file")"
config_tools_source="$(jq -r 'select(.toolsSource!=null) | .toolsSource' "$config_file")"
else
__error "$config_file is invalid JSON. Its settings will be ignored."
exit 1
fi
elif __machine_has python ; then
if python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'))" >/dev/null ; then
config_channel="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")"
config_tools_source="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")"
else
__error "$config_file is invalid JSON. Its settings will be ignored."
exit 1
fi
else
__error 'Missing required command: jq or python. Could not parse the JSON file. Its settings will be ignored.'
exit 1
fi
[ ! -z "${config_channel:-}" ] && channel="$config_channel"
[ ! -z "${config_tools_source:-}" ] && tools_source="$config_tools_source"
fi
export DOTNET_HOME="$DIR/.dotnet"
get_korebuild
if [ "$build_all" = true ]; then if [ "$build_all" = true ]; then
msbuild_args[${#msbuild_args[*]}]="-p:BuildAllProjects=true" msbuild_args[${#msbuild_args[*]}]="-p:BuildAllProjects=true"
elif [ ! -z "$build_projects" ]; then elif [ ! -z "$build_projects" ]; then
msbuild_args[${#msbuild_args[*]}]="-p:Projects=$build_projects" msbuild_args[${#msbuild_args[*]}]="-p:ProjectToBuild=$build_projects"
elif [ -z "$build_managed" ] && [ -z "$build_nodejs" ] && [ -z "$build_java" ] && [ -z "$build_native" ]; then elif [ -z "$build_managed" ] && [ -z "$build_nodejs" ] && [ -z "$build_java" ] && [ -z "$build_native" ] && [ -z "$build_installers" ]; then
# This goal of this is to pick a sensible default for `build.sh` with zero arguments. # This goal of this is to pick a sensible default for `build.sh` with zero arguments.
# We believe the most common thing our contributors will work on is C#, so if no other build group was picked, build the C# projects. # We believe the most common thing our contributors will work on is C#, so if no other build group was picked, build the C# projects.
__warn "No default group of projects was specified, so building the 'managed' subset of projects. Run ``build.sh -help`` for more details." __warn "No default group of projects was specified, so building the 'managed' subset of projects. Run ``build.sh --help`` for more details."
build_managed=true build_managed=true
fi fi
@ -312,24 +226,91 @@ fi
[ ! -z "$build_native" ] && msbuild_args[${#msbuild_args[*]}]="-p:BuildNative=$build_native" [ ! -z "$build_native" ] && msbuild_args[${#msbuild_args[*]}]="-p:BuildNative=$build_native"
[ ! -z "$build_nodejs" ] && msbuild_args[${#msbuild_args[*]}]="-p:BuildNodeJS=$build_nodejs" [ ! -z "$build_nodejs" ] && msbuild_args[${#msbuild_args[*]}]="-p:BuildNodeJS=$build_nodejs"
[ ! -z "$build_managed" ] && msbuild_args[${#msbuild_args[*]}]="-p:BuildManaged=$build_managed" [ ! -z "$build_managed" ] && msbuild_args[${#msbuild_args[*]}]="-p:BuildManaged=$build_managed"
[ ! -z "$build_installers" ] && msbuild_args[${#msbuild_args[*]}]="-p:BuildInstallers=$build_installers"
# Run restore by default unless --no-restore or --no-build was specified. # Run restore by default unless --no-restore or --no-build was specified.
[ -z "$run_restore" ] && run_restore=true [ -z "$run_restore" ] && run_restore=true
[ "$run_restore" = true ] && msbuild_args[${#msbuild_args[*]}]="-restore" msbuild_args[${#msbuild_args[*]}]="-p:Restore=$run_restore"
msbuild_args[${#msbuild_args[*]}]="-p:_RunBuild=$run_build" msbuild_args[${#msbuild_args[*]}]="-p:Build=$run_build"
msbuild_args[${#msbuild_args[*]}]="-p:_RunPack=$run_pack" if [ "$run_build" = false ]; then
msbuild_args[${#msbuild_args[*]}]="-p:_RunTests=$run_tests" msbuild_args[${#msbuild_args[*]}]="-p:NoBuild=true"
fi
msbuild_args[${#msbuild_args[*]}]="-p:Pack=$run_pack"
msbuild_args[${#msbuild_args[*]}]="-p:Test=$run_tests"
msbuild_args[${#msbuild_args[*]}]="-p:TargetArchitecture=$target_arch" msbuild_args[${#msbuild_args[*]}]="-p:TargetArchitecture=$target_arch"
msbuild_args[${#msbuild_args[*]}]="-p:TargetOsName=$target_os_name" msbuild_args[${#msbuild_args[*]}]="-p:TargetOsName=$target_os_name"
# Disable downloading ref assemblies as a tarball. Use netfx refs from the Microsoft.NETFramework.ReferenceAssemblies NuGet package instead. if [ -z "$configuration" ]; then
[ -z "${KOREBUILD_SKIP_INSTALL_NETFX:-}" ] && KOREBUILD_SKIP_INSTALL_NETFX=1 if [ "$ci" = true ]; then
configuration='Release'
else
configuration='Debug'
fi
fi
msbuild_args[${#msbuild_args[*]}]="-p:Configuration=$configuration"
export KOREBUILD_KEEPGLOBALJSON=1 # Initialize global variables need to be set before the import of Arcade is imported
set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$DIR" "$config_file" "$ci" restore=$run_restore
# Disable node reuse - Workaround perpetual issues in node reuse and custom task assemblies
nodeReuse=false
export MSBUILDDISABLENODEREUSE=1
# Our build often has warnings that we can't fix
# Fixing this is tracked by https://github.com/aspnet/AspNetCore-Internal/issues/601
warn_as_error=false
# Workaround Arcade check which asserts BinaryLog is true on CI.
# We always use binlogs on CI, but we customize the name of the log file
if [ "$ci" = true ]; then
binary_log=true
fi
# increase file descriptor limit on macOS
if [ "$(uname)" = "Darwin" ]; then
ulimit -n 10000
fi
# Import Arcade
. "$DIR/eng/common/tools.sh"
if [ "$use_default_binary_log" = true ]; then
msbuild_args[${#msbuild_args[*]}]="-bl:\"$log_dir/Build.binlog\""
fi
# Capture MSBuild crash logs
export MSBUILDDEBUGPATH="$log_dir"
# Import custom tools configuration, if present in the repo.
configure_toolset_script="$eng_root/configure-toolset.sh"
if [[ -a "$configure_toolset_script" ]]; then
. "$configure_toolset_script"
fi
# Set this global property so Arcade will always initialize the toolset. The error message you get when you build on a clean machine
# with -norestore is not obvious about what to do to fix it. As initialization takes very little time, we think always initializing
# the toolset is a better default behavior.
_tmp_restore=$restore
restore=true
InitializeToolset
restore=$_tmp_restore=
if [ "$build_repo_tasks" = true ]; then
MSBuild $_InitializeToolset \
-p:RepoRoot="$repo_root" \
-p:Projects="$DIR/eng/tools/RepoTasks/RepoTasks.csproj" \
-p:Configuration=Release \
-p:Restore=$run_restore \
-p:Build=true \
-clp:NoSummary
fi
# This incantation avoids unbound variable issues if msbuild_args is empty # This incantation avoids unbound variable issues if msbuild_args is empty
# https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u # https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u
invoke_korebuild_command 'default-build' ${msbuild_args[@]+"${msbuild_args[@]}"} MSBuild $_InitializeToolset -p:RepoRoot="$repo_root" ${msbuild_args[@]+"${msbuild_args[@]}"}
ExitWithExitCode 0

View File

@ -1,25 +0,0 @@
<Project>
<PropertyGroup>
<AzureIntegrationProjectRoot>$(MSBuildThisFileDirectory)..\src\AzureIntegration\</AzureIntegrationProjectRoot>
</PropertyGroup>
<Target Name="BuildAzureIntegration">
<PropertyGroup>
<AzureIntegrationProjProperties>
RepoRoot=$(AzureIntegrationProjectRoot);
Configuration=$(Configuration);
</AzureIntegrationProjProperties>
</PropertyGroup>
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="$(AzureIntegrationProjectTargets)"
Properties="$(AzureIntegrationProjProperties)" />
<ItemGroup>
<AzureIntegrationArtifacts Include="$(AzureIntegrationProjectRoot)artifacts\build\*" />
</ItemGroup>
<Copy SourceFiles="@(AzureIntegrationArtifacts)" DestinationFolder="$(ArtifactsShippingPackagesDir)" />
</Target>
</Project>

View File

@ -1,55 +0,0 @@
<Project>
<ItemGroup>
<!--
Use the PublicKeyToken of .NET assemblies to determine with authenticode cert to use.
'None' is required to ensure code signing does not attempt to re-sign them or submit
to ESPR for strong-naming signing. We don't delay sign, so we only need to authenticode sign.
See https://github.com/dotnet/arcade/issues/1911 for context.
-->
<!-- The AspNetCore strong name. -->
<AssemblyToSign Include="None" PublicKeyToken="adb9793829ddae60" CertificateName="Microsoft400" />
<!-- The MsSharedLib72 strong name. -->
<AssemblyToSign Include="None" PublicKeyToken="31bf3856ad364e35" CertificateName="Microsoft400" />
<!-- The MsftStrongName strong name. -->
<AssemblyToSign Include="None" PublicKeyToken="b03f5f7f11d50a3a" CertificateName="Microsoft400" />
<!-- The MsftStrongName2 strong name. -->
<AssemblyToSign Include="None" PublicKeyToken="b77a5c561934e089" CertificateName="Microsoft400" />
<!-- The MsftOpenStrongName strong name. -->
<AssemblyToSign Include="None" PublicKeyToken="cc7b13ffcd2ddd51" CertificateName="Microsoft400" />
<!-- Native .dll's. These don't have a public key token, but are from Microsoft and should be signed. -->
<FileNamesToSign Include="aspnetcore.dll" CertificateName="Microsoft400" />
<FileNamesToSign Include="aspnetcorev2_inprocess.dll" CertificateName="Microsoft400" />
<FileNamesToSign Include="aspnetcorev2_outofprocess.dll" CertificateName="Microsoft400" />
<FileNamesToSign Include="aspnetcorev2.dll" CertificateName="Microsoft400" />
<FileNamesToSign Include="blazor-devserver.exe" CertificateName="Microsoft400" />
<FileNamesToSign Include="dotnet-dev-certs.exe" CertificateName="Microsoft400" />
<FileNamesToSign Include="dotnet-sql-cache.exe" CertificateName="Microsoft400" />
<FileNamesToSign Include="dotnet-user-secrets.exe" CertificateName="Microsoft400" />
<FileNamesToSign Include="dotnet-watch.exe" CertificateName="Microsoft400" />
<FileNamesToSign Include="Microsoft.AspNetCore.Blazor.Build.exe" CertificateName="Microsoft400" />
<FileNamesToSign Include="sni.dll" CertificateName="Microsoft400" />
<!-- Third-party components which should be signed. -->
<FileNamesToSign Include="Newtonsoft.Json.dll" CertificateName="3PartySHA2" />
<FileNamesToSign Include="AngleSharp.dll" CertificateName="3PartySHA2" />
<FileNamesToSign Include="Mono.Cecil.dll" CertificateName="3PartySHA2" />
<FileNamesToSign Include="Mono.Cecil.Mdb.dll" CertificateName="3PartySHA2" />
<FileNamesToSign Include="Mono.Cecil.Pdb.dll" CertificateName="3PartySHA2" />
<FileNamesToSign Include="Mono.Cecil.Rocks.dll" CertificateName="3PartySHA2" />
</ItemGroup>
<ItemGroup Label="Code sign exclusions">
<!-- We don't need to code sign .js files because they are not used in Windows Script Host. -->
<FileExtensionsToSign Include=".js" CertificateName="None" />
<!-- We don't produce font files. We rebundle some for using the web brower, so they do not need to be signed. -->
<FileExtensionsToSign Include=".otf" CertificateName="None" />
<FileExtensionsToSign Include=".ttf" CertificateName="None" />
<!-- This is a text file which doesn't need to be code signed, even though some .mof files can be signed. -->
<FileNamesToSign Include="ancm.mof" CertificateName="None" />
<!-- Exclude the apphost because this is expected to be code-signed by customers after the SDK modifies it. -->
<FileNamesToSign Include="apphost.exe" CertificateName="None" />
</ItemGroup>
</Project>

View File

@ -1,46 +0,0 @@
<Project>
<PropertyGroup>
<CodeSignDependsOn>$(CodeSignDependsOn);CollectFileSignInfo</CodeSignDependsOn>
</PropertyGroup>
<ItemGroup>
<!-- Configures signcheck to inspect well-known folders for signed content. -->
<SignCheckDirectory Include="$(ArtifactsPackagesDir.TrimEnd('\'))" />
<SignCheckDirectory Include="$(InstallersOutputPath.TrimEnd('\'))" />
<SignCheckDirectory Include="$(VisualStudioSetupOutputPath.TrimEnd('\'))" />
<!-- KoreBuild by default scans everything in artifacts/, but this causes problems because we put unsigned content in artifacts/obj/ and bin/ which can be ignored. -->
<SignCheckDirectory Remove="$(ArtifactsDir)" />
</ItemGroup>
<Target Name="CollectFileSignInfo">
<PropertyGroup>
<BaseRedistNetCorePath>$(ArtifactsDir)obj\RedistSharedFx.Layout\$(Configuration)\</BaseRedistNetCorePath>
<RedistNetCorePath>$(BaseRedistNetCorePath)$(TargetRuntimeIdentifier)\</RedistNetCorePath>
</PropertyGroup>
<ItemGroup>
<FilesToSign Include="$(ArtifactsShippingPackagesDir)*.jar" Certificate="MicrosoftJARSHA2" />
<FilesToSign Include="$(ArtifactsShippingPackagesDir)*.nupkg" Exclude="$(ArtifactsShippingPackagesDir)*.symbols.nupkg" Certificate="NuGet" />
<FilesToSign Include="$(ArtifactsNonShippingPackagesDir)*.nupkg" Exclude="$(ArtifactsNonShippingPackagesDir)*.symbols.nupkg" Certificate="NuGet" />
<FilesToSign Include="$(VisualStudioSetupOutputPath)*.vsix" Certificate="VsixSHA2" />
<!-- "None" means don't sign the .zip file itself, but still scan the contents of the .zip for signable files. -->
<FilesToSign Include="$(InstallersOutputPath)*.zip" Certificate="None" />
<!--
These files should already be signed by the .NET Core team. They have to be listed again here because we recreate a redistributable which includes the Microsoft.NETCore.App runtime.
List all combinations of Windows RID's because CI may build multiple combinations of artitectures on the same machine.
This uses globs because some of the file names change on every build of .NET Core, like sos_amd64_$(fileversion).dll.
-->
<FilesToExcludeFromSigning Include="$(BaseRedistNetCorePath)win-x64\shared\Microsoft.NETCore.App\**\*.dll" />
<FilesToExcludeFromSigning Include="$(BaseRedistNetCorePath)win-x86\shared\Microsoft.NETCore.App\**\*.dll" />
<FilesToExcludeFromSigning Include="$(BaseRedistNetCorePath)win-arm\shared\Microsoft.NETCore.App\**\*.dll" />
<FilesToExcludeFromSigning Include="$(BaseRedistNetCorePath)win-x64\host\**\*.dll" />
<FilesToExcludeFromSigning Include="$(BaseRedistNetCorePath)win-x86\host\**\*.dll" />
<FilesToExcludeFromSigning Include="$(BaseRedistNetCorePath)win-arm\host\**\*.dll" />
<FilesToExcludeFromSigning Include="$(RedistNetCorePath)dotnet.exe" />
<FilesToExcludeFromSigning Include="hostpolicy.dll" />
<FilesToExcludeFromSigning Include="hostfxr.dll" />
</ItemGroup>
</Target>
</Project>

View File

@ -1,41 +0,0 @@
<Project>
<PropertyGroup>
<BuildSharedFxDependsOn>_BuildSharedFxProjects;RemoveSharedFrameworkOnlyRefsFromNuspec</BuildSharedFxDependsOn>
<BuildSharedFxDependsOn Condition="'$(TestOnly)' != 'true'">$(BuildSharedFxDependsOn);CodeSign</BuildSharedFxDependsOn>
</PropertyGroup>
<ItemGroup>
<FxProjectToBuild Condition=" '$(TargetRuntimeIdentifier)' == 'linux-x64' AND '$(LinuxInstallerType)' == 'deb' " Include="$(RepoRoot)src\Installers\Debian\**\*.*proj" />
<FxProjectToBuild Condition=" '$(TargetRuntimeIdentifier)' == 'linux-x64' AND '$(LinuxInstallerType)' == 'rpm' " Include="$(RepoRoot)src\Installers\Rpm\**\*.*proj" />
<FxProjectToBuild Condition=" '$(BuildSiteExtensions)' == 'true' " Include="$(RepoRoot)src\SiteExtensions\Runtime\Microsoft.AspNetCore.Runtime.SiteExtension.pkgproj" />
<FxProjectToBuild Condition=" '$(BuildSiteExtensions)' == 'true' " Include="$(RepoRoot)src\SiteExtensions\LoggingBranch\LB.csproj" />
<FxProjectToBuild Condition=" '$(TargetRuntimeIdentifier)' == 'win-x86' " Include="$(RepoRoot)src\Framework\src\Microsoft.AspNetCore.App.Runtime.csproj" />
<FxProjectToBuild Condition=" '$(TargetRuntimeIdentifier)' == 'win-x86' " Include="$(RepoRoot)src\Servers\IIS\AspNetCoreModuleV2\Symbols\Microsoft.AspNetCore.ANCMSymbols.csproj" />
</ItemGroup>
<Target Name="BuildSharedFx" DependsOnTargets="$(BuildSharedFxDependsOn)" />
<Target Name="_BuildSharedFxProjects" Condition="@(FxProjectToBuild->Count()) != 0">
<PropertyGroup>
<_RestoreGraphProjectInput>@(FxProjectToBuild)</_RestoreGraphProjectInput>
</PropertyGroup>
<MSBuild Projects="$(NuGetRestoreTargets)"
Targets="Restore"
Properties="$(BuildProperties);RestoreGraphProjectInput=$(_RestoreGraphProjectInput);_DummyTarget=Restore" />
<MSBuild Projects="@(FxProjectToBuild)"
Properties="$(BuildProperties)"
BuildInParallel="true" />
<!-- BuildInParallel="false" because dotnet store runs during site extension build and is failing if packages are being currently generated -->
<MSBuild Projects="@(FxProjectToBuild)"
Targets="Pack"
Properties="$(BuildProperties);NoBuild=true"
BuildInParallel="false"
SkipNonexistentTargets="true" />
</Target>
</Project>

View File

@ -1,158 +0,0 @@
<Project>
<Import Project="AzureIntegration.targets" />
<Import Project="SharedFx.targets" />
<Import Project="CodeSign.targets" />
<PropertyGroup>
<!-- Reset the default korebuild lifecycle. -->
<BuildDependsOn>Prepare</BuildDependsOn>
<!-- Map bootstrapper flags to KoreBuild targets -->
<BuildDependsOn Condition=" '$(_RunBuild)' == 'true' ">$(BuildDependsOn);Compile</BuildDependsOn>
<BuildDependsOn Condition=" '$(_RunPack)' == 'true' ">$(BuildDependsOn);Package</BuildDependsOn>
<BuildDependsOn Condition=" '$(_RunTests)' == 'true' ">$(BuildDependsOn);Test;Verify</BuildDependsOn>
<SkipTests Condition=" '$(_RunTests)' != 'true' ">true</SkipTests>
<DisableCodeSigning Condition=" '$(_RunSign)' != 'true' OR '$(OS)' != 'Windows_NT' ">true</DisableCodeSigning>
<CleanDependsOn>$(CleanDependsOn);CleanArtifacts</CleanDependsOn>
<RestoreDependsOn>$(RestoreDependsOn);InstallDotNet;RestoreProjects</RestoreDependsOn>
<CompileDependsOn />
<CompileDependsOn>$(CompileDependsOn);BuildProjects</CompileDependsOn>
<PackageDependsOn>$(PackageDependsOn);PackProjects</PackageDependsOn>
<PackageDependsOn Condition=" '$(BuildAllProjects)' == 'true' ">$(PackageDependsOn);RemoveSharedFrameworkOnlyRefsFromNuspec;BuildSharedFx</PackageDependsOn>
<TestDependsOn />
<TestDependsOn Condition=" '$(_RunBuild)' == 'true' ">$(TestDependsOn);Compile</TestDependsOn>
<TestDependsOn>$(TestDependsOn);TestProjects</TestDependsOn>
<BuildDependsOn Condition="'$(CI)' == 'true'">$(BuildDependsOn);GenerateBuildAssetManifest</BuildDependsOn>
<!-- Package modification must happen before code signing. -->
<CodeSignDependsOn>$(CodeSignDependsOn);RemoveSharedFrameworkOnlyRefsFromNuspec</CodeSignDependsOn>
</PropertyGroup>
<Target Name="ShowProjectClosure" DependsOnTargets="ResolveProjects">
<MSBuild Targets="_CustomCollectProjectReference"
BuildInParallel="true"
SkipNonexistentTargets="true"
Projects="@(ProjectToBuild)"
Properties="DesignTimeBuild=true"
RebaseOutputs="True">
<Output TaskParameter="TargetOutputs" ItemName="_ReferenceProject" />
</MSBuild>
<RemoveDuplicates Inputs="@(_ReferenceProject->'%(FullPath)')">
<Output TaskParameter="Filtered" ItemName="ReferencedProjects" />
</RemoveDuplicates>
<Message Importance="High" Text="Projects referenced:" />
<Message Importance="High" Text=" - %(ReferencedProjects.Identity)" />
<WriteLinesToFile Lines="@(ReferencedProjects)" File="$(ProjectsReferencedOutFile)" Overwrite="true" Condition="'$(ProjectsReferencedOutFile)' != ''" />
</Target>
<Target Name="GenerateProjectList" DependsOnTargets="ResolveProjects">
<MSBuild Projects="@(ProjectToBuild)"
Targets="GetReferencesProvided"
BuildInParallel="true"
SkipNonexistentTargets="true"
SkipNonexistentProjects="true" >
<Output TaskParameter="TargetOutputs" ItemName="_ProjectReferenceProvider"/>
</MSBuild>
<ItemGroup>
<_SharedFrameworkAndPackageRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsShippingPackage', 'true')->Distinct())" />
<_SharedFrameworkRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsShippingPackage', 'false')->Distinct())" />
<_ProjectReferenceProviderWithRefAssembly Include="@(_ProjectReferenceProvider->HasMetadata('ReferenceAssemblyProjectFileRelativePath'))" />
<_ProjectReferenceProvider Remove="@(_ProjectReferenceProviderWithRefAssembly)" />
</ItemGroup>
<PropertyGroup>
<ProjectListFile>$(MSBuildThisFileDirectory)..\eng\ProjectReferences.props</ProjectListFile>
<ProjectListContent><![CDATA[<!--
This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
This file contains a map of assembly names to the projects that build them.
-->
<Project>
<ItemGroup>
@(_ProjectReferenceProvider->'<ProjectReferenceProvider Include="%(Identity)" ProjectPath="%24(RepoRoot)%(ProjectFileRelativePath)" />', '%0A ')
@(_ProjectReferenceProviderWithRefAssembly->'<ProjectReferenceProvider Include="%(Identity)" ProjectPath="%24(RepoRoot)%(ProjectFileRelativePath)" RefProjectPath="%24(RepoRoot)%(ReferenceAssemblyProjectFileRelativePath)" />', '%0A ')
</ItemGroup>
</Project>
]]></ProjectListContent>
</PropertyGroup>
<!-- Workaround https://github.com/Microsoft/msbuild/issues/1024 -->
<WriteLinesToFile Condition="'$(OS)' == 'Windows_NT'"
File="$(ProjectListFile)" Lines="$([MSBuild]::Escape($(ProjectListContent)))" Overwrite="true" />
<Exec Condition="'$(OS)' != 'Windows_NT'"
Command="echo '$(ProjectListContent.Replace('\t','\\t'))' > $(ProjectListFile)" />
<PropertyGroup>
<SharedFxDepList>$(MSBuildThisFileDirectory)..\eng\SharedFramework.Local.props</SharedFxDepList>
<SharedFxDepListContent>
<![CDATA[
<!--
This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
This file contains a complete list of the assemblies which are part of the shared framework.
This project is generated using the <IsAspNetCoreApp> and <IsShippingPackage> properties from each .csproj in this repository.
-->
<Project>
<ItemGroup>
<!-- These assemblies are available as both a NuGet package and in the shared framework -->
@(_SharedFrameworkAndPackageRef->'<AspNetCoreAppReferenceAndPackage Include="%(Identity)" />', '%0A ')
<!-- These assemblies are only in the shared framework -->
@(_SharedFrameworkRef->'<AspNetCoreAppReference Include="%(Identity)" />', '%0A ')
</ItemGroup>
</Project>
]]>
</SharedFxDepListContent>
</PropertyGroup>
<WriteLinesToFile File="$(SharedFxDepList)" Lines="$(SharedFxDepListContent)" Overwrite="true" />
</Target>
<Target Name="GenerateReferenceSources">
<MSBuild
Projects="@(ProjectToBuild)"
Targets="GenerateReferenceSource"
SkipNonexistentTargets="true"
SkipNonexistentProjects="true" />
</Target>
<!-- This is temporary until we can use FrameworkReference to build our own packages. -->
<Target Name="RemoveSharedFrameworkOnlyRefsFromNuspec">
<ItemGroup>
<_BuildOutput Include="$(ArtifactsShippingPackagesDir)*.nupkg"
Exclude="$(ArtifactsShippingPackagesDir)*.symbols.nupkg" />
</ItemGroup>
<RepoTasks.RemoveSharedFrameworkDependencies Condition="@(_BuildOutput->Count()) != 0"
Files="@(_BuildOutput)"
FrameworkOnlyPackages="@(AspNetCoreAppReference)"
SharedFrameworkTargetFramework="netcoreapp$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)" />
</Target>
<Target Name="GenerateBuildAssetManifest">
<!-- Generate build manifests. These manifests are used by Maestro and the Build Asset Registry to flow dependencies to other repos. -->
<MSBuild Projects="$(MSBuildThisFileDirectory)Maestro\Maestro.csproj"
Targets="Restore"
Properties="$(BuildProperties);__DummyTarget=Restore" />
<MSBuild Projects="$(MSBuildThisFileDirectory)Maestro\Maestro.csproj"
Targets="GenerateBuildAssetManifest"
Properties="$(BuildProperties);__DummyTarget=GenerateBuildAssetManifest" />
</Target>
<Target Name="Helix">
<MSBuild Projects="$(MSBuildThisFileDirectory)..\eng\helix\helix.proj"
Targets="Test"
Properties="$(BuildProperties);$(SolutionProperties);"
ContinueOnError="ErrorAndStop" />
</Target>
</Project>

View File

@ -1,15 +0,0 @@
<Project>
<ItemGroup>
<DotNetCoreRuntime Include="$(MicrosoftNETCoreAppRuntimeVersion)"
Feed="$(DotNetAssetRootUrl)"
FeedCredential="$(DotNetAssetRootAccessTokenSuffix)" />
<DotNetCoreRuntime Condition="'$(OS)' == 'Windows_NT'"
Include="$(MicrosoftNETCoreAppRuntimeVersion)"
Arch="x86"
Feed="$(DotNetAssetRootUrl)"
FeedCredential="$(DotNetAssetRootAccessTokenSuffix)" />
</ItemGroup>
</Project>

View File

@ -1,35 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(RepoTasksSdkPath)\Sdk.props" Condition="'$(RepoTasksSdkPath)' != '' "/>
<PropertyGroup>
<TargetFramework Condition="'$(MSBuildRuntimeType)' == 'Core' ">netcoreapp3.0</TargetFramework>
<TargetFramework Condition="'$(MSBuildRuntimeType)' != 'Core' ">net472</TargetFramework>
<DefineConstants Condition="'$(BuildInstallers)' == 'true' AND '$(TargetOsName)' == 'win'">$(DefineConstants);BUILD_MSI_TASKS</DefineConstants>
<Optimize>false</Optimize>
<DebugType>embedded</DebugType>
<DisablePackageReferenceRestrictions>true</DisablePackageReferenceRestrictions>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.Build.Tasks" Version="5.1.0-rtm.5921" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
<PackageReference Include="Yarn.MSBuild" Version="1.15.2" />
</ItemGroup>
<ItemGroup Condition="'$(BuildInstallers)' == 'true' AND '$(TargetOsName)' == 'win'">
<PackageReference Include="Wix" Version="3.11.1" />
<Reference Include="Microsoft.Deployment.WindowsInstaller">
<HintPath>$(WiXSdkPath)\Microsoft.Deployment.WindowsInstaller.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Deployment.WindowsInstaller.Package">
<HintPath>$(WiXSdkPath)\Microsoft.Deployment.WindowsInstaller.Package.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(RepoTasksSdkPath)\Sdk.targets" Condition="'$(RepoTasksSdkPath)' != '' "/>
<ItemGroup>
<PackageReference Update="Newtonsoft.Json" PrivateAssets="" />
</ItemGroup>
</Project>

View File

@ -1,10 +0,0 @@
<Project>
<PropertyGroup>
<_RepoTaskAssembly>$(MSBuildThisFileDirectory)bin\publish\RepoTasks.dll</_RepoTaskAssembly>
</PropertyGroup>
<UsingTask TaskName="RepoTasks.GenerateGuid" AssemblyFile="$(_RepoTaskAssembly)" />
<UsingTask TaskName="RepoTasks.GetMsiProperty" AssemblyFile="$(_RepoTaskAssembly)" />
<UsingTask TaskName="RepoTasks.GenerateSharedFrameworkDepsFile" AssemblyFile="$(_RepoTaskAssembly)" />
<UsingTask TaskName="RepoTasks.RemoveSharedFrameworkDependencies" AssemblyFile="$(_RepoTaskAssembly)" />
</Project>

View File

@ -1,34 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.0.0
MinimumVisualStudioVersion = 16.0.0.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RepoTasks", "RepoTasks.csproj", "{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Debug|x64.ActiveCfg = Debug|Any CPU
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Debug|x64.Build.0 = Debug|Any CPU
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Debug|x86.ActiveCfg = Debug|Any CPU
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Debug|x86.Build.0 = Debug|Any CPU
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Release|Any CPU.Build.0 = Release|Any CPU
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Release|x64.ActiveCfg = Release|Any CPU
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Release|x64.Build.0 = Release|Any CPU
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Release|x86.ActiveCfg = Release|Any CPU
{A114791F-35B7-4E5B-8E5B-9A91E0B6E4AE}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -29,7 +29,7 @@ __usage() {
echo " -e, --env <NAME=VAL> Additional environment variables to add to the build container" echo " -e, --env <NAME=VAL> Additional environment variables to add to the build container"
echo "" echo ""
echo "Description:" echo "Description:"
echo " This will run build.sh inside the dockerfile as defined in build/docker/\$image.Dockerfile." echo " This will run build.sh inside the dockerfile as defined in eng/docker/\$image.Dockerfile."
if [[ "${1:-}" != '--no-exit' ]]; then if [[ "${1:-}" != '--no-exit' ]]; then
exit 2 exit 2
@ -101,7 +101,7 @@ if [ ! -z "$commit_hash" ]; then
build_args[${#build_args[*]}]="-p:SourceRevisionId=$commit_hash" build_args[${#build_args[*]}]="-p:SourceRevisionId=$commit_hash"
fi fi
dockerfile="$DIR/build/docker/$image.Dockerfile" dockerfile="$DIR/eng/docker/$image.Dockerfile"
tagname="aspnetcore-build-$image" tagname="aspnetcore-build-$image"
# Use docker pull with retries to pre-pull the image need by the dockerfile # Use docker pull with retries to pre-pull the image need by the dockerfile
@ -130,8 +130,7 @@ docker build "$(dirname "$dockerfile")" \
docker run \ docker run \
--rm \ --rm \
-t \ -t \
-e CI \ -e TF_BUILD \
-e TEAMCITY_VERSION \
-e BUILD_NUMBER \ -e BUILD_NUMBER \
-e BUILD_BUILDNUMBER \ -e BUILD_BUILDNUMBER \
-e BUILD_REPOSITORY_URI \ -e BUILD_REPOSITORY_URI \

View File

@ -95,10 +95,6 @@ The cause of this problem is that the solution you are using does not include th
``` ```
dotnet sln add C:\src\AspNetCore\src\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj dotnet sln add C:\src\AspNetCore\src\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj
``` ```
Or you can use this script to automatically traverse the project reference graph, which then invokes `dotnet sln` for you: [eng/scripts/AddAllProjectRefsToSolution.ps1](/eng/scripts/AddAllProjectRefsToSolution.ps1).
```
./eng/scripts/AddAllProjectRefsToSolution.ps1 -WorkingDir src/Mvc/
```
## Building with Visual Studio Code ## Building with Visual Studio Code

View File

@ -13,13 +13,13 @@ To run Helix tests for one particular test project:
``` ```
cd src/MyCode/test cd src/MyCode/test
dotnet build /t:Helix dotnet msbuild /t:Helix
``` ```
To run tests for the entire repo, run: To run tests for the entire repo, run:
``` ```
.\build.cmd /t:Helix .\eng\scripts\TestHelix.ps1
``` ```
This will restore, and then publish all of the test projects including some bootstrapping scripts that will install the correct dotnet runtime/sdk before running the test assemblies on the helix machine, and upload the job to helix, it won't wait for the jobs to complete, but you can go to https://mc.dot.net/#/user/$(your user name)/builds. This will restore, and then publish all of the test projects including some bootstrapping scripts that will install the correct dotnet runtime/sdk before running the test assemblies on the helix machine, and upload the job to helix, it won't wait for the jobs to complete, but you can go to https://mc.dot.net/#/user/$(your user name)/builds.

View File

@ -0,0 +1,31 @@
<Project>
<Import Project="tools\RepoTasks\RepoTasks.tasks" />
<Import Project="SharedFramework.External.props" />
<Import Project="SharedFramework.Local.props" />
<!-- This is temporary until we can use FrameworkReference to build our own packages. -->
<Target Name="RemoveSharedFrameworkOnlyRefsFromNuspec" AfterTargets="Pack">
<ItemGroup>
<_BuildOutput Include="$(ArtifactsShippingPackagesDir)*.nupkg"
Exclude="$(ArtifactsShippingPackagesDir)*.symbols.nupkg" />
</ItemGroup>
<RepoTasks.RemoveSharedFrameworkDependencies Condition="@(_BuildOutput->Count()) != 0"
Files="@(_BuildOutput)"
FrameworkOnlyPackages="@(AspNetCoreAppReference)"
SharedFrameworkTargetFramework="netcoreapp$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)" />
</Target>
<Target Name="GenerateBuildAssetManifest" AfterTargets="Pack" Condition="'$(ContinuousIntegrationBuild)' == 'true'">
<!-- Generate build manifests. These manifests are used by Maestro and the Build Asset Registry to flow dependencies to other repos. -->
<MSBuild Projects="$(MSBuildThisFileDirectory)tools\Maestro\Maestro.csproj"
Targets="Restore"
Properties="__DummyTarget=Restore" />
<MSBuild Projects="$(MSBuildThisFileDirectory)tools\Maestro\Maestro.csproj"
Targets="GenerateBuildAssetManifest"
Properties="__DummyTarget=GenerateBuildAssetManifest" />
</Target>
</Project>

View File

@ -10,31 +10,6 @@
<BuildJava>true</BuildJava> <BuildJava>true</BuildJava>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<!-- This repo does not have solutions to build -->
<DisableDefaultTargets>true</DisableDefaultTargets>
<DisableDefaultItems>true</DisableDefaultItems>
<BuildSolutions>false</BuildSolutions>
<BuildSiteExtensions Condition="('$(TargetRuntimeIdentifier)' == 'win-x64' OR '$(TargetRuntimeIdentifier)' == 'win-x86') AND '$(BuildSiteExtensions)' == ''">true</BuildSiteExtensions>
<OverridePackageOutputPath>false</OverridePackageOutputPath>
<ArtifactsPackagesDir>$(ArtifactsDir)packages\$(Configuration)\</ArtifactsPackagesDir>
<ArtifactsShippingPackagesDir>$(ArtifactsPackagesDir)Shipping\</ArtifactsShippingPackagesDir>
<ArtifactsNonShippingPackagesDir>$(ArtifactsPackagesDir)NonShipping\</ArtifactsNonShippingPackagesDir>
<InstallersOutputPath>$(ArtifactsDir)installers\$(Configuration)\</InstallersOutputPath>
<VisualStudioSetupOutputPath>$(ArtifactsDir)VSSetup\$(Configuration)\</VisualStudioSetupOutputPath>
<LogOutputDir>$(ArtifactsDir)log\</LogOutputDir>
<SignCheckExclusionsFile>$(RepoRoot)eng\signcheck.exclusions.txt</SignCheckExclusionsFile>
<!-- Disable the check which asserts that all managed .NET binaries we distribute are strong-named signed. Workaround for https://github.com/aspnet/AspNetCore-Internal/issues/1501 -->
<DisableSignCheckStrongName>true</DisableSignCheckStrongName>
<SharedSourcesFolder>$(RepoRoot)src\Shared\</SharedSourcesFolder>
<BuildIisNativeProjects Condition="'$(TargetOsName)' == 'win' AND ('$(TargetArchitecture)' == 'x86' OR '$(TargetArchitecture)' == 'x64')">true</BuildIisNativeProjects>
</PropertyGroup>
<!-- These projects are always excluded, even when -projects is specified on command line. --> <!-- These projects are always excluded, even when -projects is specified on command line. -->
<ItemGroup> <ItemGroup>
@ -73,9 +48,9 @@
<Choose> <Choose>
<!-- Project selection can be overridden on the command line by passing in -projects --> <!-- Project selection can be overridden on the command line by passing in -projects -->
<When Condition="'$(Projects)' != ''"> <When Condition="'$(ProjectToBuild)' != ''">
<ItemGroup> <ItemGroup>
<ProjectToBuild Include="$(Projects)" Exclude="@(ProjectToExclude);$(RepoRoot)**\bin\**\*;$(RepoRoot)**\obj\**\*"> <ProjectToBuild Include="$(ProjectToBuild)" Exclude="@(ProjectToExclude);$(RepoRoot)**\bin\**\*;$(RepoRoot)**\obj\**\*">
<RestoreInParallel Condition="'%(Extension)' == '.npmproj'">false</RestoreInParallel> <RestoreInParallel Condition="'%(Extension)' == '.npmproj'">false</RestoreInParallel>
</ProjectToBuild> </ProjectToBuild>
</ItemGroup> </ItemGroup>
@ -108,9 +83,20 @@
<ProjectToBuild Include="$(RepoRoot)src\Installers\Windows\WindowsHostingBundle\WindowsHostingBundle.wixproj" AdditionalProperties="Platform=x86" /> <ProjectToBuild Include="$(RepoRoot)src\Installers\Windows\WindowsHostingBundle\WindowsHostingBundle.wixproj" AdditionalProperties="Platform=x86" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Condition="'$(BuildInstallers)' == 'true' AND '$(TargetRuntimeIdentifier)' == 'linux-x64'">
<ProjectToBuild Include="$(RepoRoot)src\Servers\**\*.pkgproj" Condition=" '$(_RunPack)' == 'true' OR '$(BuildAllProjects)' == 'true' "/> <ProjectToBuild Condition=" '$(LinuxInstallerType)' == 'deb' "
Include="$(RepoRoot)src\Installers\Debian\**\*.*proj" />
<ProjectToBuild Condition=" '$(LinuxInstallerType)' == 'rpm' "
Include="$(RepoRoot)src\Installers\Rpm\**\*.*proj" />
</ItemGroup>
<ItemGroup Condition=" '$(BuildSiteExtensions)' == 'true' ">
<ProjectToBuild Include="$(RepoRoot)src\SiteExtensions\Runtime\Microsoft.AspNetCore.Runtime.SiteExtension.pkgproj" />
<ProjectToBuild Include="$(RepoRoot)src\SiteExtensions\LoggingBranch\LoggingBranch.csproj" />
<ProjectToBuild Include="$(RepoRoot)src\SiteExtensions\LoggingAggregate\src\Microsoft.AspNetCore.AzureAppServices.SiteExtension\Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj" />
</ItemGroup>
<ItemGroup>
<NativeProjects Condition=" '$(TargetOsName)' == 'win' AND ('$(TargetArchitecture)' == 'x86' OR '$(TargetArchitecture)' == 'x64') " <NativeProjects Condition=" '$(TargetOsName)' == 'win' AND ('$(TargetArchitecture)' == 'x86' OR '$(TargetArchitecture)' == 'x64') "
Include="$(RepoRoot)src\**\*.vcxproj" Exclude="@(ProjectToExclude)"> Include="$(RepoRoot)src\**\*.vcxproj" Exclude="@(ProjectToExclude)">
<!-- Required to prevent triggering double-builds. See src\Servers\IIS\ResolveIisReferences.targets for details. --> <!-- Required to prevent triggering double-builds. See src\Servers\IIS\ResolveIisReferences.targets for details. -->
@ -181,10 +167,4 @@
</ItemGroup> </ItemGroup>
</Otherwise> </Otherwise>
</Choose> </Choose>
<Import Project="..\eng\Versions.props" />
<Import Project="..\eng\SharedFramework.Local.props" />
<Import Project="..\eng\SharedFramework.External.props" />
<Import Project="runtimes.props" />
<Import Project="CodeSign.props" />
</Project> </Project>

88
eng/CodeGen.proj Normal file
View File

@ -0,0 +1,88 @@
<Project>
<PropertyGroup>
<BuildManaged>true</BuildManaged>
<RepoRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..'))</RepoRoot>
</PropertyGroup>
<Import Project="Build.props" />
<Target Name="GenerateProjectList">
<Message Importance="High" Text="Analyzing @(ProjectToBuild->Count()) projects" />
<MSBuild Projects="@(ProjectToBuild)"
Targets="GetReferencesProvided"
BuildInParallel="true"
SkipNonexistentTargets="true"
SkipNonexistentProjects="true" >
<Output TaskParameter="TargetOutputs" ItemName="_ProjectReferenceProvider"/>
</MSBuild>
<ItemGroup>
<_SharedFrameworkAndPackageRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsShippingPackage', 'true')->Distinct())" />
<_SharedFrameworkRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsShippingPackage', 'false')->Distinct())" />
<_ProjectReferenceProviderWithRefAssembly Include="@(_ProjectReferenceProvider->HasMetadata('ReferenceAssemblyProjectFileRelativePath'))" />
<_ProjectReferenceProvider Remove="@(_ProjectReferenceProviderWithRefAssembly)" />
</ItemGroup>
<PropertyGroup>
<ProjectListFile>$(MSBuildThisFileDirectory)ProjectReferences.props</ProjectListFile>
<ProjectListContent><![CDATA[<!--
This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
This file contains a map of assembly names to the projects that build them.
-->
<Project>
<ItemGroup>
@(_ProjectReferenceProvider->'<ProjectReferenceProvider Include="%(Identity)" ProjectPath="%24(RepoRoot)%(ProjectFileRelativePath)" />', '%0A ')
@(_ProjectReferenceProviderWithRefAssembly->'<ProjectReferenceProvider Include="%(Identity)" ProjectPath="%24(RepoRoot)%(ProjectFileRelativePath)" RefProjectPath="%24(RepoRoot)%(ReferenceAssemblyProjectFileRelativePath)" />', '%0A ')
</ItemGroup>
</Project>
]]></ProjectListContent>
</PropertyGroup>
<!-- Workaround https://github.com/Microsoft/msbuild/issues/1024 -->
<WriteLinesToFile Condition="'$(OS)' == 'Windows_NT'"
File="$(ProjectListFile)" Lines="$([MSBuild]::Escape($(ProjectListContent)))" Overwrite="true" />
<Exec Condition="'$(OS)' != 'Windows_NT'"
Command="echo '$(ProjectListContent.Replace('\t','\\t'))' > $(ProjectListFile)" />
<Message Importance="High" Text="Generated $(ProjectListFile)" />
<PropertyGroup>
<SharedFxDepList>$(MSBuildThisFileDirectory)SharedFramework.Local.props</SharedFxDepList>
<SharedFxDepListContent>
<![CDATA[
<!--
This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
This file contains a complete list of the assemblies which are part of the shared framework.
This project is generated using the <IsAspNetCoreApp> and <IsShippingPackage> properties from each .csproj in this repository.
-->
<Project>
<ItemGroup>
<!-- These assemblies are available as both a NuGet package and in the shared framework -->
@(_SharedFrameworkAndPackageRef->'<AspNetCoreAppReferenceAndPackage Include="%(Identity)" />', '%0A ')
<!-- These assemblies are only in the shared framework -->
@(_SharedFrameworkRef->'<AspNetCoreAppReference Include="%(Identity)" />', '%0A ')
</ItemGroup>
</Project>
]]>
</SharedFxDepListContent>
</PropertyGroup>
<WriteLinesToFile File="$(SharedFxDepList)" Lines="$(SharedFxDepListContent)" Overwrite="true" />
<Message Importance="High" Text="Generated $(SharedFxDepList)" />
</Target>
<Target Name="GenerateReferenceSources">
<MSBuild
Projects="@(ProjectToBuild)"
Targets="GenerateReferenceSource"
SkipNonexistentTargets="true"
SkipNonexistentProjects="true" />
</Target>
</Project>

View File

@ -6,13 +6,13 @@
</PropertyGroup> </PropertyGroup>
<!-- Azure Pipelines Flakiness --> <!-- Azure Pipelines Flakiness -->
<PropertyGroup Condition="'$(AGENT_OS)' != ''"> <PropertyGroup Condition="'$(TF_BUILD)' != ''">
<_FlakyRunAdditionalArgs>$(_FlakyRunAdditionalArgs) -trait "Flaky:AzP:All=true" -trait "Flaky:AzP:OS:$(AGENT_OS)=true"</_FlakyRunAdditionalArgs> <_FlakyRunAdditionalArgs>$(_FlakyRunAdditionalArgs) -trait "Flaky:AzP:All=true" -trait "Flaky:AzP:OS:$(AGENT_OS)=true"</_FlakyRunAdditionalArgs>
<_NonFlakyRunAdditionalArgs>$(_NonFlakyRunAdditionalArgs) -notrait "Flaky:AzP:All=true" -notrait "Flaky:AzP:OS:$(AGENT_OS)=true"</_NonFlakyRunAdditionalArgs> <_NonFlakyRunAdditionalArgs>$(_NonFlakyRunAdditionalArgs) -notrait "Flaky:AzP:All=true" -notrait "Flaky:AzP:OS:$(AGENT_OS)=true"</_NonFlakyRunAdditionalArgs>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<TestRunnerAdditionalArguments Condition="'$(RunFlakyTests)' == ''">$(_NonFlakyRunAdditionalArgs)</TestRunnerAdditionalArguments> <TestRunnerAdditionalArguments Condition="'$(RunFlakyTests)' == ''">$(_NonFlakyRunAdditionalArgs) $(TestRunnerAdditionalArguments)</TestRunnerAdditionalArguments>
<TestRunnerAdditionalArguments Condition="'$(RunFlakyTests)' == 'true'">$(_FlakyRunAdditionalArgs)</TestRunnerAdditionalArguments> <TestRunnerAdditionalArguments Condition="'$(RunFlakyTests)' == 'true'">$(_FlakyRunAdditionalArgs) $(TestRunnerAdditionalArguments)</TestRunnerAdditionalArguments>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -1,41 +0,0 @@
{
"adx": {
"rules": [
"AdxVerificationCompositeRule"
],
"packages": {
"dotnet-watch": {
"packageTypes": [
"DotnetTool"
]
},
"dotnet-sql-cache": {
"packageTypes": [
"DotnetTool"
]
},
"dotnet-user-secrets": {
"packageTypes": [
"DotnetTool"
]
},
"dotnet-dev-certs": {
"packageTypes": [
"DotnetTool"
]
},
"Microsoft.AspNetCore.DeveloperCertificates.XPlat": {
"Exclusions": {
"DOC_MISSING": {
"lib/netcoreapp3.0/Microsoft.AspNetCore.DeveloperCertificates.XPlat.dll": "Docs not required to shipoob package"
}
}
}
}
},
"Default": {
"rules": [
"DefaultCompositeRule"
]
}
}

99
eng/Signing.props Normal file
View File

@ -0,0 +1,99 @@
<Project>
<!-- See https://github.com/dotnet/arcade/blob/master/Documentation/CorePackages/Signing.md for details. -->
<ItemGroup>
<!-- Reset Arcade's defaults. -->
<ItemsToSign Remove="@(ItemsToSign)" />
<StrongNameSignInfo Remove="@(StrongNameSignInfo)" />
<FileExtensionSignInfo Remove="@(FileExtensionSignInfo)" />
</ItemGroup>
<ItemGroup Label="Signing config">
<ItemsToSign Include="$(ArtifactsPackagesDir)**\*.nupkg" Exclude="$(ArtifactsPackagesDir)**\*symbols.nupkg" />
<ItemsToSign Include="$(VisualStudioSetupOutputPath)**\*.vsix" />
<ItemsToSign Include="$(ArtifactsPackagesDir)**\*.jar" />
<ItemsToSign Include="$(InstallersOutputPath)**\*.zip" />
<!--
Map file extensions to a code-sign cert.
"None" means don't sign the file itself, but still scan the contents for signable files.
-->
<FileExtensionSignInfo Include=".jar" CertificateName="MicrosoftJARSHA2" />
<FileExtensionSignInfo Include=".ps1;.psd1;.psm1;.psc1" CertificateName="Microsoft400" />
<FileExtensionSignInfo Include=".nupkg" CertificateName="NuGet" />
<FileExtensionSignInfo Include=".vsix" CertificateName="VsixSHA2" />
<FileExtensionSignInfo Include=".zip" CertificateName="None" />
<!--
Use the PublicKeyToken of .NET assemblies to determine with authenticode cert to use.
'None' is required to ensure code signing does not attempt to re-sign them or submit
to ESPR for strong-naming signing. We don't delay sign, so we only need to authenticode sign.
See https://github.com/dotnet/arcade/issues/1911 for context.
-->
<!-- The AspNetCore strong name. -->
<StrongNameSignInfo Include="None" PublicKeyToken="adb9793829ddae60" CertificateName="Microsoft400" />
<!-- The MsSharedLib72 strong name. -->
<StrongNameSignInfo Include="None" PublicKeyToken="31bf3856ad364e35" CertificateName="Microsoft400" />
<!-- The MsftStrongName strong name. -->
<StrongNameSignInfo Include="None" PublicKeyToken="b03f5f7f11d50a3a" CertificateName="Microsoft400" />
<!-- The MsftStrongName2 strong name. -->
<StrongNameSignInfo Include="None" PublicKeyToken="b77a5c561934e089" CertificateName="Microsoft400" />
<!-- The MsftOpenStrongName strong name. -->
<StrongNameSignInfo Include="None" PublicKeyToken="cc7b13ffcd2ddd51" CertificateName="Microsoft400" />
<!-- Native .dll's. These don't have a public key token, but are from Microsoft and should be signed. -->
<FileSignInfo Include="aspnetcore.dll" CertificateName="Microsoft400" />
<FileSignInfo Include="aspnetcorev2_inprocess.dll" CertificateName="Microsoft400" />
<FileSignInfo Include="aspnetcorev2_outofprocess.dll" CertificateName="Microsoft400" />
<FileSignInfo Include="aspnetcorev2.dll" CertificateName="Microsoft400" />
<FileSignInfo Include="blazor-devserver.exe" CertificateName="Microsoft400" />
<FileSignInfo Include="dotnet-dev-certs.exe" CertificateName="Microsoft400" />
<FileSignInfo Include="dotnet-sql-cache.exe" CertificateName="Microsoft400" />
<FileSignInfo Include="dotnet-user-secrets.exe" CertificateName="Microsoft400" />
<FileSignInfo Include="dotnet-watch.exe" CertificateName="Microsoft400" />
<FileSignInfo Include="Microsoft.AspNetCore.Blazor.Build.exe" CertificateName="Microsoft400" />
<FileSignInfo Include="sni.dll" CertificateName="Microsoft400" />
<!-- Third-party components which should be signed. -->
<FileSignInfo Include="Newtonsoft.Json.dll" CertificateName="3PartySHA2" />
<FileSignInfo Include="AngleSharp.dll" CertificateName="3PartySHA2" />
<FileSignInfo Include="Mono.Cecil.dll" CertificateName="3PartySHA2" />
<FileSignInfo Include="Mono.Cecil.Mdb.dll" CertificateName="3PartySHA2" />
<FileSignInfo Include="Mono.Cecil.Pdb.dll" CertificateName="3PartySHA2" />
<FileSignInfo Include="Mono.Cecil.Rocks.dll" CertificateName="3PartySHA2" />
</ItemGroup>
<PropertyGroup>
<TargetRuntimeIdentifier Condition="'$(TargetRuntimeIdentifier)' == ''">$(TargetOsName)-$(TargetArchitecture)</TargetRuntimeIdentifier>
<BaseRedistNetCorePath>$(ArtifactsObjDir)RedistSharedFx.Layout\$(Configuration)\</BaseRedistNetCorePath>
<RedistNetCorePath>$(BaseRedistNetCorePath)$(TargetRuntimeIdentifier)\</RedistNetCorePath>
</PropertyGroup>
<ItemGroup Label="Code sign exclusions">
<!-- We don't need to code sign .js files because they are not used in Windows Script Host. -->
<FileExtensionSignInfo Include=".js" CertificateName="None" />
<!-- We don't produce font files. We rebundle some for using the web brower, so they do not need to be signed. -->
<FileExtensionSignInfo Include=".otf" CertificateName="None" />
<FileExtensionSignInfo Include=".ttf" CertificateName="None" />
<!-- This is a text file which doesn't need to be code signed, even though some .mof files can be signed. -->
<FileSignInfo Include="ancm.mof" CertificateName="None" />
<!-- Exclude the apphost because this is expected to be code-signed by customers after the SDK modifies it. -->
<FileSignInfo Include="apphost.exe" CertificateName="None" />
<!--
These files should already be signed by the .NET Core team. They have to be listed again here because we recreate a redistributable which includes the Microsoft.NETCore.App runtime.
List all combinations of Windows RID's because CI may build multiple combinations of artitectures on the same machine.
This uses globs because some of the file names change on every build of .NET Core, like sos_amd64_$(fileversion).dll.
-->
<_DotNetFilesToExclude Include="$(BaseRedistNetCorePath)win-x64\shared\Microsoft.NETCore.App\**\*.dll" CertificateName="None" />
<_DotNetFilesToExclude Include="$(BaseRedistNetCorePath)win-x86\shared\Microsoft.NETCore.App\**\*.dll" CertificateName="None" />
<_DotNetFilesToExclude Include="$(BaseRedistNetCorePath)win-arm\shared\Microsoft.NETCore.App\**\*.dll" CertificateName="None" />
<_DotNetFilesToExclude Include="$(BaseRedistNetCorePath)win-x64\host\**\*.dll" CertificateName="None" />
<_DotNetFilesToExclude Include="$(BaseRedistNetCorePath)win-x86\host\**\*.dll" CertificateName="None" />
<_DotNetFilesToExclude Include="$(BaseRedistNetCorePath)win-arm\host\**\*.dll" CertificateName="None" />
<_DotNetFilesToExclude Include="$(RedistNetCorePath)dotnet.exe" CertificateName="None" />
<FileSignInfo Include="@(_DotNetFilesToExclude->'%(FileName)%(Extension)'->Distinct())" CertificateName="None" />
</ItemGroup>
</Project>

12
eng/Tools.props Normal file
View File

@ -0,0 +1,12 @@
<Project>
<ItemGroup>
<!--
This is here to workaround flakiness in the NuGet SDK resolver in MSBuild.
Arcade will run a pre-restore for these packages. This works more consistently than the SDK resolution which uses global.json.
Without this here, we see regular failures with 'error MSB4236: The SDK 'Yarn.MSBuild' specified could not be found.'
Since this project is evaluated before .npmproj files are loaded, this should cause the package to end
up in the NuGet cache ahead of time.
-->
<PackageReference Include="Yarn.MSBuild" Version="1.15.2" />
</ItemGroup>
</Project>

View File

@ -404,17 +404,17 @@
<Uri>https://github.com/aspnet/Extensions</Uri> <Uri>https://github.com/aspnet/Extensions</Uri>
<Sha>42b3a303ba27594637de04c78aaf9f1c7af6e303</Sha> <Sha>42b3a303ba27594637de04c78aaf9f1c7af6e303</Sha>
</Dependency> </Dependency>
<Dependency Name="Microsoft.DotNet.GenAPI" Version="1.0.0-beta.19302.2"> <Dependency Name="Microsoft.DotNet.GenAPI" Version="1.0.0-beta.19312.4">
<Uri>https://github.com/dotnet/arcade</Uri> <Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e6a5d5f970bb872451c6310ae34eda31041fb552</Sha> <Sha>8b34615157193918f13821730cb2cac05c2eb1b1</Sha>
</Dependency> </Dependency>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19302.2"> <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19312.4">
<Uri>https://github.com/dotnet/arcade</Uri> <Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e6a5d5f970bb872451c6310ae34eda31041fb552</Sha> <Sha>8b34615157193918f13821730cb2cac05c2eb1b1</Sha>
</Dependency> </Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="2.0.0-beta.19302.2"> <Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="2.0.0-beta.19312.4">
<Uri>https://github.com/dotnet/arcade</Uri> <Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e6a5d5f970bb872451c6310ae34eda31041fb552</Sha> <Sha>8b34615157193918f13821730cb2cac05c2eb1b1</Sha>
</Dependency> </Dependency>
<Dependency Name="Microsoft.AspNetCore.Testing" Version="3.0.0-preview7.19312.4" CoherentParentDependency="Microsoft.EntityFrameworkCore"> <Dependency Name="Microsoft.AspNetCore.Testing" Version="3.0.0-preview7.19312.4" CoherentParentDependency="Microsoft.EntityFrameworkCore">
<Uri>https://github.com/aspnet/Extensions</Uri> <Uri>https://github.com/aspnet/Extensions</Uri>

View File

@ -52,7 +52,7 @@
--> -->
<PropertyGroup Label="Automated"> <PropertyGroup Label="Automated">
<!-- Packages from dotnet/arcade --> <!-- Packages from dotnet/arcade -->
<MicrosoftDotNetGenAPIPackageVersion>1.0.0-beta.19302.2</MicrosoftDotNetGenAPIPackageVersion> <MicrosoftDotNetGenAPIPackageVersion>1.0.0-beta.19312.4</MicrosoftDotNetGenAPIPackageVersion>
<!-- Packages from dotnet/core-setup --> <!-- Packages from dotnet/core-setup -->
<MicrosoftExtensionsDependencyModelPackageVersion>3.0.0-preview7-27812-08</MicrosoftExtensionsDependencyModelPackageVersion> <MicrosoftExtensionsDependencyModelPackageVersion>3.0.0-preview7-27812-08</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>3.0.0-preview7-27812-08</MicrosoftNETCoreAppRefPackageVersion> <MicrosoftNETCoreAppRefPackageVersion>3.0.0-preview7-27812-08</MicrosoftNETCoreAppRefPackageVersion>

View File

@ -1,18 +1,5 @@
<!-- Use this file to workaround issues. List the issue tracking the item to fix so we can remove the workaround when the issue is resolved. --> <!-- Use this file to workaround issues. List the issue tracking the item to fix so we can remove the workaround when the issue is resolved. -->
<Project> <Project>
<!-- Workaround https://github.com/Microsoft/msbuild/issues/4150 -->
<!-- Evaluate this import here so we can override WixTargetsPath before wix.targets is imported -->
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.wixproj'">
<MSBuildProjectExtensionsPath>$(BaseIntermediateOutputPath)</MSBuildProjectExtensionsPath>
<MSBuildProjectExtensionsPath Condition="'$(MSBuildProjectExtensionsPath)' == ''">$(MSBuildProjectDir)\obj\</MSBuildProjectExtensionsPath>
</PropertyGroup>
<Import Project="$(MSBuildProjectExtensionsPath)$(MSBuildProjectFile).*.props" Condition=" '$(MSBuildProjectExtension)' == '.wixproj' " />
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.wixproj'">
<!-- Suppress double-import in eng/targets/Wix.Common.props -->
<_ProjectExtensionsWereImported>true</_ProjectExtensionsWereImported>
<WixTargetsPath>$(WixInstallPath)\wix2010.targets</WixTargetsPath>
</PropertyGroup>
<PropertyGroup> <PropertyGroup>
<!-- Reset this to the Microsoft.NET.Sdk default to workaround Arcade's defaults, which sets IsPackable=false by default. --> <!-- Reset this to the Microsoft.NET.Sdk default to workaround Arcade's defaults, which sets IsPackable=false by default. -->
<IsPackable /> <IsPackable />
@ -44,4 +31,16 @@
<PropertyGroup> <PropertyGroup>
<PublishWindowsPdb>false</PublishWindowsPdb> <PublishWindowsPdb>false</PublishWindowsPdb>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<!-- Xunit output is piped into a file anyways, so color codes aren't useful. -->
<TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) -nocolor</TestRunnerAdditionalArguments>
</PropertyGroup>
<!-- Workaround https://github.com/dotnet/roslyn/issues/27975 -->
<PropertyGroup>
<!-- We use the compiler toolset that comes from NuGet Packages rather than the SDK built-in.
This one sets UseSharedCompilation to false by default. -->
<UseSharedCompilation>true</UseSharedCompilation>
</PropertyGroup>
</Project> </Project>

View File

@ -157,15 +157,15 @@ fetch_tizen_pkgs()
Inform "Initialize arm base" Inform "Initialize arm base"
fetch_tizen_pkgs_init standard base fetch_tizen_pkgs_init standard base
Inform "fetch common packages" Inform "fetch common packages"
fetch_tizen_pkgs armv7l gcc glibc glibc-devel libicu libicu-devel fetch_tizen_pkgs armv7l gcc glibc glibc-devel libicu libicu-devel libatomic
fetch_tizen_pkgs noarch linux-glibc-devel fetch_tizen_pkgs noarch linux-glibc-devel
Inform "fetch coreclr packages" Inform "fetch coreclr packages"
fetch_tizen_pkgs armv7l lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel tizen-release lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu fetch_tizen_pkgs armv7l lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu
Inform "fetch corefx packages" Inform "fetch corefx packages"
fetch_tizen_pkgs armv7l libcom_err libcom_err-devel zlib zlib-devel libopenssl libopenssl-devel krb5 krb5-devel libcurl libcurl-devel fetch_tizen_pkgs armv7l libcom_err libcom_err-devel zlib zlib-devel libopenssl libopenssl-devel krb5 krb5-devel libcurl libcurl-devel
Inform "Initialize standard unified" Inform "Initialize standard unified"
fetch_tizen_pkgs_init standard unified fetch_tizen_pkgs_init standard unified
Inform "fetch corefx packages" Inform "fetch corefx packages"
fetch_tizen_pkgs armv7l gssdp gssdp-devel fetch_tizen_pkgs armv7l gssdp gssdp-devel tizen-release

View File

@ -181,7 +181,7 @@ if [ -z "$__RootfsDir" ] && [ ! -z "$ROOTFS_DIR" ]; then
fi fi
if [ -z "$__RootfsDir" ]; then if [ -z "$__RootfsDir" ]; then
__RootfsDir="$__CrossDir/rootfs/$__BuildArch" __RootfsDir="$__CrossDir/../../../.tools/rootfs/$__BuildArch"
fi fi
if [ -d "$__RootfsDir" ]; then if [ -d "$__RootfsDir" ]; then

View File

@ -11,10 +11,10 @@ function InstallDarcCli ($darcVersion) {
$dotnetRoot = InitializeDotNetCli -install:$true $dotnetRoot = InitializeDotNetCli -install:$true
$dotnet = "$dotnetRoot\dotnet.exe" $dotnet = "$dotnetRoot\dotnet.exe"
$toolList = Invoke-Expression "& `"$dotnet`" tool list -g" $toolList = & "$dotnet" tool list -g
if ($toolList -like "*$darcCliPackageName*") { if ($toolList -like "*$darcCliPackageName*") {
Invoke-Expression "& `"$dotnet`" tool uninstall $darcCliPackageName -g" & "$dotnet" tool uninstall $darcCliPackageName -g
} }
# If the user didn't explicitly specify the darc version, # If the user didn't explicitly specify the darc version,
@ -22,12 +22,12 @@ function InstallDarcCli ($darcVersion) {
if (-not $darcVersion) { if (-not $darcVersion) {
$darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
} }
$arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json' $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json'
Write-Host "Installing Darc CLI version $darcVersion..." Write-Host "Installing Darc CLI version $darcVersion..."
Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed."
Invoke-Expression "& `"$dotnet`" tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g
} }
InstallDarcCli $darcVersion InstallDarcCli $darcVersion

View File

@ -25,7 +25,7 @@ function CheckExitCode ([string]$stage)
try { try {
Push-Location $PSScriptRoot Push-Location $PSScriptRoot
Write-Host "Installing darc..." Write-Host "Installing darc..."
. .\darc-init.ps1 -darcVersion $darcVersion . .\darc-init.ps1 -darcVersion $darcVersion
CheckExitCode "Running darc-init" CheckExitCode "Running darc-init"
@ -40,9 +40,9 @@ try {
$darcExe = "$env:USERPROFILE\.dotnet\tools" $darcExe = "$env:USERPROFILE\.dotnet\tools"
$darcExe = Resolve-Path "$darcExe\darc.exe" $darcExe = Resolve-Path "$darcExe\darc.exe"
Create-Directory $outputFolder Create-Directory $outputFolder
# Generate 3 graph descriptions: # Generate 3 graph descriptions:
# 1. Flat with coherency information # 1. Flat with coherency information
# 2. Graphviz (dot) file # 2. Graphviz (dot) file
@ -51,26 +51,26 @@ try {
$graphVizImageFilePath = "$outputFolder\graph.png" $graphVizImageFilePath = "$outputFolder\graph.png"
$normalGraphFilePath = "$outputFolder\graph-full.txt" $normalGraphFilePath = "$outputFolder\graph-full.txt"
$flatGraphFilePath = "$outputFolder\graph-flat.txt" $flatGraphFilePath = "$outputFolder\graph-flat.txt"
$baseOptions = "get-dependency-graph --github-pat $gitHubPat --azdev-pat $azdoPat --password $barToken" $baseOptions = @( "--github-pat", "$gitHubPat", "--azdev-pat", "$azdoPat", "--password", "$barToken" )
if ($includeToolset) { if ($includeToolset) {
Write-Host "Toolsets will be included in the graph..." Write-Host "Toolsets will be included in the graph..."
$baseOptions += " --include-toolset" $baseOptions += @( "--include-toolset" )
} }
Write-Host "Generating standard dependency graph..." Write-Host "Generating standard dependency graph..."
Invoke-Expression "& `"$darcExe`" $baseOptions --output-file $normalGraphFilePath" & "$darcExe" get-dependency-graph @baseOptions --output-file $normalGraphFilePath
CheckExitCode "Generating normal dependency graph" CheckExitCode "Generating normal dependency graph"
Write-Host "Generating flat dependency graph and graphviz file..." Write-Host "Generating flat dependency graph and graphviz file..."
Invoke-Expression "& `"$darcExe`" $baseOptions --flat --coherency --graphviz $graphVizFilePath --output-file $flatGraphFilePath" & "$darcExe" get-dependency-graph @baseOptions --flat --coherency --graphviz $graphVizFilePath --output-file $flatGraphFilePath
CheckExitCode "Generating flat and graphviz dependency graph" CheckExitCode "Generating flat and graphviz dependency graph"
Write-Host "Generating graph image $graphVizFilePath" Write-Host "Generating graph image $graphVizFilePath"
$dotFilePath = Join-Path $installBin "graphviz\$graphvizVersion\release\bin\dot.exe" $dotFilePath = Join-Path $installBin "graphviz\$graphvizVersion\release\bin\dot.exe"
Invoke-Expression "& `"$dotFilePath`" -Tpng -o'$graphVizImageFilePath' `"$graphVizFilePath`"" & "$dotFilePath" -Tpng -o"$graphVizImageFilePath" "$graphVizFilePath"
CheckExitCode "Generating graphviz image" CheckExitCode "Generating graphviz image"
Write-Host "'$graphVizFilePath', '$flatGraphFilePath', '$normalGraphFilePath' and '$graphVizImageFilePath' created!" Write-Host "'$graphVizFilePath', '$flatGraphFilePath', '$normalGraphFilePath' and '$graphVizImageFilePath' created!"
} }
catch { catch {

View File

@ -79,28 +79,27 @@ try {
$NativeTools.PSObject.Properties | ForEach-Object { $NativeTools.PSObject.Properties | ForEach-Object {
$ToolName = $_.Name $ToolName = $_.Name
$ToolVersion = $_.Value $ToolVersion = $_.Value
$LocalInstallerCommand = $InstallerPath $LocalInstallerArguments = @{ ToolName = "$ToolName" }
$LocalInstallerCommand += " -ToolName $ToolName" $LocalInstallerArguments += @{ InstallPath = "$InstallBin" }
$LocalInstallerCommand += " -InstallPath $InstallBin" $LocalInstallerArguments += @{ BaseUri = "$BaseUri" }
$LocalInstallerCommand += " -BaseUri $BaseUri" $LocalInstallerArguments += @{ CommonLibraryDirectory = "$EngCommonBaseDir" }
$LocalInstallerCommand += " -CommonLibraryDirectory $EngCommonBaseDir" $LocalInstallerArguments += @{ Version = "$ToolVersion" }
$LocalInstallerCommand += " -Version $ToolVersion"
if ($Verbose) { if ($Verbose) {
$LocalInstallerCommand += " -Verbose" $LocalInstallerArguments += @{ Verbose = $True }
} }
if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') { if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') {
if($Force) { if($Force) {
$LocalInstallerCommand += " -Force" $LocalInstallerArguments += @{ Force = $True }
} }
} }
if ($Clean) { if ($Clean) {
$LocalInstallerCommand += " -Clean" $LocalInstallerArguments += @{ Clean = $True }
} }
Write-Verbose "Installing $ToolName version $ToolVersion" Write-Verbose "Installing $ToolName version $ToolVersion"
Write-Verbose "Executing '$LocalInstallerCommand'" Write-Verbose "Executing '$InstallerPath $LocalInstallerArguments'"
Invoke-Expression "$LocalInstallerCommand" & $InstallerPath @LocalInstallerArguments
if ($LASTEXITCODE -Ne "0") { if ($LASTEXITCODE -Ne "0") {
$errMsg = "$ToolName installation failed" $errMsg = "$ToolName installation failed"
if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) { if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) {

View File

@ -209,7 +209,7 @@ function New-ScriptShim {
Remove-Item (Join-Path $ShimDirectory "$ShimName.exe") Remove-Item (Join-Path $ShimDirectory "$ShimName.exe")
} }
Invoke-Expression "$ShimDirectory\WinShimmer\winshimmer.exe $ShimName $ToolFilePath $ShimDirectory" & "$ShimDirectory\WinShimmer\winshimmer.exe" $ShimName $ToolFilePath $ShimDirectory
return $True return $True
} }
catch { catch {

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<clear />
<add key="guardian" value="https://securitytools.pkgs.visualstudio.com/_packaging/Guardian/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>

View File

@ -0,0 +1,97 @@
Param(
[string] $GuardianPackageName, # Required: the name of guardian CLI pacakge (not needed if GuardianCliLocation is specified)
[string] $NugetPackageDirectory, # Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified)
[string] $GuardianCliLocation, # Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified
[string] $Repository, # Required: the name of the repository (e.g. dotnet/arcade)
[string] $BranchName="master", # Optional: name of branch or version of gdn settings; defaults to master
[string] $SourceDirectory, # Required: the directory where source files are located
[string] $ArtifactsDirectory, # Required: the directory where build artifacts are located
[string] $DncEngAccessToken, # Required: access token for dnceng; should be provided via KeyVault
[string[]] $SourceToolsList, # Optional: list of SDL tools to run on source code
[string[]] $ArtifactToolsList, # Optional: list of SDL tools to run on built artifacts
[bool] $TsaPublish=$False, # Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs.
[string] $TsaBranchName=$env:BUILD_SOURCEBRANCHNAME, # Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs.
[string] $TsaRepositoryName, # Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs.
[string] $BuildNumber=$env:BUILD_BUILDNUMBER, # Optional: required for TSA publish; defaults to $(Build.BuildNumber)
[bool] $UpdateBaseline=$False, # Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed
[bool] $TsaOnboard=$False, # Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs.
[string] $TsaInstanceUrl, # Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs.
[string] $TsaCodebaseName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs.
[string] $TsaProjectName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs.
[string] $TsaNotificationEmail, # Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. alias@microsoft.com); TSA is the automated framework used to upload test results as bugs.
[string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs.
[string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs.
[string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs.
[string] $GuardianLoggerLevel="Standard" # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error
)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2.0
$LASTEXITCODE = 0
#Replace repo names to the format of org/repo
if (!($Repository.contains('/'))) {
$RepoName = $Repository -replace '(.*?)-(.*)', '$1/$2';
}
else{
$RepoName = $Repository;
}
if ($GuardianPackageName) {
$guardianCliLocation = Join-Path $NugetPackageDirectory (Join-Path $GuardianPackageName (Join-Path "tools" "guardian.cmd"))
} else {
$guardianCliLocation = $GuardianCliLocation
}
$ValidPath = Test-Path $guardianCliLocation
if ($ValidPath -eq $False)
{
Write-Host "Invalid Guardian CLI Location."
exit 1
}
& $(Join-Path $PSScriptRoot "init-sdl.ps1") -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $ArtifactsDirectory -DncEngAccessToken $DncEngAccessToken -GuardianLoggerLevel $GuardianLoggerLevel
$gdnFolder = Join-Path $ArtifactsDirectory ".gdn"
if ($TsaOnboard) {
if ($TsaCodebaseName -and $TsaNotificationEmail -and $TsaCodebaseAdmin -and $TsaBugAreaPath) {
Write-Host "$guardianCliLocation tsa-onboard --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel"
& $guardianCliLocation tsa-onboard --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel
if ($LASTEXITCODE -ne 0) {
Write-Host "Guardian tsa-onboard failed with exit code $LASTEXITCODE."
exit $LASTEXITCODE
}
} else {
Write-Host "Could not onboard to TSA -- not all required values ($$TsaCodebaseName, $$TsaNotificationEmail, $$TsaCodebaseAdmin, $$TsaBugAreaPath) were specified."
exit 1
}
}
if ($ArtifactToolsList -and $ArtifactToolsList.Count -gt 0) {
& $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -DncEngAccessToken $DncEngAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel
}
if ($SourceToolsList -and $SourceToolsList.Count -gt 0) {
& $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -DncEngAccessToken $DncEngAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel
}
if ($UpdateBaseline) {
& (Join-Path $PSScriptRoot "push-gdn.ps1") -Repository $RepoName -BranchName $BranchName -GdnFolder $GdnFolder -DncEngAccessToken $DncEngAccessToken -PushReason "Update baseline"
}
if ($TsaPublish) {
if ($TsaBranchName -and $BuildNumber) {
if (-not $TsaRepositoryName) {
$TsaRepositoryName = "$($Repository)-$($BranchName)"
}
Write-Host "$guardianCliLocation tsa-publish --all-tools --repository-name `"$TsaRepositoryName`" --branch-name `"$TsaBranchName`" --build-number `"$BuildNumber`" --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $SourceDirectory --logger-level $GuardianLoggerLevel"
& $guardianCliLocation tsa-publish --all-tools --repository-name "$TsaRepositoryName" --branch-name "$TsaBranchName" --build-number "$BuildNumber" --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel
if ($LASTEXITCODE -ne 0) {
Write-Host "Guardian tsa-publish failed with exit code $LASTEXITCODE."
exit $LASTEXITCODE
}
} else {
Write-Host "Could not publish to TSA -- not all required values ($$TsaBranchName, $$BuildNumber) were specified."
exit 1
}
}

View File

@ -0,0 +1,48 @@
Param(
[string] $GuardianCliLocation,
[string] $Repository,
[string] $BranchName="master",
[string] $WorkingDirectory,
[string] $DncEngAccessToken,
[string] $GuardianLoggerLevel="Standard"
)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2.0
$LASTEXITCODE = 0
# Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file
$encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$DncEngAccessToken"))
$escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn")
$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0-preview.1"
$zipFile = "$WorkingDirectory/gdn.zip"
Add-Type -AssemblyName System.IO.Compression.FileSystem
$gdnFolder = (Join-Path $WorkingDirectory ".gdn")
Try
{
# We try to download the zip; if the request fails (e.g. the file doesn't exist), we catch it and init guardian instead
Write-Host "Downloading gdn folder from internal config repostiory..."
Invoke-WebRequest -Headers @{ "Accept"="application/zip"; "Authorization"="Basic $encodedPat" } -Uri $uri -OutFile $zipFile
if (Test-Path $gdnFolder) {
# Remove the gdn folder if it exists (it shouldn't unless there's too much caching; this is just in case)
Remove-Item -Force -Recurse $gdnFolder
}
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipFile, $WorkingDirectory)
Write-Host $gdnFolder
} Catch [System.Net.WebException] {
# if the folder does not exist, we'll do a guardian init and push it to the remote repository
Write-Host "Initializing Guardian..."
Write-Host "$GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel"
& $GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel
if ($LASTEXITCODE -ne 0) {
Write-Error "Guardian init failed with exit code $LASTEXITCODE."
}
# We create the mainbaseline so it can be edited later
Write-Host "$GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline"
& $GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline
if ($LASTEXITCODE -ne 0) {
Write-Error "Guardian baseline failed with exit code $LASTEXITCODE."
}
& $(Join-Path $PSScriptRoot "push-gdn.ps1") -Repository $Repository -BranchName $BranchName -GdnFolder $gdnFolder -DncEngAccessToken $DncEngAccessToken -PushReason "Initialize gdn folder"
}

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Guardian.Cli" version="0.3.2"/>
</packages>

View File

@ -0,0 +1,51 @@
Param(
[string] $Repository,
[string] $BranchName="master",
[string] $GdnFolder,
[string] $DncEngAccessToken,
[string] $PushReason
)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2.0
$LASTEXITCODE = 0
# We create the temp directory where we'll store the sdl-config repository
$sdlDir = Join-Path $env:TEMP "sdl"
if (Test-Path $sdlDir) {
Remove-Item -Force -Recurse $sdlDir
}
Write-Host "git clone https://dnceng:`$DncEngAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir"
git clone https://dnceng:$DncEngAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir
if ($LASTEXITCODE -ne 0) {
Write-Error "Git clone failed with exit code $LASTEXITCODE."
}
# We copy the .gdn folder from our local run into the git repository so it can be committed
$sdlRepositoryFolder = Join-Path (Join-Path (Join-Path $sdlDir $Repository) $BranchName) ".gdn"
if (Get-Command Robocopy) {
Robocopy /S $GdnFolder $sdlRepositoryFolder
} else {
rsync -r $GdnFolder $sdlRepositoryFolder
}
# cd to the sdl-config directory so we can run git there
Push-Location $sdlDir
# git add . --> git commit --> git push
Write-Host "git add ."
git add .
if ($LASTEXITCODE -ne 0) {
Write-Error "Git add failed with exit code $LASTEXITCODE."
}
Write-Host "git -c user.email=`"dn-bot@microsoft.com`" -c user.name=`"Dotnet Bot`" commit -m `"$PushReason for $Repository/$BranchName`""
git -c user.email="dn-bot@microsoft.com" -c user.name="Dotnet Bot" commit -m "$PushReason for $Repository/$BranchName"
if ($LASTEXITCODE -ne 0) {
Write-Error "Git commit failed with exit code $LASTEXITCODE."
}
Write-Host "git push"
git push
if ($LASTEXITCODE -ne 0) {
Write-Error "Git push failed with exit code $LASTEXITCODE."
}
# Return to the original directory
Pop-Location

View File

@ -0,0 +1,65 @@
Param(
[string] $GuardianCliLocation,
[string] $WorkingDirectory,
[string] $TargetDirectory,
[string] $GdnFolder,
[string[]] $ToolsList,
[string] $UpdateBaseline,
[string] $GuardianLoggerLevel="Standard"
)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2.0
$LASTEXITCODE = 0
# We store config files in the r directory of .gdn
Write-Host $ToolsList
$gdnConfigPath = Join-Path $GdnFolder "r"
$ValidPath = Test-Path $GuardianCliLocation
if ($ValidPath -eq $False)
{
Write-Host "Invalid Guardian CLI Location."
exit 1
}
foreach ($tool in $ToolsList) {
$gdnConfigFile = Join-Path $gdnConfigPath "$tool-configure.gdnconfig"
$config = $False
Write-Host $tool
# We have to manually configure tools that run on source to look at the source directory only
if ($tool -eq "credscan") {
Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory : $TargetDirectory `""
& $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory : $TargetDirectory "
if ($LASTEXITCODE -ne 0) {
Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE."
exit $LASTEXITCODE
}
$config = $True
}
if ($tool -eq "policheck") {
Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target : $TargetDirectory `""
& $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target : $TargetDirectory "
if ($LASTEXITCODE -ne 0) {
Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE."
exit $LASTEXITCODE
}
$config = $True
}
Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel --config $gdnConfigFile $config"
if ($config) {
& $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel --config $gdnConfigFile
if ($LASTEXITCODE -ne 0) {
Write-Host "Guardian run for $tool using $gdnConfigFile failed with exit code $LASTEXITCODE."
exit $LASTEXITCODE
}
} else {
& $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel
if ($LASTEXITCODE -ne 0) {
Write-Host "Guardian run for $tool failed with exit code $LASTEXITCODE."
exit $LASTEXITCODE
}
}
}

View File

@ -35,7 +35,7 @@
# Specifies which msbuild engine to use for build: 'vs', 'dotnet' or unspecified (determined based on presence of tools.vs in global.json). # Specifies which msbuild engine to use for build: 'vs', 'dotnet' or unspecified (determined based on presence of tools.vs in global.json).
[string]$msbuildEngine = if (Test-Path variable:msbuildEngine) { $msbuildEngine } else { $null } [string]$msbuildEngine = if (Test-Path variable:msbuildEngine) { $msbuildEngine } else { $null }
# True to attempt using .NET Core already that meets requirements specified in global.json # True to attempt using .NET Core already that meets requirements specified in global.json
# installed on the machine instead of downloading one. # installed on the machine instead of downloading one.
[bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } [bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true }
@ -76,7 +76,7 @@ function Exec-Process([string]$command, [string]$commandArgs) {
$finished = $false $finished = $false
try { try {
while (-not $process.WaitForExit(100)) { while (-not $process.WaitForExit(100)) {
# Non-blocking loop done to allow ctr-c interrupts # Non-blocking loop done to allow ctr-c interrupts
} }
@ -107,11 +107,11 @@ function Write-PipelineTaskError {
if(!$ci) { if(!$ci) {
if($Type -eq 'error') { if($Type -eq 'error') {
Write-Error $Message Write-Host $Message -ForegroundColor Red
return return
} }
elseif ($Type -eq 'warning') { elseif ($Type -eq 'warning') {
Write-Warning $Message Write-Host $Message -ForegroundColor Yellow
return return
} }
} }
@ -138,7 +138,8 @@ function Write-PipelineSetVariable {
if($ci) { if($ci) {
Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{
'variable' = $Name 'variable' = $Name
'issecret' = $Secret 'isSecret' = $Secret
'isOutput' = 'true'
} -AsOutput:$AsOutput } -AsOutput:$AsOutput
} }
} }
@ -250,7 +251,7 @@ function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $archit
} }
# #
# Locates Visual Studio MSBuild installation. # Locates Visual Studio MSBuild installation.
# The preference order for MSBuild to use is as follows: # The preference order for MSBuild to use is as follows:
# #
# 1. MSBuild from an active VS command prompt # 1. MSBuild from an active VS command prompt
@ -267,7 +268,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs }
$vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { "15.9" } $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { "15.9" }
$vsMinVersion = [Version]::new($vsMinVersionStr) $vsMinVersion = [Version]::new($vsMinVersionStr)
# Try msbuild command available in the environment. # Try msbuild command available in the environment.
if ($env:VSINSTALLDIR -ne $null) { if ($env:VSINSTALLDIR -ne $null) {
@ -316,7 +317,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) { function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) {
$env:VSINSTALLDIR = $vsInstallDir $env:VSINSTALLDIR = $vsInstallDir
Set-Item "env:VS$($vsMajorVersion)0COMNTOOLS" (Join-Path $vsInstallDir "Common7\Tools\") Set-Item "env:VS$($vsMajorVersion)0COMNTOOLS" (Join-Path $vsInstallDir "Common7\Tools\")
$vsSdkInstallDir = Join-Path $vsInstallDir "VSSDK\" $vsSdkInstallDir = Join-Path $vsInstallDir "VSSDK\"
if (Test-Path $vsSdkInstallDir) { if (Test-Path $vsSdkInstallDir) {
Set-Item "env:VSSDK$($vsMajorVersion)0Install" $vsSdkInstallDir Set-Item "env:VSSDK$($vsMajorVersion)0Install" $vsSdkInstallDir
@ -351,13 +352,13 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) {
# Locates Visual Studio instance that meets the minimal requirements specified by tools.vs object in global.json. # Locates Visual Studio instance that meets the minimal requirements specified by tools.vs object in global.json.
# #
# The following properties of tools.vs are recognized: # The following properties of tools.vs are recognized:
# "version": "{major}.{minor}" # "version": "{major}.{minor}"
# Two part minimal VS version, e.g. "15.9", "16.0", etc. # Two part minimal VS version, e.g. "15.9", "16.0", etc.
# "components": ["componentId1", "componentId2", ...] # "components": ["componentId1", "componentId2", ...]
# Array of ids of workload components that must be available in the VS instance. # Array of ids of workload components that must be available in the VS instance.
# See e.g. https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-enterprise?view=vs-2017 # See e.g. https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-enterprise?view=vs-2017
# #
# Returns JSON describing the located VS instance (same format as returned by vswhere), # Returns JSON describing the located VS instance (same format as returned by vswhere),
# or $null if no instance meeting the requirements is found on the machine. # or $null if no instance meeting the requirements is found on the machine.
# #
function LocateVisualStudio([object]$vsRequirements = $null){ function LocateVisualStudio([object]$vsRequirements = $null){
@ -377,8 +378,8 @@ function LocateVisualStudio([object]$vsRequirements = $null){
} }
if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs }
$args = @("-latest", "-prerelease", "-format", "json", "-requires", "Microsoft.Component.MSBuild") $args = @("-latest", "-prerelease", "-format", "json", "-requires", "Microsoft.Component.MSBuild", "-products", "*")
if (Get-Member -InputObject $vsRequirements -Name "version") { if (Get-Member -InputObject $vsRequirements -Name "version") {
$args += "-version" $args += "-version"
$args += $vsRequirements.version $args += $vsRequirements.version
@ -388,7 +389,7 @@ function LocateVisualStudio([object]$vsRequirements = $null){
foreach ($component in $vsRequirements.components) { foreach ($component in $vsRequirements.components) {
$args += "-requires" $args += "-requires"
$args += $component $args += $component
} }
} }
$vsInfo =& $vsWhereExe $args | ConvertFrom-Json $vsInfo =& $vsWhereExe $args | ConvertFrom-Json
@ -445,7 +446,7 @@ function GetDefaultMSBuildEngine() {
if (Get-Member -InputObject $GlobalJson.tools -Name "vs") { if (Get-Member -InputObject $GlobalJson.tools -Name "vs") {
return "vs" return "vs"
} }
if (Get-Member -InputObject $GlobalJson.tools -Name "dotnet") { if (Get-Member -InputObject $GlobalJson.tools -Name "dotnet") {
return "dotnet" return "dotnet"
} }
@ -475,11 +476,13 @@ function GetSdkTaskProject([string]$taskName) {
function InitializeNativeTools() { function InitializeNativeTools() {
if (Get-Member -InputObject $GlobalJson -Name "native-tools") { if (Get-Member -InputObject $GlobalJson -Name "native-tools") {
$nativeArgs="" $nativeArgs= @{}
if ($ci) { if ($ci) {
$nativeArgs = "-InstallDirectory $ToolsDir" $nativeArgs = @{
InstallDirectory = "$ToolsDir"
}
} }
Invoke-Expression "& `"$PSScriptRoot/init-tools-native.ps1`" $nativeArgs" & "$PSScriptRoot/init-tools-native.ps1" @nativeArgs
} }
} }
@ -573,8 +576,8 @@ function MSBuild-Core() {
$cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci"
if ($warnAsError) { if ($warnAsError) {
$cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true" $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true"
} }
foreach ($arg in $args) { foreach ($arg in $args) {
@ -582,29 +585,29 @@ function MSBuild-Core() {
$cmdArgs += " `"$arg`"" $cmdArgs += " `"$arg`""
} }
} }
$exitCode = Exec-Process $buildTool.Path $cmdArgs $exitCode = Exec-Process $buildTool.Path $cmdArgs
if ($exitCode -ne 0) { if ($exitCode -ne 0) {
Write-PipelineTaskError "Build failed." Write-PipelineTaskError "Build failed."
$buildLog = GetMSBuildBinaryLogCommandLineArgument $args $buildLog = GetMSBuildBinaryLogCommandLineArgument $args
if ($buildLog -ne $null) { if ($buildLog -ne $null) {
Write-Host "See log: $buildLog" -ForegroundColor DarkGray Write-Host "See log: $buildLog" -ForegroundColor DarkGray
} }
ExitWithExitCode $exitCode ExitWithExitCode $exitCode
} }
} }
function GetMSBuildBinaryLogCommandLineArgument($arguments) { function GetMSBuildBinaryLogCommandLineArgument($arguments) {
foreach ($argument in $arguments) { foreach ($argument in $arguments) {
if ($argument -ne $null) { if ($argument -ne $null) {
$arg = $argument.Trim() $arg = $argument.Trim()
if ($arg.StartsWith("/bl:", "OrdinalIgnoreCase")) { if ($arg.StartsWith("/bl:", "OrdinalIgnoreCase")) {
return $arg.Substring("/bl:".Length) return $arg.Substring("/bl:".Length)
} }
if ($arg.StartsWith("/binaryLogger:", "OrdinalIgnoreCase")) { if ($arg.StartsWith("/binaryLogger:", "OrdinalIgnoreCase")) {
return $arg.Substring("/binaryLogger:".Length) return $arg.Substring("/binaryLogger:".Length)
} }

View File

@ -221,7 +221,7 @@ function InitializeDotNetCli {
export PATH="$dotnet_root:$PATH" export PATH="$dotnet_root:$PATH"
if [[ $ci == true ]]; then if [[ $ci == true ]]; then
# Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build
echo "##vso[task.prependpath]$dotnet_root" echo "##vso[task.prependpath]$dotnet_root"
echo "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0" echo "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0"
echo "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1" echo "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1"
@ -349,7 +349,7 @@ function InitializeToolset {
fi fi
if [[ "$restore" != true ]]; then if [[ "$restore" != true ]]; then
EmitError "Toolset version $toolsetVersion has not been restored." EmitError "Toolset version $toolset_version has not been restored."
ExitWithExitCode 2 ExitWithExitCode 2
fi fi
@ -460,4 +460,4 @@ mkdir -p "$log_dir"
if [[ $ci == true ]]; then if [[ $ci == true ]]; then
export TEMP="$temp_dir" export TEMP="$temp_dir"
export TMP="$temp_dir" export TMP="$temp_dir"
fi fi

View File

@ -0,0 +1,5 @@
# We can't use already installed dotnet cli since we need to install additional shared runtimes.
# We could potentially try to find an existing installation that has all the required runtimes,
# but it's unlikely one will be available.
$script:useInstalledDotNetCli = $false

7
eng/configure-toolset.sh Normal file
View File

@ -0,0 +1,7 @@
# We can't use already installed dotnet cli since we need to install additional shared runtimes.
# We could potentially try to find an existing installation that has all the required runtimes,
# but it's unlikely one will be available.
if [ "${DotNetBuildFromSource:-false}" = false ]; then
use_installed_dotnet_cli="false"
fi

View File

@ -1,7 +1,15 @@
<Project Sdk="Microsoft.DotNet.Helix.Sdk" DefaultTargets="Test"> <Project Sdk="Microsoft.DotNet.Helix.Sdk" DefaultTargets="Test" TreatAsLocalProperty="ProjectToBuild">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Helix.Common.props" /> <PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\..\build\repo.props" /> <!--
When invoking helix.proj for the whole repo with build.cmd, ProjectToBuild will be set to the path to this project.
This must be reset in order for Build.props to evaluate a list of projects to be tested on Helix.
-->
<ProjectToBuild Condition="'$(ProjectToBuild)' == '$(MSBuildProjectFullPath)'"/>
</PropertyGroup>
<Import Project="..\targets\Helix.Common.props" />
<Import Project="..\Build.props" />
<ItemGroup> <ItemGroup>
<HelixTargetQueue Include="@(HelixAvailableTargetQueue)" /> <HelixTargetQueue Include="@(HelixAvailableTargetQueue)" />
@ -16,7 +24,7 @@
<MaxRetryCount Condition="'$(MaxRetryCount)' == ''">2</MaxRetryCount> <MaxRetryCount Condition="'$(MaxRetryCount)' == ''">2</MaxRetryCount>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(CI)' == 'true' "> <PropertyGroup Condition=" '$(ContinuousIntegrationBuild)' == 'true' ">
<HelixType>ci</HelixType> <HelixType>ci</HelixType>
<Creator>aspnetcore</Creator> <Creator>aspnetcore</Creator>
<HelixBuild>$(BUILD_BUILDNUMBER).$(SYSTEM_JOBATTEMPT)</HelixBuild> <HelixBuild>$(BUILD_BUILDNUMBER).$(SYSTEM_JOBATTEMPT)</HelixBuild>
@ -25,11 +33,11 @@
<FailOnMissionControlTestFailure>true</FailOnMissionControlTestFailure> <FailOnMissionControlTestFailure>true</FailOnMissionControlTestFailure>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(CI)' != 'true' "> <PropertyGroup Condition=" '$(ContinuousIntegrationBuild)' != 'true' ">
<HelixType>dev</HelixType> <HelixType>dev</HelixType>
<Creator>$(USERNAME)</Creator> <Creator>$(USERNAME)</Creator>
<Creator Condition="'$(USERNAME)' == ''">$(USER)</Creator> <Creator Condition="'$(USERNAME)' == ''">$(USER)</Creator>
<HelixBuild>$([System.DateTime]::Now.ToString('yyyyMMdd HH:mm'))</HelixBuild> <HelixBuild>$([System.DateTime]::Now.ToString('yyyyMMddHHmm'))</HelixBuild>
</PropertyGroup> </PropertyGroup>
<Target Name="Gather" BeforeTargets="Build"> <Target Name="Gather" BeforeTargets="Build">

View File

@ -1,60 +0,0 @@
<#
.SYNOPSIS
This adds the complete closure of project references to a .sln file
.EXAMPLE
Let's say you have a folder of projects in src/Banana/, and a file src/Banana/Banana.sln.
To traverse the ProjectReference graph to add all dependency projects, run this script:
./eng/scripts/AddAllProjectRefsToSolution.ps1 -WorkingDir ./src/Banana/
.EXAMPLE
If src/Banana/ has multiple .sln files, use the -sln parameter.
./eng/scripts/AddAllProjectRefsToSolution.ps1 -WorkingDir ./src/Banana/ -SolutionFile src/Banana/Solution1.sln
#>
[CmdletBinding(PositionalBinding = $false)]
param(
[string]$WorkingDir,
[Alias('sln')]
[string]$SolutionFile
)
$ErrorActionPreference = 'Stop'
$repoRoot = Resolve-Path "$PSScriptRoot/../../"
$listFile = New-TemporaryFile
if (-not $WorkingDir) {
$WorkingDir = Get-Location
}
Push-Location $WorkingDir
try {
if (-not $SolutionFile) {
$slnCount = Get-ChildItem *.sln | Measure
if ($slnCount.count -eq 0) {
Write-Error "Could not find a solution in this directory. Specify one with -sln <PATH>"
exit 1
}
if ($slnCount.count -gt 1) {
Write-Error "Multiple solutions found in this directory. Specify which one to modify with -sln <PATH>"
exit 1
}
$SolutionFile = Get-ChildItem *.sln | select -first 1
}
& "$repoRoot\build.ps1" -projects "$(Get-Location)\**\*.*proj" /t:ShowProjectClosure "/p:ProjectsReferencedOutFile=$listFile"
foreach ($proj in (Get-Content $listFile)) {
& dotnet sln $SolutionFile add $proj
if ($lastexitcode -ne 0) {
Write-Warning "Failed to add $proj to $SolutionFile"
}
}
}
finally {
Pop-Location
rm $listFile -ea ignore
}

View File

@ -43,9 +43,11 @@ function LogError {
try { try {
if ($ci) { if ($ci) {
# Install dotnet.exe # Install dotnet.exe
& $repoRoot/build.ps1 -ci -norestore /t:InstallDotNet & $repoRoot/restore.cmd -ci -NoBuildNodeJS
} }
. "$repoRoot/activate.ps1"
# #
# Duplicate .csproj files can cause issues with a shared build output folder # Duplicate .csproj files can cause issues with a shared build output folder
# #
@ -55,7 +57,7 @@ try {
# Ignore duplicates in submodules. These should be isolated from the rest of the build. # Ignore duplicates in submodules. These should be isolated from the rest of the build.
# Ignore duplicates in the .ref folder. This is expected. # Ignore duplicates in the .ref folder. This is expected.
Get-ChildItem -Recurse "$repoRoot/src/*.*proj" ` Get-ChildItem -Recurse "$repoRoot/src/*.*proj" `
| ? { $_.FullName -notmatch 'submodules' } ` | ? { $_.FullName -notmatch 'submodules' -and $_.FullName -notmatch 'node_modules' } `
| ? { (Split-Path -Leaf (Split-Path -Parent $_)) -ne 'ref' } ` | ? { (Split-Path -Leaf (Split-Path -Parent $_)) -ne 'ref' } `
| % { | % {
$fileName = [io.path]::GetFileNameWithoutExtension($_) $fileName = [io.path]::GetFileNameWithoutExtension($_)
@ -122,10 +124,6 @@ try {
-filepath "$repoRoot\eng\Versions.props" -filepath "$repoRoot\eng\Versions.props"
} }
#
# Solutions
#
Write-Host "Checking that solutions are up to date" Write-Host "Checking that solutions are up to date"
Get-ChildItem "$repoRoot/*.sln" -Recurse ` Get-ChildItem "$repoRoot/*.sln" -Recurse `
@ -164,17 +162,13 @@ try {
} }
Write-Host "Re-generating package baselines" Write-Host "Re-generating package baselines"
$dotnet = 'dotnet'
if ($ci) {
$dotnet = "$repoRoot/.dotnet/dotnet.exe"
}
Invoke-Block { Invoke-Block {
& $dotnet run -p "$repoRoot/eng/tools/BaselineGenerator/" & dotnet run -p "$repoRoot/eng/tools/BaselineGenerator/"
} }
Write-Host "Re-generating Browser.JS files" Write-Host "Re-generating Browser.JS files"
Invoke-Block { Invoke-Block {
& $dotnet build "$repoRoot\src\Components\Browser.JS\Microsoft.AspNetCore.Components.Browser.JS.npmproj" & dotnet build "$repoRoot\src\Components\Browser.JS\Microsoft.AspNetCore.Components.Browser.JS.npmproj"
} }
Write-Host "Run git diff to check for pending changes" Write-Host "Run git diff to check for pending changes"

View File

@ -5,4 +5,6 @@ $ErrorActionPreference = 'stop'
$repoRoot = Resolve-Path "$PSScriptRoot/../.." $repoRoot = Resolve-Path "$PSScriptRoot/../.."
& "$repoRoot\build.ps1" -ci:$ci -NoRestore -all /t:GenerateProjectList & "$repoRoot\eng\common\msbuild.ps1" -ci:$ci "$repoRoot/eng/CodeGen.proj" `
/t:GenerateProjectList `
/bl:artifacts/log/genprojlist.binlog

View File

@ -5,4 +5,6 @@ $ErrorActionPreference = 'stop'
$repoRoot = Resolve-Path "$PSScriptRoot/../.." $repoRoot = Resolve-Path "$PSScriptRoot/../.."
& "$repoRoot\build.ps1" -ci:$ci -BuildManaged -NoBuildNodeJS /t:GenerateReferenceSources & "$repoRoot\eng\common\msbuild.ps1" -ci:$ci "$repoRoot/eng/CodeGen.proj" `
/t:GenerateReferenceSources `
/bl:artifacts/log/genrefassemblies.binlog

View File

@ -45,14 +45,18 @@ _kill iisexpresstray.exe
_kill w3wp.exe _kill w3wp.exe
_kill msbuild.exe _kill msbuild.exe
_kill vbcscompiler.exe _kill vbcscompiler.exe
_kill git.exe
_kill vctip.exe _kill vctip.exe
_kill chrome.exe
_kill h2spec.exe _kill h2spec.exe
_kill WerFault.exe _kill WerFault.exe
_killJavaInstances _killJavaInstances
_killSeleniumTrackedProcesses _killSeleniumTrackedProcesses
# Special case these. When testing with -ci locally, you typically don't actually want to kill your browser or git command line
if ($env:TF_BUILD) {
_kill chrome.exe
_kill git.exe
}
if (Get-Command iisreset -ErrorAction ignore) { if (Get-Command iisreset -ErrorAction ignore) {
iisreset /restart iisreset /restart
} }

View File

@ -1,6 +0,0 @@
@ECHO OFF
SET RepoRoot=%~dp0..\..
%RepoRoot%\build.cmd -ci -all -pack -sign %*
SET exit_code=%ERRORLEVEL%
ECHO build.cmd completed
EXIT /b %exit_code%

View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
export PATH="$PATH:$HOME/nginxinstall/sbin/"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
repo_root="$DIR/../.."
"$repo_root/build.sh" --ci --all --pack "$@"

View File

@ -4,3 +4,4 @@ curl -sSL http://nginx.org/download/nginx-1.14.2.tar.gz | tar zxfv - -C /tmp &&
./configure --prefix=$HOME/nginxinstall --with-http_ssl_module ./configure --prefix=$HOME/nginxinstall --with-http_ssl_module
make make
make install make install
echo "##vso[task.prependpath]$HOME/nginxinstall/sbin"

View File

@ -1,8 +0,0 @@
*/AppHostTemplate/apphost.exe;AspNetCoreRuntime.*.nupkg; Exclude the apphost because this is expected to be code-signed by customers after the SDK modifies it.
*/runtime.*.microsoft.netcore.dotnetapphost/*/apphost.exe;Microsoft.AspNetCore.AzureAppServices.SiteExtension.*.nupkg; Exclude the apphost because this is expected to be code-signed by customers after the SDK modifies it.
*.js;; Exclude all JavaScript files from codesigning because we don't expect these to run on Windows Script Host
*.binlog;; Exclude msbuild log files
*.symbols.nupkg;; Exclude NuGet symbols packages. These are not shipped to customers and should not be code signed.
;*.symbols.nupkg; Exclude everything inside NuGet symbols packages. These are not shipped to customers and should not be code signed.
;runtime.osx-x64.Microsoft.AspNetCore.App.*.nupkg; Exclude the contents of the MacOS runtime package because MacOS only supports codesigning for MacOS native binaries and apps
;runtime.linux-*.Microsoft.AspNetCore.App.*.nupkg; Exclude the contents of the Linux runtime packages because Linux doesn't support validating authenticode signatures

View File

@ -13,12 +13,12 @@
This target is meant to be used when invoking helix tests on one project at a time. This target is meant to be used when invoking helix tests on one project at a time.
Usage: dotnet build /t:Helix src/MyTestProject.csproj Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
--> -->
<Target Name="Helix"> <Target Name="Helix">
<MSBuild Projects="$(MSBuildThisFileDirectory)..\helix\helix.proj" <MSBuild Projects="$(MSBuildThisFileDirectory)..\helix\helix.proj"
Properties="Projects=$(MSBuildProjectFullPath)" /> Properties="ProjectToBuild=$(MSBuildProjectFullPath)" />
</Target> </Target>
<!-- Build the actual helix work items to send to helix queues --> <!-- Build the actual helix work items to send to helix queues -->

View File

@ -1,7 +1,7 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<NpmTestArgs>test</NpmTestArgs> <NpmTestArgs>test</NpmTestArgs>
<Configuration Condition="'$(Configuration)' == '' AND '$(CI)' == 'true'">Release</Configuration> <Configuration Condition="'$(Configuration)' == '' AND '$(ContinuousIntegrationBuild)' == 'true'">Release</Configuration>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -40,6 +40,7 @@
<Exec Condition="'$(OS)' != 'Windows_NT'" <Exec Condition="'$(OS)' != 'Windows_NT'"
Command="echo '$(ProjectListContentLines.Replace('\t','\\t'))' > $(_RefProjectFileOutputPath)" /> Command="echo '$(ProjectListContentLines.Replace('\t','\\t'))' > $(_RefProjectFileOutputPath)" />
<Message Importance="High" Text="Generated $(_RefProjectFileOutputPath)" />
</Target> </Target>
<Target Name="_GenerateProjectSourceInner" Returns="@(ProjectListContent)" DependsOnTargets="Build" Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'"> <Target Name="_GenerateProjectSourceInner" Returns="@(ProjectListContent)" DependsOnTargets="Build" Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">
@ -65,6 +66,7 @@
</PropertyGroup> </PropertyGroup>
<MakeDir Directories="$(_RefSourceOutputPath)" /> <MakeDir Directories="$(_RefSourceOutputPath)" />
<Message Importance="High" Text="Generating $(_RefSourceFileOutputPath)" />
<Exec Command="$(_GenAPICmd)" /> <Exec Command="$(_GenAPICmd)" />
<ItemGroup> <ItemGroup>

View File

@ -103,10 +103,6 @@
</ProjectReference> </ProjectReference>
<Reference Remove="@(_ProjectReferenceByAssemblyName)" /> <Reference Remove="@(_ProjectReferenceByAssemblyName)" />
<!-- Use _ReferenceTemp to workaround issues in Visual Studio which causes a conflict between Reference, packages, and projects. -->
<_ReferenceTemp Include="@(Reference)" />
<Reference Remove="@(Reference)" />
</ItemGroup> </ItemGroup>
<!-- <!--
@ -135,9 +131,6 @@
--> -->
<Target Name="ResolveCustomReferences" BeforeTargets="CollectPackageReferences;ResolveAssemblyReferencesDesignTime;ResolveAssemblyReferences" Condition=" '$(TargetFramework)' != '' "> <Target Name="ResolveCustomReferences" BeforeTargets="CollectPackageReferences;ResolveAssemblyReferencesDesignTime;ResolveAssemblyReferences" Condition=" '$(TargetFramework)' != '' ">
<ItemGroup> <ItemGroup>
<Reference Include="@(_ReferenceTemp)" />
<_ReferenceTemp Remove="@(_ReferenceTemp)" />
<!-- Ensure only content asset are consumed from .Sources packages --> <!-- Ensure only content asset are consumed from .Sources packages -->
<Reference> <Reference>
<IncludeAssets Condition="'%(IsSharedSource)' == 'true'">ContentFiles;Build</IncludeAssets> <IncludeAssets Condition="'%(IsSharedSource)' == 'true'">ContentFiles;Build</IncludeAssets>

View File

@ -1,2 +1,9 @@
<Project> <Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />
<PropertyGroup>
<IsPackable>false</IsPackable>
<HasReferenceAssembly>false</HasReferenceAssembly>
<DisablePackageReferenceRestrictions>true</DisablePackageReferenceRestrictions>
</PropertyGroup>
</Project> </Project>

View File

@ -1,2 +0,0 @@
<Project>
</Project>

View File

@ -98,6 +98,7 @@ namespace RepoTasks
stream.Position = 0; stream.Position = 0;
stream.SetLength(0); stream.SetLength(0);
rawNuspec.Save(stream); rawNuspec.Save(stream);
Log.LogMessage(MessageImportance.High, "Added <frameworkReference> to {0}", fileName);
} }
else else
{ {

View File

@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net472</TargetFrameworks>
<DefineConstants Condition="'$(TargetFramework)' == 'net472'">$(DefineConstants);BUILD_MSI_TASKS</DefineConstants>
<Optimize>false</Optimize>
<DebugType>embedded</DebugType>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.Build.Tasks" Version="5.1.0-rtm.5921" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<PackageReference Include="Microsoft.Build.Framework" Version="15.8.166" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="15.8.166" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.8.166" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<PackageReference Include="Wix" Version="3.11.1" />
<Reference Include="Microsoft.Build" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Tasks.v4.0" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Microsoft.Deployment.WindowsInstaller">
<HintPath>$(WiXSdkPath)\Microsoft.Deployment.WindowsInstaller.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Deployment.WindowsInstaller.Package">
<HintPath>$(WiXSdkPath)\Microsoft.Deployment.WindowsInstaller.Package.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@ -0,0 +1,12 @@
<Project>
<PropertyGroup>
<_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' == 'core'">netcoreapp3.0</_RepoTaskAssemblyFolder>
<_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' != 'core'">net472</_RepoTaskAssemblyFolder>
<_RepoTaskAssembly>$(ArtifactsBinDir)RepoTasks\Release\$(_RepoTaskAssemblyFolder)\RepoTasks.dll</_RepoTaskAssembly>
</PropertyGroup>
<UsingTask TaskName="RepoTasks.GenerateGuid" AssemblyFile="$(_RepoTaskAssembly)" Condition="'$(MSBuildRuntimeType)' != 'core'" />
<UsingTask TaskName="RepoTasks.GetMsiProperty" AssemblyFile="$(_RepoTaskAssembly)" Condition="'$(MSBuildRuntimeType)' != 'core'" />
<UsingTask TaskName="RepoTasks.GenerateSharedFrameworkDepsFile" AssemblyFile="$(_RepoTaskAssembly)" />
<UsingTask TaskName="RepoTasks.RemoveSharedFrameworkDependencies" AssemblyFile="$(_RepoTaskAssembly)" />
</Project>

View File

@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.0.0
MinimumVisualStudioVersion = 16.0.0.0 MinimumVisualStudioVersion = 16.0.0.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BaselineGenerator", "BaselineGenerator\BaselineGenerator.csproj", "{CF76A947-3A72-4824-87E6-BF029D84218B}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BaselineGenerator", "BaselineGenerator\BaselineGenerator.csproj", "{CF76A947-3A72-4824-87E6-BF029D84218B}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RepoTasks", "RepoTasks\RepoTasks.csproj", "{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -30,5 +32,17 @@ Global
{CF76A947-3A72-4824-87E6-BF029D84218B}.Release|x64.Build.0 = Release|Any CPU {CF76A947-3A72-4824-87E6-BF029D84218B}.Release|x64.Build.0 = Release|Any CPU
{CF76A947-3A72-4824-87E6-BF029D84218B}.Release|x86.ActiveCfg = Release|Any CPU {CF76A947-3A72-4824-87E6-BF029D84218B}.Release|x86.ActiveCfg = Release|Any CPU
{CF76A947-3A72-4824-87E6-BF029D84218B}.Release|x86.Build.0 = Release|Any CPU {CF76A947-3A72-4824-87E6-BF029D84218B}.Release|x86.Build.0 = Release|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Debug|x64.ActiveCfg = Debug|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Debug|x64.Build.0 = Debug|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Debug|x86.ActiveCfg = Debug|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Debug|x86.Build.0 = Debug|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Release|Any CPU.Build.0 = Release|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Release|x64.ActiveCfg = Release|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Release|x64.Build.0 = Release|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Release|x86.ActiveCfg = Release|Any CPU
{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -4,11 +4,27 @@
}, },
"tools": { "tools": {
"dotnet": "3.0.100-preview5-011568", "dotnet": "3.0.100-preview5-011568",
"jdk": "11.0.3" "runtimes": {
"dotnet/x64": [
"$(MicrosoftNETCoreAppRuntimeVersion)"
],
"dotnet/x86": [
"$(MicrosoftNETCoreAppRuntimeVersion)"
]
},
"jdk": "11.0.3",
"vs": {
"version": "16.0",
"components": [
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.Windows10SDK.17134"
]
}
}, },
"msbuild-sdks": { "msbuild-sdks": {
"Yarn.MSBuild": "1.15.2", "Yarn.MSBuild": "1.15.2",
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19302.2", "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19312.4",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19302.2" "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19312.4"
} }
} }

View File

@ -1,2 +0,0 @@
version:3.0.0-build-20190606.1
commithash:2229c5dff7ca6384e7c17148a6da1aaee161f44d

View File

@ -1,23 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/master/tools/korebuild.schema.json",
"channel": "master",
"msbuildType": "full",
"toolsets": {
"nodejs": {
"minVersion": "10.0",
"required": true
},
"visualstudio": {
"required": [
"Windows"
],
"includePrerelease": true,
"versionRange": "[16.0, 17.0)",
"requiredWorkloads": [
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.Windows10SDK.17134"
]
}
}
}

View File

@ -17,7 +17,7 @@
<ContentTargetFolders>contentFiles</ContentTargetFolders> <ContentTargetFolders>contentFiles</ContentTargetFolders>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences> <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<DefaultExcludeItems>$(DefaultExcludeItems);$(BaseOutputPath);$(BaseIntermediateOutputPath);</DefaultExcludeItems> <DefaultExcludeItems>$(DefaultExcludeItems);$(BaseOutputPath);$(BaseIntermediateOutputPath);</DefaultExcludeItems>
<NoWarn>$(NoWarn);NU5105;CS8021</NoWarn> <NoWarn>$(NoWarn);CS8021</NoWarn>
<IsProjectReferenceProvider>false</IsProjectReferenceProvider> <IsProjectReferenceProvider>false</IsProjectReferenceProvider>
</PropertyGroup> </PropertyGroup>

View File

@ -24,7 +24,7 @@
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<UseCodebase>true</UseCodebase> <UseCodebase>true</UseCodebase>
<GeneratePkgDefFile>true</GeneratePkgDefFile> <GeneratePkgDefFile>true</GeneratePkgDefFile>
<DeployProjectOutput Condition="'$(CI)' == 'true'">false</DeployProjectOutput> <DeployProjectOutput Condition="'$(ContinuousIntegrationBuild)' == 'true'">false</DeployProjectOutput>
<DisablePackageReferenceRestrictions>true</DisablePackageReferenceRestrictions> <DisablePackageReferenceRestrictions>true</DisablePackageReferenceRestrictions>
</PropertyGroup> </PropertyGroup>

View File

@ -18,6 +18,12 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Hosting\Server.IntegrationTesting\src\Microsoft.AspNetCore.Server.IntegrationTesting.csproj" /> <ProjectReference Include="$(RepoRoot)src\Hosting\Server.IntegrationTesting\src\Microsoft.AspNetCore.Server.IntegrationTesting.csproj" />
<ProjectReference Include="$(RepoRoot)src\Servers\IIS\IntegrationTesting.IIS\src\Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj" /> <ProjectReference Include="$(RepoRoot)src\Servers\IIS\IntegrationTesting.IIS\src\Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj" />
<ProjectReference Include="$(RepoRoot)src\DefaultBuilder\testassets\CreateDefaultBuilderApp\CreateDefaultBuilderApp.csproj" ReferenceOutputAssemblies="false" />
<ProjectReference Include="$(RepoRoot)src\DefaultBuilder\testassets\CreateDefaultBuilderOfTApp\CreateDefaultBuilderOfTApp.csproj" ReferenceOutputAssemblies="false" />
<ProjectReference Include="$(RepoRoot)src\DefaultBuilder\testassets\DependencyInjectionApp\DependencyInjectionApp.csproj" ReferenceOutputAssemblies="false" />
<ProjectReference Include="$(RepoRoot)src\DefaultBuilder\testassets\StartRequestDelegateUrlApp\StartRequestDelegateUrlApp.csproj" ReferenceOutputAssemblies="false" />
<ProjectReference Include="$(RepoRoot)src\DefaultBuilder\testassets\StartRouteBuilderUrlApp\StartRouteBuilderUrlApp.csproj" ReferenceOutputAssemblies="false" />
<ProjectReference Include="$(RepoRoot)src\DefaultBuilder\testassets\StartWithIApplicationBuilderUrlApp\StartWithIApplicationBuilderUrlApp.csproj" ReferenceOutputAssemblies="false" />
<Reference Include="Microsoft.AspNetCore" /> <Reference Include="Microsoft.AspNetCore" />
<Reference Include="Microsoft.Extensions.Logging.Testing" /> <Reference Include="Microsoft.Extensions.Logging.Testing" />

View File

@ -173,7 +173,8 @@ namespace Microsoft.AspNetCore.Hosting
options.ValidateScopes = true; options.ValidateScopes = true;
}); });
Assert.Throws<InvalidOperationException>(() => hostBuilder.Build().Start()); using var host = hostBuilder.Build();
Assert.Throws<InvalidOperationException>(() => host.Start());
} }
[Theory] [Theory]
@ -200,7 +201,8 @@ namespace Microsoft.AspNetCore.Hosting
options.ValidateScopes = true; options.ValidateScopes = true;
}); });
Assert.Throws<InvalidOperationException>(() => hostBuilder.Build().Start()); using var host = hostBuilder.Build();
Assert.Throws<InvalidOperationException>(() => host.Start());
Assert.True(configurationCallbackCalled); Assert.True(configurationCallbackCalled);
} }
@ -559,7 +561,6 @@ namespace Microsoft.AspNetCore.Hosting
#pragma warning restore CS0618 // Type or member is obsolete #pragma warning restore CS0618 // Type or member is obsolete
} }
} }
[Theory] [Theory]
[MemberData(nameof(DefaultWebHostBuildersWithConfig))] [MemberData(nameof(DefaultWebHostBuildersWithConfig))]
public void BuildAndDispose(IWebHostBuilder builder) public void BuildAndDispose(IWebHostBuilder builder)
@ -653,10 +654,13 @@ namespace Microsoft.AspNetCore.Hosting
[MemberData(nameof(DefaultWebHostBuilders))] [MemberData(nameof(DefaultWebHostBuilders))]
public void DefaultWebHostBuilderWithNoStartupThrows(IWebHostBuilder builder) public void DefaultWebHostBuilderWithNoStartupThrows(IWebHostBuilder builder)
{ {
var host = builder builder.UseServer(new TestServer());
.UseServer(new TestServer());
var ex = Assert.Throws<InvalidOperationException>(() => host.Build().Start()); var ex = Assert.Throws<InvalidOperationException>(() =>
{
using var host = builder.Build();
host.Start();
});
Assert.Contains("No application configured.", ex.Message); Assert.Contains("No application configured.", ex.Message);
} }
@ -701,7 +705,7 @@ namespace Microsoft.AspNetCore.Hosting
[MemberData(nameof(DefaultWebHostBuilders))] [MemberData(nameof(DefaultWebHostBuilders))]
public void DefaultApplicationNameWithUseStartupOfType(IWebHostBuilder builder) public void DefaultApplicationNameWithUseStartupOfType(IWebHostBuilder builder)
{ {
var host = builder using var host = builder
.UseServer(new TestServer()) .UseServer(new TestServer())
.UseStartup(typeof(StartupNoServicesNoInterface)) .UseStartup(typeof(StartupNoServicesNoInterface))
.Build(); .Build();
@ -1130,7 +1134,8 @@ namespace Microsoft.AspNetCore.Hosting
}) })
.UseServer(new TestServer()); .UseServer(new TestServer());
Assert.Throws<InvalidOperationException>(() => builder.Build().Start()); using var host = builder.Build();
Assert.Throws<InvalidOperationException>(() => host.Start());
Assert.NotNull(testSink); Assert.NotNull(testSink);
Assert.Contains(testSink.Writes, w => w.Exception?.Message == "Startup exception"); Assert.Contains(testSink.Writes, w => w.Exception?.Message == "Startup exception");
@ -1178,7 +1183,8 @@ namespace Microsoft.AspNetCore.Hosting
var exception = await Assert.ThrowsAsync<InvalidOperationException>(async () => var exception = await Assert.ThrowsAsync<InvalidOperationException>(async () =>
{ {
var host = hostBuilder.Build(); using var host = hostBuilder.Build();
var filter = (MyStartupFilter)host.Services.GetServices<IStartupFilter>().FirstOrDefault(s => s is MyStartupFilter); var filter = (MyStartupFilter)host.Services.GetServices<IStartupFilter>().FirstOrDefault(s => s is MyStartupFilter);
Assert.NotNull(filter); Assert.NotNull(filter);
try try
@ -1214,11 +1220,9 @@ namespace Microsoft.AspNetCore.Hosting
Assert.Equal("nestedvalue", builder.GetSetting("key")); Assert.Equal("nestedvalue", builder.GetSetting("key"));
using (var host = builder.Build()) using var host = builder.Build();
{ var appConfig = host.Services.GetRequiredService<IConfiguration>();
var appConfig = host.Services.GetRequiredService<IConfiguration>(); Assert.Equal("nestedvalue", appConfig["key"]);
Assert.Equal("nestedvalue", appConfig["key"]);
}
} }
[Theory] [Theory]
@ -1232,12 +1236,14 @@ namespace Microsoft.AspNetCore.Hosting
}) })
.UseServer(new TestServer()); .UseServer(new TestServer());
var host = builder.Build(); using (var host = builder.Build())
var startEx = await Assert.ThrowsAsync<InvalidOperationException>(() => host.StartAsync()); {
Assert.Equal("Hosted Service throws in StartAsync", startEx.Message); var startEx = await Assert.ThrowsAsync<InvalidOperationException>(() => host.StartAsync());
var stopEx = await Assert.ThrowsAsync<AggregateException>(() => host.StopAsync()); Assert.Equal("Hosted Service throws in StartAsync", startEx.Message);
Assert.Single(stopEx.InnerExceptions); var stopEx = await Assert.ThrowsAsync<AggregateException>(() => host.StopAsync());
Assert.Equal("Hosted Service throws in StopAsync", stopEx.InnerExceptions[0].Message); Assert.Single(stopEx.InnerExceptions);
Assert.Equal("Hosted Service throws in StopAsync", stopEx.InnerExceptions[0].Message);
}
} }
[Theory] [Theory]
@ -1252,7 +1258,7 @@ namespace Microsoft.AspNetCore.Hosting
}) })
.UseServer(new TestServer()); .UseServer(new TestServer());
var host = builder.Build(); using var host = builder.Build();
var service = host.Services.GetServices<IHostedService>().OfType<NonThrowingHostedService>().First(); var service = host.Services.GetServices<IHostedService>().OfType<NonThrowingHostedService>().First();
var startEx = await Assert.ThrowsAsync<InvalidOperationException>(() => host.StartAsync()); var startEx = await Assert.ThrowsAsync<InvalidOperationException>(() => host.StartAsync());
Assert.Equal("Hosted Service throws in StartAsync", startEx.Message); Assert.Equal("Hosted Service throws in StartAsync", startEx.Message);

View File

@ -35,6 +35,8 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
+ $" --output \"{publishDirectory.FullName}\"" + $" --output \"{publishDirectory.FullName}\""
+ $" --framework {deploymentParameters.TargetFramework}" + $" --framework {deploymentParameters.TargetFramework}"
+ $" --configuration {deploymentParameters.Configuration}" + $" --configuration {deploymentParameters.Configuration}"
// avoids triggering builds of dependencies of the test app which could cause issues like https://github.com/dotnet/arcade/issues/2941
+ $" --no-dependencies"
+ $" /p:TargetArchitecture={deploymentParameters.RuntimeArchitecture}" + $" /p:TargetArchitecture={deploymentParameters.RuntimeArchitecture}"
+ " --no-restore"; + " --no-restore";

View File

@ -237,7 +237,9 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
{ {
VaryByAncmHostingModel(variants, server, tfm, type, arch, archSkip); VaryByAncmHostingModel(variants, server, tfm, type, arch, archSkip);
} }
else
// TODO: remove this workaround: https://github.com/aspnet/AspNetCore/issues/11301
else if (string.IsNullOrEmpty(archSkip))
{ {
variants.Add(new TestVariant() variants.Add(new TestVariant()
{ {
@ -289,15 +291,19 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
} }
} }
variants.Add(new TestVariant() // TODO: remove this workaround: https://github.com/aspnet/AspNetCore/issues/11301
if (string.IsNullOrEmpty(skipAncm))
{ {
Server = server, variants.Add(new TestVariant()
Tfm = tfm, {
ApplicationType = type, Server = server,
Architecture = arch, Tfm = tfm,
HostingModel = hostingModel, ApplicationType = type,
Skip = skipAncm, Architecture = arch,
}); HostingModel = hostingModel,
Skip = skipAncm,
});
}
} }
} }

View File

@ -477,7 +477,7 @@ namespace Microsoft.AspNetCore.TestHost
return Task.FromResult(0); return Task.FromResult(0);
} }
} }
[Fact] [Fact]
public async Task ClientHandlerCreateContextWithDefaultRequestParameters() public async Task ClientHandlerCreateContextWithDefaultRequestParameters()
{ {

View File

@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.TestHost
public async Task GenericRawCreate() public async Task GenericRawCreate()
{ {
var server = new TestServer(); var server = new TestServer();
var host = new HostBuilder() using var host = new HostBuilder()
.ConfigureWebHost(webBuilder => .ConfigureWebHost(webBuilder =>
{ {
webBuilder webBuilder
@ -48,7 +48,7 @@ namespace Microsoft.AspNetCore.TestHost
[Fact] [Fact]
public async Task GenericCreateAndStartHost_GetTestServer() public async Task GenericCreateAndStartHost_GetTestServer()
{ {
var host = await new HostBuilder() using var host = await new HostBuilder()
.ConfigureWebHost(webBuilder => .ConfigureWebHost(webBuilder =>
{ {
webBuilder webBuilder
@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.TestHost
[Fact] [Fact]
public async Task GenericCreateAndStartHost_GetTestClient() public async Task GenericCreateAndStartHost_GetTestClient()
{ {
var host = await new HostBuilder() using var host = await new HostBuilder()
.ConfigureWebHost(webBuilder => .ConfigureWebHost(webBuilder =>
{ {
webBuilder webBuilder
@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.TestHost
.Configure(app => { }) .Configure(app => { })
.UseTestServer(); .UseTestServer();
var host = builder.Build(); using var host = builder.Build();
host.Start(); host.Start();
} }

View File

@ -17,6 +17,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Hosting\Server.IntegrationTesting\src\Microsoft.AspNetCore.Server.IntegrationTesting.csproj" /> <ProjectReference Include="$(RepoRoot)src\Hosting\Server.IntegrationTesting\src\Microsoft.AspNetCore.Server.IntegrationTesting.csproj" />
<ProjectReference Include="$(RepoRoot)src\Hosting\test\testassets\IStartupInjectionAssemblyName\IStartupInjectionAssemblyName.csproj" ReferenceOutputAssemblies="false" />
<Reference Include="Microsoft.AspNetCore.Hosting" /> <Reference Include="Microsoft.AspNetCore.Hosting" />
<Reference Include="Microsoft.Extensions.Logging.Console" /> <Reference Include="Microsoft.Extensions.Logging.Console" />

View File

@ -322,6 +322,8 @@ namespace Microsoft.AspNetCore.Identity.Test
// Assert // Assert
Assert.True(result.Succeeded); Assert.True(result.Succeeded);
manager.Verify(); manager.Verify();
AppContext.SetSwitch("Microsoft.AspNetCore.Identity.CheckPasswordSignInAlwaysResetLockoutOnSuccess", false);
} }
[Theory] [Theory]

View File

@ -21,6 +21,7 @@
<Target Name="GetTargetPath" Returns="$(TargetPath)" /> <Target Name="GetTargetPath" Returns="$(TargetPath)" />
<Target Name="Build" DependsOnTargets="DebBuild" /> <Target Name="Build" DependsOnTargets="DebBuild" />
<Target Name="Pack" />
<Target Name="DebBuild" DependsOnTargets="$(DebBuildDependsOn)"> <Target Name="DebBuild" DependsOnTargets="$(DebBuildDependsOn)">
<!-- Generate debian_config.json. We can't simply use WriteLinesToFile because of https://github.com/Microsoft/msbuild/issues/1622. Use our custom GenerateFileFromTemplate task instead --> <!-- Generate debian_config.json. We can't simply use WriteLinesToFile because of https://github.com/Microsoft/msbuild/issues/1622. Use our custom GenerateFileFromTemplate task instead -->

View File

@ -12,6 +12,17 @@
<PackageSummary>ASP.NET Core Targeting Pack</PackageSummary> <PackageSummary>ASP.NET Core Targeting Pack</PackageSummary>
<PackageDescription>Provides a default set of APIs for building an ASP.NET Core $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion) application. Contains reference assemblies, documentation, and other design-time assets.</PackageDescription> <PackageDescription>Provides a default set of APIs for building an ASP.NET Core $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion) application. Contains reference assemblies, documentation, and other design-time assets.</PackageDescription>
<!-- Needed some creativity to convert the PackageVersion M.N.P-PreReleaseVersionLabel-Build to the installer version M.N.P~PreReleaseVersionLabel-Build, The conditional handles stabilized builds -->
<DotnetTargetingPackDependencyVersion>$(MicrosoftNETCoreAppRefPackageVersion)</DotnetTargetingPackDependencyVersion>
<DotnetTargetingPackDependencyVersion Condition="$(DotnetTargetingPackDependencyVersion.Contains('-'))">$(DotnetTargetingPackDependencyVersion.Substring(0, $(DotnetTargetingPackDependencyVersion.IndexOf('-'))))~$(DotnetTargetingPackDependencyVersion.Substring($([MSBuild]::Add($(DotnetTargetingPackDependencyVersion.IndexOf('-')), 1))))</DotnetTargetingPackDependencyVersion>
<PackageSummary>$(SharedFxProductName)</PackageSummary>
<PackageDescription>$(SharedFxDescription)</PackageDescription>
<DebianConfigProperties>
DotnetTargetingPackDependencyVersion=$(DotnetTargetingPackDependencyVersion);
</DebianConfigProperties>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -30,7 +30,7 @@
"debian_dependencies": { "debian_dependencies": {
"dotnet-targeting-pack-${AspNetCoreMajorVersion}.${AspNetCoreMinorVersion}": { "dotnet-targeting-pack-${AspNetCoreMajorVersion}.${AspNetCoreMinorVersion}": {
"package_version": "${DotnetRuntimeDependencyVersion}" "package_version": "${DotnetTargetingPackDependencyVersion}"
} }
} }
} }

View File

@ -30,6 +30,7 @@
</PropertyGroup> </PropertyGroup>
<Target Name="Build" DependsOnTargets="RpmBuild" /> <Target Name="Build" DependsOnTargets="RpmBuild" />
<Target Name="Pack" />
<Target Name="RpmBuild" DependsOnTargets="$(RpmBuildDependsOn)"> <Target Name="RpmBuild" DependsOnTargets="$(RpmBuildDependsOn)">
<!-- Create layout: Create changelog --> <!-- Create layout: Create changelog -->

View File

@ -24,14 +24,6 @@
<Yarn Command="install --mutex network" /> <Yarn Command="install --mutex network" />
</Target> </Target>
<Target Name="_IsCustomRestoreTargetSupported" Returns="@(CustomRestoreTargets)" Condition="'$(BuildNodeJs)' == 'true'">
<ItemGroup>
<CustomRestoreTargets Include="$(MSBuildProjectFullPath)">
<Targets>YarnInstall</Targets>
</CustomRestoreTargets>
</ItemGroup>
</Target>
<Target Name="PrepublishScript" DependsOnTargets="YarnInstall" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' "> <Target Name="PrepublishScript" DependsOnTargets="YarnInstall" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
<Exec Command="node node_modules/webpack/bin/webpack.js" /> <Exec Command="node node_modules/webpack/bin/webpack.js" />
</Target> </Target>

View File

@ -28,14 +28,6 @@
<Yarn Command="install --mutex network" /> <Yarn Command="install --mutex network" />
</Target> </Target>
<Target Name="_IsCustomRestoreTargetSupported" Returns="@(CustomRestoreTargets)" Condition="'$(BuildNodeJs)' == 'true'">
<ItemGroup>
<CustomRestoreTargets Include="$(MSBuildProjectFullPath)">
<Targets>YarnInstall</Targets>
</CustomRestoreTargets>
</ItemGroup>
</Target>
<Target Name="PrepublishScript" DependsOnTargets="YarnInstall" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' "> <Target Name="PrepublishScript" DependsOnTargets="YarnInstall" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
<Exec Command="node node_modules/webpack/bin/webpack.js" /> <Exec Command="node node_modules/webpack/bin/webpack.js" />
</Target> </Target>

View File

@ -6,9 +6,6 @@
<TestGroupName>MusicStore.E2ETests</TestGroupName> <TestGroupName>MusicStore.E2ETests</TestGroupName>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<ServerGarbageCollection>true</ServerGarbageCollection> <ServerGarbageCollection>true</ServerGarbageCollection>
<WarningsNotAsErrors>$(WarningsNotAsErrors);xUnit1004</WarningsNotAsErrors>
<!-- Temporarily suppress warnings about Microsoft.AspNetCore.Server.IntegrationTesting -->
<NoWarn>$(NoWarn);NU1605</NoWarn>
<!-- Tests are disabled due to https://github.com/aspnet/AspNetCore-Internal/issues/1967 --> <!-- Tests are disabled due to https://github.com/aspnet/AspNetCore-Internal/issues/1967 -->
<SkipTests>true</SkipTests> <SkipTests>true</SkipTests>
<!-- https://github.com/aspnet/AspNetCore/issues/8343 --> <!-- https://github.com/aspnet/AspNetCore/issues/8343 -->

View File

@ -55,14 +55,8 @@
<Reference Include="AngleSharp" /> <Reference Include="AngleSharp" />
<Reference Include="Microsoft.AspNet.WebApi.Client" /> <Reference Include="Microsoft.AspNet.WebApi.Client" />
<Reference Include="Microsoft.AspNetCore.Routing.Abstractions" />
<!-- <Reference Include="Microsoft.AspNetCore.Routing" />
Explicitly referencing routing here to make it easy to integrate breaking changes. Localization.Routing brings in a transitive
reference to routing, which makes it hard to work with builds from a feature branch.
-->
<Reference Include="Microsoft.AspNetCore.Routing.Abstractions" NoWarn="NU1605" />
<Reference Include="Microsoft.AspNetCore.Routing" NoWarn="NU1605" />
<Reference Include="Microsoft.AspNetCore.TestHost" /> <Reference Include="Microsoft.AspNetCore.TestHost" />
<Reference Include="Microsoft.Extensions.Logging.Testing" /> <Reference Include="Microsoft.Extensions.Logging.Testing" />
</ItemGroup> </ItemGroup>

View File

@ -19,8 +19,8 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
public void TestingInfrastructure_WebHost_WithWebHostBuilderRespectsCustomizations() public void TestingInfrastructure_WebHost_WithWebHostBuilderRespectsCustomizations()
{ {
// Act // Act
var factory = new CustomizedFactory<BasicWebSite.StartupWithoutEndpointRouting>(); using var factory = new CustomizedFactory<BasicWebSite.StartupWithoutEndpointRouting>();
var customized = factory using var customized = factory
.WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("Customization")) .WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("Customization"))
.WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("FurtherCustomization")); .WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("FurtherCustomization"));
var client = customized.CreateClient(); var client = customized.CreateClient();
@ -38,8 +38,8 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
public void TestingInfrastructure_GenericHost_WithWithHostBuilderRespectsCustomizations() public void TestingInfrastructure_GenericHost_WithWithHostBuilderRespectsCustomizations()
{ {
// Act // Act
var factory = new CustomizedFactory<GenericHostWebSite.Startup>(); using var factory = new CustomizedFactory<GenericHostWebSite.Startup>();
var customized = factory using var customized = factory
.WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("Customization")) .WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("Customization"))
.WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("FurtherCustomization")); .WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("FurtherCustomization"));
var client = customized.CreateClient(); var client = customized.CreateClient();
@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
public void TestingInfrastructure_GenericHost_WithWithHostBuilderHasServices() public void TestingInfrastructure_GenericHost_WithWithHostBuilderHasServices()
{ {
// Act // Act
var factory = new CustomizedFactory<GenericHostWebSite.Startup>(); using var factory = new CustomizedFactory<GenericHostWebSite.Startup>();
// Assert // Assert
Assert.NotNull(factory.Services); Assert.NotNull(factory.Services);

View File

@ -48,7 +48,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
[Fact] [Fact]
public void TestingInfrastructure_CreateClientThrowsInvalidOperationForNonEntryPoint() public void TestingInfrastructure_CreateClientThrowsInvalidOperationForNonEntryPoint()
{ {
var factory = new WebApplicationFactory<ClassLibraryStartup>(); using var factory = new WebApplicationFactory<ClassLibraryStartup>();
var ex = Assert.Throws<InvalidOperationException>(() => factory.CreateClient()); var ex = Assert.Throws<InvalidOperationException>(() => factory.CreateClient());
Assert.Equal($"The provided Type '{typeof(RazorPagesClassLibrary.ClassLibraryStartup).Name}' does not belong to an assembly with an entry point. A common cause for this error is providing a Type from a class library.", Assert.Equal($"The provided Type '{typeof(RazorPagesClassLibrary.ClassLibraryStartup).Name}' does not belong to an assembly with an entry point. A common cause for this error is providing a Type from a class library.",
ex.Message); ex.Message);
@ -123,7 +123,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
[Fact] [Fact]
public async Task TestingInfrastructure_WorksWithGenericHost() public async Task TestingInfrastructure_WorksWithGenericHost()
{ {
var factory = new WebApplicationFactory<GenericHostWebSite.Program>() using var factory = new WebApplicationFactory<GenericHostWebSite.Program>()
.WithWebHostBuilder(builder => .WithWebHostBuilder(builder =>
builder.ConfigureTestServices(s => s.AddSingleton<GenericHostWebSite.TestGenericService, OverridenGenericService>())); builder.ConfigureTestServices(s => s.AddSingleton<GenericHostWebSite.TestGenericService, OverridenGenericService>()));
@ -135,7 +135,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
[Fact] [Fact]
public void TestingInfrastructure_HasServicesUsingWebHostProgram() public void TestingInfrastructure_HasServicesUsingWebHostProgram()
{ {
var factory = new WebApplicationFactory<BasicWebSite.Program>(); using var factory = new WebApplicationFactory<BasicWebSite.Program>();
Assert.NotNull(factory.Services); Assert.NotNull(factory.Services);
Assert.NotNull(factory.Services.GetService(typeof(IConfiguration))); Assert.NotNull(factory.Services.GetService(typeof(IConfiguration)));
@ -144,7 +144,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
[Fact] [Fact]
public void TestingInfrastructure_HasServicesUsingWebHostStartup() public void TestingInfrastructure_HasServicesUsingWebHostStartup()
{ {
var factory = new WebApplicationFactory<BasicWebSite.Startup>(); using var factory = new WebApplicationFactory<BasicWebSite.Startup>();
Assert.NotNull(factory.Services); Assert.NotNull(factory.Services);
Assert.NotNull(factory.Services.GetService(typeof(IConfiguration))); Assert.NotNull(factory.Services.GetService(typeof(IConfiguration)));
@ -153,7 +153,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
[Fact] [Fact]
public void TestingInfrastructure_HasServicesUsingGenericHostProgram() public void TestingInfrastructure_HasServicesUsingGenericHostProgram()
{ {
var factory = new WebApplicationFactory<GenericHostWebSite.Program>(); using var factory = new WebApplicationFactory<GenericHostWebSite.Program>();
Assert.NotNull(factory.Services); Assert.NotNull(factory.Services);
Assert.NotNull(factory.Services.GetService(typeof(IConfiguration))); Assert.NotNull(factory.Services.GetService(typeof(IConfiguration)));
@ -162,7 +162,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
[Fact] [Fact]
public void TestingInfrastructure_HasServicesUsingGenericHostStartup() public void TestingInfrastructure_HasServicesUsingGenericHostStartup()
{ {
var factory = new WebApplicationFactory<GenericHostWebSite.Startup>(); using var factory = new WebApplicationFactory<GenericHostWebSite.Startup>();
Assert.NotNull(factory.Services); Assert.NotNull(factory.Services);
Assert.NotNull(factory.Services.GetService(typeof(IConfiguration))); Assert.NotNull(factory.Services.GetService(typeof(IConfiguration)));

View File

@ -27,7 +27,6 @@
<PackageVersionVariableReference Include="$(RepoRoot)src\Middleware\Diagnostics.EntityFrameworkCore\src\Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.csproj" /> <PackageVersionVariableReference Include="$(RepoRoot)src\Middleware\Diagnostics.EntityFrameworkCore\src\Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<GeneratedContent Include="Angular-CSharp.csproj.in" OutputPath="content/Angular-CSharp/Company.WebApplication1.csproj" /> <GeneratedContent Include="Angular-CSharp.csproj.in" OutputPath="content/Angular-CSharp/Company.WebApplication1.csproj" />
<GeneratedContent Include="React-CSharp.csproj.in" OutputPath="content/React-CSharp/Company.WebApplication1.csproj" /> <GeneratedContent Include="React-CSharp.csproj.in" OutputPath="content/React-CSharp/Company.WebApplication1.csproj" />

View File

@ -1,3 +1,3 @@
@ECHO OFF @ECHO OFF
SET RepoRoot=%~dp0..\.. SET RepoRoot=%~dp0..\..
%RepoRoot%\build.cmd -projects %~dp0**\*.*proj -pack /t:BuildSharedFx /t:Build %* %RepoRoot%\build.cmd -projects %~dp0**\*.*proj %*

View File

@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
public async Task OnChallenge_Fires() public async Task OnChallenge_Fires()
{ {
var eventInvoked = false; var eventInvoked = false;
var server = await CreateServerAsync(options => using var host = await CreateHostAsync(options =>
{ {
options.Events = new NegotiateEvents() options.Events = new NegotiateEvents()
{ {
@ -39,6 +39,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
} }
}; };
}); });
var server = host.GetTestServer();
var result = await SendAsync(server, "/Authenticate", new TestConnection()); var result = await SendAsync(server, "/Authenticate", new TestConnection());
Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode); Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
@ -49,7 +50,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
[Fact] [Fact]
public async Task OnChallenge_Handled() public async Task OnChallenge_Handled()
{ {
var server = await CreateServerAsync(options => using var host = await CreateHostAsync(options =>
{ {
options.Events = new NegotiateEvents() options.Events = new NegotiateEvents()
{ {
@ -62,6 +63,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
} }
}; };
}); });
var server = host.GetTestServer();
var result = await SendAsync(server, "/Authenticate", new TestConnection()); var result = await SendAsync(server, "/Authenticate", new TestConnection());
Assert.Equal(StatusCodes.Status418ImATeapot, result.Response.StatusCode); Assert.Equal(StatusCodes.Status418ImATeapot, result.Response.StatusCode);
@ -72,7 +74,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
public async Task OnAuthenticationFailed_Fires() public async Task OnAuthenticationFailed_Fires()
{ {
var eventInvoked = false; var eventInvoked = false;
var server = await CreateServerAsync(options => using var host = await CreateHostAsync(options =>
{ {
options.Events = new NegotiateEvents() options.Events = new NegotiateEvents()
{ {
@ -85,6 +87,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
} }
}; };
}); });
var server = host.GetTestServer();
var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => var ex = await Assert.ThrowsAsync<InvalidOperationException>(() =>
SendAsync(server, "/404", new TestConnection(), "Negotiate InvalidBlob")); SendAsync(server, "/404", new TestConnection(), "Negotiate InvalidBlob"));
@ -95,7 +98,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
[Fact] [Fact]
public async Task OnAuthenticationFailed_Handled() public async Task OnAuthenticationFailed_Handled()
{ {
var server = await CreateServerAsync(options => using var host = await CreateHostAsync(options =>
{ {
options.Events = new NegotiateEvents() options.Events = new NegotiateEvents()
{ {
@ -108,6 +111,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
} }
}; };
}); });
var server = host.GetTestServer();
var result = await SendAsync(server, "/404", new TestConnection(), "Negotiate InvalidBlob"); var result = await SendAsync(server, "/404", new TestConnection(), "Negotiate InvalidBlob");
Assert.Equal(StatusCodes.Status418ImATeapot, result.Response.StatusCode); Assert.Equal(StatusCodes.Status418ImATeapot, result.Response.StatusCode);
@ -118,7 +122,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
public async Task OnAuthenticated_FiresOncePerRequest() public async Task OnAuthenticated_FiresOncePerRequest()
{ {
var callCount = 0; var callCount = 0;
var server = await CreateServerAsync(options => using var host = await CreateHostAsync(options =>
{ {
options.PersistKerberosCredentials = true; options.PersistKerberosCredentials = true;
options.Events = new NegotiateEvents() options.Events = new NegotiateEvents()
@ -134,6 +138,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
} }
}; };
}); });
var server = host.GetTestServer();
var testConnection = new TestConnection(); var testConnection = new TestConnection();
await KerberosStage1And2Auth(server, testConnection); await KerberosStage1And2Auth(server, testConnection);
@ -147,7 +152,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
public async Task OnAuthenticated_Success_Continues() public async Task OnAuthenticated_Success_Continues()
{ {
var callCount = 0; var callCount = 0;
var server = await CreateServerAsync(options => using var host = await CreateHostAsync(options =>
{ {
options.Events = new NegotiateEvents() options.Events = new NegotiateEvents()
{ {
@ -159,6 +164,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
} }
}; };
}); });
var server = host.GetTestServer();
await KerberosStage1And2Auth(server, new TestConnection()); await KerberosStage1And2Auth(server, new TestConnection());
Assert.Equal(1, callCount); Assert.Equal(1, callCount);
@ -168,7 +174,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
public async Task OnAuthenticated_NoResult_SuppresesCredentials() public async Task OnAuthenticated_NoResult_SuppresesCredentials()
{ {
var callCount = 0; var callCount = 0;
var server = await CreateServerAsync(options => using var host = await CreateHostAsync(options =>
{ {
options.Events = new NegotiateEvents() options.Events = new NegotiateEvents()
{ {
@ -180,6 +186,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
} }
}; };
}); });
var server = host.GetTestServer();
var result = await SendAsync(server, "/Authenticate", new TestConnection(), "Negotiate ClientKerberosBlob"); var result = await SendAsync(server, "/Authenticate", new TestConnection(), "Negotiate ClientKerberosBlob");
Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode); Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
@ -191,7 +198,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
public async Task OnAuthenticated_Fail_SuppresesCredentials() public async Task OnAuthenticated_Fail_SuppresesCredentials()
{ {
var callCount = 0; var callCount = 0;
var server = await CreateServerAsync(options => using var host = await CreateHostAsync(options =>
{ {
options.Events = new NegotiateEvents() options.Events = new NegotiateEvents()
{ {
@ -203,6 +210,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
} }
}; };
}); });
var server = host.GetTestServer();
var result = await SendAsync(server, "/Authenticate", new TestConnection(), "Negotiate ClientKerberosBlob"); var result = await SendAsync(server, "/Authenticate", new TestConnection(), "Negotiate ClientKerberosBlob");
Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode); Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
@ -230,7 +238,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
Assert.Equal("Negotiate ServerKerberosBlob2", result.Response.Headers[HeaderNames.WWWAuthenticate]); Assert.Equal("Negotiate ServerKerberosBlob2", result.Response.Headers[HeaderNames.WWWAuthenticate]);
} }
private static async Task<TestServer> CreateServerAsync(Action<NegotiateOptions> configureOptions = null) private static async Task<IHost> CreateHostAsync(Action<NegotiateOptions> configureOptions = null)
{ {
var builder = new HostBuilder() var builder = new HostBuilder()
.ConfigureServices(services => services .ConfigureServices(services => services
@ -249,11 +257,10 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
app.UseRouting(); app.UseRouting();
app.UseAuthentication(); app.UseAuthentication();
app.UseEndpoints(ConfigureEndpoints); app.UseEndpoints(ConfigureEndpoints);
}); });
}); });
var server = (await builder.StartAsync()).GetTestServer(); return await builder.StartAsync();
return server;
} }
private static void ConfigureEndpoints(IEndpointRouteBuilder builder) private static void ConfigureEndpoints(IEndpointRouteBuilder builder)

Some files were not shown because too many files have changed in this diff Show More