readPubspec static method
Implementation
static Future<BPConfig> readPubspec(List<String> args) async {
final rawPubspecFile = File('pubspec.yaml');
if (!(await rawPubspecFile.exists())) {
Console.logError("pubspec.yaml file could not be found!");
exit(1);
}
final pubspec = yaml.loadYaml(await rawPubspecFile.readAsString());
if (!(pubspec as yaml.YamlMap).containsKey("build_pipe")) {
Console.logError(
"please add the build_pipe configuration to your pubspec file!",
);
exit(1);
}
final config = BPConfig.fromMap(
pubspec["build_pipe"],
args,
pubspec["version"].split("+")[0],
// just in case the + doesnt exist
pubspec["version"].split("+").length > 1
? pubspec["version"].split("+")[1]
: "0",
);
if (config.platforms.isEmpty) {
Console.logError(
"No target platforms were detected. Please add your target platforms to pubspec",
);
exit(1);
}
return config;
}