|
1 | 1 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | 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" /> |
| 3 | + <UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.DownloadUri" /> |
| 4 | + <UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.SetEnvironmentVariable" /> |
| 5 | + <UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\Xamarin.Android.Tools.BootstrapTasks.dll" TaskName="Xamarin.Android.Tools.BootstrapTasks.UnzipDirectoryChildren" /> |
5 | 6 |
|
6 | 7 | <!-- public targets --> |
7 | 8 |
|
8 | | - <Target Name="Build" DependsOnTargets="_SetupDepotTools;_BuildR8;_CopyR8" /> |
9 | | - <Target Name="Clean" DependsOnTargets="_CleanR8;_CleanDepotTools" /> |
| 9 | + <PropertyGroup> |
| 10 | + <BuildDependsOn> |
| 11 | + _DownloadDepotTools; |
| 12 | + _UnzipDepotTools; |
| 13 | + _SetDepotToolsEnvironment; |
| 14 | + _BootstrapDepotTools; |
| 15 | + _BuildR8; |
| 16 | + _CopyR8; |
| 17 | + </BuildDependsOn> |
| 18 | + <CleanDependsOn> |
| 19 | + _SetDepotToolsEnvironment; |
| 20 | + _CleanR8; |
| 21 | + _CleanDepotTools; |
| 22 | + </CleanDependsOn> |
| 23 | + </PropertyGroup> |
| 24 | + <Target Name="Build" DependsOnTargets="$(BuildDependsOn)" /> |
| 25 | + <Target Name="Clean" DependsOnTargets="$(CleanDependsOn)" /> |
10 | 26 |
|
11 | | - <!-- depot_tools --> |
| 27 | + <!-- |
| 28 | + depot_tools, a set of git extensions from Chromium |
| 29 | + http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html |
| 30 | + --> |
12 | 31 |
|
13 | | - <!-- Why do people split files and make build scripts unreadable? That's unacceptable. Therefore properties are here. Always consider code readability. --> |
14 | 32 | <PropertyGroup> |
15 | | - <_WindowsDepotToolzZipDownload>..\..\bin\Build$(Configuration)\depot_tools.zip</_WindowsDepotToolzZipDownload> |
| 33 | + <_DepotToolsZip>..\..\bin\Build$(Configuration)\depot_tools.zip</_DepotToolsZip> |
| 34 | + <_PathToDepotTools>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\depot_tools'))</_PathToDepotTools> |
16 | 35 | </PropertyGroup> |
17 | 36 |
|
18 | | - <Target Name="_SetupDepotTools" DependsOnTargets="_SetupDepotToolsWindows" /> |
19 | | - <Target Name="_CleanDepotTools" DependsOnTargets="_CleanDepotToolsWindows" /> |
20 | | - |
21 | | - <Target Name="_SetupDepotToolsWindows" Condition="$(HostOS) == 'Windows'"> |
| 37 | + <Target Name="_DownloadDepotTools"> |
22 | 38 | <DownloadUri |
23 | | - SourceUris="https://storage.googleapis.com/chrome-infra/depot_tools.zip" |
24 | | - DestinationFiles="$(_WindowsDepotToolzZipDownload)" |
| 39 | + SourceUris="https://storage.googleapis.com/chrome-infra/depot_tools.zip" |
| 40 | + DestinationFiles="$(_DepotToolsZip)" |
25 | 41 | /> |
26 | | - <Unzip |
27 | | - Sources="$(_WindowsDepotToolsZipDownload)" |
28 | | - Destination="bin\Build$(Configuration)\depot_tools" |
29 | | - /> |
30 | 42 | </Target> |
31 | 43 |
|
32 | | - <Target Name="_CleanDepotToolsWindows" Condition="$(HostOS) == 'Windows'"> |
33 | | - <RemoveDir Directories="bin\Build$(Configuration)\depot_tools" /> |
| 44 | + <Target Name="_UnzipDepotTools" |
| 45 | + Inputs="$(_DepotToolsZip)" |
| 46 | + Outputs="$(_PathToDepotTools)\unzip.stamp"> |
| 47 | + <UnzipDirectoryChildren |
| 48 | + HostOS="$(HostOS)" |
| 49 | + NoSubdirectory="True" |
| 50 | + SourceFiles="$(_DepotToolsZip)" |
| 51 | + DestinationFolder="$(_PathToDepotTools)" |
| 52 | + /> |
| 53 | + <Touch |
| 54 | + Files="$(_PathToDepotTools)\unzip.stamp" |
| 55 | + AlwaysCreate="True" |
| 56 | + /> |
34 | 57 | </Target> |
35 | 58 |
|
| 59 | + <!-- |
| 60 | + NOTE: depot_tools has an odd requirement of being in PATH |
| 61 | + I am also getting some odd failures on Windows, if not specifying namespace for <SetEnvironmentVariable /> |
| 62 | + --> |
36 | 63 |
|
37 | | - <!-- r8 --> |
| 64 | + <Target Name="_SetDepotToolsEnvironment"> |
| 65 | + <Xamarin.Android.BuildTools.PrepTasks.SetEnvironmentVariable |
| 66 | + Name="PATH" |
| 67 | + Value="$(_PathToDepotTools)$(PathSeparator)$(PATH)" |
| 68 | + /> |
| 69 | + </Target> |
38 | 70 |
|
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> |
| 71 | + <!-- This "bootstraps" depot_tools, such as downloading/installing gradle and python --> |
47 | 72 |
|
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 | | - /> |
| 73 | + <Target Name="_BootstrapDepotTools" |
| 74 | + Inputs="$(_PathToDepotTools)\unzip.stamp" |
| 75 | + Outputs="$(_PathToDepotTools)\bootstrap.stamp"> |
| 76 | + <Exec Command="gclient --version" /> |
| 77 | + <Touch |
| 78 | + Files="$(_PathToDepotTools)\bootstrap.stamp" |
| 79 | + AlwaysCreate="True" |
| 80 | + /> |
| 81 | + </Target> |
| 82 | + |
| 83 | + <Target Name="_CleanDepotTools"> |
| 84 | + <Delete Files="$(_DepotToolsZip)" /> |
| 85 | + <RemoveDir Directories="$(_PathToDepotTools)" /> |
| 86 | + </Target> |
| 87 | + |
| 88 | + <!-- r8 --> |
| 89 | + |
| 90 | + <Target Name="_BuildR8"> |
| 91 | + <Exec |
| 92 | + Command="python tools\gradle.py d8 r8" |
| 93 | + WorkingDirectory="..\..\external\r8" |
| 94 | + /> |
54 | 95 | </Target> |
55 | 96 |
|
56 | 97 | <Target Name="_CopyR8"> |
57 | 98 | <Copy |
58 | | - SourceFiles="..\..\external\r8\build\libs\d8.jar" |
59 | | - DestinationFolder="$(XAInstallPrefix)\xbuild\Xamarin\Android\" |
60 | | - SkipUnchangedFiles="true" |
| 99 | + SourceFiles="..\..\external\r8\build\libs\d8.jar" |
| 100 | + DestinationFolder="$(XAInstallPrefix)\xbuild\Xamarin\Android\" |
| 101 | + SkipUnchangedFiles="true" |
61 | 102 | /> |
62 | 103 | <Copy |
63 | | - SourceFiles="..\..\external\r8\build\libs\r8.jar" |
64 | | - DestinationFolder="$(XAInstallPrefix)\xbuild\Xamarin\Android\" |
65 | | - SkipUnchangedFiles="true" |
| 104 | + SourceFiles="..\..\external\r8\build\libs\r8.jar" |
| 105 | + DestinationFolder="$(XAInstallPrefix)\xbuild\Xamarin\Android\" |
| 106 | + SkipUnchangedFiles="true" |
66 | 107 | /> |
67 | 108 | </Target> |
68 | 109 |
|
69 | 110 | <Target Name="_CleanR8"> |
70 | 111 | <Exec |
71 | | - Command="..\..\external\r8\tools\gradle.py clean" |
72 | | - WorkingDirectory="..\..\external\r8" |
73 | | - EnvironmentVariables="$(_EnvForDepotTools)" |
| 112 | + Command="python tools\gradle.py clean" |
| 113 | + WorkingDirectory="..\..\external\r8" |
74 | 114 | /> |
75 | 115 | </Target> |
76 | 116 |
|
|
0 commit comments