Commit 71690343 authored by Yegor's avatar Yegor Committed by GitHub

detailed error message re missing xcconfigs (#9001)

parent 49f5fbb8
...@@ -23,7 +23,6 @@ Future<Null> prepareProvisioningCertificates(String flutterProjectPath) async { ...@@ -23,7 +23,6 @@ Future<Null> prepareProvisioningCertificates(String flutterProjectPath) async {
await testXcconfig.writeAsString(certificateConfig); await testXcconfig.writeAsString(certificateConfig);
} }
Future<Null> _patchXcconfigFilesIfNotPatched(String flutterProjectPath) async { Future<Null> _patchXcconfigFilesIfNotPatched(String flutterProjectPath) async {
final List<File> xcconfigFiles = <File>[ final List<File> xcconfigFiles = <File>[
_fs.file(path.join(flutterProjectPath, 'ios/Flutter/Flutter.xcconfig')), _fs.file(path.join(flutterProjectPath, 'ios/Flutter/Flutter.xcconfig')),
...@@ -34,20 +33,25 @@ Future<Null> _patchXcconfigFilesIfNotPatched(String flutterProjectPath) async { ...@@ -34,20 +33,25 @@ Future<Null> _patchXcconfigFilesIfNotPatched(String flutterProjectPath) async {
bool xcconfigFileExists = false; bool xcconfigFileExists = false;
for (final File file in xcconfigFiles) { for (final File file in xcconfigFiles) {
if ((await file.exists())) { if (await file.exists()) {
xcconfigFileExists = true; xcconfigFileExists = true;
const String include = '#include "$_kTestXcconfigFileName"'; const String include = '#include "$_kTestXcconfigFileName"';
final String contents = await file.readAsString(); final String contents = await file.readAsString();
if (!contents.contains(include)) { final bool alreadyPatched = contents.contains(include);
if (!alreadyPatched) {
final IOSink patchOut = file.openWrite(mode: FileMode.APPEND); final IOSink patchOut = file.openWrite(mode: FileMode.APPEND);
patchOut.writeln(); // in case EOF is not preceded by line break
patchOut.writeln(include); patchOut.writeln(include);
await patchOut.close(); await patchOut.close();
} }
} }
} }
if (!xcconfigFileExists) if (!xcconfigFileExists) {
throw 'No xcconfig file found'; final String candidatesFormatted = xcconfigFiles.map<String>((File f) => f.path).join(', ');
throw 'Failed to locate a xcconfig file to patch with provisioning profile '
'info. Tried: $candidatesFormatted';
}
} }
Future<String> _readProvisioningConfigFile() async { Future<String> _readProvisioningConfigFile() async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment