From 56cc658b93ac53053bfc7fcc3986a680d7aea5fc Mon Sep 17 00:00:00 2001 From: Yuntao Xu Date: Thu, 29 Jul 2021 23:15:19 -0700 Subject: [PATCH] remove target from every intermediate depFile 1. The current logic in the rsCppCmdLine only removes the target from the first intermediated depFile, which is different from the logic in Make, see https://source.corp.google.com/android/build/make/core/definitions.mk;l=1078 2. The expected logic, as that in Make, is to remove the target from every intermediate depFile, if there are many, before the concatenation; 3. This bug would cause dependency cycle error, please check the bug number below for more details; 4. The fix is to make sure the logic here is the same as that in Make. Bug: 195036632 Test: m CtsRsCppTestCases with the converted Android.bp file (run more than once to make sure no error occurs) Test: manually checked the gen/rs/rs.stamp.d file to make sure there is only one target on the top (the same as that built with the former Android.mk file) Test: TreeHugger Change-Id: If79e3e5e7bc18a6fddcf56c0168daea93726afc6 --- cc/rs.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cc/rs.go b/cc/rs.go index ba69f2339..fbc86e2a0 100644 --- a/cc/rs.go +++ b/cc/rs.go @@ -36,7 +36,8 @@ func init() { var rsCppCmdLine = strings.Replace(` ${rsCmd} -o ${outDir} -d ${outDir} -a ${out} -MD -reflect-c++ ${rsFlags} $in && -(echo '${out}: \' && cat ${depFiles} | awk 'start { sub(/( \\)?$$/, " \\"); print } /:/ { start=1 }') > ${out}.d && +echo '${out}: \' > ${out}.d && +for f in ${depFiles}; do cat $${f} | awk 'start { sub(/( \\)?$$/, " \\"); print } /:/ { start=1 }' >> ${out}.d; done && touch $out `, "\n", "", -1)