summaryrefslogtreecommitdiff
path: root/build/README.md
blob: 4d9656fc1085145597425c8f1c901f0d660e3c90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Building the ART Module

ART is built as a module in the form of an APEX package, `com.android.art.apex`.
That package can be installed with `adb install` on a device running Android S
or later. It is also included in the system partition (in the `system/apex`
directory) of platform releases, to ensure it is always available.

The recommended way to build the ART Module is to use the `master-art` manifest,
which only has the sources and dependencies required for the module.

The ART Module is available as a debug variant, `com.android.art.debug.apex`,
which has extra internal consistency checks enabled, and some debug tools. A
device cannot have both the non-debug and debug variants installed at once - it
may not boot then.

`com.google.android.art.apex` (note `.google.`) is the Google signed variant of
the module. It is also mutually exclusive with the other ones.


## Building as a module on `master-art`

1.  Check out the `master-art` tree:

    ```
    repo init -b master-art -u <repository url>
    ```

    See the [Android source access
    instructions](https://source.android.com/setup/build/downloading) for
    further details. Google internal users please see [go/sync](http://go/sync).

2.  Set up the development environment:

    See
    [art/test/README.chroot.md](https://android.googlesource.com/platform/art/+/refs/heads/main/test/README.chroot.md)
    for details on how to set up the environment on `master-art`, but the
    `lunch` step can be skipped. Instead use `banchan` to initialize an
    unbundled module build:

    ```
    source build/envsetup.sh
    banchan com.android.art <arch>
    ```

    `<arch>` is the device architecture - use `hmm` to see the options.
    Regardless of the device architecture, the build also includes the usual
    host architectures, and 64/32-bit multilib for the 64-bit products.

    To build the debug variant of the module, specify `com.android.art.debug`
    instead of `com.android.art`. It is also possible to list both.

3.  Build the module:

    ```
    m apps_only dist
    ```

4.  Install the module and reboot:

    ```
    adb install out/dist/com.android.art.apex
    adb reboot
    ```

    The name of the APEX file depends on what you passed to `banchan`.


## Building as part of the base system image

NOTE: This method of building is slated to be obsoleted in favor of the
module build on `master-art` above (b/172480617).

1.  Check out a full Android platform tree and lunch the appropriate product the
    normal way.

2.  Ensure the ART Module is built from source:

    Active development on ART module happens in `trunk_staging` release
    configuration. Whenever possible, use this configuration for local development.

    ```
    lunch <product>-trunk_staging-<variant>
    ```

    Some release configurations use prebuilts of ART module. To verify whether a
    particular release configuration uses ART prebuilts, run the following command

    ```
    get_build_var RELEASE_APEX_CONTRIBUTIONS_ART
    ```

    If this returns a non-empty value, it usually means that this release
    configuration uses ART prebuilts. (To verify, you can inspect the `contents` of
    the `apex_contributions` Android.bp module reported by the above command.)

    For troubleshooting, it might be desirable to build ART from source in that
    release configuration. To do so, please modify the <release>.scl file and unset
    the `RELEASE_APEX_CONTIRBUTIONS_ART` build flag. To determine which .scl files
    are used in the current release configuration, please refer to
    `out/release_config_entrypoint.scl`.

3.  Build the system image the normal way, for example:

    ```
    m droid
    ```


## Prebuilts

Prebuilts are used for the ART Module dependencies that have sources outside the
`master-art` manifest. Conversely the ART Module may be a prebuilt when used in
platform builds of the base system image.

The locations of the prebuilts are:

*  `prebuilts/runtime/mainline` for prebuilts and SDKs required to build the ART
   Module.

   See
   [prebuilts/runtime/mainline/README.md](https://android.googlesource.com/platform/prebuilts/runtime/+/master/mainline/README.md)
   for instructions on how to update them.

*  `packages/modules/ArtPrebuilt` for the ART Module APEX packages, if present.

*  `prebuilts/module_sdk/art` for the ART Module SDK and other tools, needed to
   build platform images and other modules that depend on the ART Module.