Commit Graph

23 Commits

Author SHA1 Message Date
Rob Seymour
b6cab552b7 Add host snapshot installation and module checks
Bug: 192556798
Bug: 190721104
Test: install host snapshot
Test: check host module usage with fake snapshot

Change-Id: Ib88a66be73041c25af66ec4aa8b42833738cc32c
2021-08-20 18:54:58 +00:00
Kiyoung Kim
3d0ed7691d Install etc files with VSDK
Create snapshot_etc module in the Android.bp, so etc files in the
snapshot can be used from the build.

Bug: 192430376
Test: tested locally to check if update.py creates snapshot_etc module
and build succeeds

Change-Id: I4cc533d8a0a378dc94d0b780ea2972cd8c6314f4
2021-07-29 14:38:54 +09:00
Justin Yun
5b5cd9e4f7 Add static_executable property for the binary snapshots
Static binaries have "static_executable: true". This is required to
check if a static lib dependency on 'libc' is allowed for the
snapshot binaries.

Bug: 190690041
Test: 'm nothing' with snapshots
Change-Id: I6c0c7e71fe50624ac233bc43665f4127c0f6103b
2021-07-01 11:53:01 +00:00
Justin Yun
1ec0f13155 Read static libs information from the json files
snapshot modules have the static libs information. Include
`static_libs` property to the snapshot modules.

Bug: 190690041
Test: read the json files to create Android.bp
      check if static_libs properties are included
Change-Id: I7aef610c9a767895d039991385b9abfabc531874
2021-06-29 12:04:19 +00:00
Ivan Lozano
40c498011f Add rlib support for vendor_snapshot/update.py
Adds support for collecting rlibs as part of the vendor snapshot.

Bug: 184042776
Test: m dist vendor-snapshot
Test: python3 development/vendor_snapshot/update.py --local $DIST_DIR --install-dir
    vendor/vendor_name/vendor_snapshot VER
Test: vendor_snapshot_rlib modules generated, vendor_snapshot has rlibs
Change-Id: Ia90e53131c4ffba32883718b66ba99f4962d4633
2021-06-03 10:52:33 -04:00
Inseob Kim
c0c754211e Reexport vndk for vendor snapshot modules
Bug: 184795475
Test: run update.py with fake snapshot and see Android.bp
Change-Id: I5f3032574b957edaecf0dfa9f5e0c7981670d25a
2021-04-12 21:11:29 +09:00
Jose "Pepe" Galmes
bc2a5a25ee Merge "Revert "Add support to androidmk_suffix prop"" 2021-04-07 22:29:50 +00:00
Inseob Kim
24d10cb254 Set multilib to all snapshots except header
Vendor snapshot mutator has been handled disabling unused arch variants,
but it's not the case for now. This change adds compile_multilib to all
modules except for header, so only needed variants can be created.

Bug: 184601825
Test: build fake snapshot, install, and see Android.bp
Change-Id: Iabca5c7e044811e2e89f42d3bb92107c3d91a81c
2021-04-06 16:27:06 +09:00
Inseob Kim
00f4a84b24 Revert "Add support to androidmk_suffix prop"
This reverts commit 8ab25aa5d5.

Reason for revert: androidmk_suffix prop is removed

Change-Id: I412c690cffa74432dac939be9f0ecda5cbe06526
2021-04-05 05:18:18 +00:00
Bill Peckham
e5f35b6f87 Sort properties to ease comparison.
You might want to compare generated Android.bp files
from different snapshots or different points in time on
the same snapshot. Sorting the properties makes this
easier.

