Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung committed Jun 11, 2021
2 parents e1cab80 + 645dfe6 commit 6271751
Show file tree
Hide file tree
Showing 1,931 changed files with 95,843 additions and 21,241 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"microsoft.dotnet.xharness.cli": {
"version": "1.0.0-prerelease.21271.1",
"version": "1.0.0-prerelease.21307.1",
"commands": [
"xharness"
]
Expand Down
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@
<RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation>
<!-- Turn off end of life target framework checks as we intentionally build older .NETCoreApp configurations. -->
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<!-- Turn off workload support until we support them. -->
<MSBuildEnableWorkloadResolver>false</MSBuildEnableWorkloadResolver>
<!-- Disable source link when building locally. -->
<DisableSourceLink Condition="'$(DisableSourceLink)' == '' and
'$(ContinuousIntegrationBuild)' != 'true' and
Expand All @@ -224,6 +226,9 @@
<CoreLibSharedDir>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'src'))</CoreLibSharedDir>
<CoreLibProject Condition="'$(RuntimeFlavor)' == 'CoreCLR'">$([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj'))</CoreLibProject>
<CoreLibProject Condition="'$(RuntimeFlavor)' == 'Mono'">$([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj'))</CoreLibProject>

<!-- this property is used by the SDK to pull in mono-based runtime packs -->
<UseMonoRuntime Condition="'$(UseMonoRuntime)' == '' and '$(RuntimeFlavor)' == 'Mono'">true</UseMonoRuntime>
</PropertyGroup>

<!-- Packaging -->
Expand Down Expand Up @@ -256,6 +261,7 @@
<GeneratePackage Condition="(('$(PreReleaseVersionLabel)' == 'servicing' or
'$(GitHubRepositoryName)' == 'runtimelab') and
'$(MSBuildProjectExtension)' != '.sfxproj')">false</GeneratePackage>
<PlaceholderFile>$(RepositoryEngineeringDir)_._</PlaceholderFile>
</PropertyGroup>

<!-- Language configuration -->
Expand Down
36 changes: 36 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<PackageDescription Condition="'$(PackageDescription)' == '' and '$(UseRuntimePackageDisclaimer)' == 'true'">$(RuntimePackageDisclaimer)</PackageDescription>
<!-- Keep in sync as required by the Packaging SDK in Arcade. -->
<Description>$(PackageDescription)</Description>
<BeforePack>$(BeforePack);AddNETStandardCompatErrorFileForPackaging</BeforePack>
</PropertyGroup>

<!-- Remove when https://github.com/NuGet/Home/issues/10405 is implemented and consumed. -->
Expand All @@ -71,4 +72,39 @@
<PackDependsOn />
</PropertyGroup>
</Target>

<!-- Add targets file that marks a .NETStandard applicable tfm as unsupported. -->
<Target Name="AddNETStandardCompatErrorFileForPackaging"
Condition="'@(NETStandardCompatError)' != ''"
Inputs="%(NETStandardCompatError.Identity)"
Outputs="unused"
BeforeTargets="GetFiles">
<PropertyGroup>
<_NETStandardCompatErrorFilePath>$(BaseIntermediateOutputPath)netstandardcompaterrors\%(NETStandardCompatError.Identity)\$(PackageId).targets</_NETStandardCompatErrorFilePath>
<_NETStandardCompatErrorFileTarget>NETStandardCompatError_$(PackageId.Replace('.', '_'))_$([System.String]::new('%(NETStandardCompatError.Supported)').Replace('.', '_'))</_NETStandardCompatErrorFileTarget>
<_NETStandardCompatErrorFileContent>
<![CDATA[<Project InitialTargets="$(_NETStandardCompatErrorFileTarget)">
<Target Name="$(_NETStandardCompatErrorFileTarget)"
Condition="'%24(SuppressTfmSupportBuildWarnings)' == ''">
<Error Text="$(PackageId) doesn't support %24(TargetFramework). Consider updating your TargetFramework to %(NETStandardCompatError.Supported) or later." />
</Target>
</Project>]]>
</_NETStandardCompatErrorFileContent>
</PropertyGroup>

<WriteLinesToFile File="$(_NETStandardCompatErrorFilePath)"
Lines="$(_NETStandardCompatErrorFileContent)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />

<ItemGroup>
<None Include="$(_NETStandardCompatErrorFilePath)"
PackagePath="buildTransitive\%(NETStandardCompatError.Identity)"
Pack="true" />
<None Include="$(PlaceholderFile)"
PackagePath="buildTransitive\%(NETStandardCompatError.Supported)"
Pack="true" />
<FileWrites Include="$(_NETStandardCompatErrorFilePath)" />
</ItemGroup>
</Target>
</Project>
28 changes: 15 additions & 13 deletions docs/area-owners.md

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions docs/coding-guidelines/libraries-packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To add a library to the .NETCore shared framework, that library's `AssemblyName`

The library should have both a `ref` and `src` project. Its reference assembly will be included in the ref-pack for the Microsoft.NETCore.App shared framework, and its implementation assembly will be included in the runtime pack.

Including a library in the shared framework only includes the best applicable TargetFramework build of that library: `$(NetCoreAppCurrent)` if it exists, but possibly `netstandard2.1` or another if that is best. If a library has builds for other frameworks those will only be shipped if the library also produces a [Nuget package](#nuget-package). If a library ships both in the shared framework and a nuget package, it may decide to exclude its latest `$(NetCoreAppCurrent)` build from the package. This can be done by setting `ExcludeCurrentNetCoreAppFromPackage` to true. Libraries should take care when doing this to ensure that whatever asset in the package that would apply to `$(NetCoreAppCurrent)` is functionally equivalent to that which it replaces from the shared framework, to avoid breaking applications which reference a newer package than the shared framework. If possible, it's preferable to avoid this by choosing to target frameworks which can both ship in the package and shared framework.
Including a library in the shared framework only includes the best applicable TargetFramework build of that library: `$(NetCoreAppCurrent)` if it exists, but possibly `netstandard2.1` or another if that is best. If a library has builds for other frameworks those will only be shipped if the library also produces a [Nuget package](#nuget-package).

In some occasions we may want to include a library in the shared framework, but not expose it publicly. To do so, include the library in the `NetCoreAppLibraryNoReference` property in [NetCoreAppLibrary.props](../../src/libraries/NetCoreAppLibrary.props). The library should also be named in a way to discourage use at runtime, for example using the `System.Private` prefix. We should avoid hiding arbitrary public libraries as it complicates deployment and servicing, though some platform specific libraries are in this state due to historical reasons.

Expand Down Expand Up @@ -61,13 +61,6 @@ By default all TargetFrameworks listed in your project will be included in the p
</PropertyGroup>
```

A common pattern is to build for the latest .NET version, for example to include a library in the shared framework or a transport package, but then excluded this from the NuGet package. This can be done to avoid growing the NuGet package in size. To do this set
```xml
<PropertyGroup>
<ExcludeCurrentNetCoreAppFromPackage>true</ExcludeCurrentNetCoreAppFromPackage>
</PropertyGroup>
```

When excluding TargetFrameworks from a package special care should be taken to ensure that the builds included are equivalent to those excluded. Avoid ifdef'ing the implementation only in an excluded TargetFramework. Doing so will result in testing something different than what we ship, or shipping a nuget package that degrades the shared framework.

### Build props / targets and other content
Expand Down
Loading

0 comments on commit 6271751

Please sign in to comment.