Currently, we build host and device targets separately because we
must pass a different config option to each (--config=android_arm64
for device targets and --config=hermetic_cc, the default, for host
targets).
With a transition to using android_filegroup for device targets, we
can obviate away the need for building separately.
Collapse the host and device targets into one build command.
Change-Id: Ib6bbb0ecaa7098f5ef39b88544e8be4463e7979e
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, --config=stamp appears to be causing issues when
traversing git history in some large repos.
To work around this, drop --config=stamp from the command line
options.
Change-Id: I561c5175de620984df0b130b9bd1b7958aa883c1
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Kleaf test_mapping rules are no longer used upstream and were being
skipped in our builds anyway.
Remove the test_mapping rules.
Change-Id: If8689f4572b1d1dce2c8ba03075444fa3af7d86b
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
With a recent change to the output directory handling from
build_with_bazel.py, some dist directory paths incorrectly used
hyphens instead of underscores.
Fix this issue by mirroring the logic in msm_common.bzl which handles
these paths properly.
Also, run buildifier to fix format of Bazel build files.
Change-Id: Ia82073f059c54f4a7f523c5bd91afdc755c70df1
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Commit 02faddf96a ("ANDROID: build: Add build_opts.txt file to
output") changed the way targets are specified. This broke the
menuconfig invocation, so fix it.
Change-Id: I23610538d1dafe1f80acccfb13684819d27ee25e
Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
Currently, there's no convenient way to discover which build options
were passed to the kernel build other than examining the output
.config file. That method is somewhat fragile as the mapping between
the CONFIG options we're parsing and the options being set by a
particular build flag could change.
Instead, let's create a new build artifact which writes the build
flags to a file which can be easily consumed later. This will allow
external module (DDK) builds to guarantee a match between the kernel
build and their build.
The output format looks like this (one opt per line):
--kasan
--lto=none
--config=stamp
--user_kmi_symbol_lists=//msm-kernel:android/abi_gki_aarch64_qcom
--ignore_missing_projects
The flags can be pulled into a separate build command line like this:
./tools/bazel build $(xargs -a build_opts.txt) //my_package:my_target
Change-Id: I162c950ff01c99e082945190b50d13b4a139f944
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, you can run analysis of the Bazel build by passing
--nobuild to the raw Bazel commands, but there's no way to perform
the analysis via the normal build script.
Add a --dry-run command which performs loading and analysis of the
Bazel build but does not actually perform compilation. This is useful
for validating BUILD files and detecting errors in the inputs.
Change-Id: Iec9c1d861dacbe5cd68b648620945f91e966cb89
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, the workspace_status_stamp.py script will perform various
operations on all projects defined in the repo manifest.
In some cases, the project directories may not be present. When this
happens, the build currently fails.
A flag was added upstream to ignore missing project directories. Pass
this flag, --ignore_missing_projects, by default.
Change-Id: I38828d2fb16cc64e4b356575429ae78bf1752396
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, if there are any symbols added to
msm-kernel/android/abi_gki_aarch64_qcom, they are not considered when
updating the msm-kernel ABI or when checking the ABI compatibility.
To address this, we added a new flag upstream which allows us to
specify a user KMI list.
Pass this flag by default.
Change-Id: I98ccf20263898c1b00bf73c643015cf96559f568
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, we pass --config=hermetic_cc to Bazel when building host
targets. With a recent upstream update, this was made the default.
Now, when building, we see this warning:
WARNING: The following configs were expanded more than once: [hermetic_cc].
For repeatable flags, repeats are counted twice and may lead to unexpected behavior.
Remove the warning by simply not passing --config=hermetic_cc.
Change-Id: I09cc008113a7f1ba797a42770f6fa27eb2b1f41c
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Add user option "--config=stamp" for all builds. This embeds the string
"g<SHA>" in the Linux banner/version string which is required for VINTF
GKI compliance tests.
Heads-up: This is known to increase incremental build times.
Change-Id: I2345ee9bbc442fe097222f6d991e18886b6e5124
Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
Currently, the build_with_bazel.py script will query Bazel for
compatible cross-toolchains for use when building userspace apps
which target the device. When building userspace apps for the host,
the build will use whatever compiler is detected on the host.
Now that Kleaf supports using the hermetic toolchain for userspace,
we no longer need to support using an external one. Instead, we can
pass "--config=android_arm64" when building a cross target and
"--config=hermetic_cc" when building a host target.
Update the script to use the hermetic toolchain in both cases.
Change-Id: Iec997dc3cc0d3e9f6242c4754ac858f8a6e7e452
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
This reverts commit 30238f4585 to prevent
the version string arising from consolidate builds from falling afoul of
the 64-character string length limit:
"6.1.15-mainline-qki-consolidate-android14-1-00690-ge2d158dd0514-dirty" exceeds 64 characters
This change will be re-landed when the config file required for VINTF
checks makes it downstream as it is required for those tests to pass.
Change-Id: I2408f37eb16cdd00a06b9c5eaceac1c3cb53f06a
Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
Currently, there's no way for our mixed build to use a custom ABI
definition.
To allow this capability, copy the symbol list file to the ACK tree
prior to launching build which will be used to generate ABI definition.
Change-Id: I14067e05da2ab7ec29a1425d6dd311940b671aca
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Signed-off-by: Satya Durga Srinivasu Prabhala <quic_satyap@quicinc.com>
Enable support for running menuconfig for a given target-variant combo.
Also make the core bazel function accept `bazel_target_opts` which pass
options to the bazel target via "-- <options>".
Change-Id: I4f8c108e553fe748b2709398cc4253b0d2260289
Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
Add user option "--config=stamp" for all builds. This embeds the string
"android14-0" in the Linux banner/version string which is required for
VINTF GKI compliance tests.
Heads-up: This is known to increase incremental build times.
Change-Id: I8ee627830cda8a9a006a166b56a02621fa2ccff3
Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
This reverts commit 6beedeabcc.
Currently the change cause a vendor build error. And menuconfig
is not yet can be verified due to lack of kernel/build changes.
Change-Id: I4afa7350aae5a9ce8b1a82ac7859f38c4ebe7458
Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
Currently, some legacy build files still exist in the source tree
after a legacy build.sh build. This results in errors like this:
cp: msm-kernel/arch/arm64/configs/vendor/pineapple_tuivm_defconfig: Read-only file system
Expand the pattern match for these files to include target/variant
names that do not have a "-" in them.
Change-Id: I3bc87f321f4f29db7fe77fab884c8d2b46086370
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Enable support for running menuconfig for a given target-variant combo.
Change-Id: Icf20e4a5826dcd99d75da009f132d0cad5e6296b
Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
Currently, there's no way to select sources from Bazel extension
hooks based on projects being skipped.
Add Bazel config_settings to allow users to configure build sources
via command line flags. Automatically provide these flags when
building with build_with_bazel.py.
Change-Id: Ifecb58443b14dfd666b6407725fd3a4c287bae05
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, the base kernel_build rule which outputs artifacts to
"out/msm-kernel-$target-$variant/dist" removes the destination
directory prior to copying build outputs. The ABL build rule also
copies files to that directory, but does not remove the directory
first.
The build_with_bazel.py script queries build rules available for the
current target/variant combo and the returned list does not have any
specific ordering. This leads to the possibility that the ABL dist
rule is run prior to the base kernel_build rule. In that case, the
ABL build outputs are removed and the kernel_build outputs replace
it.
Fix this issue by sorting the build targets based on name length.
This will guarantee that the shortest rule name (the base
kernel_build rule) will be executed first. With that, other build
outputs being copied to that directory will no longer be clobbered.
Change-Id: I8cdbba6c9636d9aab4f801db3d407f0c71a1790c
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
The legacy build.sh build generates some files in source directories
which cause problems for Bazel. If a user has run a legacy build,
then tries to run a Bazel build, they will encounter an error. The
error occurs because Bazel (by design) cannot overwrite source files.
To avoid these errors, clean up these generated files prior to
starting the Bazel build.
Change-Id: Id2ea294b45588b56418063a1db95c13c71fed617
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, if a user runs ./build_with_bazel.py -t foo "", which
occurs when an empty variable is passed in, the build script will
match targets incorrectly.
Disallow this behavior and force users to pass in a non-empty string
for both the target and variant.
Change-Id: I767486ab6deb88f84e171a0811134c80e003babc
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, build_with_bazel.py will break when run with Python 3 due
to differences in the way Python 2 and 3 encode string types.
Explicitly decode command outputs to utf-8 strings which works
properly for both Python versions.
Change-Id: I921bd591ce16b5b91c76a6bb2a5d0e8626c29c19
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, there's no way for a user to specify a custom output
directory when using build_with_bazel.py.
Add a command line argument to allow such usage (similar to the
OUT_DIR environment variable from build.sh).
Change-Id: I44f720c85409fc8ec82a9f4a96d428fab80a7547
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, the Bazel build may fail if symlinks to the Bazel
extension files are not linked to the proper locations.
To make sure the build always works (falling back on default
extensions), configure the script to create the symlinks to the
default files in case they don't exist or are broken symlinks.
Change-Id: Ie385e4ede912d0f40026ef6c78a9c2fb60ca8924
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
When the Bazel subprocess exits unexpectedly, the wrapper script
gets an OSError exception while cleaning up the processes.
Ignore the OSError exception to make sure all subprocesses are
cleaned up properly.
Change-Id: I7c1062a900e70cfc2d90bd9695254ba80b07721b
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, the build_with_bazel.py script has an internal list
of targets. As we add/subtract targets, this becomes more difficult
to maintain. It also makes adding extra targets defined by
msm_kernel_extensions.bzl a manual process.
Instead, query the Bazel DAG to dynamically determine the
build targets based on input target name.
Change-Id: Id39889260b8f8af5c0c157ff091ee6e0d253c90f
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Currently, only legacy build.sh support exists for VM
builds.
Add Bazel support for these builds.
Change-Id: I10b221aa4a6633240b984eff333e15f5cd8b82cd
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
When using build_with_bazel.py, users may want to build extra
userspace cc_binary targets with a different toolchain.
Enable this capability by adding the --userspace_cross_toolchain
option.
Change-Id: I9eaaaa71ba483132fb68124e713a05d2918f9aa1
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
The raw Bazel build/run commands are difficult to parse
and users could easily miss building something.
To help improve the UX and efficiency of the build
across platforms/variants, let's add a top-level script
for the kernel platform build.
Change-Id: I16dfad6c90acc882123f6129c1bd02cb3d2131fc
Signed-off-by: John Moon <quic_johmoo@quicinc.com>