-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
sendtohelix-mobile.targets
145 lines (124 loc) · 8.68 KB
/
sendtohelix-mobile.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
<Project>
<PropertyGroup>
<BuildHelixWorkItemsDependsOn>$(BuildHelixWorkItemsDependsOn);PrepareForBuildHelixWorkItems_Mobile</BuildHelixWorkItemsDependsOn>
<EnableDefaultBuildHelixWorkItems>false</EnableDefaultBuildHelixWorkItems>
<IncludeHelixCorrelationPayload>false</IncludeHelixCorrelationPayload>
<NeedsToBuildAppsOnHelix Condition="('$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator') and '$(NeedsToBuildAppsOnHelix)' == '' and '$(Scenario)' == 'BuildiOSApps'">true</NeedsToBuildAppsOnHelix>
<NeedsiOSSDK Condition="'$(NeedsToBuildAppsOnHelix)' == 'true' and '$(NeedsWorkload)' != 'true'">true</NeedsiOSSDK>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(TargetOS)' == 'maccatalyst'">
<XHarnessAppBundleToTest>
<Targets>maccatalyst</Targets>
<TestTimeout>$(_workItemTimeout)</TestTimeout>
<LaunchTimeout>$(_workItemTimeout)</LaunchTimeout>
</XHarnessAppBundleToTest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(TargetOS)' == 'android'">
<XHarnessApkToTest>
<Targets Condition="'$(TargetArchitecture)' == 'arm'">armeabi-v7a</Targets>
<Targets Condition="'$(TargetArchitecture)' == 'arm64'">arm64-v8a</Targets>
<Targets Condition="'$(TargetArchitecture)' == 'x64'">x86_64</Targets>
<Targets Condition="'$(TargetArchitecture)' == 'x86'">x86</Targets>
<AndroidInstrumentationName>net.dot.MonoRunner</AndroidInstrumentationName>
<TestTimeout>$(_workItemTimeout)</TestTimeout>
</XHarnessApkToTest>
</ItemDefinitionGroup>
<PropertyGroup Condition="'$(NeedsiOSSDK)' == 'true'">
<NeedsDotNetSdk>true</NeedsDotNetSdk>
<UseDotNetCliVersionFromGlobalJson>true</UseDotNetCliVersionFromGlobalJson>
<IncludeXHarnessCli>true</IncludeXHarnessCli>
</PropertyGroup>
<ItemGroup Condition="'$(TargetsAppleMobile)' == 'true'">
<HelixPreCommand Include="export XHARNESS_DISABLE_COLORED_OUTPUT=true" />
<HelixPreCommand Include="export XHARNESS_LOG_WITH_TIMESTAMPS=true" />
</ItemGroup>
<Target Name="PrepareForBuildHelixWorkItems_Mobile">
<PropertyGroup Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'maccatalyst'">
<AppleTestTarget Condition="'$(TargetOS)' == 'iossimulator'">ios-simulator-64</AppleTestTarget>
<AppleTestTarget Condition="'$(TargetOS)' == 'tvossimulator'">tvos-simulator</AppleTestTarget>
<AppleTestTarget Condition="'$(TargetOS)' == 'ios'">ios-device</AppleTestTarget>
<AppleTestTarget Condition="'$(TargetOS)' == 'tvos'">tvos-device</AppleTestTarget>
<AppleTestTarget Condition="'$(TargetOS)' == 'maccatalyst'">maccatalyst</AppleTestTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetsAppleMobile)' == 'true'">
<iOSLikeBuildTargetsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'msbuild', 'apple', 'build'))</iOSLikeBuildTargetsDir>
<iOSLikeLibraryBuilderTargetsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'msbuild', 'common'))</iOSLikeLibraryBuilderTargetsDir>
<WorkItemPrefix Condition="'$(Scenario)' == 'BuildiOSApps' and '$(TestUsingWorkloads)' != 'true'">$(TargetOS)-</WorkItemPrefix>
<CMakeUrl>https://netcorenativeassets.blob.core.windows.net/resource-packages/external/macos/cmake/cmake-3.16.4-Darwin-x86_64.tar.gz</CMakeUrl>
<_XHarnessAppleCustomCommand Condition="'$(NeedsiOSSDK)' == 'true'">
source build-apple-app.sh
</_XHarnessAppleCustomCommand>
</PropertyGroup>
<ItemGroup Condition="'$(NeedsiOSSDK)' == 'true'">
<HelixCorrelationPayload Include="cmake" Uri="$(CMakeUrl)" Destination="build/cmake" />
<HelixCorrelationPayload Include="$(AppleAppBuilderDir)" Destination="build/AppleAppBuilder" />
<HelixCorrelationPayload Include="$(MonoAOTCompilerDir)" Destination="build/MonoAOTCompiler" />
<HelixCorrelationPayload Include="$(MicrosoftNetCoreAppRuntimePackDir)" Destination="build/microsoft.netcore.app.runtime.$(TargetOS)-$(TargetArchitecture.ToLower())" />
<HelixCorrelationPayload Include="$(iOSLikeBuildTargetsDir)" Destination="build/apple" />
<HelixCorrelationPayload Include="$(iOSLikeLibraryBuilderTargetsDir)" Destination="build/common" />
<HelixCorrelationPayload Include="$(MonoAotCrossDir)" Destination="build/cross" />
<HelixCorrelationPayload Include="$(MonoTargetsTasksDir)" Destination="build/MonoTargetsTasks" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsAppleMobile)' == 'true'">
<!-- Create work items for test apps -->
<XHarnessAppBundleToTest
Include="$([System.IO.Directory]::GetDirectories('$(TestArchiveTestsRoot)', '*.app', System.IO.SearchOption.AllDirectories))">
<TestTarget>$(AppleTestTarget)</TestTarget>
<TestTimeout>$(_workItemTimeout)</TestTimeout>
<CustomCommands>$(_XHarnessAppleCustomCommand)</CustomCommands>
</XHarnessAppBundleToTest>
<!-- To save on overall size, we compress each app after building. -->
<XHarnessAppBundleToTest
Include="$([System.IO.Directory]::GetFiles('$(TestArchiveTestsRoot)$(OSPlatformConfig)', '*.zip', System.IO.SearchOption.TopDirectoryOnly))"
Exclude="$([System.IO.Directory]::GetFiles('$(TestArchiveRoot)', 'xharness-app-payload*', System.IO.SearchOption.AllDirectories))">
<TestTarget>$(AppleTestTarget)</TestTarget>
<TestTimeout>$(_workItemTimeout)</TestTimeout>
<CustomCommands>$(_XHarnessAppleCustomCommand)</CustomCommands>
</XHarnessAppBundleToTest>
<!--
Create work items for run-only apps
Note: We're excluding iOS and tvOS device runonly as mlaunch does not seem to return and times out.
-->
<XHarnessAppBundleToTest Condition="Exists('$(TestArchiveRoot)runonly') and '$(TargetOS)' != 'tvos' and '$(TargetOS)' != 'ios'" Include="$([System.IO.Directory]::GetDirectories('$(TestArchiveRoot)runonly', '*.app', System.IO.SearchOption.AllDirectories))" >
<!-- The sample app doesn't need test runner -->
<IncludesTestRunner>false</IncludesTestRunner>
<!-- The sample's C# Main method returns 42 so it should be considered by xharness as a success -->
<ExpectedExitCode>42</ExpectedExitCode>
<TestTarget>$(AppleTestTarget)</TestTarget>
</XHarnessAppBundleToTest>
<!-- To save on overall size, we compress each app after building. -->
<XHarnessAppBundleToTest Condition="Exists('$(TestArchiveRoot)runonly/$(OSPlatformConfig)') and '$(TargetOS)' != 'tvos' and '$(TargetOS)' != 'ios'"
Include="$([System.IO.Directory]::GetFiles('$(TestArchiveRoot)runonly/$(OSPlatformConfig)', '*.zip', System.IO.SearchOption.TopDirectoryOnly))"
Exclude="$([System.IO.Directory]::GetFiles('$(TestArchiveRoot)runonly', 'xharness-app-payload*', System.IO.SearchOption.AllDirectories))">
<!-- The sample app doesn't need test runner -->
<IncludesTestRunner>false</IncludesTestRunner>
<!-- The sample's C# Main method returns 42 so it should be considered by xharness as a success -->
<ExpectedExitCode>42</ExpectedExitCode>
<TestTarget>$(AppleTestTarget)</TestTarget>
</XHarnessAppBundleToTest>
</ItemGroup>
<ItemGroup Condition="'$(TargetOS)' == 'android'">
<_apks Include="$(TestArchiveTestsRoot)**/*.apk" />
<XHarnessApkToTest Include="@(_apks)">
<AndroidPackageName>net.dot.%(Filename)</AndroidPackageName>
</XHarnessApkToTest>
<_runonlyApks Include="$(TestArchiveRoot)runonly/**/*.apk" />
<XHarnessApkToTest Include="@(_runonlyApks)">
<AndroidPackageName>net.dot.%(Filename)</AndroidPackageName>
<!-- The android sample returns 42 so it should be considered by xharness as a success -->
<ExpectedExitCode>42</ExpectedExitCode>
</XHarnessApkToTest>
</ItemGroup>
</Target>
<Target Name="AfterBuildHelixWorkItems_Mobile" AfterTargets="BuildHelixWorkItems">
<Message Condition="'$(Scenario)' == ''" Importance="High" Text="Done building Helix work items. Work item count: @(XHarnessAppBundleToTest->Count())" />
<PropertyGroup>
<_TestPath Condition="'%(XHarnessAppBundleToTest.CustomCommands)' != ''">$([System.IO.Path]::GetDirectoryName('%(XHarnessAppBundleToTest.Identity)'))</_TestPath>
</PropertyGroup>
<Exec Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvos'"
Command="du -sh "$(_TestPath)""
ContinueOnError="true"
IgnoreExitCode="true"
IgnoreStandardErrorWarningFormat="true" />
</Target>
</Project>