From e31813b9cd47968f4ec7348dc363d6276b98cbdf Mon Sep 17 00:00:00 2001 From: John Luo <johluo@microsoft.com> Date: Mon, 8 Jul 2019 11:02:30 -0700 Subject: [PATCH] Add support for source-build (#11717) --- .azure/pipelines/ci.yml | 49 ++++++ Directory.Build.targets | 3 + eng/AfterSolutionBuild.targets | 2 +- eng/Dependencies.props | 143 ++++++++++-------- eng/Workarounds.targets | 7 +- eng/WorkaroundsImported.targets | 5 + eng/scripts/ci-source-build.sh | 39 +++++ eng/targets/CSharp.Common.props | 2 +- eng/targets/ResolveReferences.targets | 6 +- eng/tools/RepoTasks/RepoTasks.csproj | 2 + .../ref/Microsoft.AspNetCore.App.Ref.csproj | 3 + .../Microsoft.AspNetCore.App.Runtime.csproj | 14 +- .../Microsoft.AspNetCore.Identity.UI.csproj | 6 +- ...NetCore.DeveloperCertificates.XPlat.csproj | 1 + .../test/dotnet-watch.Tests.csproj | 6 +- 15 files changed, 208 insertions(+), 80 deletions(-) create mode 100644 eng/WorkaroundsImported.targets create mode 100755 eng/scripts/ci-source-build.sh diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index d6a660b48bb..caa6557d494 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -471,3 +471,52 @@ jobs: - name: Linux_Test_Results path: artifacts/TestResults/ publishOnError: true + +# Source build +- job: Source_Build + displayName: 'Test: Linux Source Build' + container: centos:7 + pool: + vmImage: 'ubuntu-16.04' + variables: + DotNetCoreSdkDir: $(Agent.ToolsDirectory)/dotnet + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true + steps: + - script: | + source eng/common/native/common-library.sh + mkdir -p $HOME/bin + GetFile https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 $HOME/bin/jq + chmod +x $HOME/bin/jq + echo "##vso[task.prependpath]$HOME/bin" + displayName: Install jq + - task: UseDotNet@2 + displayName: 'Use .NET Core sdk' + inputs: + packageType: sdk + # The SDK version selected here is intentionally supposed to use the latest release + # For the purpose of building Linux distros, we can't depend on features of the SDK + # which may not exist in pre-built versions of the SDK + version: 3.0.x + installationPath: $(DotNetCoreSdkDir) + includePreviewVersions: true + - script: ./eng/scripts/ci-source-build.sh --ci --configuration Release /p:BuildManaged=true + displayName: Run ci-source-build.sh + - task: PublishBuildArtifacts@1 + displayName: Upload logs + condition: always() + continueOnError: true + inputs: + pathtoPublish: artifacts/log/ + artifactName: Source_Build_Logs + artifactType: Container + parallel: true + - task: PublishBuildArtifacts@1 + displayName: Upload package artifacts + # Only capture source build artifacts in PRs for the sake of inspecting + # changes that impact source-build. The artifacts from this build pipeline are never actually used. + condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) + inputs: + pathtoPublish: artifacts/packages/ + artifactName: Source_Build_Packages + artifactType: Container + parallel: true diff --git a/Directory.Build.targets b/Directory.Build.targets index 3f3ff318a91..0da788da27e 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -14,6 +14,9 @@ By default, assemblies which are only in the Microsoft.AspNetCore.App shared framework are not available as NuGet packages. --> <IsPackable Condition="'$(IsAspNetCoreApp)' == 'true' AND '$(IsShippingPackage)' != 'true'">false</IsPackable> + + <!-- Only build assemblies in Microsoft.AspNetCore.App in source build --> + <ExcludeFromSourceBuild Condition="'$(ExcludeFromSourceBuild)' == '' and '$(DotNetBuildFromSource)' == 'true' and '$(IsAspNetCoreApp)' != 'true'">true</ExcludeFromSourceBuild> </PropertyGroup> <Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" /> diff --git a/eng/AfterSolutionBuild.targets b/eng/AfterSolutionBuild.targets index 3857e152395..24f5a1b8b25 100644 --- a/eng/AfterSolutionBuild.targets +++ b/eng/AfterSolutionBuild.targets @@ -17,7 +17,7 @@ SharedFrameworkTargetFramework="netcoreapp$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)" /> </Target> - <Target Name="GenerateBuildAssetManifest" AfterTargets="Pack" Condition="'$(ContinuousIntegrationBuild)' == 'true'"> + <Target Name="GenerateBuildAssetManifest" AfterTargets="Pack" Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(DotNetBuildFromSource)' != 'true'"> <!-- Generate build manifests. These manifests are used by Maestro and the Build Asset Registry to flow dependencies to other repos. --> <MSBuild Projects="$(MSBuildThisFileDirectory)tools\Maestro\Maestro.csproj" Targets="Restore" diff --git a/eng/Dependencies.props b/eng/Dependencies.props index f04112c1965..754b192df38 100644 --- a/eng/Dependencies.props +++ b/eng/Dependencies.props @@ -19,32 +19,10 @@ and are generated based on the last package release. </LatestPackageReference> </ItemDefinitionGroup> - <ItemGroup> - <LatestPackageReference Include="AngleSharp" Version="$(AngleSharpPackageVersion)" /> - <LatestPackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetPackageVersion)" /> - <LatestPackageReference Include="FSharp.Core" Version="$(FSharpCorePackageVersion)" /> - <LatestPackageReference Include="Google.ProtoBuf" Version="$(GoogleProtoBufPackageVersion)" /> - <LatestPackageReference Include="IdentityServer4.AspNetIdentity" Version="$(IdentityServer4AspNetIdentityPackageVersion)" /> - <LatestPackageReference Include="IdentityServer4.EntityFramework" Version="$(IdentityServer4EntityFrameworkPackageVersion)" /> - <LatestPackageReference Include="IdentityServer4.EntityFramework.Storage" Version="$(IdentityServer4EntityFrameworkStoragePackageVersion)" /> - <LatestPackageReference Include="IdentityServer4" Version="$(IdentityServer4PackageVersion)" /> - <LatestPackageReference Include="IdentityServer4.Storage" Version="$(IdentityServer4StoragePackageVersion)" /> - <LatestPackageReference Include="Libuv" Version="$(LibuvPackageVersion)" /> - <LatestPackageReference Include="MessagePack" Version="$(MessagePackPackageVersion)" /> - <LatestPackageReference Include="Microsoft.AspNet.WebApi.Client" Version="$(MicrosoftAspNetWebApiClientPackageVersion)" /> - <LatestPackageReference Include="Microsoft.AspNetCore.Analyzer.Testing" Version="$(MicrosoftAspNetCoreAnalyzerTestingPackageVersion)" /> - <LatestPackageReference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.2.1" Version="$(MicrosoftAspNetCoreAzureAppServicesSiteExtension21PackageVersion)" /> - <LatestPackageReference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.2.2" Version="$(MicrosoftAspNetCoreAzureAppServicesSiteExtension22PackageVersion)" /> - <LatestPackageReference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" Version="$(MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion)" /> - <LatestPackageReference Include="Microsoft.AspNetCore.Blazor.Mono" Version="$(MicrosoftAspNetCoreBlazorMonoPackageVersion)" /> + <ItemGroup Label=".NET team dependencies"> <LatestPackageReference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="$(MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion)" /> <LatestPackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="$(MicrosoftAspNetCoreRazorLanguagePackageVersion)" /> - <LatestPackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Azure.KeyVault" Version="$(MicrosoftAzureKeyVaultPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Azure.Storage.Blob" Version="$(MicrosoftAzureStorageBlobPackageVersion)" /> <LatestPackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftBclAsyncInterfacesPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCorePackageVersion)" /> <LatestPackageReference Include="Microsoft.CodeAnalysis.Common" Version="$(MicrosoftCodeAnalysisCommonPackageVersion)" /> <LatestPackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion)" /> <LatestPackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisCSharpPackageVersion)" /> @@ -52,17 +30,9 @@ and are generated based on the last package release. <LatestPackageReference Include="Microsoft.CSharp" Version="$(MicrosoftCSharpPackageVersion)" /> <LatestPackageReference Include="Microsoft.DotNet.GenAPI" Version="$(MicrosoftDotNetGenApiPackageVersion)" /> <LatestPackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(MicrosoftDotNetPlatformAbstractionsPackageVersion)" /> - <LatestPackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(MicrosoftEntityFrameworkCoreInMemoryPackageVersion)" /> - <LatestPackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(MicrosoftEntityFrameworkCoreRelationalPackageVersion)" /> - <LatestPackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(MicrosoftEntityFrameworkCoreSqlitePackageVersion)" /> - <LatestPackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(MicrosoftEntityFrameworkCoreSqlServerPackageVersion)" /> - <LatestPackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftEntityFrameworkCoreToolsPackageVersion)" /> - <LatestPackageReference Include="Microsoft.EntityFrameworkCore" Version="$(MicrosoftEntityFrameworkCorePackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.ActivatorUtilities.Sources" Version="$(MicrosoftExtensionsActivatorUtilitiesSourcesPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="$(MicrosoftExtensionsCachingAbstractionsPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(MicrosoftExtensionsCachingMemoryPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="$(MicrosoftExtensionsCachingSqlServerPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="$(MicrosoftExtensionsCachingStackExchangeRedisPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="$(MicrosoftExtensionsConfigurationAbstractionsPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsConfigurationBinderPackageVersion)" /> @@ -94,13 +64,11 @@ and are generated based on the last package release. <LatestPackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="$(MicrosoftExtensionsLocalizationAbstractionsPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Localization" Version="$(MicrosoftExtensionsLocalizationPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsLoggingAbstractionsPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="$(MicrosoftExtensionsLoggingAzureAppServicesPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="$(MicrosoftExtensionsLoggingConfigurationPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Logging.EventSource" Version="$(MicrosoftExtensionsLoggingEventSourcePackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="$(MicrosoftExtensionsLoggingEventLogPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Logging.TraceSource" Version="$(MicrosoftExtensionsLoggingTraceSourcePackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.ObjectPool" Version="$(MicrosoftExtensionsObjectPoolPackageVersion)" /> @@ -112,42 +80,15 @@ and are generated based on the last package release. <LatestPackageReference Include="Microsoft.Extensions.TypeNameHelper.Sources" Version="$(MicrosoftExtensionsTypeNameHelperSourcesPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.ValueStopWatch.Sources" Version="$(MicrosoftExtensionsValueStopwatchSourcesPackageVersion)" /> <LatestPackageReference Include="Microsoft.Extensions.WebEncoders" Version="$(MicrosoftExtensionsWebEncodersPackageVersion)" /> - <LatestPackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="$(MicrosoftIdentityModelClientsActiveDirectoryPackageVersion)" /> - <LatestPackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="$(MicrosoftIdentityModelProtocolsOpenIdConnectPackageVersion)" /> - <LatestPackageReference Include="Microsoft.IdentityModel.Protocols.WsFederation" Version="$(MicrosoftIdentityModelProtocolsWsFederationPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Internal.AspNetCore.H2Spec.All" Version="$(MicrosoftInternalAspNetCoreH2SpecAllPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Internal.Extensions.Refs" Version="$(MicrosoftInternalExtensionsRefsPackageVersion)" /> <LatestPackageReference Include="Microsoft.JSInterop" Version="$(MicrosoftJSInteropPackageVersion)" /> - <LatestPackageReference Include="Microsoft.NETCore.Windows.ApiSets" Version="$(MicrosoftNETCoreWindowsApiSetsPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Owin.Security.Cookies" Version="$(MicrosoftOwinSecurityCookiesPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Owin.Testing" Version="$(MicrosoftOwinTestingPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Web.Administration" Version="$(MicrosoftWebAdministrationPackageVersion)" /> - <LatestPackageReference Include="Microsoft.Web.Xdt" Version="$(MicrosoftWebXdtPackageVersion)" /> <LatestPackageReference Include="Microsoft.Win32.Registry" Version="$(MicrosoftWin32RegistryPackageVersion)" /> - <LatestPackageReference Include="Mono.Cecil" Version="$(MonoCecilPackageVersion)" /> - <LatestPackageReference Include="Mono.WebAssembly.Interop" Version="$(MonoWebAssemblyInteropPackageVersion)" /> - <LatestPackageReference Include="Moq" Version="$(MoqPackageVersion)" /> - <LatestPackageReference Include="Newtonsoft.Json.Bson" Version="$(NewtonsoftJsonBsonPackageVersion)" /> - <LatestPackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" /> - <LatestPackageReference Include="Selenium.Support" Version="$(SeleniumSupportPackageVersion)" /> - <LatestPackageReference Include="Selenium.WebDriver.ChromeDriver" Version="$(SeleniumWebDriverChromeDriverPackageVersion)" /> - <LatestPackageReference Include="Selenium.WebDriver.MicrosoftDriver" Version="$(SeleniumWebDriverMicrosoftDriverPackageVersion)" /> - <LatestPackageReference Include="Selenium.WebDriver" Version="$(SeleniumWebDriverPackageVersion)" /> - <LatestPackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsLoggingPackageVersion)" /> - <LatestPackageReference Include="Serilog.Sinks.File" Version="$(SerilogSinksFilePackageVersion)" /> - <LatestPackageReference Include="StackExchange.Redis" Version="$(StackExchangeRedisPackageVersion)" /> <LatestPackageReference Include="System.Buffers" Version="$(SystemBuffersPackageVersion)" /> <LatestPackageReference Include="System.CodeDom" Version="$(SystemCodeDomPackageVersion)" /> <LatestPackageReference Include="System.ComponentModel" Version="$(SystemComponentModelPackageVersion)" /> <LatestPackageReference Include="System.ComponentModel.Annotations" Version="$(SystemComponentModelAnnotationsPackageVersion)" /> - <LatestPackageReference Include="System.Data.SqlClient" Version="$(SystemDataSqlClientPackageVersion)" /> <LatestPackageReference Include="System.Diagnostics.EventLog" Version="$(SystemDiagnosticsEventLogPackageVersion)" /> - <LatestPackageReference Include="System.IdentityModel.Tokens.Jwt" Version="$(SystemIdentityModelTokensJwtPackageVersion)" /> <LatestPackageReference Include="System.IO.Pipelines" Version="$(SystemIOPipelinesPackageVersion)" /> - <LatestPackageReference Include="System.Net.Http.WinHttpHandler" Version="$(SystemNetHttpWinHttpHandlerPackageVersion)" /> <LatestPackageReference Include="System.Net.Http" Version="$(SystemNetHttpPackageVersion)" /> - <LatestPackageReference Include="System.Net.WebSockets.WebSocketProtocol" Version="$(SystemNetWebSocketsWebSocketProtocolPackageVersion)" /> - <LatestPackageReference Include="System.Reactive.Linq" Version="$(SystemReactiveLinqPackageVersion)" /> <LatestPackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataPackageVersion)" /> <LatestPackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafePackageVersion)" /> <LatestPackageReference Include="System.Security.Cryptography.Cng" Version="$(SystemSecurityCryptographyCngPackageVersion)" /> @@ -155,15 +96,8 @@ and are generated based on the last package release. <LatestPackageReference Include="System.Security.Cryptography.Xml" Version="$(SystemSecurityCryptographyXmlPackageVersion)" /> <LatestPackageReference Include="System.Security.Permissions" Version="$(SystemSecurityPermissionsPackageVersion)" /> <LatestPackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindowsPackageVersion)" /> - <LatestPackageReference Include="System.ServiceProcess.ServiceController" Version="$(SystemServiceProcessServiceControllerPackageVersion)" /> <LatestPackageReference Include="System.Text.Json" Version="$(SystemTextJsonPackageVersion)" /> <LatestPackageReference Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" /> - <LatestPackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsPackageVersion)" /> - <LatestPackageReference Include="xunit.abstractions" Version="$(XunitAbstractionsPackageVersion)" /> - <LatestPackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersPackageVersion)" /> - <LatestPackageReference Include="xunit.assert" Version="$(XunitAssertPackageVersion)" /> - <LatestPackageReference Include="xunit.extensibility.core" Version="$(XunitExtensibilityCorePackageVersion)" /> - <LatestPackageReference Include="xunit.extensibility.execution" Version="$(XunitExtensibilityExecutionPackageVersion)" /> <!-- Runtime packages required for crossgen --> <LatestPackageReference Include="microsoft.netcore.app.runtime.win-x64" Version="$(MicrosoftNETCoreAppRuntimeVersion)" /> @@ -177,4 +111,79 @@ and are generated based on the last package release. <LatestPackageReference Include="microsoft.netcore.app.runtime.linux-musl-arm64" Version="$(MicrosoftNETCoreAppRuntimeVersion)" /> </ItemGroup> + <ItemGroup Label=".NET team dependencies (Non-source-build)" Condition="'$(DotNetBuildFromSource)' != 'true'"> + <LatestPackageReference Include="Microsoft.AspNet.WebApi.Client" Version="$(MicrosoftAspNetWebApiClientPackageVersion)" /> + <LatestPackageReference Include="Microsoft.AspNetCore.Analyzer.Testing" Version="$(MicrosoftAspNetCoreAnalyzerTestingPackageVersion)" /> + <LatestPackageReference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.2.1" Version="$(MicrosoftAspNetCoreAzureAppServicesSiteExtension21PackageVersion)" /> + <LatestPackageReference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.2.2" Version="$(MicrosoftAspNetCoreAzureAppServicesSiteExtension22PackageVersion)" /> + <LatestPackageReference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" Version="$(MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion)" /> + <LatestPackageReference Include="Microsoft.AspNetCore.Blazor.Mono" Version="$(MicrosoftAspNetCoreBlazorMonoPackageVersion)" /> + <LatestPackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" /> + <LatestPackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(MicrosoftEntityFrameworkCoreInMemoryPackageVersion)" /> + <LatestPackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(MicrosoftEntityFrameworkCoreRelationalPackageVersion)" /> + <LatestPackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(MicrosoftEntityFrameworkCoreSqlitePackageVersion)" /> + <LatestPackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(MicrosoftEntityFrameworkCoreSqlServerPackageVersion)" /> + <LatestPackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftEntityFrameworkCoreToolsPackageVersion)" /> + <LatestPackageReference Include="Microsoft.EntityFrameworkCore" Version="$(MicrosoftEntityFrameworkCorePackageVersion)" /> + <LatestPackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="$(MicrosoftExtensionsCachingSqlServerPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="$(MicrosoftExtensionsCachingStackExchangeRedisPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="$(MicrosoftExtensionsLoggingAzureAppServicesPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" /> + <LatestPackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="$(MicrosoftIdentityModelClientsActiveDirectoryPackageVersion)" /> + <LatestPackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="$(MicrosoftIdentityModelProtocolsOpenIdConnectPackageVersion)" /> + <LatestPackageReference Include="Microsoft.IdentityModel.Protocols.WsFederation" Version="$(MicrosoftIdentityModelProtocolsWsFederationPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Internal.AspNetCore.H2Spec.All" Version="$(MicrosoftInternalAspNetCoreH2SpecAllPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Internal.Extensions.Refs" Version="$(MicrosoftInternalExtensionsRefsPackageVersion)" /> + <LatestPackageReference Include="Microsoft.NETCore.Windows.ApiSets" Version="$(MicrosoftNETCoreWindowsApiSetsPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Owin.Security.Cookies" Version="$(MicrosoftOwinSecurityCookiesPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Owin.Testing" Version="$(MicrosoftOwinTestingPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Web.Administration" Version="$(MicrosoftWebAdministrationPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Web.Xdt" Version="$(MicrosoftWebXdtPackageVersion)" /> + <LatestPackageReference Include="System.Data.SqlClient" Version="$(SystemDataSqlClientPackageVersion)" /> + <LatestPackageReference Include="System.IdentityModel.Tokens.Jwt" Version="$(SystemIdentityModelTokensJwtPackageVersion)" /> + <LatestPackageReference Include="System.Net.Http.WinHttpHandler" Version="$(SystemNetHttpWinHttpHandlerPackageVersion)" /> + <LatestPackageReference Include="System.Net.WebSockets.WebSocketProtocol" Version="$(SystemNetWebSocketsWebSocketProtocolPackageVersion)" /> + <LatestPackageReference Include="System.ServiceProcess.ServiceController" Version="$(SystemServiceProcessServiceControllerPackageVersion)" /> + <LatestPackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsPackageVersion)" /> + </ItemGroup> + + <ItemGroup Label="MSBuild"> + <LatestPackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCorePackageVersion)" /> + </ItemGroup> + + <ItemGroup Label="External dependencies" Condition="'$(DotNetBuildFromSource)' != 'true'"> + <LatestPackageReference Include="AngleSharp" Version="$(AngleSharpPackageVersion)" /> + <LatestPackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetPackageVersion)" /> + <LatestPackageReference Include="FSharp.Core" Version="$(FSharpCorePackageVersion)" /> + <LatestPackageReference Include="Google.ProtoBuf" Version="$(GoogleProtoBufPackageVersion)" /> + <LatestPackageReference Include="IdentityServer4" Version="$(IdentityServer4PackageVersion)" /> + <LatestPackageReference Include="IdentityServer4.AspNetIdentity" Version="$(IdentityServer4AspNetIdentityPackageVersion)" /> + <LatestPackageReference Include="IdentityServer4.EntityFramework" Version="$(IdentityServer4EntityFrameworkPackageVersion)" /> + <LatestPackageReference Include="IdentityServer4.EntityFramework.Storage" Version="$(IdentityServer4EntityFrameworkStoragePackageVersion)" /> + <LatestPackageReference Include="IdentityServer4.Storage" Version="$(IdentityServer4StoragePackageVersion)" /> + <LatestPackageReference Include="Libuv" Version="$(LibuvPackageVersion)" /> + <LatestPackageReference Include="MessagePack" Version="$(MessagePackPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Azure.KeyVault" Version="$(MicrosoftAzureKeyVaultPackageVersion)" /> + <LatestPackageReference Include="Microsoft.Azure.Storage.Blob" Version="$(MicrosoftAzureStorageBlobPackageVersion)" /> + <LatestPackageReference Include="Mono.Cecil" Version="$(MonoCecilPackageVersion)" /> + <LatestPackageReference Include="Mono.WebAssembly.Interop" Version="$(MonoWebAssemblyInteropPackageVersion)" /> + <LatestPackageReference Include="Moq" Version="$(MoqPackageVersion)" /> + <LatestPackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" /> + <LatestPackageReference Include="Newtonsoft.Json.Bson" Version="$(NewtonsoftJsonBsonPackageVersion)" /> + <LatestPackageReference Include="Selenium.Support" Version="$(SeleniumSupportPackageVersion)" /> + <LatestPackageReference Include="Selenium.WebDriver" Version="$(SeleniumWebDriverPackageVersion)" /> + <LatestPackageReference Include="Selenium.WebDriver.ChromeDriver" Version="$(SeleniumWebDriverChromeDriverPackageVersion)" /> + <LatestPackageReference Include="Selenium.WebDriver.MicrosoftDriver" Version="$(SeleniumWebDriverMicrosoftDriverPackageVersion)" /> + <LatestPackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsLoggingPackageVersion)" /> + <LatestPackageReference Include="Serilog.Sinks.File" Version="$(SerilogSinksFilePackageVersion)" /> + <LatestPackageReference Include="StackExchange.Redis" Version="$(StackExchangeRedisPackageVersion)" /> + <LatestPackageReference Include="System.Reactive.Linq" Version="$(SystemReactiveLinqPackageVersion)" /> + <LatestPackageReference Include="xunit.abstractions" Version="$(XunitAbstractionsPackageVersion)" /> + <LatestPackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersPackageVersion)" /> + <LatestPackageReference Include="xunit.assert" Version="$(XunitAssertPackageVersion)" /> + <LatestPackageReference Include="xunit.extensibility.core" Version="$(XunitExtensibilityCorePackageVersion)" /> + <LatestPackageReference Include="xunit.extensibility.execution" Version="$(XunitExtensibilityExecutionPackageVersion)" /> + </ItemGroup> + </Project> diff --git a/eng/Workarounds.targets b/eng/Workarounds.targets index 029cbbc390c..83e176a4a87 100644 --- a/eng/Workarounds.targets +++ b/eng/Workarounds.targets @@ -21,10 +21,15 @@ </ItemGroup> <!-- Workaround https://github.com/aspnet/AspNetCore/issues/7503. This chains GenerateSourceLinkFile before razor component targets run. --> - <Target Name="_EnsureSourceLinkHappensBeforeRazorComponentGeneration" + <!-- Workaround https://github.com/dotnet/source-build/issues/1112. Source link is currently disabled in source build so do not apply this worksaround. --> + <Target Condition="'$(DotNetBuildFromSource)' != 'true'" + Name="_EnsureSourceLinkHappensBeforeRazorComponentGeneration" BeforeTargets="PrepareForRazorComponentGenerate" DependsOnTargets="GenerateSourceLinkFile" /> + <!-- Workaround https://github.com/dotnet/source-build/issues/1112. Source link is currently disabled in source build so define this dummy target which is required for pack. --> + <Import Condition="'$(DotNetBuildFromSource)' == 'true'" Project="WorkaroundsImported.targets" /> + <!-- Workaround https://github.com/aspnet/websdk/pull/646. If merged, once we update to a websdk with this fix, we can move the setting below to Directory.Build.props. --> <PropertyGroup> <!-- Ignore warning about calling the Pack target on Web SDK projects. Our build scripts call /t:pack on everything in this repo. --> diff --git a/eng/WorkaroundsImported.targets b/eng/WorkaroundsImported.targets new file mode 100644 index 00000000000..3b6f29f3621 --- /dev/null +++ b/eng/WorkaroundsImported.targets @@ -0,0 +1,5 @@ +<!-- Use this file to workaround issues. List the issue tracking the item to fix so we can remove the workaround when the issue is resolved. --> +<Project> + <!-- Workaround https://github.com/dotnet/source-build/issues/1112. Source link is currently disabled in source build so define this dummy target which is required for pack. --> + <Target Name="InitializeSourceControlInformation"/> +</Project> diff --git a/eng/scripts/ci-source-build.sh b/eng/scripts/ci-source-build.sh new file mode 100755 index 00000000000..8b4c801d3af --- /dev/null +++ b/eng/scripts/ci-source-build.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + + # +# This script is meant for testing source build by imitating some of the input parameters and conditions. +# + +set -euo pipefail + +scriptroot="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +reporoot="$(dirname "$(dirname "$scriptroot")")" + + # For local development, make a backup copy of this file first +if [ ! -f "$reporoot/global.bak.json" ]; then + mv "$reporoot/global.json" "$reporoot/global.bak.json" +fi + + # Detect the current version of .NET Core installed +export SDK_VERSION=$(dotnet --version) +echo "The ambient version of .NET Core SDK version = $SDK_VERSION" + + # Update the global.json file to match the current .NET environment +cat "$reporoot/global.bak.json" | \ + jq '.sdk.version=env.SDK_VERSION' | \ + jq '.tools.dotnet=env.SDK_VERSION' | \ + jq 'del(.tools.runtimes)' \ + > "$reporoot/global.json" + + # Restore the original global.json file +trap "{ + mv "$reporoot/global.bak.json" "$reporoot/global.json" +}" EXIT + +export DotNetBuildFromSource='true' + + # Build repo tasks +"$reporoot/eng/common/build.sh" --restore --build --ci --configuration Release /p:ProjectToBuild=$reporoot/eng/tools/RepoTasks/RepoTasks.csproj + + # Build projects +"$reporoot/eng/common/build.sh" --restore --build --pack "$@" \ No newline at end of file diff --git a/eng/targets/CSharp.Common.props b/eng/targets/CSharp.Common.props index 64966a92d3c..6cc6bd2dd81 100644 --- a/eng/targets/CSharp.Common.props +++ b/eng/targets/CSharp.Common.props @@ -11,7 +11,7 @@ <!-- Required to exist in the NuGet package cache to enable code-signing. --> <PackageReference Include="MicroBuild.Core" Version="0.3.0" PrivateAssets="All" AllowExplicitReference="true" ExcludeAssets="All" /> - <PackageReference Include="Microsoft.DotNet.GenAPI" PrivateAssets="All" Version="$(MicrosoftDotNetGenApiPackageVersion)" IsImplicitlyDefined="true" /> + <PackageReference Condition="'$(DotNetBuildFromSource)' != 'true'" Include="Microsoft.DotNet.GenAPI" PrivateAssets="All" Version="$(MicrosoftDotNetGenApiPackageVersion)" IsImplicitlyDefined="true" /> </ItemGroup> <ItemGroup Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''"> diff --git a/eng/targets/ResolveReferences.targets b/eng/targets/ResolveReferences.targets index 684660fed17..263edf3eaa0 100644 --- a/eng/targets/ResolveReferences.targets +++ b/eng/targets/ResolveReferences.targets @@ -19,6 +19,8 @@ <Project> <PropertyGroup> + <EnableCustomReferenceResolution Condition="'$(EnableCustomReferenceResolution)' == '' AND ('$(DotNetBuildFromSource)' != 'true' OR '$(ExcludeFromSourceBuild)' != 'true')">true</EnableCustomReferenceResolution> + <ResolveReferencesDependsOn> ResolveCustomReferences; $(ResolveReferencesDependsOn); @@ -60,7 +62,7 @@ </Reference> </ItemDefinitionGroup> - <ItemGroup> + <ItemGroup Condition="'$(EnableCustomReferenceResolution)' == 'true'"> <Reference Update="@(Reference)"> <IsSharedSource Condition="'%(IsSharedSource)' == '' AND $([System.String]::new('%(Identity)').EndsWith('.Sources'))">true</IsSharedSource> </Reference> @@ -129,7 +131,7 @@ This target resolves remaining Referene items to Packages, if possible. If not, they are left as Reference items fo the SDK to resolve. This executes on NuGet restore and during DesignTimeBuild. It should not run in the outer, cross-targeting build. --> - <Target Name="ResolveCustomReferences" BeforeTargets="CollectPackageReferences;ResolveAssemblyReferencesDesignTime;ResolveAssemblyReferences" Condition=" '$(TargetFramework)' != '' "> + <Target Name="ResolveCustomReferences" BeforeTargets="CollectPackageReferences;ResolveAssemblyReferencesDesignTime;ResolveAssemblyReferences" Condition=" '$(TargetFramework)' != '' AND '$(EnableCustomReferenceResolution)' == 'true' "> <ItemGroup> <!-- Ensure only content asset are consumed from .Sources packages --> <Reference> diff --git a/eng/tools/RepoTasks/RepoTasks.csproj b/eng/tools/RepoTasks/RepoTasks.csproj index f62865e2032..0bf6be98ae9 100644 --- a/eng/tools/RepoTasks/RepoTasks.csproj +++ b/eng/tools/RepoTasks/RepoTasks.csproj @@ -7,6 +7,8 @@ <Optimize>false</Optimize> <DebugType>embedded</DebugType> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> + <!-- Need to build this project in source build --> + <ExcludeFromSourceBuild>false</ExcludeFromSourceBuild> </PropertyGroup> <ItemGroup> diff --git a/src/Framework/ref/Microsoft.AspNetCore.App.Ref.csproj b/src/Framework/ref/Microsoft.AspNetCore.App.Ref.csproj index 2a73d0fb44f..44e668d4528 100644 --- a/src/Framework/ref/Microsoft.AspNetCore.App.Ref.csproj +++ b/src/Framework/ref/Microsoft.AspNetCore.App.Ref.csproj @@ -76,6 +76,9 @@ This package is an internal implementation of the .NET Core SDK and is not meant _InstallTargetingPackIntoLocalDotNet; _CreateTargetingPackArchive; </BuildDependsOn> + + <!-- No-op when in source build --> + <BuildDependsOn Condition="'$(IsTargetingPackBuilding)' != 'false' and '$(DotNetBuildFromSource)' == 'true'"/> </PropertyGroup> <!-- Override the default MSBuild targets so that nothing is returned from the project since it represents a collection of assemblies. --> diff --git a/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj b/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj index 7bc95d9fe5e..d483371a187 100644 --- a/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj +++ b/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj @@ -8,6 +8,8 @@ <SelfContained>false</SelfContained> <PackageId>$(MSBuildProjectName).$(RuntimeIdentifier)</PackageId> <IsShippingPackage>true</IsShippingPackage> + <!-- Do not exclude this project from source build --> + <ExcludeFromSourceBuild>false</ExcludeFromSourceBuild> <HasReferenceAssembly>false</HasReferenceAssembly> <PackageDescription>Provides a default set of APIs for building an ASP.NET Core application. Contains assets used for self-contained deployments. @@ -361,8 +363,8 @@ This package is an internal implementation of the .NET Core SDK and is not meant Targets related to creating .zip/.tar.gz ######################################### --> - <Target Name="_DownloadAndExtractDotNetRuntime"> - <DownloadFile Condition=" ! Exists('$(DotNetRuntimeArchive)')" + <Target Name="_DownloadAndExtractDotNetRuntime" Condition="'$(DotNetBuildFromSource)' != 'true'"> + <DownloadFile Condition=" ! Exists('$(DotNetRuntimeArchive)')" SourceUrl="$(DotNetRuntimeDownloadUrl)$(DotNetAssetRootAccessTokenSuffix)" DestinationFolder="$(BaseIntermediateOutputPath)" DestinationFileName="$(DotNetRuntimeArchiveFileName)" /> @@ -412,7 +414,9 @@ This package is an internal implementation of the .NET Core SDK and is not meant </Target> <!-- Required to workaround https://github.com/dotnet/core-setup/issues/4809. This copies the shared framework into the $reporoot/.dotnet folder so tests can run against the shared framework. --> - <Target Name="_InstallFrameworkIntoLocalDotNet" + <!-- This workaround is not needed in source build --> + <Target Condition="'$(DotNetBuildFromSource)' != 'true'" + Name="_InstallFrameworkIntoLocalDotNet" Inputs="@(SharedFxContent)" Outputs="@(SharedFxContent->'$(LocalInstallationOutputPath)%(FileName)%(Extension)')"> @@ -437,7 +441,9 @@ This package is an internal implementation of the .NET Core SDK and is not meant Condition="'$(ArchiveExtension)' == '.tar.gz'" /> </Target> - <Target Name="_CreateRedistSharedFxArchive" + <!-- Redist tarball including the dotnet-runtime is not needed in source build --> + <Target Condition="'$(DotNetBuildFromSource)' != 'true'" + Name="_CreateRedistSharedFxArchive" Inputs="@(SharedFxContent)" Outputs="$(RedistArchiveOutputPath)"> <Message Importance="High" Text="$(MSbuildProjectFile) -> $(RedistArchiveOutputPath)" /> diff --git a/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj b/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj index f34b186e0df..49f3f003b66 100644 --- a/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj +++ b/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj @@ -40,7 +40,8 @@ <UIFrameworkVersionMoniker Include="V4" /> </ItemGroup> - <Target Name="BuildRazorViews" DependsOnTargets="Compile" BeforeTargets="Build"> + <!-- Source build doesn't build this package --> + <Target Name="BuildRazorViews" DependsOnTargets="Compile" BeforeTargets="Build" Condition="'$(DotNetBuildFromSource)' != 'true'"> <Message Text="Building razor views assemblies" Importance="High" /> <MSbuild Projects="$(MSBuildThisFile)" Targets="BuildForUI" @@ -128,7 +129,8 @@ </ItemGroup> </Target> - <Target Name="VerifyBuildOutputs" AfterTargets="BuildRazorViews"> + <!-- Source build doesn't build this package --> + <Target Name="VerifyBuildOutputs" AfterTargets="BuildRazorViews" Condition="'$(DotNetBuildFromSource)' != 'true'"> <ItemGroup> <ExpectedOutputFile Include="$(TargetDir)Microsoft.AspNetCore.Identity.UI.Views.V3.dll" /> <ExpectedOutputFile Include="$(TargetDir)Microsoft.AspNetCore.Identity.UI.Views.V4.dll" /> diff --git a/src/Tools/FirstRunCertGenerator/src/Microsoft.AspNetCore.DeveloperCertificates.XPlat.csproj b/src/Tools/FirstRunCertGenerator/src/Microsoft.AspNetCore.DeveloperCertificates.XPlat.csproj index 3d7ce08b726..e0500429ab4 100644 --- a/src/Tools/FirstRunCertGenerator/src/Microsoft.AspNetCore.DeveloperCertificates.XPlat.csproj +++ b/src/Tools/FirstRunCertGenerator/src/Microsoft.AspNetCore.DeveloperCertificates.XPlat.csproj @@ -9,6 +9,7 @@ <!-- This package contains API for the .NET CLI to generate the aspnet HTTPs dev cert during CLI first-run initialization. --> <IsShippingPackage>false</IsShippingPackage> <HasReferenceAssembly>false</HasReferenceAssembly> + <ExcludeFromSourceBuild>false</ExcludeFromSourceBuild> </PropertyGroup> <ItemGroup> diff --git a/src/Tools/dotnet-watch/test/dotnet-watch.Tests.csproj b/src/Tools/dotnet-watch/test/dotnet-watch.Tests.csproj index 349e681dbf6..49aebd14822 100644 --- a/src/Tools/dotnet-watch/test/dotnet-watch.Tests.csproj +++ b/src/Tools/dotnet-watch/test/dotnet-watch.Tests.csproj @@ -28,13 +28,15 @@ <RemoveDir Directories="$(TargetDir)TestProjects" Condition="Exists('$(TargetDir)TestProjects')" /> </Target> - <Target Name="PublishDotNetWatchOnBuild" BeforeTargets="Build"> + <!-- Do not publish in source build --> + <Target Name="PublishDotNetWatchOnBuild" BeforeTargets="Build" Condition="'$(DotNetBuildFromSource)' != 'true'"> <MSBuild Projects="..\src\dotnet-watch.csproj" Targets="Publish" Properties="PublishDir=$(OutputPath)\tool\;Configuration=$(Configuration)" /> </Target> - <Target Name="PublishDotNetWatchOnPublish" BeforeTargets="Publish"> + <!-- Do not publish in source build --> + <Target Name="PublishDotNetWatchOnPublish" BeforeTargets="Publish" Condition="'$(DotNetBuildFromSource)' != 'true'"> <MSBuild Projects="..\src\dotnet-watch.csproj" Targets="Publish" Properties="PublishDir=$(PublishDir)\tool\;Configuration=$(Configuration)" /> -- GitLab