We now compile against the reference assembly in all places where we were compiling against the mono/coreclr System.Private.CoreLib.dll implementation assembly before.
The new reference assembly consumes sources from the existing contracts to avoid checking in a generated version of SPC.dll (this would add ~20k lines of .cs which is mostly duplicated with System.Runtime.cs)
Since a few contracts have only partially moved types to SPC we wrap contract types with `#if !BUILDING_CORELIB_REFERENCE` so we can hide them when compiling the SPC reference assembly. This needed a few GenAPI changes which are implemented here: https://github.com/dotnet/arcade/pull/10003.
Note that this means that the types which live in CoreLib are moved to the end of the ref .cs file which causes a GitHub diff to show up, but it is actually a no-op.
Regenerating the ref .cs files works the same way as before, by running the `GenerateReferenceAssemblySource` target in the contract's src\ folder.
Fixes https://github.com/dotnet/runtime/issues/67660
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
* Remove the use of IsPartialFacadeAssembly in refererences
This flag requires assembly-re-writing to replace type-defs in reference
assemblies with type forwards, when the same type exists in references.
We've pretty much exclusively used this on .NETFramework, since it's
not friendly to source build (CCI isn't part of source build).
.NETFramework isn't going to be changing so it doesn't save us much
to generate these typeforwards in the build.
We also used these to make sure the netstandard surface area was
compatible with .NETFramework facades (we'd use the pre-rewritten
reference assemblies for contract), but this need goes away now that we
have package validation based APICompat that compares netstandard refs
to net4x facades.
* Fix some projects I missed after changing naming convention
* Fixup another project
* Fix build of System.System.Threading.AccessControl
* Adding a section to ref-source docs on .NETFramework facades
* Address feedback
* use arcade target
* extra space
* fixes generation of reference src from runtime projects
* run target to get genapi
* use referencePath to get references
* adding GenerateReferenceSource target
* added the target name
* Move files into hierarchy
* fix more links
* Fix botr and features links
* Remove bad apostrophe
* spelling
* Apply suggestions from code review
Co-Authored-By: Youssef Victor <31348972+Youssef1313@users.noreply.github.com>
* Update docs/coding-guidelines/package-projects.md
Co-Authored-By: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Youssef Victor <31348972+Youssef1313@users.noreply.github.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>