|
| 1 | +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 2 | + |
| 3 | + <UsingTask TaskName="Xamarin.Android.Tasks.Unzip" AssemblyFile="Xamarin.Android.Build.Tasks.dll" /> |
| 4 | + <UsingTask AssemblyFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.DownloadUri" /> |
| 5 | + |
| 6 | + <!-- public targets --> |
| 7 | + |
| 8 | + <Target Name="Build" DependsOnTargets="_SetupDepotTools;_BuildR8;_CopyR8" /> |
| 9 | + <Target Name="Clean" DependsOnTargets="_CleanR8;_CleanDepotTools" /> |
| 10 | + |
| 11 | + <!-- depot_tools --> |
| 12 | + |
| 13 | + <!-- Why do people split files and make build scripts unreadable? That's unacceptable. Therefore properties are here. Always consider code readability. --> |
| 14 | + <PropertyGroup> |
| 15 | + <_WindowsDepotToolzZipDownload>..\..\bin\Build$(Configuration)\depot_tools.zip</_WindowsDepotToolzZipDownload> |
| 16 | + </PropertyGroup> |
| 17 | + |
| 18 | + <Target Name="_SetupDepotTools" DependsOnTargets="_SetupDepotToolsWindows" /> |
| 19 | + <Target Name="_CleanDepotTools" DependsOnTargets="_CleanDepotToolsWindows" /> |
| 20 | + |
| 21 | + <Target Name="_SetupDepotToolsWindows" Condition="$(HostOS) == 'Windows'"> |
| 22 | + <DownloadUri |
| 23 | + SourceUris="https://storage.googleapis.com/chrome-infra/depot_tools.zip" |
| 24 | + DestinationFiles="$(_WindowsDepotToolzZipDownload)" |
| 25 | + /> |
| 26 | + <Unzip |
| 27 | + Sources="$(_WindowsDepotToolsZipDownload)" |
| 28 | + Destination="bin\Build$(Configuration)\depot_tools" |
| 29 | + /> |
| 30 | + </Target> |
| 31 | + |
| 32 | + <Target Name="_CleanDepotToolsWindows" Condition="$(HostOS) == 'Windows'"> |
| 33 | + <RemoveDir Directories="bin\Build$(Configuration)\depot_tools" /> |
| 34 | + </Target> |
| 35 | + |
| 36 | + |
| 37 | + <!-- r8 --> |
| 38 | + |
| 39 | + <PropertyGroup> |
| 40 | + <_PathToDepotTools Condition="'$(HostOS)' == 'Windows'">..\..\bin\Build$(Configuration)\depot_tools</_PathToDepotTools> |
| 41 | + <_PathToDepotTools Condition="'$(HostOS)' != 'Windows'">..\..\external\depot_tools</_PathToDepotTools> |
| 42 | + <_Sep Condition="'$(HostOS)' == 'Windows'">;</_Sep> |
| 43 | + <_Sep Condition="'$(HostOS)' != 'Windows'">:</_Sep> |
| 44 | + <_W Condition="'$(HostOS)' == 'Windows'">"</_W> |
| 45 | + <_W Condition="'$(HostOS)' != 'Windows'"></_W> <_EnvForDepotTools>PATH=$(_W)$(_PathToDepotTools)$(_W)$(_Sep)$(PATH)</_EnvForDepotTools> |
| 46 | + </PropertyGroup> |
| 47 | + |
| 48 | + <Target Name="_BuildR8" DependsOnTargets="_SetupDepotTools"> |
| 49 | + <Exec |
| 50 | + Command="..\..\external\r8\tools\gradle.py d8 r8" |
| 51 | + WorkingDirectory="..\..\external\r8" |
| 52 | + EnvironmentVariables="$(_EnvForDepotTools)" |
| 53 | + /> |
| 54 | + </Target> |
| 55 | + |
| 56 | + <Target Name="_CopyR8"> |
| 57 | + <Copy |
| 58 | + SourceFiles="..\..\external\r8\build\libs\r8.jar" |
| 59 | + DestinationFolder="$(XAInstallPrefix)\xbuild\Xamarin\Android\" |
| 60 | + SkipUnchangedFiles="true" |
| 61 | + /> |
| 62 | + </Target> |
| 63 | + |
| 64 | + <Target Name="_CleanR8"> |
| 65 | + <Exec |
| 66 | + Command="..\..\external\r8\tools\gradle.py clean" |
| 67 | + WorkingDirectory="..\..\external\r8" |
| 68 | + EnvironmentVariables="$(_EnvForDepotTools)" |
| 69 | + /> |
| 70 | + </Target> |
| 71 | + |
| 72 | +</Project> |
0 commit comments