fix Qualcomm XMLs that use '/* ... */' multiline header comments
These comments aren't supported by AOSP build system.
This commit is contained in:
parent
59619ec1d7
commit
000663fe1c
1 changed files with 20 additions and 2 deletions
|
@ -25,9 +25,27 @@ export async function copyBlobs(entries: Iterable<BlobEntry>, srcDir: string, de
|
|||
// Some files need patching
|
||||
if (entry.path.endsWith('.xml')) {
|
||||
let xml = await readFile(srcPath)
|
||||
// Fix Qualcomm "version 2.0" XMLs
|
||||
// Fix Qualcomm XMLs
|
||||
let patched
|
||||
if (xml.startsWith('<?xml version="2.0"')) {
|
||||
let patched = xml.replace(/^<\?xml version="2.0"/, '<?xml version="1.0"')
|
||||
patched = xml.replace(/^<\?xml version="2.0"/, '<?xml version="1.0"')
|
||||
} else if (xml.startsWith('/*')) {
|
||||
patched = xml
|
||||
.split('\n')
|
||||
.map(line => {
|
||||
switch (line) {
|
||||
case '/*':
|
||||
return '<!--'
|
||||
case ' */':
|
||||
return '-->'
|
||||
default:
|
||||
return line
|
||||
}
|
||||
})
|
||||
.join('\n')
|
||||
}
|
||||
|
||||
if (patched !== undefined) {
|
||||
await fs.writeFile(outPath, patched)
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue