argumentBuilder property

  1. @override
List<String> get argumentBuilder
override

Builds the Fastlane command arguments list.

Constructs the complete command-line arguments for the Fastlane upload_to_play_store action. Handles file path resolution, mapping file detection, and parameter formatting.

Key behavior:

  • Automatically detects binary files in directories
  • Adds debug symbols mapping files when found
  • Formats all parameters for Fastlane execution
  • Includes conditional parameters based on configuration

Returns list of formatted Fastlane command arguments.

Example output:

["run", "upload_to_play_store", "aab:/path/to/app.aab",
 "metadata_path:/path/to/metadata", "track:production"]

Implementation

@override
List<String> get argumentBuilder {
  final mappingPathParser = (mappingPaths ?? []);

  String filePath = this.filePath;
  if (FileSystemEntity.isDirectorySync(filePath)) {
    final file = (Directory(filePath).listSync()).firstWhere(
      (item) => item.path.endsWith(binaryType == "apk" ? ".apk" : ".aab"),
      orElse: () => throw Exception("No file found"),
    );
    filePath = file.path;
    if (uploadDebugSymbols) {
      final debugSymbol = File(path.join(this.filePath, "debug_symbols.zip"));
      if (debugSymbol.existsSync()) {
        mappingPathParser.add(debugSymbol.path);
      } else {
        logger.logWarning(
          "Debug symbols file not found at ${path.join(this.filePath, "debug_symbols.zip")}, skipping upload.",
        );
      }
    }
  } else {
    if (uploadDebugSymbols) {
      final debugSymbol = File(
        path.join(File(filePath).parent.path, "debug_symbols.zip"),
      );
      if (debugSymbol.existsSync()) {
        mappingPathParser.add(debugSymbol.path);
      } else {
        logger.logWarning(
          "Debug symbols file not found at ${path.join(File(filePath).parent.path, "debug_symbols.zip")}, skipping upload.",
        );
      }
    }
  }
  return [
    "run",
    "upload_to_play_store",
    "metadata_path:$metadataPath",
    binaryType == "apk" ? "apk:$filePath" : "aab:$filePath",
    "package_name:${parent.parent.packageName}",
    "json_key:$jsonKey",
    "timeout:$timeout",
    "track:$track",
    if (releaseStatus != null) "release_status:$releaseStatus",
    if (versionName != null) "version_name:$versionName",
    if (versionCode != null) "version_code:$versionCode",
    if (rollout != null) "rollout:$rollout",
    if (jsonKeyData != null) "json_key_data:$jsonKeyData",
    if (apk != null) "apk:$apk",
    if (apkPaths != null && apkPaths!.isNotEmpty)
      "apk_paths:${apkPaths!.join(',')}",
    if (aab != null) "aab:$aab",
    if (aabPaths != null && aabPaths!.isNotEmpty)
      "aab_paths:${aabPaths!.join(',')}",
    if (skipUploadApk) "skip_upload_apk:true",
    if (skipUploadAab) "skip_upload_aab:true",
    if (skipUploadMetadata) "skip_upload_metadata:true",
    if (skipUploadChangelogs) "skip_upload_changelogs:true",
    if (skipUploadImages) "skip_upload_images:true",
    if (skipUploadScreenshots) "skip_upload_screenshots:true",
    if (syncImageUpload) "sync_image_upload:true",
    if (trackPromoteTo != null) "track_promote_to:$trackPromoteTo",
    if (trackPromoteReleaseStatus != null)
      "track_promote_release_status:$trackPromoteReleaseStatus",
    if (validateOnly) "validate_only:true",
    if (mapping != null) "mapping:$mapping",
    if (mappingPathParser.isNotEmpty)
      "mapping_paths:${mappingPathParser.join(',')}",
    if (rootUrl != null) "root_url:$rootUrl",
    if (versionCodesToRetain != null && versionCodesToRetain!.isNotEmpty)
      "version_codes_to_retain:${versionCodesToRetain!.join(',')}",
    if (changesNotSentForReview) "changes_not_sent_for_review:true",
    if (rescueChangesNotSentForReview)
      "rescue_changes_not_sent_for_review:true",
    if (inAppUpdatePriority != null)
      "in_app_update_priority:$inAppUpdatePriority",
    if (obbMainReferencesVersion != null)
      "obb_main_references_version:$obbMainReferencesVersion",
    if (obbMainFileSize != null) "obb_main_file_size:$obbMainFileSize",
    if (obbPatchReferencesVersion != null)
      "obb_patch_references_version:$obbPatchReferencesVersion",
    if (obbPatchFileSize != null) "obb_patch_file_size:$obbPatchFileSize",
    if (ackBundleInstallationWarning == true)
      "ack_bundle_installation_warning:$ackBundleInstallationWarning",
  ];
}
set argumentBuilder (List<String> value)
inherited

Raw list of command-line arguments before variable processing.

Subclasses should populate this list with the appropriate arguments for their specific job type.

Implementation

List<String> argumentBuilder = [];