ANDROID: build: Clean up legacy generated files
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>
This commit is contained in:
parent
3a59280025
commit
8bb27db561
@ -4,6 +4,7 @@
|
||||
|
||||
import argparse
|
||||
import errno
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
@ -192,6 +193,21 @@ class BazelBuilder:
|
||||
logging.debug("using userspace cross toolchain %s", toolchain)
|
||||
return toolchain
|
||||
|
||||
def clean_legacy_generated_files(self):
|
||||
"""Clean generated files from legacy build to avoid conflicts with Bazel"""
|
||||
for f in glob.glob("{}/msm-kernel/arch/arm64/configs/vendor/*-*_defconfig".format(self.workspace)):
|
||||
os.remove(f)
|
||||
|
||||
f = os.path.join(self.workspace, "bootable", "bootloader", "edk2", "Conf", ".AutoGenIdFile.txt")
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
for root, _, files in os.walk(os.path.join(self.workspace, "bootable")):
|
||||
for f in files:
|
||||
if f.endswith(".pyc"):
|
||||
os.remove(os.path.join(root, f))
|
||||
|
||||
|
||||
def bazel(
|
||||
self,
|
||||
bazel_subcommand,
|
||||
@ -258,6 +274,8 @@ class BazelBuilder:
|
||||
logging.error("no targets to build")
|
||||
sys.exit(1)
|
||||
|
||||
self.clean_legacy_generated_files()
|
||||
|
||||
logging.info("Building %s targets...", CPU)
|
||||
self.build_targets(
|
||||
cross_targets_to_build,
|
||||
|
Loading…
Reference in New Issue
Block a user