diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index 11979c4538..b5cbf7d2a2 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -49,14 +49,14 @@ 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 -arch x64 /p:DisableCodeSigning=true + - script: ./eng/scripts/cibuild.cmd -arch x64 /p:DisableCodeSigning=true /bl:artifacts/logs/build.x64.binlog displayName: Build x64 # TODO: make it possible to build for one Windows architecture at a time # 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 -arch x86 /t:BuildSharedFx /p:DisableCodeSigning=true + - script: ./eng/scripts/cibuild.cmd -arch x86 /t:BuildSharedFx /p:DisableCodeSigning=true /bl:artifacts/logs/build.x86.binlog displayName: Build x86 # This is in a separate build step with -forceCoreMsbuild to workaround MAX_PATH limitations - https://github.com/Microsoft/msbuild/issues/53 @@ -66,7 +66,7 @@ jobs: # 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 -sign /t:CodeSign /p:SignType=$(_SignType) /p:DisableSignCheck=true + - script: ./build.cmd -ci -sign /t:CodeSign /p:SignType=$(_SignType) /p:DisableSignCheck=true /bl:artifacts/logs/build.codesign.binlog displayName: Code sign packages # Windows installers bundle both x86 and x64 assets @@ -74,7 +74,7 @@ jobs: displayName: Build Installers # Run sign check to verify everything was code signed. - - script: ./build.cmd -ci -sign /t:SignCheck /p:SignType=$(_SignType) + - script: ./build.cmd -ci -sign /t:SignCheck /p:SignType=$(_SignType) /bl:artifacts/logs/build.signcheck.binlog displayName: Run sign check condition: eq(variables['_SignType'], 'real') @@ -109,7 +109,7 @@ jobs: afterBuild: # Remove packages that are not rid-specific. # TODO add a flag so builds only produce runtime packages - - powershell: gci artifacts/packages/ -recurse -exclude 'runtime.*' -file | rm -ea ignore + - powershell: gci artifacts/packages/ -recurse -exclude 'runtime.*', 'Microsoft.AspNetCore.App.Runtime.*' -file | rm -ea ignore artifacts: - name: Windows_arm_Packages path: artifacts/packages/ @@ -133,7 +133,7 @@ jobs: afterBuild: # Remove packages that are not rid-specific. # TODO add a flag so macOS/Linux builds only produce runtime packages - - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -delete; fi + - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi condition: always() artifacts: - name: MacOS_x64_Packages @@ -184,7 +184,7 @@ jobs: afterBuild: # Remove packages that are not rid-specific. # TODO add a flag so macOS/Linux builds only produce runtime packages - - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -delete; fi + - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi condition: always() artifacts: - name: Linux_x64_Packages @@ -212,7 +212,7 @@ jobs: afterBuild: # Remove packages that are not rid-specific. # TODO add a flag so macOS/Linux builds only produce runtime packages - - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -delete; fi + - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi condition: always() artifacts: - name: Linux_arm_Packages @@ -240,7 +240,7 @@ jobs: afterBuild: # Remove packages that are not rid-specific. # TODO add a flag so macOS/Linux builds only produce runtime packages - - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -delete; fi + - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi condition: always() artifacts: - name: Linux_arm64_Packages @@ -268,7 +268,7 @@ jobs: afterBuild: # Remove packages that are not rid-specific. # TODO add a flag so macOS/Linux builds only produce runtime packages - - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -delete; fi + - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi condition: always() artifacts: - name: Linux_musl_x64_Packages diff --git a/Directory.Build.targets b/Directory.Build.targets index 843f5ac441..a5ae54b6f1 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -75,11 +75,6 @@ - - - - - diff --git a/build.ps1 b/build.ps1 index 859ae10cfe..2b3e52b776 100644 --- a/build.ps1 +++ b/build.ps1 @@ -21,6 +21,9 @@ Suppress running restore on projects. .PARAMETER NoBuild Suppress re-compile projects. (Implies -NoRestore) +.PARAMETER NoBuildDeps +Do not build project-to-project references and only build the specified project. + .PARAMETER Pack Produce packages. @@ -88,6 +91,7 @@ param( [switch]$Restore, [switch]$NoRestore, # Suppress restore [switch]$NoBuild, # Suppress compiling + [switch]$NoBuildDeps, # Suppress project to project dependencies [switch]$Pack, # Produce packages [switch]$Test, # Run tests [switch]$Sign, # Code sign @@ -269,6 +273,8 @@ if ($BuildNative) { $MSBuildArguments += "/p:BuildNative=true" } if ($BuildNodeJS) { $MSBuildArguments += "/p:BuildNodeJS=true" } if ($BuildJava) { $MSBuildArguments += "/p:BuildJava=true" } +if ($NoBuildDeps) { $MSBuildArguments += "/p:BuildProjectReferences=false" } + if ($NoBuildInstallers) { $MSBuildArguments += "/p:BuildInstallers=false" } if ($NoBuildManaged) { $MSBuildArguments += "/p:BuildManaged=false" } if ($NoBuildNative) { $MSBuildArguments += "/p:BuildNative=false" } diff --git a/build.sh b/build.sh index 4499355155..cdbd9853e1 100755 --- a/build.sh +++ b/build.sh @@ -25,6 +25,7 @@ run_build=true run_pack=false run_tests=false build_all=false +build_deps=true build_managed='' build_native='' build_nodejs='' @@ -60,6 +61,7 @@ Options: --projects A list of projects to build. (Must be an absolute path.) Globbing patterns are supported, such as \"$(pwd)/**/*.csproj\". + --no-build-deps Do not build project-to-project references and only build the specified project. --all Build all project types. --[no-]build-native Build native projects (C, C++). @@ -190,6 +192,9 @@ while [[ $# -gt 0 ]]; do # --no-build implies --no-restore run_restore=false ;; + --no-build-deps) + build_deps=false + ;; --pack|-[Pp]ack) run_pack=true ;; @@ -298,6 +303,10 @@ elif [ -z "$build_managed" ] && [ -z "$build_nodejs" ] && [ -z "$build_java" ] & build_managed=true fi +if [ "$build_deps" = false ]; then + msbuild_args[${#msbuild_args[*]}]="-p:BuildProjectReferences=false" +fi + # Only set these MSBuild properties if they were explicitly set by build parameters. [ ! -z "$build_java" ] && msbuild_args[${#msbuild_args[*]}]="-p:BuildJava=$build_java" [ ! -z "$build_native" ] && msbuild_args[${#msbuild_args[*]}]="-p:BuildNative=$build_native" diff --git a/build/repo.props b/build/repo.props index 588fc15d84..5ffd98230b 100644 --- a/build/repo.props +++ b/build/repo.props @@ -141,6 +141,7 @@ --> (); + var nativeFiles = new List(); + var resourceAssemblies = new List(); + + foreach (var reference in References) + { + var filePath = reference.ItemSpec; + var fileName = Path.GetFileName(filePath); + var fileVersion = FileUtilities.GetFileVersion(filePath)?.ToString() ?? string.Empty; + var assemblyVersion = FileUtilities.TryGetAssemblyVersion(filePath); + if (assemblyVersion == null) + { + var nativeFile = new RuntimeFile(fileName, null, fileVersion); + nativeFiles.Add(nativeFile); + } + else + { + var runtimeFile = new RuntimeFile(fileName, + fileVersion: fileVersion, + assemblyVersion: assemblyVersion.ToString()); + runtimeFiles.Add(runtimeFile); + } + } + + var runtimeLibrary = new RuntimeLibrary("package", + RuntimePackageName, + FrameworkVersion, + hash: string.Empty, + runtimeAssemblyGroups: new[] { new RuntimeAssetGroup(string.Empty, runtimeFiles) }, + nativeLibraryGroups: new[] { new RuntimeAssetGroup(string.Empty, nativeFiles) }, + Enumerable.Empty(), + Array.Empty(), + hashPath: null, + path: $"{RuntimePackageName.ToLowerInvariant()}/{FrameworkVersion}", + serviceable: true); + + var context = new DependencyContext(target, + CompilationOptions.Default, + Enumerable.Empty(), + new[] { runtimeLibrary }, + Enumerable.Empty()); + + Directory.CreateDirectory(Path.GetDirectoryName(DepsFilePath)); + + try + { + using (var depsStream = File.Create(DepsFilePath)) + { + new DependencyContextWriter().Write(context, depsStream); + } + } + catch (Exception ex) + { + // If there is a problem, ensure we don't write a partially complete version to disk. + if (File.Exists(DepsFilePath)) + { + File.Delete(DepsFilePath); + } + Log.LogErrorFromException(ex); + } + } + } +} diff --git a/build/tasks/RepoTasks.csproj b/build/tasks/RepoTasks.csproj index 2069525e61..ac89d3beed 100644 --- a/build/tasks/RepoTasks.csproj +++ b/build/tasks/RepoTasks.csproj @@ -5,6 +5,8 @@ netcoreapp2.2 net461 $(DefineConstants);BUILD_MSI_TASKS + false + embedded true diff --git a/build/tasks/RepoTasks.tasks b/build/tasks/RepoTasks.tasks index d253037b90..c7160bfd92 100644 --- a/build/tasks/RepoTasks.tasks +++ b/build/tasks/RepoTasks.tasks @@ -6,6 +6,7 @@ + diff --git a/docs/SharedFramework.md b/docs/SharedFramework.md index fa87215061..834e59db3f 100644 --- a/docs/SharedFramework.md +++ b/docs/SharedFramework.md @@ -24,7 +24,7 @@ The ASP.NET Core shared framework contains assemblies that are fully developed, The contents of the shared framework are defined in two ways: -* [src/Framework/LocalDependencies.props](/src/Framework/LocalDependencies.props) - this file is generated from the .csproj files in this repo +* [eng/SharedFramework.Local.props](/eng/SharedFramework.Local.props) - this file is generated from the .csproj files in this repo by looking for projects which have set `true`. -* [src/Framework/Microsoft.AspNetCore.App.props](/src/Framework/Microsoft.AspNetCore.App.props) - this file lists all assemblies shipped - in Microsoft.AspNetCore.App which are built by source code found in other repositories. \ No newline at end of file +* [eng/SharedFramework.External.props](/eng/SharedFramework.External.props) - this file lists all assemblies shipped + in Microsoft.AspNetCore.App which are built by source code found in other repositories. diff --git a/eng/Dependencies.props b/eng/Dependencies.props index 841d7a086d..dd9f4f86ca 100644 --- a/eng/Dependencies.props +++ b/eng/Dependencies.props @@ -160,6 +160,7 @@ and are generated based on the last package release. + diff --git a/eng/Versions.props b/eng/Versions.props index fff0051213..fdea14b97b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -194,5 +194,6 @@ 2.3.1 2.4.0 2.4.0 + 2.4.1 diff --git a/eng/targets/CSharp.Common.props b/eng/targets/CSharp.Common.props index 854d6a7a8d..f55984e330 100644 --- a/eng/targets/CSharp.Common.props +++ b/eng/targets/CSharp.Common.props @@ -28,13 +28,14 @@ - + + diff --git a/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj b/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj new file mode 100644 index 0000000000..819b679d12 --- /dev/null +++ b/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj @@ -0,0 +1,296 @@ + + + true + + + + + + $(DefaultNetCoreTargetFramework) + $(TargetRuntimeIdentifier) + + false + Microsoft.AspNetCore.App + $(MSBuildProjectName).$(RuntimeIdentifier) + true + + Provides a default set of APIs for building an ASP.NET Core application. Contains assets used for self-contained deployments. + +This package is an internal implementation of the .NET Core SDK and is not meant to be used as a normal PackageReference. + + aspnetcore;shared-framework + true + + + RuntimePack + + runtimes/$(RuntimeIdentifier)/lib/ + + runtimes/$(RuntimeIdentifier)/native/ + + + .pdb + + + $(AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder);.map + + + true + + + true + false + + + true + $(SharedFxName).runtimeconfig.json + + + false + $(SharedFxName).deps.json + + + $(IntermediateOutputPath)ignoreme.dev.runtimeconfig.json + + + none + false + false + false + + + true + + + <_GetChildProjectCopyToOutputDirectoryItems>false + + + false + + + PerfMap + PDB + + lib + .so + .dll + .dylib + .exe + + : + %3B + + + crossgen + $(CrossgenToolFileName).exe + + $(CrossgenToolFileName) + + x64_arm\$(CrossgenToolPackagePath) + x64_arm64\$(CrossgenToolPackagePath) + x86_arm\$(CrossgenToolPackagePath) + + $(NuGetPackageRoot)/runtime.$(RuntimeIdentifier).microsoft.netcore.app/$(MicrosoftNETCoreAppPackageVersion)/ + $(RuntimePackageRoot)tools/$(CrossgenToolPackagePath) + + + + + + Runtime;Native + + + + Platform=$(TargetArchitecture) + Platform=Win32 + + false + + true + TargetFramework + _ResolvedNativeProjectReferencePaths + + + + + + + + + + + + + $(ResolveReferencesDependsOn); + FilterUnwantedContent; + _ResolveCopyLocalNativeReference; + PrepareForCrossGen; + + + $(CoreBuildDependsOn); + GenerateSharedFxDepsFile; + Crossgen; + + + ResolveReferences; + + + $(CrossGenDependsOn); + _BatchCrossGenAssemblies; + + + $(TargetsForTfmSpecificBuildOutput); + _ResolveRuntimePackBuildOutput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_RuntimeReference Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Extension)' != '.pdb' AND '%(ReferenceCopyLocalPaths.Extension)' != '.map'" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(IntermediateOutputPath)crossgen\ + $(CrossgenToolDir)$(LibPrefix)clrjit$(LibExtension) + + + + + + + + + + + + + + + <_PlatformAssemblyPaths Include="$(CrossgenToolDir)" /> + <_PlatformAssemblyPaths Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)')" /> + + + + + + + $(TargetDir) + @(_PlatformAssemblyPaths->Distinct(), '$(PathSeparator)') + + $(TargetDir)\ + $(CrossgenPlatformAssemblyPaths)\ + + + + + + + + + + + + + + + + + + + + + + +