Huawei has been building cash since 2014 or earlier

Huawei on Dec 31, 2018 had cash and cash equivalents of CNY184.1 billion. It also had other short term investments of CNY81.8 billion. That is about US$38 billion. Ren has been preparing for war for a decade.

Huawei has about US$10 billion in debt, much of it not due until 2022 or later.

For much more about Huawei finances, check the 2018 annual report.