diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index cffbae0de3..8bcde2552d 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -25,7 +25,7 @@ variables: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - name: _BuildArgs value: /p:TeamName=$(_TeamName) - /p:OfficialBuildId=$(Build.BuildNumber) + /p:OfficialBuildId=$(Build.BuildNumber) - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}: - name: _BuildArgs 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. # The sign settings have been configured to - - script: ./eng/scripts/cibuild.cmd + - script: ./build.cmd + -ci -arch x64 - -BuildNative - /p:DisableCodeSigning=true + -pack + -all + -buildNative /bl:artifacts/log/build.x64.binlog $(_BuildArgs) 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 # Build the x86 shared framework - # Set DisableSignCheck because we'll run sign check in an explicit step after installers build - - script: ./eng/scripts/cibuild.cmd + - script: ./build.cmd + -ci -arch x86 - -NoRestore - -BuildNative - /t:BuildSharedFx + -pack + -all + -buildNative + -noBuildJava /p:OnlyPackPlatformSpecificPackages=true - /p:DisableCodeSigning=true /bl:artifacts/log/build.x86.binlog $(_BuildArgs) displayName: Build x86 # This is in a separate build step with -forceCoreMsbuild to workaround MAX_PATH limitations - https://github.com/Microsoft/msbuild/issues/53 - - script: ./build.cmd - -ci - -sign - -forceCoreMsbuild - /p:DisableCodeSigning=true - -projects ./src/SiteExtensions/LoggingAggregate/src/Microsoft.AspNetCore.AzureAppServices.SiteExtension/Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj - $(_BuildArgs) - displayName: Build SiteExtension - - # Remove all task build output - - script: rmdir /s /q build\tasks\bin - displayName: Clear task build output + # TODO: need to figure out how to make site extensions build with Arcade. See https://github.com/aspnet/AspNetCore/issues/11186 + # - script: ./build.cmd + # -ci + # -pack + # -forceCoreMsbuild + # -noBuildDeps + # /p:BuildSiteExtensions=true + # $(_BuildArgs) + # displayName: Build SiteExtension # 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. # Sign check is disabled because it is run in a separate step below, after installers are built. - script: ./build.cmd -ci + -noBuild + -noRestore -sign - -NoRestore - /t:CodeSign - /p:SignType=$(_SignType) - /p:DisableSignCheck=true /bl:artifacts/log/build.codesign.binlog $(_BuildArgs) displayName: Code sign packages # 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 - -ci - -sign - -NoRestore - /t:SignCheck - /p:SignType=$(_SignType) - /bl:artifacts/log/build.signcheck.binlog - $(_BuildArgs) - displayName: Run sign check - condition: and(succeeded(), eq(variables['_SignType'], 'real')) + -ci + -sign + -buildInstallers + /bl:artifacts/log/installers.msbuild.binlog + $(_BuildArgs) + displayName: Build Installers artifacts: - name: Windows_Logs @@ -150,12 +137,13 @@ jobs: jobName: Windows_arm_build jobDisplayName: "Build: Windows ARM" agentOs: Windows - buildScript: ./eng/scripts/cibuild.cmd - buildArgs: -arch arm - -NoBuildNodeJS - -NoBuildJava + buildArgs: + -arch arm + -sign + -pack + -noBuildNodeJS + -noBuildJava /p:OnlyPackPlatformSpecificPackages=true - /p:SignType=$(_SignType) /bl:artifacts/log/build.win-arm.binlog $(_BuildArgs) installNodeJs: false @@ -177,8 +165,10 @@ jobs: jobName: MacOs_x64_build jobDisplayName: "Build: macOS" agentOs: macOs - buildScript: ./eng/scripts/cibuild.sh - buildArgs: --no-build-nodejs + buildArgs: + --pack + --all + --no-build-nodejs --no-build-java -p:OnlyPackPlatformSpecificPackages=true -bl:artifacts/log/build.macos.binlog @@ -206,24 +196,24 @@ jobs: agentOs: Linux installNodeJs: false steps: - - script: ./eng/scripts/cibuild.sh + - script: ./build.sh + --ci --arch x64 + --pack + --all --no-build-nodejs --no-build-java -p:OnlyPackPlatformSpecificPackages=true -bl:artifacts/log/build.linux-x64.binlog $(_BuildArgs) - displayName: Run cibuild.sh + displayName: Run build.sh - script: | - rm -rf .dotnet/ - git clean -xfd src/ + git clean -xfd src/**/obj/ ./dockerbuild.sh bionic \ - --ci --pack --all --no-build-nodejs --no-build-java \ + --ci \ --arch x64 \ - -e KOREBUILD_SKIP_INSTALL_NETFX=0 \ - --no-restore \ + --build-installers \ --no-build-deps \ - -t:BuildSharedFx \ -p:OnlyPackPlatformSpecificPackages=true \ -p:BuildRuntimeArchive=false \ -p:LinuxInstallerType=deb \ @@ -231,15 +221,12 @@ jobs: $(_BuildArgs) displayName: Build Debian installers - script: | - rm -rf .dotnet/ - git clean -xfd src/ + git clean -xfd src/**/obj/ ./dockerbuild.sh rhel \ - --ci --pack --all --no-build-nodejs --no-build-java \ + --ci \ --arch x64 \ - -e KOREBUILD_SKIP_INSTALL_NETFX=0 \ - --no-restore \ + --build-installers \ --no-build-deps \ - -t:BuildSharedFx \ -p:OnlyPackPlatformSpecificPackages=true \ -p:BuildRuntimeArchive=false \ -p:LinuxInstallerType=rpm \ @@ -266,8 +253,10 @@ jobs: jobName: Linux_arm_build jobDisplayName: "Build: Linux ARM" agentOs: Linux - buildScript: ./eng/scripts/cibuild.sh - buildArgs: --arch arm + buildArgs: + --arch arm + --pack + --all --no-build-nodejs --no-build-java -p:OnlyPackPlatformSpecificPackages=true @@ -294,8 +283,10 @@ jobs: jobName: Linux_arm64_build jobDisplayName: "Build: Linux ARM64" agentOs: Linux - buildScript: ./eng/scripts/cibuild.sh - buildArgs: --arch arm64 + buildArgs: + --arch arm64 + --all + --pack --no-build-nodejs --no-build-java -p:OnlyPackPlatformSpecificPackages=true @@ -323,12 +314,12 @@ jobs: jobDisplayName: "Build: Linux Musl x64" agentOs: Linux buildScript: ./dockerbuild.sh alpine - buildArgs: --ci - --pack - --all - -e KOREBUILD_SKIP_INSTALL_NETFX=0 + buildArgs: + --ci --arch x64 --os-name linux-musl + --pack + --all --no-build-nodejs --no-build-java -p:OnlyPackPlatformSpecificPackages=true @@ -356,12 +347,12 @@ jobs: jobDisplayName: "Build: Linux Musl ARM64" agentOs: Linux buildScript: ./dockerbuild.sh ubuntu-alpine37 - buildArgs: --ci - --pack - --all - -e KOREBUILD_SKIP_INSTALL_NETFX=0 + buildArgs: + --ci --arch arm64 --os-name linux-musl + --pack + --all --no-build-nodejs --no-build-java -p:OnlyPackPlatformSpecificPackages=true @@ -390,8 +381,7 @@ jobs: jobDisplayName: "Test: Windows Server 2016 x64" agentOs: Windows isTestingJob: true - buildScript: ./eng/scripts/cibuild.cmd - buildArgs: -test -BuildNative "/p:SkipIISNewHandlerTests=true /p:SkipIISTests=true /p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true /p:RunTemplateTests=false /p:BuildSiteExtensions=false" + buildArgs: -all -pack -test -BuildNative "/p:SkipIISNewHandlerTests=true /p:SkipIISTests=true /p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true /p:RunTemplateTests=false" beforeBuild: - powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1; & ./src/Servers/IIS/tools/update_schema.ps1" displayName: Setup IISExpress test certificates and schema @@ -403,6 +393,9 @@ jobs: - name: Windows_Test_Logs path: artifacts/log/ publishOnError: true + - name: Windows_Test_Results + path: artifacts/TestResults/ + publishOnError: true - template: jobs/default-build.yml parameters: @@ -411,15 +404,20 @@ jobs: jobDisplayName: "Test: Templates - Windows Server 2016 x64" agentOs: Windows isTestingJob: true - buildScript: ./src/ProjectTemplates/build.cmd - buildArgs: -ci -test -NoRestore -NoBuild -NoBuilddeps "/p:RunTemplateTests=true /p:BuildSiteExtensions=false" - beforeBuild: - - powershell: ./eng/scripts/cibuild.cmd + steps: + - script: ./build.cmd -ci -all -pack 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: - name: Windows_Test_Templates_Logs path: artifacts/log/ publishOnError: true + - name: Windows_Test_Templates_Results + path: artifacts/TestResults/ + publishOnError: true - template: jobs/default-build.yml parameters: @@ -428,8 +426,7 @@ jobs: jobDisplayName: "Test: macOS 10.13" agentOs: macOs isTestingJob: true - buildScript: ./eng/scripts/cibuild.sh - buildArgs: --test + buildArgs: --all --test "/p:RunTemplateTests=false" beforeBuild: - bash: "./eng/scripts/install-nginx-mac.sh" displayName: Installing Nginx @@ -441,6 +438,9 @@ jobs: - name: MacOS_Test_Logs path: artifacts/log/ publishOnError: true + - name: MacOS_Test_Results + path: artifacts/TestResults/ + publishOnError: true - template: jobs/default-build.yml parameters: @@ -449,8 +449,7 @@ jobs: jobDisplayName: "Test: Ubuntu 16.04 x64" agentOs: Linux isTestingJob: true - buildScript: ./eng/scripts/cibuild.sh - buildArgs: --test + buildArgs: --all --test "/p:RunTemplateTests=false" beforeBuild: - bash: "./eng/scripts/install-nginx-linux.sh" displayName: Installing Nginx @@ -464,3 +463,6 @@ jobs: - name: Linux_Test_Logs path: artifacts/log/ publishOnError: true + - name: Linux_Test_Results + path: artifacts/TestResults/ + publishOnError: true diff --git a/.azure/pipelines/helix-test.yml b/.azure/pipelines/helix-test.yml index 1b512109b1..4a7b845a2d 100644 --- a/.azure/pipelines/helix-test.yml +++ b/.azure/pipelines/helix-test.yml @@ -15,7 +15,9 @@ jobs: agentOs: Windows timeoutInMinutes: 240 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 env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops diff --git a/.azure/pipelines/jobs/default-build.yml b/.azure/pipelines/jobs/default-build.yml index 96586165ce..cee1da9be2 100644 --- a/.azure/pipelines/jobs/default-build.yml +++ b/.azure/pipelines/jobs/default-build.yml @@ -113,7 +113,7 @@ jobs: variables: AgentOsName: ${{ parameters.agentOs }} 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 }} BuildScriptArgs: ${{ parameters.buildArgs }} BuildConfiguration: ${{ parameters.configuration }} @@ -150,7 +150,7 @@ jobs: displayName: Install JDK 11 - ${{ if eq(parameters.isTestingJob, true) }}: - 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 displayName: Install Chrome - ${{ 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.buildScript, '') }}: - ${{ 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 - ${{ 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 - ${{ if ne(parameters.buildScript, '') }}: - - script: $(BuildScript) /p:Configuration=$(BuildConfiguration) $(BuildScriptArgs) + - script: $(BuildScript) -Configuration $(BuildConfiguration) $(BuildScriptArgs) displayName: run $(BuildScript) - ${{ parameters.afterBuild }} @@ -208,33 +208,46 @@ jobs: artifactType: Container parallel: true - - task: PublishTestResults@2 - displayName: Publish test results - condition: always() - continueOnError: true - inputs: - testRunTitle: $(AgentOsName)-$(BuildConfiguration) - testRunner: vstest - testResultsFiles: '**/artifacts/**/*.trx' - mergeTestResults: true - buildConfiguration: $(BuildConfiguration) - buildPlatform: $(AgentOsName) - - task: PublishTestResults@2 - displayName: Publish js test results - condition: always() - 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 eq(parameters.isTestingJob, true) }}: + - task: PublishTestResults@2 + displayName: Publish test results + condition: always() + continueOnError: true + inputs: + testRunTitle: $(AgentOsName)-$(BuildConfiguration) + testRunner: vstest + testResultsFiles: '**/artifacts/**/*.trx' + mergeTestResults: true + buildConfiguration: $(BuildConfiguration) + buildPlatform: $(AgentOsName) + - task: PublishTestResults@2 + displayName: Publish test results + condition: always() + continueOnError: true + inputs: + testRunTitle: $(AgentOsName)-$(BuildConfiguration) + testRunner: xunit + testResultsFiles: '**/artifacts/TestResults/**/*.xml' + mergeTestResults: true + buildConfiguration: $(BuildConfiguration) + buildPlatform: $(AgentOsName) + - task: PublishTestResults@2 + displayName: Publish js test results + condition: always() + 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')) }}: - task: MicroBuildCleanup@1 diff --git a/Directory.Build.props b/Directory.Build.props index a39b240399..35aaa6a2ae 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,4 +1,9 @@  + + $(MSBuildThisFileDirectory) + https://github.com/aspnet/AspNetCore + git + @@ -18,10 +23,11 @@ false + + - Microsoft ASP.NET Core MicrosoftAspNetCore @@ -51,16 +57,13 @@ - $(MSBuildThisFileDirectory) - https://github.com/aspnet/AspNetCore - git $(MSBuildThisFileDirectory)src\Shared\ $(RepoRoot)src\submodules\googletest\ true - - true + + false @@ -133,10 +136,9 @@ $(LocalDotNetRoot)packs\ - + - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/CodeSign.targets b/build/CodeSign.targets deleted file mode 100644 index 883898ee85..0000000000 --- a/build/CodeSign.targets +++ /dev/null @@ -1,46 +0,0 @@ - - - - $(CodeSignDependsOn);CollectFileSignInfo - - - - - - - - - - - - - - $(ArtifactsDir)obj\RedistSharedFx.Layout\$(Configuration)\ - $(BaseRedistNetCorePath)$(TargetRuntimeIdentifier)\ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/SharedFx.targets b/build/SharedFx.targets deleted file mode 100644 index 5244b5e2a7..0000000000 --- a/build/SharedFx.targets +++ /dev/null @@ -1,41 +0,0 @@ - - - _BuildSharedFxProjects;RemoveSharedFrameworkOnlyRefsFromNuspec - $(BuildSharedFxDependsOn);CodeSign - - - - - - - - - - - - - - - - - - - <_RestoreGraphProjectInput>@(FxProjectToBuild) - - - - - - - - - - diff --git a/build/repo.targets b/build/repo.targets deleted file mode 100644 index df94a22d00..0000000000 --- a/build/repo.targets +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - Prepare - - $(BuildDependsOn);Compile - $(BuildDependsOn);Package - $(BuildDependsOn);Test;Verify - true - true - - $(CleanDependsOn);CleanArtifacts - - $(RestoreDependsOn);InstallDotNet;RestoreProjects - - - $(CompileDependsOn);BuildProjects - - $(PackageDependsOn);PackProjects - $(PackageDependsOn);RemoveSharedFrameworkOnlyRefsFromNuspec;BuildSharedFx - - - $(TestDependsOn);Compile - $(TestDependsOn);TestProjects - - $(BuildDependsOn);GenerateBuildAssetManifest - - - $(CodeSignDependsOn);RemoveSharedFrameworkOnlyRefsFromNuspec - - - - - - - - - - - - - - - - - - - - - - - <_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)" /> - - - - $(MSBuildThisFileDirectory)..\eng\ProjectReferences.props - - - - @(_ProjectReferenceProvider->'', '%0A ') - @(_ProjectReferenceProviderWithRefAssembly->'', '%0A ') - - -]]> - - - - - - - - $(MSBuildThisFileDirectory)..\eng\SharedFramework.Local.props - - and properties from each .csproj in this repository. ---> - - - - @(_SharedFrameworkAndPackageRef->'', '%0A ') - - - @(_SharedFrameworkRef->'', '%0A ') - - - ]]> - - - - - - - - - - - - - - <_BuildOutput Include="$(ArtifactsShippingPackagesDir)*.nupkg" - Exclude="$(ArtifactsShippingPackagesDir)*.symbols.nupkg" /> - - - - - - - - - - - - - - - - diff --git a/build/runtimes.props b/build/runtimes.props deleted file mode 100644 index d5cd1f7781..0000000000 --- a/build/runtimes.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/build/tasks/RepoTasks.csproj b/build/tasks/RepoTasks.csproj deleted file mode 100644 index 24dc25d2eb..0000000000 --- a/build/tasks/RepoTasks.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - - netcoreapp3.0 - net472 - $(DefineConstants);BUILD_MSI_TASKS - false - embedded - true - - - - - - - - - - - - - $(WiXSdkPath)\Microsoft.Deployment.WindowsInstaller.dll - - - $(WiXSdkPath)\Microsoft.Deployment.WindowsInstaller.Package.dll - - - - - - - - - diff --git a/build/tasks/RepoTasks.tasks b/build/tasks/RepoTasks.tasks deleted file mode 100644 index 39f085fd04..0000000000 --- a/build/tasks/RepoTasks.tasks +++ /dev/null @@ -1,10 +0,0 @@ - - - <_RepoTaskAssembly>$(MSBuildThisFileDirectory)bin\publish\RepoTasks.dll - - - - - - - diff --git a/build/tasks/tasks.sln b/build/tasks/tasks.sln deleted file mode 100644 index 55921e71f9..0000000000 --- a/build/tasks/tasks.sln +++ /dev/null @@ -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 diff --git a/dockerbuild.sh b/dockerbuild.sh index 315a8a832a..10ce8e9d08 100755 --- a/dockerbuild.sh +++ b/dockerbuild.sh @@ -29,7 +29,7 @@ __usage() { echo " -e, --env Additional environment variables to add to the build container" echo "" 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 exit 2 @@ -101,7 +101,7 @@ if [ ! -z "$commit_hash" ]; then build_args[${#build_args[*]}]="-p:SourceRevisionId=$commit_hash" fi -dockerfile="$DIR/build/docker/$image.Dockerfile" +dockerfile="$DIR/eng/docker/$image.Dockerfile" tagname="aspnetcore-build-$image" # Use docker pull with retries to pre-pull the image need by the dockerfile @@ -130,8 +130,7 @@ docker build "$(dirname "$dockerfile")" \ docker run \ --rm \ -t \ - -e CI \ - -e TEAMCITY_VERSION \ + -e TF_BUILD \ -e BUILD_NUMBER \ -e BUILD_BUILDNUMBER \ -e BUILD_REPOSITORY_URI \ diff --git a/docs/BuildFromSource.md b/docs/BuildFromSource.md index 8c15063761..d84fe2ab8c 100644 --- a/docs/BuildFromSource.md +++ b/docs/BuildFromSource.md @@ -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 ``` - 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 diff --git a/docs/Helix.md b/docs/Helix.md index 3ac9c55f10..c685977981 100644 --- a/docs/Helix.md +++ b/docs/Helix.md @@ -13,13 +13,13 @@ To run Helix tests for one particular test project: ``` cd src/MyCode/test -dotnet build /t:Helix +dotnet msbuild /t:Helix ``` 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. diff --git a/eng/AfterSolutionBuild.targets b/eng/AfterSolutionBuild.targets new file mode 100644 index 0000000000..3857e15239 --- /dev/null +++ b/eng/AfterSolutionBuild.targets @@ -0,0 +1,31 @@ + + + + + + + + + + <_BuildOutput Include="$(ArtifactsShippingPackagesDir)*.nupkg" + Exclude="$(ArtifactsShippingPackagesDir)*.symbols.nupkg" /> + + + + + + + + + + + + + diff --git a/build/repo.props b/eng/Build.props similarity index 81% rename from build/repo.props rename to eng/Build.props index bba7a1cc43..14293f5d2e 100644 --- a/build/repo.props +++ b/eng/Build.props @@ -10,31 +10,6 @@ true - - - true - true - false - true - - false - - $(ArtifactsDir)packages\$(Configuration)\ - $(ArtifactsPackagesDir)Shipping\ - $(ArtifactsPackagesDir)NonShipping\ - $(ArtifactsDir)installers\$(Configuration)\ - $(ArtifactsDir)VSSetup\$(Configuration)\ - $(ArtifactsDir)log\ - - $(RepoRoot)eng\signcheck.exclusions.txt - - - true - - $(RepoRoot)src\Shared\ - true - - @@ -73,9 +48,9 @@ - + - + false @@ -108,9 +83,20 @@ - - + + + + + + + + + + + @@ -181,10 +167,4 @@ - - - - - - diff --git a/eng/CodeGen.proj b/eng/CodeGen.proj new file mode 100644 index 0000000000..d16f2875e5 --- /dev/null +++ b/eng/CodeGen.proj @@ -0,0 +1,88 @@ + + + + true + $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..')) + + + + + + + + + + + + + + <_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)" /> + + + + $(MSBuildThisFileDirectory)ProjectReferences.props + + + + @(_ProjectReferenceProvider->'', '%0A ') + @(_ProjectReferenceProviderWithRefAssembly->'', '%0A ') + + +]]> + + + + + + + + + $(MSBuildThisFileDirectory)SharedFramework.Local.props + + and properties from each .csproj in this repository. +--> + + + + @(_SharedFrameworkAndPackageRef->'', '%0A ') + + + @(_SharedFrameworkRef->'', '%0A ') + + + ]]> + + + + + + + + + + + + diff --git a/eng/FlakyTests.BeforeArcade.props b/eng/FlakyTests.BeforeArcade.props index 1cd94cc9cd..02f9fb6c59 100644 --- a/eng/FlakyTests.BeforeArcade.props +++ b/eng/FlakyTests.BeforeArcade.props @@ -6,13 +6,13 @@ - + <_FlakyRunAdditionalArgs>$(_FlakyRunAdditionalArgs) -trait "Flaky:AzP:All=true" -trait "Flaky:AzP:OS:$(AGENT_OS)=true" <_NonFlakyRunAdditionalArgs>$(_NonFlakyRunAdditionalArgs) -notrait "Flaky:AzP:All=true" -notrait "Flaky:AzP:OS:$(AGENT_OS)=true" - $(_NonFlakyRunAdditionalArgs) - $(_FlakyRunAdditionalArgs) + $(_NonFlakyRunAdditionalArgs) $(TestRunnerAdditionalArguments) + $(_FlakyRunAdditionalArgs) $(TestRunnerAdditionalArguments) diff --git a/eng/NuGetPackageVerifier.json b/eng/NuGetPackageVerifier.json deleted file mode 100644 index 8c6f0eedfa..0000000000 --- a/eng/NuGetPackageVerifier.json +++ /dev/null @@ -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" - ] - } -} diff --git a/eng/Signing.props b/eng/Signing.props new file mode 100644 index 0000000000..2e55228d04 --- /dev/null +++ b/eng/Signing.props @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(TargetOsName)-$(TargetArchitecture) + $(ArtifactsObjDir)RedistSharedFx.Layout\$(Configuration)\ + $(BaseRedistNetCorePath)$(TargetRuntimeIdentifier)\ + + + + + + + + + + + + + + + <_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" /> + + + + diff --git a/eng/Tools.props b/eng/Tools.props new file mode 100644 index 0000000000..46285b1448 --- /dev/null +++ b/eng/Tools.props @@ -0,0 +1,12 @@ + + + + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 34038febe7..8ab0f86983 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -404,17 +404,17 @@ https://github.com/aspnet/Extensions 42b3a303ba27594637de04c78aaf9f1c7af6e303 - + https://github.com/dotnet/arcade - e6a5d5f970bb872451c6310ae34eda31041fb552 + 8b34615157193918f13821730cb2cac05c2eb1b1 - + https://github.com/dotnet/arcade - e6a5d5f970bb872451c6310ae34eda31041fb552 + 8b34615157193918f13821730cb2cac05c2eb1b1 - + https://github.com/dotnet/arcade - e6a5d5f970bb872451c6310ae34eda31041fb552 + 8b34615157193918f13821730cb2cac05c2eb1b1 https://github.com/aspnet/Extensions diff --git a/eng/Versions.props b/eng/Versions.props index e34c41dc27..3db6ef368f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -52,7 +52,7 @@ --> - 1.0.0-beta.19302.2 + 1.0.0-beta.19312.4 3.0.0-preview7-27812-08 3.0.0-preview7-27812-08 diff --git a/eng/Workarounds.props b/eng/Workarounds.props index 0668b92981..e2ad3d58a8 100644 --- a/eng/Workarounds.props +++ b/eng/Workarounds.props @@ -1,18 +1,5 @@ - - - - $(BaseIntermediateOutputPath) - $(MSBuildProjectDir)\obj\ - - - - - <_ProjectExtensionsWereImported>true - $(WixInstallPath)\wix2010.targets - - @@ -44,4 +31,16 @@ false + + + + $(TestRunnerAdditionalArguments) -nocolor + + + + + + true + diff --git a/eng/common/cross/armel/tizen-fetch.sh b/eng/common/cross/armel/tizen-fetch.sh index ba16e991c7..ed70e0a86e 100755 --- a/eng/common/cross/armel/tizen-fetch.sh +++ b/eng/common/cross/armel/tizen-fetch.sh @@ -157,15 +157,15 @@ fetch_tizen_pkgs() Inform "Initialize arm base" fetch_tizen_pkgs_init standard base 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 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" 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" fetch_tizen_pkgs_init standard unified Inform "fetch corefx packages" -fetch_tizen_pkgs armv7l gssdp gssdp-devel +fetch_tizen_pkgs armv7l gssdp gssdp-devel tizen-release diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 34d3d2ba1f..7c4e122651 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -181,7 +181,7 @@ if [ -z "$__RootfsDir" ] && [ ! -z "$ROOTFS_DIR" ]; then fi if [ -z "$__RootfsDir" ]; then - __RootfsDir="$__CrossDir/rootfs/$__BuildArch" + __RootfsDir="$__CrossDir/../../../.tools/rootfs/$__BuildArch" fi if [ -d "$__RootfsDir" ]; then diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index dea7cdd903..8854d979f3 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -11,10 +11,10 @@ function InstallDarcCli ($darcVersion) { $dotnetRoot = InitializeDotNetCli -install:$true $dotnet = "$dotnetRoot\dotnet.exe" - $toolList = Invoke-Expression "& `"$dotnet`" tool list -g" + $toolList = & "$dotnet" tool list -g 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, @@ -22,12 +22,12 @@ function InstallDarcCli ($darcVersion) { if (-not $darcVersion) { $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content } - + $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json' 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." - 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 diff --git a/eng/common/generate-graph-files.ps1 b/eng/common/generate-graph-files.ps1 index a05b84f798..b056e4c1ac 100644 --- a/eng/common/generate-graph-files.ps1 +++ b/eng/common/generate-graph-files.ps1 @@ -25,7 +25,7 @@ function CheckExitCode ([string]$stage) try { Push-Location $PSScriptRoot - + Write-Host "Installing darc..." . .\darc-init.ps1 -darcVersion $darcVersion CheckExitCode "Running darc-init" @@ -40,9 +40,9 @@ try { $darcExe = "$env:USERPROFILE\.dotnet\tools" $darcExe = Resolve-Path "$darcExe\darc.exe" - + Create-Directory $outputFolder - + # Generate 3 graph descriptions: # 1. Flat with coherency information # 2. Graphviz (dot) file @@ -51,26 +51,26 @@ try { $graphVizImageFilePath = "$outputFolder\graph.png" $normalGraphFilePath = "$outputFolder\graph-full.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) { Write-Host "Toolsets will be included in the graph..." - $baseOptions += " --include-toolset" + $baseOptions += @( "--include-toolset" ) } 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" 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" Write-Host "Generating graph image $graphVizFilePath" $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" - + Write-Host "'$graphVizFilePath', '$flatGraphFilePath', '$normalGraphFilePath' and '$graphVizImageFilePath' created!" } catch { diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index a4306bd37e..9d18645f45 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -79,28 +79,27 @@ try { $NativeTools.PSObject.Properties | ForEach-Object { $ToolName = $_.Name $ToolVersion = $_.Value - $LocalInstallerCommand = $InstallerPath - $LocalInstallerCommand += " -ToolName $ToolName" - $LocalInstallerCommand += " -InstallPath $InstallBin" - $LocalInstallerCommand += " -BaseUri $BaseUri" - $LocalInstallerCommand += " -CommonLibraryDirectory $EngCommonBaseDir" - $LocalInstallerCommand += " -Version $ToolVersion" + $LocalInstallerArguments = @{ ToolName = "$ToolName" } + $LocalInstallerArguments += @{ InstallPath = "$InstallBin" } + $LocalInstallerArguments += @{ BaseUri = "$BaseUri" } + $LocalInstallerArguments += @{ CommonLibraryDirectory = "$EngCommonBaseDir" } + $LocalInstallerArguments += @{ Version = "$ToolVersion" } if ($Verbose) { - $LocalInstallerCommand += " -Verbose" + $LocalInstallerArguments += @{ Verbose = $True } } if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') { if($Force) { - $LocalInstallerCommand += " -Force" + $LocalInstallerArguments += @{ Force = $True } } } if ($Clean) { - $LocalInstallerCommand += " -Clean" + $LocalInstallerArguments += @{ Clean = $True } } Write-Verbose "Installing $ToolName version $ToolVersion" - Write-Verbose "Executing '$LocalInstallerCommand'" - Invoke-Expression "$LocalInstallerCommand" + Write-Verbose "Executing '$InstallerPath $LocalInstallerArguments'" + & $InstallerPath @LocalInstallerArguments if ($LASTEXITCODE -Ne "0") { $errMsg = "$ToolName installation failed" if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) { diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 index f286ae0cde..7a34c7e8a4 100644 --- a/eng/common/native/CommonLibrary.psm1 +++ b/eng/common/native/CommonLibrary.psm1 @@ -209,7 +209,7 @@ function New-ScriptShim { 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 } catch { diff --git a/eng/common/sdl/NuGet.config b/eng/common/sdl/NuGet.config new file mode 100644 index 0000000000..0c5451c114 --- /dev/null +++ b/eng/common/sdl/NuGet.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 new file mode 100644 index 0000000000..74080f22d1 --- /dev/null +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -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 + } +} diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 new file mode 100644 index 0000000000..cbf5c36a8f --- /dev/null +++ b/eng/common/sdl/init-sdl.ps1 @@ -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" +} \ No newline at end of file diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config new file mode 100644 index 0000000000..b054737df1 --- /dev/null +++ b/eng/common/sdl/packages.config @@ -0,0 +1,4 @@ + + + + diff --git a/eng/common/sdl/push-gdn.ps1 b/eng/common/sdl/push-gdn.ps1 new file mode 100644 index 0000000000..cacaf8e912 --- /dev/null +++ b/eng/common/sdl/push-gdn.ps1 @@ -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 \ No newline at end of file diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 new file mode 100644 index 0000000000..e6a86d03a2 --- /dev/null +++ b/eng/common/sdl/run-sdl.ps1 @@ -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 + } + } +} + diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 3983d719be..9ea85c4f97 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -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). [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. [bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } @@ -76,7 +76,7 @@ function Exec-Process([string]$command, [string]$commandArgs) { $finished = $false try { - while (-not $process.WaitForExit(100)) { + while (-not $process.WaitForExit(100)) { # Non-blocking loop done to allow ctr-c interrupts } @@ -107,11 +107,11 @@ function Write-PipelineTaskError { if(!$ci) { if($Type -eq 'error') { - Write-Error $Message + Write-Host $Message -ForegroundColor Red return } elseif ($Type -eq 'warning') { - Write-Warning $Message + Write-Host $Message -ForegroundColor Yellow return } } @@ -138,7 +138,8 @@ function Write-PipelineSetVariable { if($ci) { Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ 'variable' = $Name - 'issecret' = $Secret + 'isSecret' = $Secret + 'isOutput' = 'true' } -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: # # 1. MSBuild from an active VS command prompt @@ -267,7 +268,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { "15.9" } - $vsMinVersion = [Version]::new($vsMinVersionStr) + $vsMinVersion = [Version]::new($vsMinVersionStr) # Try msbuild command available in the environment. if ($env:VSINSTALLDIR -ne $null) { @@ -316,7 +317,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) { $env:VSINSTALLDIR = $vsInstallDir Set-Item "env:VS$($vsMajorVersion)0COMNTOOLS" (Join-Path $vsInstallDir "Common7\Tools\") - + $vsSdkInstallDir = Join-Path $vsInstallDir "VSSDK\" if (Test-Path $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. # # 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. -# "components": ["componentId1", "componentId2", ...] +# "components": ["componentId1", "componentId2", ...] # 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 # -# 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. # function LocateVisualStudio([object]$vsRequirements = $null){ @@ -377,8 +378,8 @@ function LocateVisualStudio([object]$vsRequirements = $null){ } 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") { $args += "-version" $args += $vsRequirements.version @@ -388,7 +389,7 @@ function LocateVisualStudio([object]$vsRequirements = $null){ foreach ($component in $vsRequirements.components) { $args += "-requires" $args += $component - } + } } $vsInfo =& $vsWhereExe $args | ConvertFrom-Json @@ -445,7 +446,7 @@ function GetDefaultMSBuildEngine() { if (Get-Member -InputObject $GlobalJson.tools -Name "vs") { return "vs" } - + if (Get-Member -InputObject $GlobalJson.tools -Name "dotnet") { return "dotnet" } @@ -475,11 +476,13 @@ function GetSdkTaskProject([string]$taskName) { function InitializeNativeTools() { if (Get-Member -InputObject $GlobalJson -Name "native-tools") { - $nativeArgs="" + $nativeArgs= @{} 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" - if ($warnAsError) { - $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true" + if ($warnAsError) { + $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true" } foreach ($arg in $args) { @@ -582,29 +585,29 @@ function MSBuild-Core() { $cmdArgs += " `"$arg`"" } } - + $exitCode = Exec-Process $buildTool.Path $cmdArgs if ($exitCode -ne 0) { Write-PipelineTaskError "Build failed." $buildLog = GetMSBuildBinaryLogCommandLineArgument $args - if ($buildLog -ne $null) { - Write-Host "See log: $buildLog" -ForegroundColor DarkGray + if ($buildLog -ne $null) { + Write-Host "See log: $buildLog" -ForegroundColor DarkGray } ExitWithExitCode $exitCode } } -function GetMSBuildBinaryLogCommandLineArgument($arguments) { +function GetMSBuildBinaryLogCommandLineArgument($arguments) { foreach ($argument in $arguments) { if ($argument -ne $null) { $arg = $argument.Trim() if ($arg.StartsWith("/bl:", "OrdinalIgnoreCase")) { return $arg.Substring("/bl:".Length) - } - + } + if ($arg.StartsWith("/binaryLogger:", "OrdinalIgnoreCase")) { return $arg.Substring("/binaryLogger:".Length) } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index fd26f6fbb2..86973b3c2f 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -221,7 +221,7 @@ function InitializeDotNetCli { export PATH="$dotnet_root:$PATH" 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.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0" echo "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1" @@ -349,7 +349,7 @@ function InitializeToolset { fi if [[ "$restore" != true ]]; then - EmitError "Toolset version $toolsetVersion has not been restored." + EmitError "Toolset version $toolset_version has not been restored." ExitWithExitCode 2 fi @@ -460,4 +460,4 @@ mkdir -p "$log_dir" if [[ $ci == true ]]; then export TEMP="$temp_dir" export TMP="$temp_dir" -fi \ No newline at end of file +fi diff --git a/eng/configure-toolset.ps1 b/eng/configure-toolset.ps1 new file mode 100644 index 0000000000..eda160dff3 --- /dev/null +++ b/eng/configure-toolset.ps1 @@ -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 diff --git a/eng/configure-toolset.sh b/eng/configure-toolset.sh new file mode 100644 index 0000000000..ea92acd6a3 --- /dev/null +++ b/eng/configure-toolset.sh @@ -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 diff --git a/build/docker/alpine.Dockerfile b/eng/docker/alpine.Dockerfile similarity index 100% rename from build/docker/alpine.Dockerfile rename to eng/docker/alpine.Dockerfile diff --git a/build/docker/bionic.Dockerfile b/eng/docker/bionic.Dockerfile similarity index 100% rename from build/docker/bionic.Dockerfile rename to eng/docker/bionic.Dockerfile diff --git a/build/docker/rhel.Dockerfile b/eng/docker/rhel.Dockerfile similarity index 100% rename from build/docker/rhel.Dockerfile rename to eng/docker/rhel.Dockerfile diff --git a/build/docker/ubuntu-alpine37.Dockerfile b/eng/docker/ubuntu-alpine37.Dockerfile similarity index 100% rename from build/docker/ubuntu-alpine37.Dockerfile rename to eng/docker/ubuntu-alpine37.Dockerfile diff --git a/eng/helix/helix.proj b/eng/helix/helix.proj index 7304dd629a..cc0013e68c 100644 --- a/eng/helix/helix.proj +++ b/eng/helix/helix.proj @@ -1,7 +1,15 @@ - + - - + + + + + + + @@ -16,7 +24,7 @@ 2 - + ci aspnetcore $(BUILD_BUILDNUMBER).$(SYSTEM_JOBATTEMPT) @@ -25,11 +33,11 @@ true - + dev $(USERNAME) $(USER) - $([System.DateTime]::Now.ToString('yyyyMMdd HH:mm')) + $([System.DateTime]::Now.ToString('yyyyMMddHHmm')) diff --git a/eng/scripts/AddAllProjectRefsToSolution.ps1 b/eng/scripts/AddAllProjectRefsToSolution.ps1 deleted file mode 100644 index 274c098fba..0000000000 --- a/eng/scripts/AddAllProjectRefsToSolution.ps1 +++ /dev/null @@ -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 " - exit 1 - } - if ($slnCount.count -gt 1) { - Write-Error "Multiple solutions found in this directory. Specify which one to modify with -sln " - 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 -} diff --git a/eng/scripts/CodeCheck.ps1 b/eng/scripts/CodeCheck.ps1 index a6c50e73d9..12029d6cda 100644 --- a/eng/scripts/CodeCheck.ps1 +++ b/eng/scripts/CodeCheck.ps1 @@ -43,9 +43,11 @@ function LogError { try { if ($ci) { # 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 # @@ -55,7 +57,7 @@ try { # Ignore duplicates in submodules. These should be isolated from the rest of the build. # Ignore duplicates in the .ref folder. This is expected. 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' } ` | % { $fileName = [io.path]::GetFileNameWithoutExtension($_) @@ -122,10 +124,6 @@ try { -filepath "$repoRoot\eng\Versions.props" } - # - # Solutions - # - Write-Host "Checking that solutions are up to date" Get-ChildItem "$repoRoot/*.sln" -Recurse ` @@ -164,17 +162,13 @@ try { } Write-Host "Re-generating package baselines" - $dotnet = 'dotnet' - if ($ci) { - $dotnet = "$repoRoot/.dotnet/dotnet.exe" - } Invoke-Block { - & $dotnet run -p "$repoRoot/eng/tools/BaselineGenerator/" + & dotnet run -p "$repoRoot/eng/tools/BaselineGenerator/" } Write-Host "Re-generating Browser.JS files" 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" diff --git a/eng/scripts/GenerateProjectList.ps1 b/eng/scripts/GenerateProjectList.ps1 index adee357de4..47449b3d7a 100644 --- a/eng/scripts/GenerateProjectList.ps1 +++ b/eng/scripts/GenerateProjectList.ps1 @@ -5,4 +5,6 @@ $ErrorActionPreference = 'stop' $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 diff --git a/eng/scripts/GenerateReferenceAssemblies.ps1 b/eng/scripts/GenerateReferenceAssemblies.ps1 index 78cb024345..fa58025c34 100644 --- a/eng/scripts/GenerateReferenceAssemblies.ps1 +++ b/eng/scripts/GenerateReferenceAssemblies.ps1 @@ -5,4 +5,6 @@ $ErrorActionPreference = 'stop' $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 diff --git a/eng/scripts/KillProcesses.ps1 b/eng/scripts/KillProcesses.ps1 index 48681071cf..153234abd9 100644 --- a/eng/scripts/KillProcesses.ps1 +++ b/eng/scripts/KillProcesses.ps1 @@ -45,14 +45,18 @@ _kill iisexpresstray.exe _kill w3wp.exe _kill msbuild.exe _kill vbcscompiler.exe -_kill git.exe _kill vctip.exe -_kill chrome.exe _kill h2spec.exe _kill WerFault.exe _killJavaInstances _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) { iisreset /restart } diff --git a/eng/scripts/cibuild.cmd b/eng/scripts/cibuild.cmd deleted file mode 100644 index de8de80014..0000000000 --- a/eng/scripts/cibuild.cmd +++ /dev/null @@ -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% diff --git a/eng/scripts/cibuild.sh b/eng/scripts/cibuild.sh deleted file mode 100755 index d5837c0908..0000000000 --- a/eng/scripts/cibuild.sh +++ /dev/null @@ -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 "$@" diff --git a/eng/scripts/install-nginx-linux.sh b/eng/scripts/install-nginx-linux.sh index a245308a0c..b9ad6daf93 100755 --- a/eng/scripts/install-nginx-linux.sh +++ b/eng/scripts/install-nginx-linux.sh @@ -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 make make install +echo "##vso[task.prependpath]$HOME/nginxinstall/sbin" \ No newline at end of file diff --git a/eng/signcheck.exclusions.txt b/eng/signcheck.exclusions.txt deleted file mode 100644 index 93f17f63f5..0000000000 --- a/eng/signcheck.exclusions.txt +++ /dev/null @@ -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 diff --git a/eng/targets/Helix.targets b/eng/targets/Helix.targets index 1f671c0bd6..9322dab239 100644 --- a/eng/targets/Helix.targets +++ b/eng/targets/Helix.targets @@ -13,12 +13,12 @@ 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 --> + Properties="ProjectToBuild=$(MSBuildProjectFullPath)" /> diff --git a/eng/targets/Npm.Common.props b/eng/targets/Npm.Common.props index 3308ca9ee0..6f7de5c652 100644 --- a/eng/targets/Npm.Common.props +++ b/eng/targets/Npm.Common.props @@ -1,7 +1,7 @@ test - Release + Release Debug diff --git a/eng/targets/ReferenceAssembly.targets b/eng/targets/ReferenceAssembly.targets index 605c715eb7..dccc945227 100644 --- a/eng/targets/ReferenceAssembly.targets +++ b/eng/targets/ReferenceAssembly.targets @@ -40,6 +40,7 @@ + @@ -65,6 +66,7 @@ + diff --git a/eng/targets/ResolveReferences.targets b/eng/targets/ResolveReferences.targets index 848c95c8b2..684660fed1 100644 --- a/eng/targets/ResolveReferences.targets +++ b/eng/targets/ResolveReferences.targets @@ -103,10 +103,6 @@ - - - <_ReferenceTemp Include="@(Reference)" /> - - - <_ReferenceTemp Remove="@(_ReferenceTemp)" /> - ContentFiles;Build diff --git a/eng/tools/Directory.Build.props b/eng/tools/Directory.Build.props index f75adf7e4d..771294cf65 100644 --- a/eng/tools/Directory.Build.props +++ b/eng/tools/Directory.Build.props @@ -1,2 +1,9 @@  + + + + false + false + true + diff --git a/eng/tools/Directory.Build.targets b/eng/tools/Directory.Build.targets deleted file mode 100644 index f75adf7e4d..0000000000 --- a/eng/tools/Directory.Build.targets +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/build/Maestro/Maestro.csproj b/eng/tools/Maestro/Maestro.csproj similarity index 100% rename from build/Maestro/Maestro.csproj rename to eng/tools/Maestro/Maestro.csproj diff --git a/build/tasks/FileUtilities.cs b/eng/tools/RepoTasks/FileUtilities.cs similarity index 100% rename from build/tasks/FileUtilities.cs rename to eng/tools/RepoTasks/FileUtilities.cs diff --git a/build/tasks/GenerateGuid.cs b/eng/tools/RepoTasks/GenerateGuid.cs similarity index 100% rename from build/tasks/GenerateGuid.cs rename to eng/tools/RepoTasks/GenerateGuid.cs diff --git a/build/tasks/GenerateSharedFrameworkDepsFile.cs b/eng/tools/RepoTasks/GenerateSharedFrameworkDepsFile.cs similarity index 100% rename from build/tasks/GenerateSharedFrameworkDepsFile.cs rename to eng/tools/RepoTasks/GenerateSharedFrameworkDepsFile.cs diff --git a/build/tasks/GetMsiProperty.cs b/eng/tools/RepoTasks/GetMsiProperty.cs similarity index 100% rename from build/tasks/GetMsiProperty.cs rename to eng/tools/RepoTasks/GetMsiProperty.cs diff --git a/build/tasks/RemoveSharedFrameworkDependencies.cs b/eng/tools/RepoTasks/RemoveSharedFrameworkDependencies.cs similarity index 97% rename from build/tasks/RemoveSharedFrameworkDependencies.cs rename to eng/tools/RepoTasks/RemoveSharedFrameworkDependencies.cs index 3066bb5a89..1471c657dc 100644 --- a/build/tasks/RemoveSharedFrameworkDependencies.cs +++ b/eng/tools/RepoTasks/RemoveSharedFrameworkDependencies.cs @@ -98,6 +98,7 @@ namespace RepoTasks stream.Position = 0; stream.SetLength(0); rawNuspec.Save(stream); + Log.LogMessage(MessageImportance.High, "Added to {0}", fileName); } else { diff --git a/eng/tools/RepoTasks/RepoTasks.csproj b/eng/tools/RepoTasks/RepoTasks.csproj new file mode 100644 index 0000000000..f62865e203 --- /dev/null +++ b/eng/tools/RepoTasks/RepoTasks.csproj @@ -0,0 +1,37 @@ + + + + netcoreapp3.0 + $(TargetFrameworks);net472 + $(DefineConstants);BUILD_MSI_TASKS + false + embedded + true + + + + + + + + + + + + + + + + + + + + + + $(WiXSdkPath)\Microsoft.Deployment.WindowsInstaller.dll + + + $(WiXSdkPath)\Microsoft.Deployment.WindowsInstaller.Package.dll + + + diff --git a/eng/tools/RepoTasks/RepoTasks.tasks b/eng/tools/RepoTasks/RepoTasks.tasks new file mode 100644 index 0000000000..e8a24ee1f3 --- /dev/null +++ b/eng/tools/RepoTasks/RepoTasks.tasks @@ -0,0 +1,12 @@ + + + <_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' == 'core'">netcoreapp3.0 + <_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' != 'core'">net472 + <_RepoTaskAssembly>$(ArtifactsBinDir)RepoTasks\Release\$(_RepoTaskAssemblyFolder)\RepoTasks.dll + + + + + + + diff --git a/build/tasks/Uuid.cs b/eng/tools/RepoTasks/Uuid.cs similarity index 100% rename from build/tasks/Uuid.cs rename to eng/tools/RepoTasks/Uuid.cs diff --git a/eng/tools/tools.sln b/eng/tools/tools.sln index 51e337b7e3..d6f192e38e 100644 --- a/eng/tools/tools.sln +++ b/eng/tools/tools.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.0.0 MinimumVisualStudioVersion = 16.0.0.0 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BaselineGenerator", "BaselineGenerator\BaselineGenerator.csproj", "{CF76A947-3A72-4824-87E6-BF029D84218B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RepoTasks", "RepoTasks\RepoTasks.csproj", "{E418DA57-B2AA-43FC-9AD5-0E4D1AA993DE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution 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|x86.ActiveCfg = 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 EndGlobal diff --git a/global.json b/global.json index 97f7c9313f..e90a90d0f5 100644 --- a/global.json +++ b/global.json @@ -4,11 +4,27 @@ }, "tools": { "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": { "Yarn.MSBuild": "1.15.2", - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19302.2", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19302.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19312.4", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19312.4" } } diff --git a/korebuild-lock.txt b/korebuild-lock.txt deleted file mode 100644 index cb6baecc02..0000000000 --- a/korebuild-lock.txt +++ /dev/null @@ -1,2 +0,0 @@ -version:3.0.0-build-20190606.1 -commithash:2229c5dff7ca6384e7c17148a6da1aaee161f44d diff --git a/korebuild.json b/korebuild.json deleted file mode 100644 index e189d4b1de..0000000000 --- a/korebuild.json +++ /dev/null @@ -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" - ] - } - } -} diff --git a/src/Analyzers/shared/FeatureDetection/Microsoft.AspNetCore.Analyzers.FeatureDetection.Sources.csproj b/src/Analyzers/shared/FeatureDetection/Microsoft.AspNetCore.Analyzers.FeatureDetection.Sources.csproj index 53f07e744a..40e7bf1d97 100644 --- a/src/Analyzers/shared/FeatureDetection/Microsoft.AspNetCore.Analyzers.FeatureDetection.Sources.csproj +++ b/src/Analyzers/shared/FeatureDetection/Microsoft.AspNetCore.Analyzers.FeatureDetection.Sources.csproj @@ -17,7 +17,7 @@ contentFiles true $(DefaultExcludeItems);$(BaseOutputPath);$(BaseIntermediateOutputPath); - $(NoWarn);NU5105;CS8021 + $(NoWarn);CS8021 false diff --git a/src/Components/Blazor/BlazorExtension/src/Microsoft.VisualStudio.BlazorExtension.csproj b/src/Components/Blazor/BlazorExtension/src/Microsoft.VisualStudio.BlazorExtension.csproj index 5fb0851198..5639616fed 100644 --- a/src/Components/Blazor/BlazorExtension/src/Microsoft.VisualStudio.BlazorExtension.csproj +++ b/src/Components/Blazor/BlazorExtension/src/Microsoft.VisualStudio.BlazorExtension.csproj @@ -24,7 +24,7 @@ false true true - false + false true diff --git a/src/DefaultBuilder/test/Microsoft.AspNetCore.FunctionalTests/Microsoft.AspNetCore.FunctionalTests.csproj b/src/DefaultBuilder/test/Microsoft.AspNetCore.FunctionalTests/Microsoft.AspNetCore.FunctionalTests.csproj index 6da74488a4..efef69f713 100644 --- a/src/DefaultBuilder/test/Microsoft.AspNetCore.FunctionalTests/Microsoft.AspNetCore.FunctionalTests.csproj +++ b/src/DefaultBuilder/test/Microsoft.AspNetCore.FunctionalTests/Microsoft.AspNetCore.FunctionalTests.csproj @@ -18,6 +18,12 @@ + + + + + + diff --git a/src/Hosting/Hosting/test/WebHostBuilderTests.cs b/src/Hosting/Hosting/test/WebHostBuilderTests.cs index 4db65a21d9..55e0de8238 100644 --- a/src/Hosting/Hosting/test/WebHostBuilderTests.cs +++ b/src/Hosting/Hosting/test/WebHostBuilderTests.cs @@ -173,7 +173,8 @@ namespace Microsoft.AspNetCore.Hosting options.ValidateScopes = true; }); - Assert.Throws(() => hostBuilder.Build().Start()); + using var host = hostBuilder.Build(); + Assert.Throws(() => host.Start()); } [Theory] @@ -200,7 +201,8 @@ namespace Microsoft.AspNetCore.Hosting options.ValidateScopes = true; }); - Assert.Throws(() => hostBuilder.Build().Start()); + using var host = hostBuilder.Build(); + Assert.Throws(() => host.Start()); Assert.True(configurationCallbackCalled); } @@ -559,7 +561,6 @@ namespace Microsoft.AspNetCore.Hosting #pragma warning restore CS0618 // Type or member is obsolete } } - [Theory] [MemberData(nameof(DefaultWebHostBuildersWithConfig))] public void BuildAndDispose(IWebHostBuilder builder) @@ -653,10 +654,13 @@ namespace Microsoft.AspNetCore.Hosting [MemberData(nameof(DefaultWebHostBuilders))] public void DefaultWebHostBuilderWithNoStartupThrows(IWebHostBuilder builder) { - var host = builder - .UseServer(new TestServer()); + builder.UseServer(new TestServer()); - var ex = Assert.Throws(() => host.Build().Start()); + var ex = Assert.Throws(() => + { + using var host = builder.Build(); + host.Start(); + }); Assert.Contains("No application configured.", ex.Message); } @@ -701,7 +705,7 @@ namespace Microsoft.AspNetCore.Hosting [MemberData(nameof(DefaultWebHostBuilders))] public void DefaultApplicationNameWithUseStartupOfType(IWebHostBuilder builder) { - var host = builder + using var host = builder .UseServer(new TestServer()) .UseStartup(typeof(StartupNoServicesNoInterface)) .Build(); @@ -1130,7 +1134,8 @@ namespace Microsoft.AspNetCore.Hosting }) .UseServer(new TestServer()); - Assert.Throws(() => builder.Build().Start()); + using var host = builder.Build(); + Assert.Throws(() => host.Start()); Assert.NotNull(testSink); Assert.Contains(testSink.Writes, w => w.Exception?.Message == "Startup exception"); @@ -1178,7 +1183,8 @@ namespace Microsoft.AspNetCore.Hosting var exception = await Assert.ThrowsAsync(async () => { - var host = hostBuilder.Build(); + using var host = hostBuilder.Build(); + var filter = (MyStartupFilter)host.Services.GetServices().FirstOrDefault(s => s is MyStartupFilter); Assert.NotNull(filter); try @@ -1214,11 +1220,9 @@ namespace Microsoft.AspNetCore.Hosting Assert.Equal("nestedvalue", builder.GetSetting("key")); - using (var host = builder.Build()) - { - var appConfig = host.Services.GetRequiredService(); - Assert.Equal("nestedvalue", appConfig["key"]); - } + using var host = builder.Build(); + var appConfig = host.Services.GetRequiredService(); + Assert.Equal("nestedvalue", appConfig["key"]); } [Theory] @@ -1232,12 +1236,14 @@ namespace Microsoft.AspNetCore.Hosting }) .UseServer(new TestServer()); - var host = builder.Build(); - var startEx = await Assert.ThrowsAsync(() => host.StartAsync()); - Assert.Equal("Hosted Service throws in StartAsync", startEx.Message); - var stopEx = await Assert.ThrowsAsync(() => host.StopAsync()); - Assert.Single(stopEx.InnerExceptions); - Assert.Equal("Hosted Service throws in StopAsync", stopEx.InnerExceptions[0].Message); + using (var host = builder.Build()) + { + var startEx = await Assert.ThrowsAsync(() => host.StartAsync()); + Assert.Equal("Hosted Service throws in StartAsync", startEx.Message); + var stopEx = await Assert.ThrowsAsync(() => host.StopAsync()); + Assert.Single(stopEx.InnerExceptions); + Assert.Equal("Hosted Service throws in StopAsync", stopEx.InnerExceptions[0].Message); + } } [Theory] @@ -1252,7 +1258,7 @@ namespace Microsoft.AspNetCore.Hosting }) .UseServer(new TestServer()); - var host = builder.Build(); + using var host = builder.Build(); var service = host.Services.GetServices().OfType().First(); var startEx = await Assert.ThrowsAsync(() => host.StartAsync()); Assert.Equal("Hosted Service throws in StartAsync", startEx.Message); diff --git a/src/Hosting/Server.IntegrationTesting/src/ApplicationPublisher.cs b/src/Hosting/Server.IntegrationTesting/src/ApplicationPublisher.cs index 8ff8e9e124..ba5c545317 100644 --- a/src/Hosting/Server.IntegrationTesting/src/ApplicationPublisher.cs +++ b/src/Hosting/Server.IntegrationTesting/src/ApplicationPublisher.cs @@ -35,6 +35,8 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting + $" --output \"{publishDirectory.FullName}\"" + $" --framework {deploymentParameters.TargetFramework}" + $" --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}" + " --no-restore"; diff --git a/src/Hosting/Server.IntegrationTesting/src/TestMatrix.cs b/src/Hosting/Server.IntegrationTesting/src/TestMatrix.cs index deb7c17343..131cb2805a 100644 --- a/src/Hosting/Server.IntegrationTesting/src/TestMatrix.cs +++ b/src/Hosting/Server.IntegrationTesting/src/TestMatrix.cs @@ -237,7 +237,9 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting { 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() { @@ -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, - Tfm = tfm, - ApplicationType = type, - Architecture = arch, - HostingModel = hostingModel, - Skip = skipAncm, - }); + variants.Add(new TestVariant() + { + Server = server, + Tfm = tfm, + ApplicationType = type, + Architecture = arch, + HostingModel = hostingModel, + Skip = skipAncm, + }); + } } } diff --git a/src/Hosting/TestHost/test/ClientHandlerTests.cs b/src/Hosting/TestHost/test/ClientHandlerTests.cs index 7539928460..ad0fa61c70 100644 --- a/src/Hosting/TestHost/test/ClientHandlerTests.cs +++ b/src/Hosting/TestHost/test/ClientHandlerTests.cs @@ -477,7 +477,7 @@ namespace Microsoft.AspNetCore.TestHost return Task.FromResult(0); } } - + [Fact] public async Task ClientHandlerCreateContextWithDefaultRequestParameters() { diff --git a/src/Hosting/TestHost/test/TestServerTests.cs b/src/Hosting/TestHost/test/TestServerTests.cs index 2eb474b496..a2921dcf81 100644 --- a/src/Hosting/TestHost/test/TestServerTests.cs +++ b/src/Hosting/TestHost/test/TestServerTests.cs @@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.TestHost public async Task GenericRawCreate() { var server = new TestServer(); - var host = new HostBuilder() + using var host = new HostBuilder() .ConfigureWebHost(webBuilder => { webBuilder @@ -48,7 +48,7 @@ namespace Microsoft.AspNetCore.TestHost [Fact] public async Task GenericCreateAndStartHost_GetTestServer() { - var host = await new HostBuilder() + using var host = await new HostBuilder() .ConfigureWebHost(webBuilder => { webBuilder @@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.TestHost [Fact] public async Task GenericCreateAndStartHost_GetTestClient() { - var host = await new HostBuilder() + using var host = await new HostBuilder() .ConfigureWebHost(webBuilder => { webBuilder @@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.TestHost .Configure(app => { }) .UseTestServer(); - var host = builder.Build(); + using var host = builder.Build(); host.Start(); } diff --git a/src/Hosting/test/FunctionalTests/Microsoft.AspNetCore.Hosting.FunctionalTests.csproj b/src/Hosting/test/FunctionalTests/Microsoft.AspNetCore.Hosting.FunctionalTests.csproj index 7a273f333d..c848da3647 100644 --- a/src/Hosting/test/FunctionalTests/Microsoft.AspNetCore.Hosting.FunctionalTests.csproj +++ b/src/Hosting/test/FunctionalTests/Microsoft.AspNetCore.Hosting.FunctionalTests.csproj @@ -17,6 +17,7 @@ + diff --git a/src/Identity/test/Identity.Test/SignInManagerTest.cs b/src/Identity/test/Identity.Test/SignInManagerTest.cs index 007942d424..40507099e0 100644 --- a/src/Identity/test/Identity.Test/SignInManagerTest.cs +++ b/src/Identity/test/Identity.Test/SignInManagerTest.cs @@ -322,6 +322,8 @@ namespace Microsoft.AspNetCore.Identity.Test // Assert Assert.True(result.Succeeded); manager.Verify(); + + AppContext.SetSwitch("Microsoft.AspNetCore.Identity.CheckPasswordSignInAlwaysResetLockoutOnSuccess", false); } [Theory] diff --git a/src/Installers/Debian/Directory.Build.targets b/src/Installers/Debian/Directory.Build.targets index ca3400af75..fe959cd4e3 100644 --- a/src/Installers/Debian/Directory.Build.targets +++ b/src/Installers/Debian/Directory.Build.targets @@ -21,6 +21,7 @@ + diff --git a/src/Installers/Debian/TargetingPack/Debian.TargetingPack.debproj b/src/Installers/Debian/TargetingPack/Debian.TargetingPack.debproj index ee170b3e7b..61e37f44ec 100644 --- a/src/Installers/Debian/TargetingPack/Debian.TargetingPack.debproj +++ b/src/Installers/Debian/TargetingPack/Debian.TargetingPack.debproj @@ -12,6 +12,17 @@ ASP.NET Core Targeting Pack Provides a default set of APIs for building an ASP.NET Core $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion) application. Contains reference assemblies, documentation, and other design-time assets. + + + $(MicrosoftNETCoreAppRefPackageVersion) + $(DotnetTargetingPackDependencyVersion.Substring(0, $(DotnetTargetingPackDependencyVersion.IndexOf('-'))))~$(DotnetTargetingPackDependencyVersion.Substring($([MSBuild]::Add($(DotnetTargetingPackDependencyVersion.IndexOf('-')), 1)))) + + $(SharedFxProductName) + $(SharedFxDescription) + + DotnetTargetingPackDependencyVersion=$(DotnetTargetingPackDependencyVersion); + + diff --git a/src/Installers/Debian/TargetingPack/debian_config.json.in b/src/Installers/Debian/TargetingPack/debian_config.json.in index bbcb1c166d..74b38efff5 100644 --- a/src/Installers/Debian/TargetingPack/debian_config.json.in +++ b/src/Installers/Debian/TargetingPack/debian_config.json.in @@ -30,7 +30,7 @@ "debian_dependencies": { "dotnet-targeting-pack-${AspNetCoreMajorVersion}.${AspNetCoreMinorVersion}": { - "package_version": "${DotnetRuntimeDependencyVersion}" + "package_version": "${DotnetTargetingPackDependencyVersion}" } } } diff --git a/src/Installers/Rpm/Directory.Build.targets b/src/Installers/Rpm/Directory.Build.targets index 7199ff32bd..9a4eb927b0 100644 --- a/src/Installers/Rpm/Directory.Build.targets +++ b/src/Installers/Rpm/Directory.Build.targets @@ -30,6 +30,7 @@ + diff --git a/src/Middleware/NodeServices/src/Microsoft.AspNetCore.NodeServices.csproj b/src/Middleware/NodeServices/src/Microsoft.AspNetCore.NodeServices.csproj index 17b6bea51b..b6e0c32519 100644 --- a/src/Middleware/NodeServices/src/Microsoft.AspNetCore.NodeServices.csproj +++ b/src/Middleware/NodeServices/src/Microsoft.AspNetCore.NodeServices.csproj @@ -24,14 +24,6 @@ - - - - YarnInstall - - - - diff --git a/src/Middleware/SpaServices/src/Microsoft.AspNetCore.SpaServices.csproj b/src/Middleware/SpaServices/src/Microsoft.AspNetCore.SpaServices.csproj index 1541835389..7efd6b6832 100644 --- a/src/Middleware/SpaServices/src/Microsoft.AspNetCore.SpaServices.csproj +++ b/src/Middleware/SpaServices/src/Microsoft.AspNetCore.SpaServices.csproj @@ -28,14 +28,6 @@ - - - - YarnInstall - - - - diff --git a/src/MusicStore/test/MusicStore.E2ETests/MusicStore.E2ETests.csproj b/src/MusicStore/test/MusicStore.E2ETests/MusicStore.E2ETests.csproj index 60d9f5a6b3..d58b11a9de 100644 --- a/src/MusicStore/test/MusicStore.E2ETests/MusicStore.E2ETests.csproj +++ b/src/MusicStore/test/MusicStore.E2ETests/MusicStore.E2ETests.csproj @@ -6,9 +6,6 @@ MusicStore.E2ETests true true - $(WarningsNotAsErrors);xUnit1004 - - $(NoWarn);NU1605 true diff --git a/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj b/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj index 51388a1c39..09fbc8c5dc 100644 --- a/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj +++ b/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj @@ -55,14 +55,8 @@ - - - - - + + diff --git a/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureInheritanceTests.cs b/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureInheritanceTests.cs index 6bc64ec9cb..167cc512c4 100644 --- a/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureInheritanceTests.cs +++ b/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureInheritanceTests.cs @@ -19,8 +19,8 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests public void TestingInfrastructure_WebHost_WithWebHostBuilderRespectsCustomizations() { // Act - var factory = new CustomizedFactory(); - var customized = factory + using var factory = new CustomizedFactory(); + using var customized = factory .WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("Customization")) .WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("FurtherCustomization")); var client = customized.CreateClient(); @@ -38,8 +38,8 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests public void TestingInfrastructure_GenericHost_WithWithHostBuilderRespectsCustomizations() { // Act - var factory = new CustomizedFactory(); - var customized = factory + using var factory = new CustomizedFactory(); + using var customized = factory .WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("Customization")) .WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("FurtherCustomization")); var client = customized.CreateClient(); @@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests public void TestingInfrastructure_GenericHost_WithWithHostBuilderHasServices() { // Act - var factory = new CustomizedFactory(); + using var factory = new CustomizedFactory(); // Assert Assert.NotNull(factory.Services); diff --git a/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureTests.cs b/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureTests.cs index 37b5a24cf2..ec946e3d15 100644 --- a/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureTests.cs +++ b/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureTests.cs @@ -48,7 +48,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests [Fact] public void TestingInfrastructure_CreateClientThrowsInvalidOperationForNonEntryPoint() { - var factory = new WebApplicationFactory(); + using var factory = new WebApplicationFactory(); var ex = Assert.Throws(() => 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.", ex.Message); @@ -123,7 +123,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests [Fact] public async Task TestingInfrastructure_WorksWithGenericHost() { - var factory = new WebApplicationFactory() + using var factory = new WebApplicationFactory() .WithWebHostBuilder(builder => builder.ConfigureTestServices(s => s.AddSingleton())); @@ -135,7 +135,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests [Fact] public void TestingInfrastructure_HasServicesUsingWebHostProgram() { - var factory = new WebApplicationFactory(); + using var factory = new WebApplicationFactory(); Assert.NotNull(factory.Services); Assert.NotNull(factory.Services.GetService(typeof(IConfiguration))); @@ -144,7 +144,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests [Fact] public void TestingInfrastructure_HasServicesUsingWebHostStartup() { - var factory = new WebApplicationFactory(); + using var factory = new WebApplicationFactory(); Assert.NotNull(factory.Services); Assert.NotNull(factory.Services.GetService(typeof(IConfiguration))); @@ -153,7 +153,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests [Fact] public void TestingInfrastructure_HasServicesUsingGenericHostProgram() { - var factory = new WebApplicationFactory(); + using var factory = new WebApplicationFactory(); Assert.NotNull(factory.Services); Assert.NotNull(factory.Services.GetService(typeof(IConfiguration))); @@ -162,7 +162,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests [Fact] public void TestingInfrastructure_HasServicesUsingGenericHostStartup() { - var factory = new WebApplicationFactory(); + using var factory = new WebApplicationFactory(); Assert.NotNull(factory.Services); Assert.NotNull(factory.Services.GetService(typeof(IConfiguration))); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj b/src/ProjectTemplates/Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj index 9a9d1ac81f..2af161238d 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj @@ -27,7 +27,6 @@ - diff --git a/src/ProjectTemplates/build.cmd b/src/ProjectTemplates/build.cmd index ee8a076876..2406296662 100644 --- a/src/ProjectTemplates/build.cmd +++ b/src/ProjectTemplates/build.cmd @@ -1,3 +1,3 @@ @ECHO OFF SET RepoRoot=%~dp0..\.. -%RepoRoot%\build.cmd -projects %~dp0**\*.*proj -pack /t:BuildSharedFx /t:Build %* +%RepoRoot%\build.cmd -projects %~dp0**\*.*proj %* diff --git a/src/Security/Authentication/Negotiate/test/Negotiate.Test/EventTests.cs b/src/Security/Authentication/Negotiate/test/Negotiate.Test/EventTests.cs index adc562d0dd..dc76aacb6e 100644 --- a/src/Security/Authentication/Negotiate/test/Negotiate.Test/EventTests.cs +++ b/src/Security/Authentication/Negotiate/test/Negotiate.Test/EventTests.cs @@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate public async Task OnChallenge_Fires() { var eventInvoked = false; - var server = await CreateServerAsync(options => + using var host = await CreateHostAsync(options => { 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()); Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode); @@ -49,7 +50,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [Fact] public async Task OnChallenge_Handled() { - var server = await CreateServerAsync(options => + using var host = await CreateHostAsync(options => { 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()); Assert.Equal(StatusCodes.Status418ImATeapot, result.Response.StatusCode); @@ -72,7 +74,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate public async Task OnAuthenticationFailed_Fires() { var eventInvoked = false; - var server = await CreateServerAsync(options => + using var host = await CreateHostAsync(options => { options.Events = new NegotiateEvents() { @@ -85,6 +87,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate } }; }); + var server = host.GetTestServer(); var ex = await Assert.ThrowsAsync(() => SendAsync(server, "/404", new TestConnection(), "Negotiate InvalidBlob")); @@ -95,7 +98,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [Fact] public async Task OnAuthenticationFailed_Handled() { - var server = await CreateServerAsync(options => + using var host = await CreateHostAsync(options => { 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"); Assert.Equal(StatusCodes.Status418ImATeapot, result.Response.StatusCode); @@ -118,7 +122,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate public async Task OnAuthenticated_FiresOncePerRequest() { var callCount = 0; - var server = await CreateServerAsync(options => + using var host = await CreateHostAsync(options => { options.PersistKerberosCredentials = true; options.Events = new NegotiateEvents() @@ -134,6 +138,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate } }; }); + var server = host.GetTestServer(); var testConnection = new TestConnection(); await KerberosStage1And2Auth(server, testConnection); @@ -147,7 +152,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate public async Task OnAuthenticated_Success_Continues() { var callCount = 0; - var server = await CreateServerAsync(options => + using var host = await CreateHostAsync(options => { options.Events = new NegotiateEvents() { @@ -159,6 +164,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate } }; }); + var server = host.GetTestServer(); await KerberosStage1And2Auth(server, new TestConnection()); Assert.Equal(1, callCount); @@ -168,7 +174,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate public async Task OnAuthenticated_NoResult_SuppresesCredentials() { var callCount = 0; - var server = await CreateServerAsync(options => + using var host = await CreateHostAsync(options => { 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"); Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode); @@ -191,7 +198,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate public async Task OnAuthenticated_Fail_SuppresesCredentials() { var callCount = 0; - var server = await CreateServerAsync(options => + using var host = await CreateHostAsync(options => { 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"); 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]); } - private static async Task CreateServerAsync(Action configureOptions = null) + private static async Task CreateHostAsync(Action configureOptions = null) { var builder = new HostBuilder() .ConfigureServices(services => services @@ -249,11 +257,10 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate app.UseRouting(); app.UseAuthentication(); app.UseEndpoints(ConfigureEndpoints); - }); + }); }); - var server = (await builder.StartAsync()).GetTestServer(); - return server; + return await builder.StartAsync(); } private static void ConfigureEndpoints(IEndpointRouteBuilder builder) diff --git a/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs b/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs index bced9c7608..b57a8e996d 100644 --- a/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs +++ b/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs @@ -26,7 +26,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [Fact] public async Task Anonymous_MissingConnectionFeatures_ThrowsNotSupported() { - var server = await CreateServerAsync(); + using var host = await CreateHostAsync(); + var server = host.GetTestServer(); var ex = await Assert.ThrowsAsync(() => SendAsync(server, "/Anonymous1", connection: null)); Assert.Equal("Negotiate authentication requires a server that supports IConnectionItemsFeature like Kestrel.", ex.Message); @@ -35,7 +36,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [Fact] public async Task Anonymous_NoChallenge_NoOps() { - var server = await CreateServerAsync(); + using var host = await CreateHostAsync(); + var server = host.GetTestServer(); var result = await SendAsync(server, "/Anonymous1", new TestConnection()); Assert.Equal(StatusCodes.Status200OK, result.Response.StatusCode); @@ -44,7 +46,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [Fact] public async Task Anonymous_Http2_NoOps() { - var server = await CreateServerAsync(); + using var host = await CreateHostAsync(); + var server = host.GetTestServer(); var result = await SendAsync(server, "/Anonymous2", connection: null, http2: true); Assert.Equal(StatusCodes.Status200OK, result.Response.StatusCode); @@ -53,7 +56,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [Fact] public async Task Anonymous_Challenge_401Negotiate() { - var server = await CreateServerAsync(); + using var host = await CreateHostAsync(); + var server = host.GetTestServer(); var result = await SendAsync(server, "/Authenticate", new TestConnection()); Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode); @@ -63,7 +67,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [Fact] public async Task Anonymous_ChallengeHttp2_401Negotiate() { - var server = await CreateServerAsync(); + using var host = await CreateHostAsync(); + var server = host.GetTestServer(); var result = await SendAsync(server, "/Authenticate", connection: null, http2: true); // Clients will downgrade to HTTP/1.1 and authenticate. @@ -74,7 +79,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [Fact] public async Task NtlmStage1Auth_401NegotiateServerBlob1() { - var server = await CreateServerAsync(); + using var host = await CreateHostAsync(); + var server = host.GetTestServer(); var result = await SendAsync(server, "/404", new TestConnection(), "Negotiate ClientNtlmBlob1"); Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode); Assert.Equal("Negotiate ServerNtlmBlob1", result.Response.Headers[HeaderNames.WWWAuthenticate]); @@ -83,7 +89,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [Fact] public async Task AnonymousAfterNtlmStage1_Throws() { - var server = await CreateServerAsync(); + using var host = await CreateHostAsync(); + var server = host.GetTestServer(); var testConnection = new TestConnection(); await NtlmStage1Auth(server, testConnection); @@ -94,7 +101,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [Fact] public async Task NtlmStage2Auth_WithoutStage1_Throws() { - var server = await CreateServerAsync(); + using var host = await CreateHostAsync(); + var server = host.GetTestServer(); var ex = await Assert.ThrowsAsync(() => SendAsync(server, "/404", new TestConnection(), "Negotiate ClientNtlmBlob2")); Assert.Equal("Stage1Complete", ex.UserMessage); @@ -105,7 +113,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [InlineData(true)] public async Task NtlmStage1And2Auth_Success(bool persistNtlm) { - var server = await CreateServerAsync(options => options.PersistNtlmCredentials = persistNtlm); + using var host = await CreateHostAsync(options => options.PersistNtlmCredentials = persistNtlm); + var server = host.GetTestServer(); var testConnection = new TestConnection(); await NtlmStage1And2Auth(server, testConnection); } @@ -115,7 +124,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [InlineData(true)] public async Task KerberosAuth_Success(bool persistKerberos) { - var server = await CreateServerAsync(options => options.PersistKerberosCredentials = persistKerberos); + using var host = await CreateHostAsync(options => options.PersistKerberosCredentials = persistKerberos); + var server = host.GetTestServer(); var testConnection = new TestConnection(); await KerberosAuth(server, testConnection); } @@ -125,7 +135,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [InlineData(true)] public async Task KerberosTwoStageAuth_Success(bool persistKerberos) { - var server = await CreateServerAsync(options => options.PersistKerberosCredentials = persistKerberos); + using var host = await CreateHostAsync(options => options.PersistKerberosCredentials = persistKerberos); + var server = host.GetTestServer(); var testConnection = new TestConnection(); await KerberosStage1And2Auth(server, testConnection); } @@ -136,7 +147,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [InlineData("Kerberos2")] public async Task AnonymousAfterCompletedPersist_Cached(string protocol) { - var server = await CreateServerAsync(options => options.PersistNtlmCredentials = options.PersistKerberosCredentials = true); + using var host = await CreateHostAsync(options => options.PersistNtlmCredentials = options.PersistKerberosCredentials = true); + var server = host.GetTestServer(); var testConnection = new TestConnection(); if (protocol == "NTLM") { @@ -162,7 +174,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [InlineData("Kerberos2")] public async Task AnonymousAfterCompletedNoPersist_Denied(string protocol) { - var server = await CreateServerAsync(options => options.PersistNtlmCredentials = options.PersistKerberosCredentials = false); + using var host = await CreateHostAsync(options => options.PersistNtlmCredentials = options.PersistKerberosCredentials = false); + var server = host.GetTestServer(); var testConnection = new TestConnection(); if (protocol == "NTLM") { @@ -187,7 +200,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [InlineData(true)] public async Task AuthHeaderAfterNtlmCompleted_ReAuthenticates(bool persist) { - var server = await CreateServerAsync(options => options.PersistNtlmCredentials = persist); + using var host = await CreateHostAsync(options => options.PersistNtlmCredentials = persist); + var server = host.GetTestServer(); var testConnection = new TestConnection(); await NtlmStage1And2Auth(server, testConnection); await NtlmStage1And2Auth(server, testConnection); @@ -198,7 +212,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [InlineData(true)] public async Task AuthHeaderAfterKerberosCompleted_ReAuthenticates(bool persist) { - var server = await CreateServerAsync(options => options.PersistNtlmCredentials = persist); + using var host = await CreateHostAsync(options => options.PersistNtlmCredentials = persist); + var server = host.GetTestServer(); var testConnection = new TestConnection(); await KerberosAuth(server, testConnection); await KerberosAuth(server, testConnection); @@ -209,7 +224,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate [InlineData(true)] public async Task AuthHeaderAfterKerberos2StageCompleted_ReAuthenticates(bool persist) { - var server = await CreateServerAsync(options => options.PersistNtlmCredentials = persist); + using var host = await CreateHostAsync(options => options.PersistNtlmCredentials = persist); + var server = host.GetTestServer(); var testConnection = new TestConnection(); await KerberosStage1And2Auth(server, testConnection); await KerberosStage1And2Auth(server, testConnection); @@ -245,7 +261,8 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate }); }); - var server = (await builder.StartAsync()).GetTestServer(); + using var host = await builder.StartAsync(); + var server = host.GetTestServer(); var testConnection = new TestConnection(); await NtlmStage1Auth(server, testConnection); @@ -302,7 +319,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate Assert.Equal("Negotiate ServerNtlmBlob2", result.Response.Headers[HeaderNames.WWWAuthenticate]); } - private static async Task CreateServerAsync(Action configureOptions = null) + private static async Task CreateHostAsync(Action configureOptions = null) { var builder = new HostBuilder() .ConfigureServices(services => services @@ -321,11 +338,10 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate app.UseRouting(); app.UseAuthentication(); app.UseEndpoints(ConfigureEndpoints); - }); + }); }); - var server = (await builder.StartAsync()).GetTestServer(); - return server; + return await builder.StartAsync(); } private static void ConfigureEndpoints(IEndpointRouteBuilder builder) diff --git a/src/Security/Authorization/Policy/src/Microsoft.AspNetCore.Authorization.Policy.csproj b/src/Security/Authorization/Policy/src/Microsoft.AspNetCore.Authorization.Policy.csproj index ecd83793a4..07078e7ea2 100644 --- a/src/Security/Authorization/Policy/src/Microsoft.AspNetCore.Authorization.Policy.csproj +++ b/src/Security/Authorization/Policy/src/Microsoft.AspNetCore.Authorization.Policy.csproj @@ -4,7 +4,7 @@ ASP.NET Core authorization policy helper classes. netcoreapp3.0 true - $(NoWarn);CS1591;NU1605 + $(NoWarn);CS1591 true aspnetcore;authorization diff --git a/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs b/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs index dd54a32c2c..71ed417a11 100644 --- a/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs +++ b/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs @@ -160,7 +160,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal // Write the bytes as if they were ASCII for (int i = 0; i < buffer.Length; i++) { - rawDataBuilder.Append((char)buffer[i]); + var bufferChar = (char)buffer[i]; + if (Char.IsControl(bufferChar)) + { + rawDataBuilder.Append("\\x"); + rawDataBuilder.Append(buffer[i].ToString("X2")); + continue; + } + rawDataBuilder.Append(bufferChar); } _logger.LogDebug(builder.ToString(), rawDataBuilder.ToString()); diff --git a/src/Servers/Kestrel/build.sh b/src/Servers/Kestrel/build.sh index 6e9976ede7..5736cc53b6 100755 --- a/src/Servers/Kestrel/build.sh +++ b/src/Servers/Kestrel/build.sh @@ -4,4 +4,4 @@ set -euo pipefail DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" repo_root="$DIR/../../.." -"$repo_root/build.sh" --all --projects "$DIR/**/*.*proj" "$@" +"$repo_root/build.sh" --projects "$DIR/**/*.*proj" "$@" diff --git a/src/Servers/test/FunctionalTests/ServerComparison.FunctionalTests.csproj b/src/Servers/test/FunctionalTests/ServerComparison.FunctionalTests.csproj index de28935c52..49e4b3a9a7 100644 --- a/src/Servers/test/FunctionalTests/ServerComparison.FunctionalTests.csproj +++ b/src/Servers/test/FunctionalTests/ServerComparison.FunctionalTests.csproj @@ -16,6 +16,7 @@ + diff --git a/src/Shared/E2ETesting/E2ETesting.props b/src/Shared/E2ETesting/E2ETesting.props index f7affc8264..8d9920f269 100644 --- a/src/Shared/E2ETesting/E2ETesting.props +++ b/src/Shared/E2ETesting/E2ETesting.props @@ -2,7 +2,7 @@ <_DefaultProjectFilter>$(MSBuildProjectDirectory)\..\.. $(DefaultItemExcludes);node_modules\** - $([MSBuild]::EnsureTrailingSlash('$(RepoRoot)'))obj\selenium\ + $([MSBuild]::EnsureTrailingSlash('$(RepoRoot)'))artifacts\tmp\selenium\ true true diff --git a/src/Shared/E2ETesting/E2ETesting.targets b/src/Shared/E2ETesting/E2ETesting.targets index 3b27dc75f7..648bdae663 100644 --- a/src/Shared/E2ETesting/E2ETesting.targets +++ b/src/Shared/E2ETesting/E2ETesting.targets @@ -14,14 +14,6 @@ - - - - EnsureNodeJSRestored - - - - true - $(GradleOptions) -Dorg.gradle.daemon=false + $(GradleOptions) -Dorg.gradle.daemon=false diff --git a/src/SignalR/clients/ts/FunctionalTests/SignalR.Npm.FunctionalTests.npmproj b/src/SignalR/clients/ts/FunctionalTests/SignalR.Npm.FunctionalTests.npmproj index aa0c322a68..3510aa1775 100644 --- a/src/SignalR/clients/ts/FunctionalTests/SignalR.Npm.FunctionalTests.npmproj +++ b/src/SignalR/clients/ts/FunctionalTests/SignalR.Npm.FunctionalTests.npmproj @@ -3,8 +3,8 @@ false - true - sauce.local + false + sauce.local <_TestSauceArgs>--verbose --no-color --configuration $(Configuration) --sauce-user "$(SauceUser)" --sauce-key "$(SauceKey)" <_TestSauceArgs Condition="'$(BrowserTestHostName)' != ''">$(_TestSauceArgs) --use-hostname "$(BrowserTestHostName)" run test:local --no-color --configuration $(Configuration) @@ -32,7 +32,7 @@ WorkingDirectory="$(RepoRoot)src/SignalR/clients/ts/FunctionalTests" /> - sauce.local + sauce.local <_TestSauceArgs>--verbose --no-color --configuration $(Configuration) --sauce-user "$(SauceUser)" --sauce-key "$(SauceKey)" <_TestSauceArgs Condition="'$(BrowserTestHostName)' != ''">$(_TestSauceArgs) --use-hostname "$(BrowserTestHostName)" diff --git a/src/SignalR/clients/ts/FunctionalTests/scripts/run-tests.ts b/src/SignalR/clients/ts/FunctionalTests/scripts/run-tests.ts index ef1fe686c0..1db900c20f 100644 --- a/src/SignalR/clients/ts/FunctionalTests/scripts/run-tests.ts +++ b/src/SignalR/clients/ts/FunctionalTests/scripts/run-tests.ts @@ -13,7 +13,7 @@ import * as _debug from "debug"; const debug = _debug("signalr-functional-tests:run"); const ARTIFACTS_DIR = path.resolve(__dirname, "..", "..", "..", "..", "..", "..", "artifacts"); -const LOGS_DIR = path.resolve(ARTIFACTS_DIR, "logs"); +const LOGS_DIR = path.resolve(ARTIFACTS_DIR, "log"); const HOSTSFILE_PATH = process.platform === "win32" ? `${process.env.SystemRoot}\\System32\\drivers\\etc\\hosts` : null; @@ -242,7 +242,6 @@ function runJest(httpsUrl: string, httpUrl: string) { // https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy+FAQS desiredServerUrl = "http://127.0.0.1:9000;https://127.0.0.1:9001"; } - const dotnet = spawn("dotnet", [serverPath], { env: { ...process.env,