Test: manually compare different Android.bp files
Change-Id: I68beea856620f14b879cbf3148cab62dd991a67b
2021-02-26 15:54:17 -08:00
Jose Galmes
8070a1ad1e Implement directed recovery snapshot.
Bug: 177451657
Test: m -j nothing
Change-Id: I72a37ddde78951e61106cc532921ca47eed71922
2021-02-09 09:55:58 -08:00
Inseob Kim
8ab25aa5d5 Add support to androidmk_suffix prop
Bug: 177098205
Test: run script after manually editing json
Change-Id: I872234a15bf4e15d2fa980d48047091ed03f64dd
2021-02-01 10:45:17 +09:00
Inseob Kim
bfcec08eba Generate snapshot list modules
This will additionally generate {image}_snapshot module which contains
a list of vndk and snapshot libraries. This information will be used by
Soong to override source modules, and will look like:

    vendor_snapshot {
        name: "vendor_snapshot",
        version: "30",
        arch: {
            arm: {
                vndk_libs: ["libvndk", ...],
                shared_libs: ["libc++", ...],
                static_libs: ["libc++_static", ...],
                header_libs: ["libbase_headers", ...],
                binaries: ["sh.vendor", ...],
                objects: ["crtbegin_so", ...],
            },
            arm64: {
                ...
            },
            ...
        },
    }

As shared/static/header/binary/object snapshots may differ among
archtecture, they will be placed under arch properties.

Bug: 177098205
Test: run script and see results
Change-Id: I774f4a6394c0a8552be6822a9592c6511a849160
2021-02-01 10:45:15 +09:00
Bill Peckham
adf54633ad Extend the update.py script to determine usage.
After you run a build that uses the full (or any) vendor
snapshot, you can use ninja to determine which files in
the vendor snapshot contribute to a given goal, which is
generally a subset of the content of a full vendor
snapshot. This information can be fed back to the
snapshot generation process to tailor the snapshot
generation towards its expected usage.

Bug: 157967325
Test: manual test
Change-Id: I0c886d130633e2ba84e9d89ae60c1faaaf9be1c4
(cherry picked from commit 57ef5d0c6a4e8e50ee9248234da69ab810a21886)
2021-01-28 15:24:07 -08:00
Jose Galmes
0bee2161c0 Support for recovery snapshot.
Bug: 171231437
Test: source build/envsetup.sh
Test: ALLOW_MISSING_DEPENDENCIES=true m -j nothing
Change-Id: I91c9529e858aa61e985a6fa7c1cb3fe296a4e46f
2020-12-16 07:46:45 -08:00
Bill Peckham
3bdbd34b9a Include 'name' in props; use post-sanitize module name.
In cases where not all the variants of a library are
included in the generated vendor snapshot, be sure to
include the module name in the props so that it can be
factored out later.

Conversely, be sure to compute the notice filename from
the de-sanitized module name so so that it can also be
factored out later.

Bug: 171413810
Bug: 157967325
Test: Verify that full snapshot Android.bp unchanged.
Test: Verify correct syntax for filtered snapshot.
Change-Id: I5725e17b19907d6a5063823e8b99bd0517c7c144
2020-10-21 15:49:54 -07:00
Bill Peckham
a2a29342aa Split gen_bp_files, make Android.bp idempotent.
Split gen_bp_files for future use of new build_props
function. Sort the data output to the Android.bp file so
that the script does not depend on the sort of the keys
in the various dictionaries.

Bug: 157967325
Test: verify that vendor snapshot content is identical
Test: verify Android.bp is sorted by arch, variation, name
Change-Id: I438f8611ad460bccfcae99441ad7c60aa3b68c49
2020-10-05 16:22:12 -07:00
Jose Galmes
00977668bf Use symlinks instead of unzipping vendor snapshot zip files.
This is useful for using the results of a local build without having to unzip
the vendor snapshot file.

Test: Passing the --symlink from other scripts and verifying the symlinks.
Change-Id: I0468c965cda99bfb0799431cc00e40a2c67d490b
2020-09-24 20:35:49 -07:00
Daniel Norman
552d49a3c1 Adds an --overwrite flag to always overwrite install dir.
This is useful for calling update.py from other scripts.

