updatePbxprojData static method
Update project.pbxproj data.
Will update for dev/prod flavors and schemes.
Implementation
static Future<void> updatePbxprojData() async {
final pbxprojPath = join(
Directory.current.path, 'ios', 'Runner.xcodeproj', 'project.pbxproj');
print(grey('\tUpdating: $pbxprojPath'));
final data = await File(pbxprojPath).readAsString();
// Insert before
String updatedData = data.replaceFirst(
PbxprojConstants.beginXCBuildConfigSection,
'${PbxprojConstants.beginXCBuildConfigSection}\n${PbxprojConstants.pbxprojBuildConfiguration}',
);
updatedData = updatedData.replaceAll(
RegExp(RegExp.escape(PbxprojConstants.beginXCConfigListSection) +
r'[\s\S]*?' +
RegExp.escape(PbxprojConstants.endXCConfigListSection)),
'${PbxprojConstants.beginXCConfigListSection}\n${PbxprojConstants.pbxprojConfigurationList}\n${PbxprojConstants.endXCConfigListSection}',
);
await File(pbxprojPath).writeAsString(updatedData);
}