validate method
Implementation
Future<ValidationCheck> validate(dynamic context) async {
String projectPath = '.';
BuildPlatform platform = BuildPlatform.android;
if (context is DeploymentContext) {
projectPath = context.projectPath;
platform = context.platform;
}
final checkedPaths = <String>[];
if (platform == BuildPlatform.android || platform == BuildPlatform.all) {
checkedPaths.add('$projectPath/android/fastlane/Fastfile');
checkedPaths.add('$projectPath/fastlane/Fastfile');
}
if (platform == BuildPlatform.ios || platform == BuildPlatform.all) {
checkedPaths.add('$projectPath/ios/fastlane/Fastfile');
checkedPaths.add('$projectPath/fastlane/Fastfile');
}
bool hasFastfile = false;
for (final path in checkedPaths) {
if (await File(path).exists()) {
hasFastfile = true;
break;
}
}
if (hasFastfile) {
return ValidationCheck(
name: name,
status: CheckStatus.passed,
message: 'Fastlane configuration (Fastfile) found in project.',
);
} else {
return ValidationCheck(
name: name,
status: CheckStatus.warning,
message:
'No Fastfile found in expected locations (${checkedPaths.join(', ')}). '
'Ensure Fastlane is configured for your project.',
);
}
}