blob: 8335ec4262f94bf9f9054cc52ec1a8b38477c586 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(TargetFrameworkVersion)' != '' and '$(TargetFrameworkProfile)' != ''">
<TargetingPortable>true</TargetingPortable>
</PropertyGroup>
<!-- Setup the default target for projects not already explicitly targeting portable -->
<PropertyGroup Condition="'$(TargetingPortable)' != 'true'">
<!-- Setting a default portable profile, although nothing should resolve from there as we BuildProjectDir to use the pacakge refs -->
<TargetPlatformIdentifier>Portable</TargetPlatformIdentifier>
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile Condition="'$(TargetFrameworkProfile)' == ''">Profile7</TargetFrameworkProfile>
<TargetFrameworkMonikerDisplayName>.NET Portable Subset</TargetFrameworkMonikerDisplayName>
<ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == ''">false</ImplicitlyExpandTargetFramework>
<AssemblySearchPaths>
{HintPathFromItem};
$(OutDir);
{RawFileName};
</AssemblySearchPaths>
<!-- For our projects we don't BuildProjectDir to resolve from the usual paths for now only hint paths and output directory
{CandidateAssemblyFiles};
$(ReferencePath);
{TargetFrameworkDirectory};
{Registry:$(FrameworkRegistryBase),$(TargetFrameworkVersion),$(AssemblyFoldersSuffix)$(AssemblyFoldersExConditions)};
-->
</PropertyGroup>
<!-- Need to add references to the mscorlib design-time facade for some old-style portable dependencies like xunit -->
<Target Name="AddDesignTimeFacadeReferences"
Condition="'$(TargetingPortable)' != 'true'"
BeforeTargets="ResolveReferences"
DependsOnTargets="GetReferenceAssemblyPaths"
>
<ItemGroup>
<PossibleTargetFrameworks Include="$(_TargetFrameworkDirectories)" />
<ReferencePath Condition="'$(LinkLocalMscorlib)' != 'true'" Include="%(PossibleTargetFrameworks.Identity)mscorlib.dll" />
<ReferencePath Condition="'$(LinkLocalMscorlib)' == 'true'" Include="$(ProjectDir)\..\bin\Product\$(BuildOS).$(BuildArch).$(BuildType)\mscorlib.dll" />
</ItemGroup>
</Target>
<!-- Project language -->
<PropertyGroup Condition="'$(ProjectLanguage)' == ''">
<ProjectLanguage Condition="'$(MSBuildProjectExtension)' == '.ilproj' OR '$(Language)' == 'IL'">IL</ProjectLanguage>
<ProjectLanguage Condition="'$(MSBuildProjectExtension)' == '.csproj' OR '$(Language)' == 'C#' OR '$(ProjectLanguage)'==''">CSharp</ProjectLanguage>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" Condition="'$(ProjectLanguage)' == 'CSharp'" />
<!-- TODO (#1122): import this from the ToolsDir once it becomes available -->
<Import Project="$(ProjectDir)IL.targets" Condition="'$(ProjectLanguage)' == 'IL'" />
<Import Project="$(ToolsDir)packageresolve.targets" Condition="Exists('$(ToolsDir)packageresolve.targets')" />
<Import Project="$(ToolsDir)sign.targets" Condition="Exists('$(ToolsDir)sign.targets')" />
<PropertyGroup>
<GenerateRunScript Condition="'$(OutputType.ToUpper())' != 'EXE' And '$(GenerateRunScript)' == ''">false</GenerateRunScript>
</PropertyGroup>
<Import Project="CLRTest.Execute.targets" />
<Target Name="CreateExecuteScript"
AfterTargets="Build"
Condition="'$(GenerateRunScript)' != 'false'"
DependsOnTargets="GenerateExecutionScriptsInternal" />
<PropertyGroup>
<OutDir>$(BaseOutputPathWithConfig)$(BuildProjectRelativeDir)\</OutDir>
</PropertyGroup>
<Target Name="CopyNativeProjectBinaries">
<ItemGroup>
<NativeProjectBinaries Include="$(NativeProjectOutputFolder)\**\*.*" />
</ItemGroup>
<Error Text="The native project files are missing in $(NativeProjectOutputFolder) please run build from the root of the repo at least once"
Condition="'@(NativeProjectBinaries)' == ''" />
<Copy
SourceFiles="@(NativeProjectBinaries)"
DestinationFiles="@(NativeProjectBinaries -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
<Target Name="ResolveCmakeNativeProjectReference"
Condition="'@(ProjectReference)' != ''"
BeforeTargets="BeforeResolveReferences;BeforeClean" >
<ItemGroup>
<NativeProjectReference Include="%(ProjectReference.Identity)" Condition="$([System.String]::Copy(%(ProjectReference.FileName)).ToUpper()) == 'CMAKELISTS'" />
<ProjectReference Remove="%(NativeProjectReference.Identity)" />
<NativeProjectReferenceNormalized Include="@(NativeProjectReference -> '%(FullPath)')" />
</ItemGroup>
</Target>
<Target Name="ConsolidateNativeProjectReference"
Condition="'@(ProjectReference)' != ''"
BeforeTargets="Build" >
<ItemGroup>
<NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(SourceDir),$(__NativeTestIntermediatesDir)\src\))$(Configuration)\"/>
</ItemGroup>
<Message Text= "Project files are :$([System.String]::Copy(%(ProjectReference.FileName)).ToUpper()) " />
<Message Text= "Project references are :%(ProjectReference.Identity)" />
<Message Text= "Native project references are :%(NativeProjectReference.Identity)" />
<Message Text= "Full native project references are :%(NativeProjectReferenceNormalized.Identity)" />
<Message Text= "Native binaries will be copied from :%(NativeProjectOutputFoldersToCopy.Identity)" />
<MSBuild Projects="$(MSBuildProjectFile)" Targets="CopyNativeProjectBinaries" Properties="NativeProjectOutputFolder=%(NativeProjectOutputFoldersToCopy.Identity)" Condition="'@(NativeProjectReference)' != ''" />
</Target>
</Project>
|