blob: cc422c30732fcd0ef6d831ef936ae2fec1d3c921 [file] [log] [blame] [view]
Martin Stjernholmcdbc5a92021-02-10 21:00:46 +00001# Building the ART Module
2
3ART is built as a module in the form of an APEX package, `com.android.art.apex`.
4That package can be installed with `adb install` on a device running Android S
5or later. It is also included in the system partition (in the `system/apex`
6directory) of platform releases, to ensure it is always available.
7
8The recommended way to build the ART Module is to use the `master-art` manifest,
9which only has the sources and dependencies required for the module.
10
11Currently it is also possible to build ART directly from sources in a platform
12build, i.e. as has been the traditional way up until Android S. However that
13method is being phased out.
14
15The ART Module is available as a debug variant, `com.android.art.debug.apex`,
16which has extra internal consistency checks enabled, and some debug tools. A
17device cannot have both the non-debug and debug variants installed at once - it
18may not boot then.
19
Martin Stjernholm243895c2021-02-12 14:03:36 +000020`com.google.android.art.apex` (note `.google.`) is the Google signed variant of
21the module. It is also mutually exclusive with the other ones.
22
Martin Stjernholmcdbc5a92021-02-10 21:00:46 +000023
24## Building as a module on `master-art`
25
261. Check out the `master-art` tree:
27
28 ```
29 repo init -b master-art -u <repository url>
30 ```
31
32 See the [Android source access
33 instructions](https://source.android.com/setup/build/downloading) for
34 further details.
35
362. Set up the development environment:
37
38 ```
Martin Stjernholm3adb7de2021-04-16 20:33:52 +010039 banchan com.android.art <arch>
Martin Stjernholm48516422021-02-19 23:35:48 +000040 export SOONG_ALLOW_MISSING_DEPENDENCIES=true
Martin Stjernholm243895c2021-02-12 14:03:36 +000041 ```
42
Martin Stjernholm3adb7de2021-04-16 20:33:52 +010043 For Google internal builds on the internal master-art branch, specify
44 instead the Google variant of the module and product:
Martin Stjernholm243895c2021-02-12 14:03:36 +000045
46 ```
Martin Stjernholm3adb7de2021-04-16 20:33:52 +010047 banchan com.google.android.art mainline_modules_<arch>
Martin Stjernholm48516422021-02-19 23:35:48 +000048 export SOONG_ALLOW_MISSING_DEPENDENCIES=true
Martin Stjernholmcdbc5a92021-02-10 21:00:46 +000049 ```
50
51 `<arch>` is the device architecture, one of `arm`, `arm64`, `x86`, or
52 `x86_64`. Regardless of the device architecture, the build also includes the
53 usual host architectures, and 64/32-bit multilib for the 64-bit products.
54
55 To build the debug variant of the module, specify `com.android.art.debug`
Martin Stjernholm3adb7de2021-04-16 20:33:52 +010056 instead of `com.android.art`. It is also possible to list both.
Martin Stjernholmcdbc5a92021-02-10 21:00:46 +000057
583. Build the module:
59
60 ```
61 m
62 ```
63
644. Install the module and reboot:
65
66 ```
Martin Stjernholm3adb7de2021-04-16 20:33:52 +010067 adb install out/target/product/generic_<arch>/system/apex/com.android.art.apex
Martin Stjernholmcdbc5a92021-02-10 21:00:46 +000068 adb reboot
69 ```
70
Martin Stjernholm3adb7de2021-04-16 20:33:52 +010071 The name of the APEX file depends on what you passed to `banchan`.
Martin Stjernholm243895c2021-02-12 14:03:36 +000072
Martin Stjernholmcdbc5a92021-02-10 21:00:46 +000073
74## Building as part of the base system image
75
76NOTE: This method of building is slated to be obsoleted in favor of the
77module build on `master-art` above (b/172480617).
78
791. Check out a full Android platform tree and lunch the appropriate product the
80 normal way.
81
822. Ensure the ART Module is built from source:
83
84 ```
85 export SOONG_CONFIG_art_module_source_build=true
86 ```
87
88 If this isn't set then the build may use prebuilts of the ART Module that
89 may be older than the sources.
90
913. Build the system image the normal way, for example:
92
93 ```
94 m droid
95 ```
96
97
98## Updating prebuilts
99
100Prebuilts are used for the ART Module dependencies that have sources outside the
101`master-art` manifest. Conversely the ART Module is (normally) a prebuilt when
102used in platform builds of the base system image.
103
104The locations of the prebuilts are:
105
106* `prebuilts/runtime/mainline` for prebuilts and SDKs required to build the ART
107 Module.
108
109 See
110 [prebuilts/runtime/mainline/README.md](https://android.googlesource.com/platform/prebuilts/runtime/+/master/mainline/README.md)
111 for instructions on how to update them.
112
113* `packages/modules/ArtPrebuilt` for the ART Module APEX packages.
114
115* `prebuilts/module_sdk/art` for the ART Module SDK and other tools, needed to
116 build platform images and other modules that depend on the ART Module.
117
118To update the ART Module prebuilts in the two last locations:
119
1201. Ensure the changes that need to go into the prebuilt are submitted.
121
1222. Wait for a new build on branch `aosp-master-art`, target `aosp_art_module`.
123
1243. In a full platform tree, run:
125
126 ```
127 packages/modules/ArtPrebuilt/update-art-module-prebuilts.py \
128 --build <build id> --upload
129 ```
130
131 This will download the prebuilts from the given `<build id>` (an integer
132 number), create a CL topic, and upload it to Gerrit. Get it reviewed and
133 submit. Please do not make any file changes locally.