Handle escaped spaces in deps-file. (#23273)

This commit is contained in:
Alexander Aprelev 2018-10-18 20:44:38 -07:00 committed by GitHub
parent 6a3ff018b1
commit dd789e645b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -581,9 +581,13 @@ class FlutterTask extends BaseFlutterTask {
if (dependenciesFile.exists()) {
try {
// Dependencies file has Makefile syntax:
// <target> <files>: <source> <files> <separated> <by> <space>
// <target> <files>: <source> <files> <separated> <by> <non-escaped space>
String depText = dependenciesFile.text
return project.files(depText.split(': ')[1].split())
// So we split list of files by non-escaped(by backslash) space,
def matcher = depText.split(': ')[1] =~ /(\\ |[^\s])+/
// then we replace all escaped spaces with regular spaces
def depList = matcher.collect{it[0].replaceAll("\\\\ ", " ")}
return project.files(depList)
} catch (Exception e) {
logger.error("Error reading dependency file ${dependenciesFile}: ${e}")
}