-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
Copy pathtests.ioslike.targets
241 lines (189 loc) · 14.9 KB
/
tests.ioslike.targets
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<Project>
<PropertyGroup>
<BundleTestAppTargets>$(BundleTestAppTargets);BundleTestAppleApp</BundleTestAppTargets>
</PropertyGroup>
<PropertyGroup>
<BuildTestsOn Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(Scenario)' == 'BuildAppleApps'">helix</BuildTestsOn>
<BuildTestsOn Condition="'$(BuildTestsOnHelix)' == 'true'">helix</BuildTestsOn>
<BuildTestsOn Condition="'$(BuildTestsOn)' == ''">local</BuildTestsOn>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildTestsOnHelix)' == 'true'">
<_AOTBuildCommand>export PATH=$HELIX_CORRELATION_PAYLOAD/build/cmake/cmake-3.28.0-macos-universal/CMake.app/Contents/bin:$PATH && </_AOTBuildCommand>
<_AOTBuildCommand>$(_AOTBuildCommand) dotnet msbuild publish/ProxyProjectForAOTOnHelix.proj /bl:$XHARNESS_OUT/AOTBuild.binlog</_AOTBuildCommand>
<!-- running aot-helix tests locally, so we can test with the same project file as CI -->
<_AOTBuildCommand Condition="'$(ContinuousIntegrationBuild)' != 'true'">$(_AOTBuildCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration)</_AOTBuildCommand>
<!-- The command below sets default properties for runtime and library tests -->
<_AOTBuildCommand>$(_AOTBuildCommand) /p:XHARNESS_EXECUTION_DIR="$XHARNESS_EXECUTION_DIR" /p:RunAOTCompilation=$(RunAOTCompilation) /p:UseNativeAOTRuntime=$(UseNativeAOTRuntime) /p:TargetOS=$(TargetOS) /p:TargetArchitecture=$(TargetArchitecture) /p:MonoForceInterpreter=$(MonoForceInterpreter) /p:MonoEnableLLVM=true /p:DevTeamProvisioning=$(DevTeamProvisioning) /p:UsePortableRuntimePack=true /p:Configuration=$(Configuration) /p:EnableAggressiveTrimming=$(EnableAggressiveTrimming)</_AOTBuildCommand>
<_AOTBuildCommand Condition="'$(NativeLib)' != ''">$(_AOTBuildCommand) /p:NativeLib=$(NativeLib) /p:BundlesResources=$(BundlesResources) /p:ForceLibraryModeGenerateAppBundle=$(ForceLibraryModeGenerateAppBundle)</_AOTBuildCommand>
<_AOTBuildCommand>$(_AOTBuildCommand) </_AOTBuildCommand>
<_ResetSimulatorSwitch Condition="('$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvossimulator') and '$(IncludesTestRunner)' == 'true'">--reset-simulator</_ResetSimulatorSwitch>
<_SignalAppEndSwitch>--signal-app-end</_SignalAppEndSwitch>
<_AppleSignCommand Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvos'">sign "$app"</_AppleSignCommand>
<IncludesTestRunner Condition="'$(IncludesTestRunner)' == ''">true</IncludesTestRunner>
<_AppleBuildCommand Condition="'$(IncludesTestRunner)' == 'true'">apple test</_AppleBuildCommand>
<_AppleBuildCommand Condition="'$(IncludesTestRunner)' != 'true'">apple run</_AppleBuildCommand>
<_AppleExpectedExitCode Condition="'$(ExpectedExitCode)' != ''">--expected-exit-code $(ExpectedExitCode)</_AppleExpectedExitCode>
<_AfterBuildCommands>
mv $XHARNESS_OUT/AOTBuild.binlog "$HELIX_WORKITEM_UPLOAD_ROOT"
$(_AppleSignCommand)
xharness $(_AppleBuildCommand) --app "$app" --output-directory "$output_directory" --target "$target" --timeout "$timeout" --xcode "$xcode_path" -v --launch-timeout "$launch_timeout" $(_ResetSimulatorSwitch) $(_SignalAppEndSwitch) $(_AppleExpectedExitCode) -- </_AfterBuildCommands>
<RunScriptCommand>$(_AOTBuildCommand) $(_AfterBuildCommands)</RunScriptCommand>
</PropertyGroup>
<Import Project="$(MonoProjectRoot)\msbuild\common\LibraryBuilder.props"
Condition="'$(BuildTestsOn)' == 'local'" />
<Import Project="$(MonoProjectRoot)\msbuild\apple\build\AppleBuild.props"
Condition="'$(BuildTestsOn)' == 'local'" />
<Import Project="$(MonoProjectRoot)\msbuild\apple\build\AppleBuild.InTree.targets"
Condition="'$(BuildTestsOn)' == 'local'" />
<PropertyGroup>
<AppleBuildDependsOn>PrepareForAppleBuildApp;$(AppleBuildDependsOn);_CopyTestArchive</AppleBuildDependsOn>
<BundleTestAppleAppDependsOn Condition="'$(BuildTestsOn)' == 'local'">AppleBuild</BundleTestAppleAppDependsOn>
<BundleTestAppleAppDependsOn Condition="'$(BuildTestsOnHelix)' == 'true'">$(BundleTestAppleAppDependsOn);_BundleAOTTestAppleAppForHelix;_CopyTestArchive</BundleTestAppleAppDependsOn>
</PropertyGroup>
<Target Name="BundleTestAppleApp" DependsOnTargets="$(BundleTestAppleAppDependsOn)" />
<UsingTask Condition="'$(BuildTestsOnHelix)' == 'true'"
TaskName="Microsoft.WebAssembly.Build.Tasks.GenerateAOTProps"
AssemblyFile="$(WasmBuildTasksAssemblyPath)" />
<Target Name="_BundleAOTTestAppleAppForHelix" DependsOnTargets="PrepareForAppleBuildApp">
<PropertyGroup>
<AppBundlePath>$(BundleDir)publish</AppBundlePath>
</PropertyGroup>
<PropertyGroup>
<_MainAssemblyPath Condition="'%(AppleAssembliesToBundle.FileName)' == $(AssemblyName) and '%(AppleAssembliesToBundle.Extension)' == '.dll'">%(AppleAssembliesToBundle.Identity)</_MainAssemblyPath>
<RuntimeConfigFilePath>$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</RuntimeConfigFilePath>
</PropertyGroup>
<ItemGroup>
<BundleFiles Condition="'%(AppleAssembliesToBundle._IsNative)' != 'true'"
Include="@(AppleAssembliesToBundle)" TargetDir="publish\%(AppleAssembliesToBundle.RecursiveDir)" />
<BundleFiles Include="@(AppleNativeFilesToBundle)" TargetDir="publish\%(AppleNativeFilesToBundle.RecursiveDir)" />
<BundleFiles Include="@(_SatelliteAssemblies)" TargetDir="publish\%(_SatelliteAssemblies.RecursiveDir)" />
<BundleFiles Include="$(RuntimeConfigFilePath)" TargetDir="publish" />
<BundleFiles Include="$(MonoProjectRoot)\msbuild\apple\data\*" TargetDir="publish" />
<ExtraFiles Condition="'%(AppleAssembliesToBundle._IsNative)' == 'true'"
Include="@(AppleAssembliesToBundle)" TargetDir="extraFiles\%(AppleAssembliesToBundle.RecursiveDir)" />
<ExtraFiles Condition="Exists(%(TrimmerRootDescriptor.Identity))"
Include="@(TrimmerRootDescriptor)" TargetDir="extraFiles" />
</ItemGroup>
<ItemGroup Condition="'$(UseNativeAOTRuntime)' == 'true' and '$(HybridGlobalization)' == 'false'" >
<BundleFiles Include="$(MicrosoftNetCoreAppRuntimePackDir)/runtimes/$(TargetOS)-$(TargetArchitecture)/native/icudt.dat"
TargetDir="publish" />
<BundleFiles Include="$(MicrosoftNetCoreAppRuntimePackDir)/runtimes/$(TargetOS)-$(TargetArchitecture)/native/libicudata.a"
TargetDir="publish" />
<BundleFiles Include="$(MicrosoftNetCoreAppRuntimePackDir)/runtimes/$(TargetOS)-$(TargetArchitecture)/native/libicuuc.a"
TargetDir="publish" />
<BundleFiles Include="$(MicrosoftNetCoreAppRuntimePackDir)/runtimes/$(TargetOS)-$(TargetArchitecture)/native/libicui18n.a"
TargetDir="publish" />
</ItemGroup>
<ItemGroup Condition="'$(DebuggerSupport)' == 'true'">
<!-- Add any pdb files, if available -->
<BundleFiles Include="@(ApplePdbsToBundle)" TargetDir="publish" Condition="Exists(%(ApplePdbsToBundle.Identity))" />
</ItemGroup>
<Copy SourceFiles="@(BundleFiles)" DestinationFolder="$(BundleDir)%(TargetDir)" />
<Copy SourceFiles="@(ExtraFiles)" DestinationFolder="$(BundleDir)\%(TargetDir)" />
<!-- Only publish artifacts minus runtime pack assets (move to dotnet build later as opposed to publish)-->
<ItemGroup Condition="'$(UsePortableRuntimePack)' == 'true'">
<_PublishBundleFiles Include="@(BundleFiles->'$(AppBundlePath)/%(FileName)%(Extension)')" />
<_RuntimePackFiles Include="$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)**\*.*" />
<_RuntimePackFiles Include="$(MicrosoftNetCoreAppRuntimePackNativeDir)*.*" />
<_UnusedRuntimePackFiles Include="@(_PublishBundleFiles)" Exclude="@(_RuntimePackFiles->'$(AppBundlePath)/%(FileName)%(Extension)')" />
<_UsedRuntimePackFiles Include="@(_PublishBundleFiles)" Exclude="@(_UnusedRuntimePackFiles)" />
<_RuntimePackFilesToDelete Include="@(_RuntimePackFiles->'$(AppBundlePath)/%(FileName)%(Extension)')" />
<!-- ILLink properties -->
<AppleReferenceSharedPathFiles Include="%(ReferencePath.Identity)" Condition="Exists('@(ReferencePath->'$(LibrariesSharedFrameworkBinArtifactsPath)%(FileName)%(Extension)')')" />
<ReferenceExtraPathFiles Include="%(ReferencePath.Identity)" Condition="!Exists('@(ReferencePath->'$(LibrariesSharedFrameworkBinArtifactsPath)%(FileName)%(Extension)')')" />
</ItemGroup>
<!-- Remove the runtime pack parts from the self contained app. We'll restore on helix -->
<Delete Condition="'$(UsePortableRuntimePack)' == 'true'" Files="@(_RuntimePackFilesToDelete)" />
<!-- Copy ILLink.Substitutions files -->
<Copy SourceFiles="%(ReferenceExtraPathFiles.Identity)" DestinationFolder="$(BundleDir)\extraFiles" />
<!-- To recreate the original project on helix, we need to set the apple properties also, same as the
library test project. Eg. $(InvariantGlobalization) -->
<ItemGroup>
<!-- Configuration properties -->
<_ApplePropertyNames Include="AssemblyName" />
<_ApplePropertyNames Include="IncludesTestRunner" />
<_ApplePropertyNames Include="MainLibraryFileName" />
<_ApplePropertyNames Include="MonoEnableLLVM" />
<_ApplePropertyNames Include="ShouldILStrip" />
<_ApplePropertyNames Include="UseConsoleUITemplate" />
<_ApplePropertyNames Include="UseRuntimeComponents" />
<_ApplePropertyNames Include="_NetCoreAppToolCurrent" />
<!-- Globalization properties -->
<_ApplePropertyNames Include="HybridGlobalization" />
<_ApplePropertyNames Include="InvariantGlobalization" />
<_AppleUsedRuntimePackFiles
Include="@(_UsedRuntimePackFiles->'%(FileName)%(Extension)')"
RemoveMetadata="_IsNative;TargetDir" />
<_ApplePropertiesToPass
Include="$(%(_ApplePropertyNames.Identity))"
Name="%(_ApplePropertyNames.Identity)"
ConditionToUse__="%(_ApplePropertyNames.ConditionToUse__)" />
<_AppleItemsToPass Include="@(_AppleUsedRuntimePackFiles)"
OriginalItemName__="_AppleUsedRuntimePackFiles" />
<_AppleItemsToPass Include="@(AppleReferenceSharedPathFiles->'%(FileName)%(Extension)')"
OriginalItemName__="AppleReferenceSharedPathFiles" />
<_AppleItemsToPass Include="@(ReferenceExtraPathFiles->'%(FileName)%(Extension)')"
OriginalItemName__="AppleReferenceExtraPathFiles" />
<_AppleItemsToPass Include="@(RuntimeHostConfigurationOption)"
OriginalItemName__="_AppleUsedRuntimeHostConfigurationOption" />
<_AppleItemsToPass Include="@(TrimmerRootAssembly)"
OriginalItemName__="TrimmerRootAssembly" />
<!-- Example of passing items to the project
<_AppleItemsToPass Include="@(BundleFiles)" OriginalItemName__="BundleFiles" ConditionToUse__="'$(Foo)' != 'true'" />
-->
</ItemGroup>
<!-- This file gets imported by the project file on helix -->
<GenerateAOTProps
Properties="@(_ApplePropertiesToPass)"
Items="@(_AppleItemsToPass)"
OutputFile="$(BundleDir)publish\ProxyProjectForAOTOnHelix.props" />
</Target>
<Target Name="PrepareForAppleBuildApp">
<Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" />
<WriteLinesToFile File="$(PublishDir)xunit-excludes.txt" Lines="$(XunitExcludesTxtFileContent)" Overwrite="true" />
<PropertyGroup>
<!-- Default for now. If we can remove our ICU and rely on the system one, then HybridGlobalization becomes the default and we can remove checks for it -->
<HybridGlobalization>true</HybridGlobalization>
<IncludesTestRunner Condition="'$(IncludesTestRunner)' == ''">true</IncludesTestRunner>
<Optimized Condition="'$(Configuration)' == 'Release'">true</Optimized>
<MainLibraryFileName Condition="'$(MainLibraryFileName)' == '' and '$(IsRuntimeTests)' != 'true' and '$(IncludesTestRunner)' == 'true'">AppleTestRunner.dll</MainLibraryFileName>
<AppleBuildDir>$(PublishDir)</AppleBuildDir>
<AppleBundleDir>$(BundleDir)</AppleBundleDir>
</PropertyGroup>
<PropertyGroup>
<GenerateXcodeProject>true</GenerateXcodeProject>
<GenerateCMakeProject>false</GenerateCMakeProject>
<GenerateXcodeProject Condition="'$(UseAppBundleRootForBuildingTests)' == 'true'">false</GenerateXcodeProject>
<GenerateCMakeProject Condition="'$(UseAppBundleRootForBuildingTests)' == 'true' and '$(IgnoreForCI)' != 'true'">true</GenerateCMakeProject>
</PropertyGroup>
<ItemGroup>
<AppleAssembliesToBundle Include="@(NativeLibraries->'$(PublishDir)%(Identity)')">
<_InternalForceInterpret>true</_InternalForceInterpret>
<_IsNative>true</_IsNative>
</AppleAssembliesToBundle>
<_PublishAssemblies Include="$(PublishDir)\**\*.dll" Exclude="$(PublishDir)\**\*.resources.dll" />
<_SatelliteAssemblies Include="$(PublishDir)\**\*.resources.dll" />
<AppleAssembliesToBundle Include="@(_PublishAssemblies)">
<_InternalForceInterpret Condition="'$(UseMonoJustInterp)' == 'true' and '%(FileName)%(Extension)' != 'System.Private.CoreLib.dll'">true</_InternalForceInterpret>
<_IsNative>false</_IsNative>
</AppleAssembliesToBundle>
<ApplePdbsToBundle Include="$([System.IO.Path]::ChangeExtension('%(AppleAssembliesToBundle.Identity)', '.pdb'))" />
<AppleXmlsToBundle Include="$([System.IO.Path]::ChangeExtension('%(AppleAssembliesToBundle.Identity)', '.xml'))" />
<AppleNativeFilesToBundle Include="$(PublishDir)\**\*.*" Exclude="@(AppleAssembliesToBundle);@(ApplePdbsToBundle);@(AppleXmlsToBundle);@(_SatelliteAssemblies)" />
</ItemGroup>
</Target>
<Target Name="_CopyTestArchive"
Condition="'$(ArchiveTests)' == 'true' and '$(IgnoreForCI)' != 'true'">
<Error Condition="'$(TestArchiveTestsDir)' == ''" Text="TestArchiveTestsDir property to archive the test folder must be set." />
<!-- Adjust the variable names -->
<PropertyGroup Condition="'$(GenerateXcodeProject)' == 'true'">
<_AppBundleDir>$(AppBundlePath)/../</_AppBundleDir>
</PropertyGroup>
<MakeDir Condition="'$(GenerateXcodeProject)' == 'true'" Directories="$(TestArchiveTestsDir)" />
<ZipDirectory Condition="'$(GenerateXcodeProject)' == 'true'"
SourceDirectory="$(_AppBundleDir)"
DestinationFile="$([MSBuild]::NormalizePath('$(TestArchiveTestsDir)', '$(TestProjectName).zip'))"
Overwrite="true" />
<RemoveDir Condition="'$(NeedsToBuildAppsOnHelixLocal)' != 'true'" Directories="$(OutDir)" />
</Target>
</Project>