Skip to content

Commit 181e3d0

Browse files
committed
[r8] add r8 and depot_tools submodules.
depot_tools is required to build r8. On Windows it is however not used but a binary executable zip will be downloaded and used instead. (see https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up for details) r8 build is not integrated in the primary Makefile and .sln yet. (r8 is not a "build tool" but we build msbuild tasks dependencies there too.)
1 parent dd36614 commit 181e3d0

File tree

6 files changed

+92
-0
lines changed

6 files changed

+92
-0
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
path = external/xamarin-android-tools
4242
url = https://github.com/xamarin/xamarin-android-tools
4343
branch = master
44+
[submodule "external/depot_tools"]
45+
path = external/depot_tools
46+
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git
47+
[submodule "external/r8"]
48+
path = external/r8
49+
url = https://r8.googlesource.com/r8
4450
[submodule "external/dlfcn-win32"]
4551
path = external/dlfcn-win32
4652
url = https://github.com/dlfcn-win32/dlfcn-win32.git

build-tools/r8/r8.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
4+
</PropertyGroup>
5+
<Import Project="r8.props" />
6+
<Import Project="..\..\Configuration.props" />
7+
<Import Project="r8.targets" />
8+
</Project>
9+

build-tools/r8/r8.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
</Project>
3+

build-tools/r8/r8.targets

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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>

external/depot_tools

Submodule depot_tools added at a16b4cc

external/r8

Submodule r8 added at d7c62cf

0 commit comments

Comments
 (0)