-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Build tests as self contained apps for mobile targets #36262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| <Project> | ||
| <PropertyGroup> | ||
| <!-- OutDir is not set early enough to set this property in .props file. --> | ||
| <BundleDir>$([MSBuild]::NormalizeDirectory('$(OutDir)', 'AppBundle'))</BundleDir> | ||
| <RunScriptOutputPath>$([MSBuild]::NormalizePath('$(BundleDir)', '$(RunScriptOutputName)'))</RunScriptOutputPath> | ||
| </PropertyGroup> | ||
|
|
||
| <!-- Generate a self-contained app bundle for Android with tests. --> | ||
| <UsingTask TaskName="AndroidAppBuilderTask" | ||
| AssemblyFile="$(AndroidAppBuilderDir)AndroidAppBuilder.dll" /> | ||
| <Target Condition="'$(TargetOS)' == 'Android'" Name="BundleTestAndroidApp"> | ||
| <PropertyGroup> | ||
| <AndroidAbi Condition="'$(TargetArchitecture)'=='arm64'">arm64-v8a</AndroidAbi> | ||
| <AndroidAbi Condition="'$(TargetArchitecture)'=='arm'">armeabi</AndroidAbi> | ||
| <AndroidAbi Condition="'$(TargetArchitecture)'=='x64'">x86_64</AndroidAbi> | ||
| <AndroidAbi Condition="'$(AndroidAbi)'==''">$(TargetArchitecture)</AndroidAbi> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <AndroidTestRunnerBinaries Include="$(AndroidTestRunnerDir)*.*" /> | ||
| </ItemGroup> | ||
|
|
||
| <Error Condition="'@(AndroidTestRunnerBinaries)' == ''" Text="Could not find AndroidTestRunner in $(AndroidTestRunnerDir)" /> | ||
| <Error Condition="!Exists('$(RuntimePackRidDir)')" Text="RuntimePackRidDir=$(RuntimePackRidDir) doesn't exist" /> | ||
|
|
||
| <RemoveDir Directories="$(BundleDir)" /> | ||
| <Copy SourceFiles="@(AndroidTestRunnerBinaries)" DestinationFolder="$(OutDir)%(RecursiveDir)" SkipUnchangedFiles="true"/> | ||
|
|
||
| <!-- TEMP: consume OpenSSL binaries from external sources via env. variables --> | ||
| <Copy Condition="'$(AndroidOpenSslCryptoLib)' != ''" | ||
| SourceFiles="$(AndroidOpenSslCryptoLib)" | ||
| DestinationFolder="$(OutDir)" SkipUnchangedFiles="true"/> | ||
| <Copy Condition="'$(AndroidOpenSslLib)' != ''" | ||
| SourceFiles="$(AndroidOpenSslLib)" | ||
| DestinationFolder="$(OutDir)" SkipUnchangedFiles="true"/> | ||
|
|
||
| <WriteLinesToFile File="$(OutDir)xunit-excludes.txt" Lines="$(_withoutCategories.Replace(';', '%0dcategory='))" /> | ||
|
|
||
| <AndroidAppBuilderTask | ||
| Abi="$(AndroidAbi)" | ||
| ProjectName="$(AssemblyName)" | ||
| MonoRuntimeHeaders="$(RuntimePackNativeDir)\include\mono-2.0" | ||
| MainLibraryFileName="AndroidTestRunner.dll" | ||
| OutputDir="$(BundleDir)" | ||
| SourceDir="$(OutDir)"> | ||
| <Output TaskParameter="ApkPackageId" PropertyName="ApkPackageId" /> | ||
| <Output TaskParameter="ApkBundlePath" PropertyName="ApkBundlePath" /> | ||
| </AndroidAppBuilderTask> | ||
| <Message Importance="High" Text="PackageId: $(ApkPackageId)"/> | ||
| <Message Importance="High" Text="Instrumentation: net.dot.MonoRunner"/> | ||
| <Message Importance="High" Text="Apk: $(ApkBundlePath)"/> | ||
| </Target> | ||
|
|
||
| <!-- Generate a self-contained app bundle for iOS with tests. --> | ||
| <UsingTask TaskName="AppleAppBuilderTask" | ||
| AssemblyFile="$(AppleAppBuilderDir)AppleAppBuilder.dll" /> | ||
| <Target Condition="'$(TargetOS)' == 'iOS'" Name="BundleTestAppleApp"> | ||
| <ItemGroup> | ||
| <AppleTestRunnerBinaries Include="$(AppleTestRunnerDir)*.*" /> | ||
| </ItemGroup> | ||
|
|
||
| <Error Condition="'@(AppleTestRunnerBinaries)' == ''" Text="Could not find AppleTestRunner in $(AppleTestRunnerDir) doesn't exist" /> | ||
| <Error Condition="!Exists('$(RuntimePackRidDir)')" Text="RuntimePackRidDir=$(RuntimePackRidDir) doesn't exist" /> | ||
|
|
||
| <RemoveDir Directories="$(BundleDir)" /> | ||
| <Copy SourceFiles="@(AppleTestRunnerBinaries)" DestinationFolder="$(OutDir)%(RecursiveDir)" SkipUnchangedFiles="true"/> | ||
|
|
||
| <WriteLinesToFile File="$(OutDir)xunit-excludes.txt" Lines="$(_withoutCategories.Replace(';', '%0dcategory='))" /> | ||
| <!-- Run App bundler, it should AOT libs (if needed), link all native bits, compile simple UI (written in ObjC) | ||
| and produce an app bundle (with xcode project) --> | ||
| <AppleAppBuilderTask | ||
| Arch="$(TargetArchitecture)" | ||
| ProjectName="$(AssemblyName)" | ||
| MonoRuntimeHeaders="$(RuntimePackNativeDir)\include\mono-2.0" | ||
| CrossCompiler="$(RuntimePackNativeDir)\cross\mono-aot-cross" | ||
| MainLibraryFileName="AppleTestRunner.dll" | ||
| UseConsoleUITemplate="True" | ||
| GenerateXcodeProject="True" | ||
| BuildAppBundle="True" | ||
| Optimized="True" | ||
| UseLlvm="$(MonoEnableLLVM)" | ||
| LlvmPath="$(RuntimePackNativeDir)\cross" | ||
| DevTeamProvisioning="$(DevTeamProvisioning)" | ||
| OutputDirectory="$(BundleDir)" | ||
| AppDir="$(OutDir)"> | ||
| <Output TaskParameter="AppBundlePath" PropertyName="AppBundlePath" /> | ||
| <Output TaskParameter="XcodeProjectPath" PropertyName="XcodeProjectPath" /> | ||
| </AppleAppBuilderTask> | ||
| <Message Importance="High" Text="Xcode: $(XcodeProjectPath)"/> | ||
| <Message Importance="High" Text="App: $(AppBundlePath)"/> | ||
| <Error Condition="$(TargetArchitecture.StartsWith('arm')) and '$(DevTeamProvisioning)' == ''" | ||
| Text="'DevTeamProvisioning' shouldn't be empty for arm64" /> | ||
| <!-- This app is now can be consumed by xharness CLI to deploy on a device or simulator --> | ||
| </Target> | ||
|
|
||
| <Target Name="AddFrameworkReference"> | ||
| <ItemGroup> | ||
| <FrameworkReference Include="$(SharedFrameworkName)" /> | ||
| </ItemGroup> | ||
| </Target> | ||
|
|
||
| <Target Name="UpdateRuntimePack" | ||
| Condition="'$(IsCrossTargetingBuild)' != 'true'" | ||
| AfterTargets="BeforeBuild" | ||
| DependsOnTargets="AddFrameworkReference;ResolveFrameworkReferences"> | ||
| <ItemGroup> | ||
| <ResolvedRuntimePack Update="@(ResolvedRuntimePack)" PackageDirectory="$(RuntimePackDir)" /> | ||
| </ItemGroup> | ||
| </Target> | ||
|
|
||
| <Target Name="PublishTestAsSelfContained" | ||
| Condition="'$(IsCrossTargetingBuild)' != 'true'" | ||
| AfterTargets="PrepareForRun" | ||
| DependsOnTargets="BundleTestAppleApp;BundleTestAndroidApp" /> | ||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,12 +20,17 @@ | |
| <_withoutCategories Condition="!$(_withCategories.Contains('failing'))">$(_withoutCategories);failing</_withoutCategories> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <PropertyGroup Condition="'$(TargetsMobile)' == 'true'"> | ||
| <MobileHelpersDirSuffix>$(NetCoreAppCurrent)-$(MonoConfiguration)</MobileHelpersDirSuffix> | ||
| <AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', '$(MobileHelpersDirSuffix)'))</AppleAppBuilderDir> | ||
| <AppleTestRunnerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleTestRunner', '$(MobileHelpersDirSuffix)'))</AppleTestRunnerDir> | ||
| <AndroidAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', '$(MobileHelpersDirSuffix)'))</AndroidAppBuilderDir> | ||
| <AndroidTestRunnerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidTestRunner', '$(MobileHelpersDirSuffix)'))</AndroidTestRunnerDir> | ||
|
|
||
| <RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier> | ||
| <SelfContained>true</SelfContained> | ||
| <EnableTargetingPackDownload>false</EnableTargetingPackDownload> | ||
| <PlatformManifestFile /> | ||
| </PropertyGroup> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it too early to enable PublishTrimmed here?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I did try that in my branch and you'll need to disable trimming on corelib or it crashes at startup. Let's do that in a separate PR.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not disable it but fix it instead.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah of course, but still in another PR :) |
||
|
|
||
| <!-- | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akoeplinger you said you were going to clean these
\up in a follow up PR since you're touching files, but since I'm touching them here, do you want me to do it instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's get this in and I'll do the cleanup, I will need to touch this whole file anyway.