Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktor Hofer <viktor.hofer@microsoft.com>2020-07-23 18:20:26 +0300
committerGitHub <noreply@github.com>2020-07-23 18:20:26 +0300
commit809a06f45161ae686a06b9e9ccc2f45097b91657 (patch)
treedaa6d29750bc49c463679fc189ae2ecb6618438d /eng/resolveContract.targets
parente8c4169b4fc4eb9a71f296b3bd2e96db16d32d35 (diff)
Remove depprojs in favor of PackageReferences (#35606)
- Remove depprojs which currently binplace external references into the RefPath folders in favor of PackageReference and PackageDownload items. - Build all configurations by default when building an individual project (either on the CLI or inside VS) same as with the official SDK. This enables .NETFramework Test Explorer support. - Centrally define libraries that compose the shared framework instead of in each Directory.Build.props file to be able to build the targeting pack first and consume it in the OOB libraries. - Use ProjectReferences to reference OOB projects. Compile against the reference assembly but use the implementation assembly app-local during runtime. - Remove OOBs from the testhost and remove the testhost folder for .NETFramework as it isn't required anymore. - Only binplace for $(NetCoreAppCurrent) to compose a) the targeting pack, b) the runtime pack, c) the testhost, d) a full closure for the shims. - Use Targeting Packs for OOB projects (with their implicit assembly references) but still explicitly define granular references for .NETCoreApp configurations (DisableImplicitAssemblyReferences switch). Use the implicit targeting pack references in some Microsoft.Extensions.* cases. - Remove placeholder configurations as they aren't needed anymore with explicit P2Ps vs Targeting Pack references. - Remove implicit assembly references (ie for .NETFramework, mscorlib) - Remove AssemblySearchPath hacks that were introduced with b7c4cb7 as the targeting pack is now used by default. - Reduce unnecessary .NETFramework configurations that were added to run tests in favor of the already existing ref&src configurations. - Stop hardcoding the paths for wasm assemblies and use the returned TargetPath of the ProjectReferences. - Addressed formatting (ItemGroups, References at the bottom of the project file, ordering of references, use LibrariesProjectRoot instead of a relative path, unnecessary AssemblyName and RootNamespace properties which are identical to the project name, ordering of tfms) - Revert "fix clean (#33758)"
Diffstat (limited to 'eng/resolveContract.targets')
-rw-r--r--eng/resolveContract.targets49
1 files changed, 47 insertions, 2 deletions
diff --git a/eng/resolveContract.targets b/eng/resolveContract.targets
index 2f59f5d9a51..6f4bb0e253e 100644
--- a/eng/resolveContract.targets
+++ b/eng/resolveContract.targets
@@ -1,8 +1,18 @@
<Project>
+ <PropertyGroup>
+ <ContractDependencyPaths Condition="'$(DisableImplicitFrameworkReferences)' == 'true' and
+ '$(TargetFrameworkIdentifier)' == '.NETCoreApp'">$(MicrosoftNetCoreAppRefPackRefDir)</ContractDependencyPaths>
+ <!-- Use implementation referencepath if no contract tfm is set. -->
+ <ContractDependencyPaths Condition="'$(ContractDependencyPaths)' == ''">$(ContractDependencyPaths);@(ReferencePath->'%(RelativeDir)'->Distinct())</ContractDependencyPaths>
+ </PropertyGroup>
+
<PropertyGroup Condition="'$(IsSourceProject)' == 'true'">
- <ContractProject Condition="'$(ContractProject)' == ''">$(LibrariesProjectRoot)$(MSBuildProjectName)/ref/$(MSBuildProjectName).csproj</ContractProject>
+ <ContractProject Condition="'$(ContractProject)' == ''">$(LibrariesProjectRoot)$(MSBuildProjectName)\ref\$(MSBuildProjectName).csproj</ContractProject>
<HasMatchingContract Condition="'$(HasMatchingContract)' == '' and Exists('$(ContractProject)')">true</HasMatchingContract>
- <ContractAssemblyPath Condition="'$(ContractAssemblyPath)' == ''">$(RefPath)/$(MSBuildProjectName).dll</ContractAssemblyPath>
+ <ContractAssemblyPath Condition="'$(ContractAssemblyPath)' == '' and
+ '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
+ $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '$(NETCoreAppCurrentVersion)'))">$(NetCoreAppCurrentRefPath)$(TargetFileName)</ContractAssemblyPath>
+ <ContractAssemblyPath Condition="'$(ContractAssemblyPath)' == ''">$([MSBuild]::NormalizePath('$(BaseOutputPath)', 'ref', '$(TargetFramework)-$(Configuration)', '$(TargetFileName)'))</ContractAssemblyPath>
<!-- Disable API compat if the project doesn't have reference assembly -->
<RunApiCompat Condition="'$(HasMatchingContract)' != 'true'">false</RunApiCompat>
@@ -10,8 +20,43 @@
<ItemGroup Condition="'$(HasMatchingContract)' == 'true'">
<ResolvedMatchingContract Condition="Exists('$(ContractAssemblyPath)')" Include="$(ContractAssemblyPath)" />
+ <!-- If the contract doesn't exist in the default contract output path add a project reference to the contract project to resolve -->
+ <ProjectReference Condition="'@(ResolvedMatchingContract)' == ''" Include="$(ContractProject)">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ <OutputItemType>ResolvedMatchingContract</OutputItemType>
+ </ProjectReference>
</ItemGroup>
<!-- intentionally empty since we no longer need a target -->
<Target Name="ResolveMatchingContract" />
+
+ <!-- Allow P2Ps that target a source project to build against the corresponding ref project. -->
+ <Target Name="AnnotateTargetPathWithTargetPlatformMonikerWithReferenceAssembly"
+ Condition="'$(HasMatchingContract)' == 'true'"
+ AfterTargets="GetTargetPathWithTargetPlatformMoniker">
+ <ItemGroup>
+ <TargetPathWithTargetPlatformMoniker ReferenceAssembly="@(ResolvedMatchingContract)" />
+ </ItemGroup>
+ </Target>
+
+ <Target Name="HandleReferenceAssemblyAttributeForProjectReferences"
+ AfterTargets="ResolveProjectReferences"
+ BeforeTargets="FindReferenceAssembliesForReferences"
+ Condition="'@(ProjectReference)' != '' and '@(_ResolvedProjectReferencePaths)' != ''">
+ <!-- If we have a ProjectReference to CoreLib, we need to compile against implementation assemblies. -->
+ <PropertyGroup Condition="@(_ResolvedProjectReferencePaths->AnyHaveMetadataValue('MSBuildSourceProjectFile', '$(CoreLibProject)'))">
+ <CompileUsingReferenceAssemblies>false</CompileUsingReferenceAssemblies>
+ </PropertyGroup>
+ <!-- Clear the ReferenceAssembly attribute on resolved P2Ps that set SkipUseReferenceAssembly to true. -->
+ <ItemGroup>
+ <_resolvedP2PFiltered Include="@(ProjectReference)">
+ <ProjectReferenceItemSpec>$([System.IO.Path]::GetFullPath('%(ProjectReference.Identity)'))</ProjectReferenceItemSpec>
+ <SkipUseReferenceAssembly>%(ProjectReference.SkipUseReferenceAssembly)</SkipUseReferenceAssembly>
+ </_resolvedP2PFiltered>
+ <_ResolvedProjectReferencePaths Update="@(_resolvedProjectReferenceFiltred)"
+ Condition="'%(_resolvedP2PFiltered.ProjectReferenceItemSpec)' == '%(_resolvedP2PFiltered.MSBuildSourceProjectFile)' and
+ '%(_resolvedP2PFiltered.SkipUseReferenceAssembly)' == 'true'"
+ ReferenceAssembly="" />
+ </ItemGroup>
+ </Target>
</Project> \ No newline at end of file