Test: Calls 'update.py --overwrite' with an existing install-dir.
Change-Id: Idc43afbf3e80150b589630dea28004726dccf808
2020-08-19 15:01:37 -07:00
Inseob Kim
ad01dffacb Implement more features to vendor snapshot script
1. It unzips artifacts and installs Android.bp at once.

No need to manually unzip artifacts and then run the script. Users can
just give dist directory to automatically unzip and install Android.bp.

$ python3 update.py --local /some/android/tree/out/dist --install-dir \
>   vendor/<vendor_name>/vendor_snapshot/v30 -vvv 30

2. The vendor snapshot can be fetched from the build server.

Just like VNDK snapshot.

$ python3 update.py --branch {some_branch} --build {some_build_id} \
>   --target {target_which_produces_vendor_snapshot} --install-dir \
>   vendor/<vendor_name>/vendor_snapshot/v30 -vvv 30

3. The install directory can be specified manually, replacing fixed
directory "prebuilts/vendor/v<VERSION>".

prebuilts/vendor/v<VERSION> was randomly picked when implementing the
draft version of this script. Now it can be installed anywhere.

Bug: 154777533
Test: manual test
Change-Id: I3870a85864a9a775b1091419b28ed0e2ab781609
2020-08-14 16:24:54 +09:00
Inseob Kim
09082f5d02 Add cfi static libraries to vendor snapshot
CFI modules can't link against non-CFI static libraries, and vice versa.
So without capturing both CFI and non-CFI static libraries, vendor
modules won't be able to use CFI, which will be a critical security
hole.

This captures both CFI and non-CFI variants of all static libraries for
vendor snapshot, except for those whose cfi are explicitly disabled.

For example, suppose that "libfoo" is defined as follows.

cc_library_static {
    name: "libfoo",
    vendor_available: true,
}

As it doesn't have cfi disabled, two libraries "libfoo.a" and
"libfoo.cfi.a" will be captured. When installed, vendor snapshot module
for "libfoo" will look like:

vendor_snapshot_static {
    name: "libfoo",
    src: "libfoo.a",
    cfi: {
        src: "libfoo.cfi.a",
    },
}

The build system will recognize the "cfi" property, and will create both
CFI and non-CFI variant, allowing any modules to link against "libfoo"
safely, no matter whether CFI is enabled or not.

Two clarification:

1) The reason why we don't create separate modules is that DepsMutator
runs before sanitize mutators. CFI and non-CFI variant of a library
should exist in a single module.

2) We can't capture CFI variant if the source module explicitly disables
cfi variant by specifying the following.

sanitize: {
    cfi: false,
}

In this case, only non-CFI variant will be created for the vendor
snapshot module.

Bug: 65377115
Test: m dist vendor-snapshot && install && build against snapshot
Change-Id: I5b36a1078399a3ca402eb302b4d1156bcb0dda4b
2020-08-06 19:47:22 +00:00
Inseob Kim
6b68541022 Assign compile_multilib for executable snapshots
Some executable binaries have both 32-bit and 64-bit outputs, and
sometimes both variants are needed to be installed. One good example is
boringssl_self_test. This CL assigns compile_multilib to support such
cases.

Bug: 157106227
Test: install vendor snapshot
Change-Id: I016265e7234a59ac480c47a1df2035f4ef7ed89f
2020-06-11 15:07:33 +09:00
Inseob Kim
7295caa166 Add script to install vendor snapshot
This script installs Android.bp under prebuilts/vendor/v{version}. This
script only supports basic operations, so artifacts from "m dist
vendor-snapshot" must be unzipped under the directory before running
this script; features including automatic un-zipping, fetching artifacts
from server, etc. are to be supported in later versions.

Bug: 65377115
Test: m dist vendor-snapshot && run update.py
Change-Id: I1e0ae6a7d2b9bc991694943bd44b84a0dc3c9f30
2020-01-31 13:44:38 +09:00