README.md
1# 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
11The ART Module is available as a debug variant, `com.android.art.debug.apex`,
12which has extra internal consistency checks enabled, and some debug tools. A
13device cannot have both the non-debug and debug variants installed at once - it
14may not boot then.
15
16`com.google.android.art.apex` (note `.google.`) is the Google signed variant of
17the module. It is also mutually exclusive with the other ones.
18
19
20## Building as a module on `master-art`
21
221. Check out the `master-art` tree:
23
24 ```
25 repo init -b master-art -u <repository url>
26 ```
27
28 See the [Android source access
29 instructions](https://source.android.com/setup/build/downloading) for
30 further details. Google internal users please see [go/sync](http://go/sync).
31
322. Set up the development environment:
33
34 See
35 [art/test/README.chroot.md](https://android.googlesource.com/platform/art/+/refs/heads/main/test/README.chroot.md)
36 for details on how to set up the environment on `master-art`, but the
37 `lunch` step can be skipped. Instead use `banchan` to initialize an
38 unbundled module build:
39
40 ```
41 source build/envsetup.sh
42 banchan com.android.art <arch>
43 ```
44
45 `<arch>` is the device architecture - use `hmm` to see the options.
46 Regardless of the device architecture, the build also includes the usual
47 host architectures, and 64/32-bit multilib for the 64-bit products.
48
49 To build the debug variant of the module, specify `com.android.art.debug`
50 instead of `com.android.art`. It is also possible to list both.
51
523. Build the module:
53
54 ```
55 m apps_only dist
56 ```
57
584. Install the module and reboot:
59
60 ```
61 adb install out/dist/com.android.art.apex
62 adb reboot
63 ```
64
65 The name of the APEX file depends on what you passed to `banchan`.
66
67
68## Building as part of the base system image
69
70NOTE: This method of building is slated to be obsoleted in favor of the
71module build on `master-art` above (b/172480617).
72
731. Check out a full Android platform tree and lunch the appropriate product the
74 normal way.
75
762. Ensure the ART Module is built from source:
77
78 Active development on ART module happens in `trunk_staging` release
79 configuration. Whenever possible, use this configuration for local development.
80
81 ```
82 lunch <product>-trunk_staging-<variant>
83 ```
84
85 Some release configurations use prebuilts of ART module. To verify whether a
86 particular release configuration uses ART prebuilts, run the following command
87
88 ```
89 get_build_var RELEASE_APEX_CONTRIBUTIONS_ART
90 ```
91
92 If this returns a non-empty value, it usually means that this release
93 configuration uses ART prebuilts. (To verify, you can inspect the `contents` of
94 the `apex_contributions` Android.bp module reported by the above command.)
95
96 For troubleshooting, it might be desirable to build ART from source in that
97 release configuration. To do so, please modify the <release>.scl file and unset
98 the `RELEASE_APEX_CONTIRBUTIONS_ART` build flag. To determine which .scl files
99 are used in the current release configuration, please refer to
100 `out/release_config_entrypoint.scl`.
101
1023. Build the system image the normal way, for example:
103
104 ```
105 m droid
106 ```
107
108
109## Prebuilts
110
111Prebuilts are used for the ART Module dependencies that have sources outside the
112`master-art` manifest. Conversely the ART Module may be a prebuilt when used in
113platform builds of the base system image.
114
115The locations of the prebuilts are:
116
117* `prebuilts/runtime/mainline` for prebuilts and SDKs required to build the ART
118 Module.
119
120 See
121 [prebuilts/runtime/mainline/README.md](https://android.googlesource.com/platform/prebuilts/runtime/+/master/mainline/README.md)
122 for instructions on how to update them.
123
124* `packages/modules/ArtPrebuilt` for the ART Module APEX packages, if present.
125
126* `prebuilts/module_sdk/art` for the ART Module SDK and other tools, needed to
127 build platform images and other modules that depend on the ART Module.
128