Martin Stjernholm | cdbc5a9 | 2021-02-10 21:00:46 +0000 | [diff] [blame] | 1 | # Building the ART Module |
| 2 | |
| 3 | ART is built as a module in the form of an APEX package, `com.android.art.apex`. |
| 4 | That package can be installed with `adb install` on a device running Android S |
| 5 | or later. It is also included in the system partition (in the `system/apex` |
| 6 | directory) of platform releases, to ensure it is always available. |
| 7 | |
| 8 | The recommended way to build the ART Module is to use the `master-art` manifest, |
| 9 | which only has the sources and dependencies required for the module. |
| 10 | |
| 11 | Currently it is also possible to build ART directly from sources in a platform |
| 12 | build, i.e. as has been the traditional way up until Android S. However that |
| 13 | method is being phased out. |
| 14 | |
| 15 | The ART Module is available as a debug variant, `com.android.art.debug.apex`, |
| 16 | which has extra internal consistency checks enabled, and some debug tools. A |
| 17 | device cannot have both the non-debug and debug variants installed at once - it |
| 18 | may not boot then. |
| 19 | |
Martin Stjernholm | 243895c | 2021-02-12 14:03:36 +0000 | [diff] [blame] | 20 | `com.google.android.art.apex` (note `.google.`) is the Google signed variant of |
| 21 | the module. It is also mutually exclusive with the other ones. |
| 22 | |
Martin Stjernholm | cdbc5a9 | 2021-02-10 21:00:46 +0000 | [diff] [blame] | 23 | |
| 24 | ## Building as a module on `master-art` |
| 25 | |
| 26 | 1. 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 | |
| 36 | 2. Set up the development environment: |
| 37 | |
| 38 | ``` |
Martin Stjernholm | 3adb7de | 2021-04-16 20:33:52 +0100 | [diff] [blame] | 39 | banchan com.android.art <arch> |
Martin Stjernholm | 4851642 | 2021-02-19 23:35:48 +0000 | [diff] [blame] | 40 | export SOONG_ALLOW_MISSING_DEPENDENCIES=true |
Martin Stjernholm | 243895c | 2021-02-12 14:03:36 +0000 | [diff] [blame] | 41 | ``` |
| 42 | |
Martin Stjernholm | 3adb7de | 2021-04-16 20:33:52 +0100 | [diff] [blame] | 43 | For Google internal builds on the internal master-art branch, specify |
| 44 | instead the Google variant of the module and product: |
Martin Stjernholm | 243895c | 2021-02-12 14:03:36 +0000 | [diff] [blame] | 45 | |
| 46 | ``` |
Martin Stjernholm | 3adb7de | 2021-04-16 20:33:52 +0100 | [diff] [blame] | 47 | banchan com.google.android.art mainline_modules_<arch> |
Martin Stjernholm | 4851642 | 2021-02-19 23:35:48 +0000 | [diff] [blame] | 48 | export SOONG_ALLOW_MISSING_DEPENDENCIES=true |
Martin Stjernholm | cdbc5a9 | 2021-02-10 21:00:46 +0000 | [diff] [blame] | 49 | ``` |
| 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 Stjernholm | 3adb7de | 2021-04-16 20:33:52 +0100 | [diff] [blame] | 56 | instead of `com.android.art`. It is also possible to list both. |
Martin Stjernholm | cdbc5a9 | 2021-02-10 21:00:46 +0000 | [diff] [blame] | 57 | |
| 58 | 3. Build the module: |
| 59 | |
| 60 | ``` |
| 61 | m |
| 62 | ``` |
| 63 | |
| 64 | 4. Install the module and reboot: |
| 65 | |
| 66 | ``` |
Martin Stjernholm | 3adb7de | 2021-04-16 20:33:52 +0100 | [diff] [blame] | 67 | adb install out/target/product/generic_<arch>/system/apex/com.android.art.apex |
Martin Stjernholm | cdbc5a9 | 2021-02-10 21:00:46 +0000 | [diff] [blame] | 68 | adb reboot |
| 69 | ``` |
| 70 | |
Martin Stjernholm | 3adb7de | 2021-04-16 20:33:52 +0100 | [diff] [blame] | 71 | The name of the APEX file depends on what you passed to `banchan`. |
Martin Stjernholm | 243895c | 2021-02-12 14:03:36 +0000 | [diff] [blame] | 72 | |
Martin Stjernholm | cdbc5a9 | 2021-02-10 21:00:46 +0000 | [diff] [blame] | 73 | |
| 74 | ## Building as part of the base system image |
| 75 | |
| 76 | NOTE: This method of building is slated to be obsoleted in favor of the |
| 77 | module build on `master-art` above (b/172480617). |
| 78 | |
| 79 | 1. Check out a full Android platform tree and lunch the appropriate product the |
| 80 | normal way. |
| 81 | |
| 82 | 2. 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 | |
| 91 | 3. Build the system image the normal way, for example: |
| 92 | |
| 93 | ``` |
| 94 | m droid |
| 95 | ``` |
| 96 | |
| 97 | |
| 98 | ## Updating prebuilts |
| 99 | |
| 100 | Prebuilts 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 |
| 102 | used in platform builds of the base system image. |
| 103 | |
| 104 | The 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 | |
| 118 | To update the ART Module prebuilts in the two last locations: |
| 119 | |
| 120 | 1. Ensure the changes that need to go into the prebuilt are submitted. |
| 121 | |
| 122 | 2. Wait for a new build on branch `aosp-master-art`, target `aosp_art_module`. |
| 123 | |
| 124 | 3. 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. |