|
1 | 1 | <Project Sdk="Microsoft.NET.Sdk">
|
2 |
| - |
3 | 2 | <PropertyGroup>
|
4 | 3 | <OutputType>Exe</OutputType>
|
5 | 4 | <OutputPath>bin</OutputPath>
|
6 | 5 | <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
|
| 6 | + <TargetArchitecture Condition="'$(TargetArchitecture)'==''">x64</TargetArchitecture> |
| 7 | + <RuntimePackDir>$(ArtifactsDir)bin\lib-runtime-packs\runtimes\ios-$(TargetArchitecture)</RuntimePackDir> |
| 8 | + <MonoRuntimeDir>$(ArtifactsDir)bin\mono\iOS.$(TargetArchitecture).$(Configuration)</MonoRuntimeDir> |
| 9 | + <BundleDir>$(MSBuildThisFileDirectory)\bin\bundle</BundleDir> |
7 | 10 | </PropertyGroup>
|
8 | 11 |
|
| 12 | + <Target Name="RebuildAppleAppBuilder"> |
| 13 | + <MSBuild Projects="$(RepoRoot)src\mono\msbuild\AppleAppBuilder\AppleAppBuilder.csproj" |
| 14 | + Properties="Configuration=$(Configuration)" Targets="Restore;Build" /> |
| 15 | + </Target> |
| 16 | + |
| 17 | + <UsingTask TaskName="AppleAppBuilderTask" |
| 18 | + AssemblyFile="$(ArtifactsObjDir)mono\AppleAppBuilder\$(TargetArchitecture)\$(Configuration)\AppleAppBuilder.dll" /> |
| 19 | + |
| 20 | + <Target Name="BuildAppBundle" DependsOnTargets="RebuildAppleAppBuilder"> |
| 21 | + <PropertyGroup> |
| 22 | + <TargetArch Condition="$(RuntimeIdentifier.EndsWith('arm64'))">arm64</TargetArch> |
| 23 | + <TargetArch Condition="'$(TargetArch)' == ''">x64</TargetArch> |
| 24 | + </PropertyGroup> |
| 25 | + <ItemGroup> |
| 26 | + <AppBinaries Include="bin\*.*"/> |
| 27 | + <BclBinaries Include="$(RuntimePackDir)\lib\$(NetCoreAppCurrent)\*.*" Exclude="$(RuntimePackDir)\lib\$(NetCoreAppCurrent)\System.Runtime.WindowsRuntime.dll" /> |
| 28 | + <BclBinaries Include="$(RuntimePackDir)\native\*.*" /> |
| 29 | + <MonoRuntimeBinaries Include="$(MonoRuntimeDir)\*.*" /> |
| 30 | + </ItemGroup> |
| 31 | + <Error Condition="!Exists('$(RuntimePackDir)')" Text="RuntimePackDir=$(RuntimePackDir) doesn't exist" /> |
| 32 | + <RemoveDir Directories="$(BundleDir)" /> |
| 33 | + <Copy SourceFiles="@(AppBinaries)" DestinationFolder="$(BundleDir)" SkipUnchangedFiles="true"/> |
| 34 | + <Copy SourceFiles="@(BclBinaries)" DestinationFolder="$(BundleDir)\%(RecursiveDir)" SkipUnchangedFiles="true"/> |
| 35 | + <!-- runtime pack contains all needed binaries but lets overwrite them from artifacts/bin/mono to sync runtime changes --> |
| 36 | + <Copy SourceFiles="@(MonoRuntimeBinaries)" DestinationFolder="$(BundleDir)\%(RecursiveDir)" SkipUnchangedFiles="true"/> |
| 37 | + <AppleAppBuilderTask |
| 38 | + Arch="$(TargetArchitecture)" |
| 39 | + ProjectName="HelloiOS" |
| 40 | + MonoRuntimeHeaders="$(RuntimePackDir)\native\include\mono-2.0" |
| 41 | + CrossCompiler="$(RuntimePackDir)\native\cross\mono-aot-cross" |
| 42 | + MainLibraryFileName="Program.dll" |
| 43 | + GenerateXcodeProject="True" |
| 44 | + BuildAppBundle="True" |
| 45 | + DevTeamProvisioning="$(DevTeamProvisioning)" |
| 46 | + OutputDirectory="$(BundleDir)" |
| 47 | + UseLlvm="$(UseLlvm)" |
| 48 | + LlvmPath="$(LlvmPath)" |
| 49 | + Optimized="False" |
| 50 | + AppDir="$(BundleDir)"> |
| 51 | + <Output TaskParameter="AppBundlePath" PropertyName="AppBundlePath" /> |
| 52 | + <Output TaskParameter="XcodeProjectPath" PropertyName="XcodeProjectPath" /> |
| 53 | + </AppleAppBuilderTask> |
| 54 | + <Message Importance="High" Text="Xcode: $(XcodeProjectPath)"/> |
| 55 | + <Message Importance="High" Text="App: $(AppBundlePath)"/> |
| 56 | + </Target> |
| 57 | + |
| 58 | + <Target Name="IosDeployToSimulator"> |
| 59 | + <PropertyGroup> |
| 60 | + <IosSimulator Condition="'$(IosSimulator)' == ''">iPhone 11</IosSimulator> |
| 61 | + </PropertyGroup> |
| 62 | + <Message Importance="High" Text="\nDeploying to '$(IosSimulator)' simulator..." /> |
| 63 | + <Exec Command="xcrun simctl shutdown "$(IosSimulator)"" ContinueOnError="WarnAndContinue" /> |
| 64 | + <Exec Command="xcrun simctl boot "$(IosSimulator)"" /> |
| 65 | + <Exec Command="open -a Simulator" /> |
| 66 | + <Exec Command="xcrun simctl install "$(IosSimulator)" $(BundleDir)/HelloiOS/Debug-iphonesimulator/HelloiOS.app" /> |
| 67 | + <Exec Command="xcrun simctl launch --console booted net.dot.HelloiOS" /> |
| 68 | + </Target> |
9 | 69 | </Project>
|
0 commit comments