supply/lib/supply/.uploader.rb.swp in fastlane-2.135.2 vs supply/lib/supply/.uploader.rb.swp in fastlane-2.136.0

- old
+ new

@@ -1,38 +1,41 @@ -b0VIM 8.1], joshJoshs-Mac-mini.local~josh/Projects/fastlane/fastlane/supply/lib/supply/uploader.rbutf-8 3210#"! UtpR8Saj@ladhR. < ;  n m "  M ' - - -a - +b0VIM 8.1]|joshJoshs-Mac-mini.local~josh/Projects/fastlane/fastlane/supply/lib/supply/uploader.rbutf-8 3210#"! UtpPPQ_jVjadxP. < ;  n m C - C  + +{ +W  - - k j [.kk@hg fvuNM)h tracks = client.tracks(track) def fetch_track_and_release!(track, version_code, status = nil) end end UI.success("Successfully finished the upload to Google Play") client.commit_current_edit! UI.message("Uploading all meta changes to Google Play...") else UI.success("Successfully validated the upload to Google Play") client.validate_current_edit! UI.message("Validating all meta changes with Google Play...") if Supply.config[:validate_only] end end upload_changelogs(release_notes, release, track) unless release_notes.empty? end release_notes << upload_changelog(language, release.name) unless Supply.config[:skip_upload_changelogs] upload_screenshots(language) unless Supply.config[:skip_upload_screenshots] upload_images(language) unless Supply.config[:skip_upload_images] upload_metadata(language, listing) unless Supply.config[:skip_upload_metadata] listing = client.listing_for_language(language) UI.message("Preparing to upload for language '#{language}'...") next if language.start_with?('.') # e.g. . or .. or hidden folders all_languages.each do |language| release_notes = [] UI.user_error!("Could not find release for version code '#{version_code}' to update changelog") unless release UI.user_error!("Unable to find the requested track - '#{Supply.config[:track]}'") unless track track, release = fetch_track_and_release!(Supply.config[:track], version_code) UI.user_error!("Could not find folder #{metadata_path}") unless File.directory?(metadata_path) version_codes.each do |version_code| version_codes = [Supply.config[:version_code]] if version_codes.empty? if (!Supply.config[:skip_upload_metadata] || !Supply.config[:skip_upload_images] || !Supply.config[:skip_upload_changelogs] || !Supply.config[:skip_upload_screenshots]) && metadata_path client.begin_edit(package_name: Supply.config[:package_name]) def perform_upload_meta(version_codes) end perform_upload_meta(apk_version_codes) end UI.success("Successfully finished the upload to Google Play") client.commit_current_edit! UI.message("Uploading all track and release changes to Google Play...") else UI.success("Successfully validated the upload to Google Play") client.validate_current_edit! UI.message("Validating all track and release changes with Google Play...") if Supply.config[:validate_only] promote_track if Supply.config[:track_promote_to] end update_rollout if !Supply.config[:rollout].nil? && Supply.config[:track].to_s != "" update_track(apk_version_codes) unless apk_version_codes.empty? # Updating a track with empty version codes can completely clear out a track # Only update tracks if we have version codes apk_version_codes.concat(Supply.config[:version_codes_to_retain]) if Supply.config[:version_codes_to_retain] upload_mapping(apk_version_codes) apk_version_codes.concat(upload_bundles) unless Supply.config[:skip_upload_aab] apk_version_codes.concat(upload_apks) unless Supply.config[:skip_upload_apk] apk_version_codes = [] verify_config! client.begin_edit(package_name: Supply.config[:package_name]) FastlaneCore::PrintTable.print_values(config: Supply.config, hide_keys: [:issuer], mask_keys: [:json_key_data], title: "Summary for supply #{Fastlane::VERSION}") def perform_upload class Uploader # rubocop:disable Metrics/ClassLengthmodule Supplyad@ldcT*"! O( @ 4 * " ! k O   f E - + + + a ` DY-k7y3 xw UI.message("Uploading all meta changes to Google Play...") else UI.success("Successfully validated the upload to Google Play") client.validate_current_edit! UI.message("Validating all meta changes with Google Play...") if Supply.config[:validate_only] end end upload_changelogs(release_notes, release, track) unless release_notes.empty? end release_notes << upload_changelog(language, version_code) unless Supply.config[:skip_upload_changelogs] upload_screenshots(language) unless Supply.config[:skip_upload_screenshots] upload_images(language) unless Supply.config[:skip_upload_images] upload_metadata(language, listing) unless Supply.config[:skip_upload_metadata] listing = client.listing_for_language(language) UI.message("Preparing to upload for language '#{language}'...") next if language.start_with?('.') # e.g. . or .. or hidden folders all_languages.each do |language| release_notes = [] UI.user_error!("Could not find release for version code '#{version_code}' to update changelog") unless release UI.user_error!("Unable to find the requested track - '#{Supply.config[:track]}'") unless track track, release = fetch_track_and_release!(Supply.config[:track], version_code) UI.user_error!("Could not find folder #{metadata_path}") unless File.directory?(metadata_path) version_codes.each do |version_code| end version_codes.to_s == "" version_codes = version_codes.reject do |version_code| version_codes = [Supply.config[:version_code]] if version_codes.empty? # Use version code from config if version codes is empty and no nil or empty string if (!Supply.config[:skip_upload_metadata] || !Supply.config[:skip_upload_images] || !Supply.config[:skip_upload_changelogs] || !Supply.config[:skip_upload_screenshots]) && metadata_path client.begin_edit(package_name: Supply.config[:package_name]) def perform_upload_meta(version_codes) end perform_upload_meta(apk_version_codes) end UI.success("Successfully finished the upload to Google Play") client.commit_current_edit! UI.message("Uploading all track and release changes to Google Play...") else UI.success("Successfully validated the upload to Google Play") client.validate_current_edit! UI.message("Validating all track and release changes with Google Play...") if Supply.config[:validate_only] end update_rollout elsif !Supply.config[:rollout].nil? && Supply.config[:track].to_s != "" promote_track if Supply.config[:track_promote_to] update_track(apk_version_codes) unless apk_version_codes.empty? # Updating a track with empty version codes can completely clear out a track # Only update tracks if we have version codes apk_version_codes.concat(Supply.config[:version_codes_to_retain]) if Supply.config[:version_codes_to_retain] upload_mapping(apk_version_codes) apk_version_codes.concat(upload_bundles) unless Supply.config[:skip_upload_aab] apk_version_codes.concat(upload_apks) unless Supply.config[:skip_upload_apk] apk_version_codes = [] verify_config! client.begin_edit(package_name: Supply.config[:package_name]) FastlaneCore::PrintTable.print_values(config: Supply.config, hide_keys: [:issuer], mask_keys: [:json_key_data], title: "Summary for supply #{Fastlane::VERSION}") def perform_upload class Uploader # rubocop:disable Metrics/ClassLengthmodule Supplyad V~cTyL$ o Y 8 b Z Y C    ` 0  + +x +l +b +Z +Y +' + M  }yoYQP i'`PF>8  end # rubocop:enable Metrics/ClassLength end end end 'patch' elsif filename.include?('patch') 'main' if filename.include?('main') filename = File.basename(obb_file_path, ".obb") def obb_expansion_file_type(obb_file_path) end expansion_file_type: expansion_file_type) apk_version_code: apk_version_code, client.upload_obb(obb_file_path: obb_path, UI.message("Uploading obb file #{obb_path}...") def upload_obb(obb_path, expansion_file_type, apk_version_code) end expansion_paths end expansion_paths[type] = path end return {} UI.important("If you'd like this to work differently, please submit an issue.") UI.important("Can only upload one '#{type}' apk expansion. Skipping obb upload entirely.") if expansion_paths[type] next unless type type = obb_expansion_file_type(path) paths.each do |path| expansion_paths = {} paths = Dir.glob(search, File::FNM_CASEFOLD) search = File.join(File.dirname(apk_path), '*.obb') def find_obbs(apk_path) # { 'main' => 'path/to/main.obb', 'patch' => 'path/to/patch.obb' } # E.g. # keyed by their detected expansion file type # @return a map of the obb paths for that apk end end end upload_obb(expansion_paths[type], type, apk_version_code) if expansion_paths[type] ['main', 'patch'].each do |type| expansion_paths = find_obbs(apk_path) def upload_obbs(apk_path, apk_version_code) # more than one of either of them. # upload at most one main and one patch file. Do nothing if it finds # searches for obbs in the directory where the apk is located and end Supply.config[:metadata_path] def metadata_path end @client ||= Client.make_from_config def client end .sort { |x, y| x <=> y } .reject { |f| f.start_with?('.') } .select { |f| File.directory?(File.join(metadata_path, f)) } Dir.entries(metadata_path) def all_languages # returns only language directories from metadata_path end client.update_track(Supply.config[:track], track) end ) releases: [track_release] track: Supply.config[:track], track = AndroidPublisher::Track.new( else track.releases = [track_release] # Google Play will keep previous releases there this release is a partial rollout # Its okay to set releases to an array containing the newest release if track track = tracks.first tracks = client.tracks(Supply.config[:track]) end track_release.user_fraction = Supply.config[:rollout].to_fad_}|` cYX9 \ Q  / } s i h "   +i +h + _ #  nR5,$#yxMwmaLn>rq;]$pLK UI.message("Uploading screenshot #{path}...") paths.sort.each do |path| client.clear_screenshots(image_type: screenshot_type, language: language) next unless paths.count > 0 paths = Dir.glob(search, File::FNM_CASEFOLD) search = File.join(metadata_path, language, Supply::IMAGES_FOLDER_NAME, screenshot_type, "*.#{IMAGE_FILE_EXTENSIONS}") Supply::SCREENSHOT_TYPES.each do |screenshot_type| def upload_screenshots(language) end end language: language) image_type: image_type, client.upload_image(image_path: File.expand_path(path), UI.message("Uploading image file #{path}...") next unless path path = Dir.glob(search, File::FNM_CASEFOLD).last search = File.join(metadata_path, language, Supply::IMAGES_FOLDER_NAME, image_type) + ".#{IMAGE_FILE_EXTENSIONS}" Supply::IMAGES_TYPES.each do |image_type| def upload_images(language) end end UI.user_error!("Metadata must be UTF-8 encoded. #{message}") message = (ex.message || '').capitalize rescue Encoding::InvalidByteSequenceError => ex listing.save begin end listing.send("#{key}=".to_sym, File.read(path, encoding: 'UTF-8')) if File.exist?(path) path = File.join(metadata_path, language, "#{key}.txt") Supply::AVAILABLE_METADATA_FIELDS.each do |key| def upload_metadata(language, listing) end client.upload_changelogs(track, Supply.config[:track]) release.release_notes = release_notes def upload_changelogs(release_notes, release, track) end }) text: changelog_text language: language, AndroidPublisher::LocalizedText.new({ end UI.message("Could not find changelog for '#{version_code}' and language '#{language}' at path #{path}...") else changelog_text = File.read(path, encoding: 'UTF-8') UI.message("Updating changelog for '#{version_code}' and language '#{language}'...") if File.exist?(path) changelog_text = '' path = File.join(Supply.config[:metadata_path], language, Supply::CHANGELOGS_FOLDER_NAME, "#{version_code}.txt") UI.user_error!("Cannot find changelog because no version code given - please specify :version_code") unless version_code def upload_changelog(language, version_code) end client.update_track(Supply.config[:track_promote_to], track_to) end ) releases: [release] track: Supply.config[:track_promote_to], track_to = AndroidPublisher::Track.new( else track_to.releases = [release] # Google Play will keep previous releases there this release is a partial rollout # Its okay to set releases to an array containing the newest release if track_to end release.user_fraction = nil release.status = Supply::ReleaseStatus::COMPLETED else release.user_fraction = Supply.config[:rollout] release.status = Supply::ReleaseStatus::IN_PROGRESS if Supply.config[:rollout] track_to = client.tracks(Supply.config[:track_promote_to]).first release = releases.first end UI.user_error!("Track '#{Supply.config[:track]}' has more than one release - use :version_code to filter the release to promote") elsif releases.size > 1 UI.user_error!("Track '#{Supply.config[:track]}' doesn't have any releases") if releases.size == 0 end end release.status == Supply::ReleaseStatus::COMPLETED releases = releases.select do |release|adF +jOC910j-#" i   8  t 7  + + + + + + + r -f -A -7 -! - - - m 1 ^O(end # rubocop:enable Metrics/ClassLength end end end 'patch' elsif filename.include?('patch') 'main' if filename.include?('main') filename = File.basename(obb_file_path, ".obb") def obb_expansion_file_type(obb_file_path) end expansion_file_type: expansion_file_type) apk_version_code: apk_version_code, client.upload_obb(obb_file_path: obb_path, UI.message("Uploading obb file #{obb_path}...") def upload_obb(obb_path, expansion_file_type, apk_version_code) end expansion_paths end expansion_paths[type] = path end return {} UI.important("If you'd like this to work differently, please submit an issue.") UI.important("Can only upload one '#{type}' apk expansion. Skipping obb upload entirely.") if expansion_paths[type] next unless type type = obb_expansion_file_type(path) paths.each do |path| expansion_paths = {} paths = Dir.glob(search, File::FNM_CASEFOLD) search = File.join(File.dirname(apk_path), '*.obb') def find_obbs(apk_path) # { 'main' => 'path/to/main.obb', 'patch' => 'path/to/patch.obb' } # E.g. # keyed by their detected expansion file type # @return a map of the obb paths for that apk end end end upload_obb(expansion_paths[type], type, apk_version_code) if expansion_paths[type] ['main', 'patch'].each do |type| expansion_paths = find_obbs(apk_path) def upload_obbs(apk_path, apk_version_code) # more than one of either of them. # upload at most one main and one patch file. Do nothing if it finds # searches for obbs in the directory where the apk is located and end Supply.config[:metadata_path] def metadata_path end @client ||= Client.make_from_config def client end .sort { |x, y| x <=> y } .reject { |f| f.start_with?('.') } .select { |f| File.directory?(File.join(metadata_path, f)) }adp &I=32    release = track_from.releases.first end UI.user_error!("Track '#{Supply.config[:track]}' has more than one release - use :version_code to filter the release to promote") elsif releases.size > 1 UI.user_error!("Track '#{Supply.config[:track]}' doesn't have any releases") if releases.size == 0 end end release.version_codes.include?(Supply.config[:version_code].to_s) releases = releases.select do |release| if Supply.config[:version_code].to_s != "" releases = track_from.releases end UI.user_error!("Cannot promote from track '#{Supply.config[:track]}' - track doesn't exist") unless track_from track_from = client.tracks(Supply.config[:track]).first def promote_track endad8WSIH%| K J g f L   - -= -3 -2 -  ~}GZ  KA@C![+\>~ release = track_from.releases.first end UI.user_error!("Track '#{Supply.config[:track]}' has more than one release - use :version_code to filter the release to promote") elsif releases.size > 1 UI.user_error!("Track '#{Supply.config[:track]}' doesn't have any releases") if releases.size == 0 end end release.version_codes.include?(Supply.config[:version_code]) releases = releases.select do |release| if Supply.config[:version_code].to_s != "" releases = track_from.releases end UI.user_error!("Cannot promote fr end Supply.config[:version_code] end Supply.config[:version_code] = Supply.config[:version_c end end Supply.config[:version_codes_to_retain] = Supply.config[:version_codes_to_retain].map(&:to_i) unless Supply.config[:version_codes_to_retain].nil? end UI.user_error!(%(Cannot specify rollout percentage when the release status is set to 'draft')) if Supply.config[:release_status] == Supply::ReleaseStatus::DRAFT && Supply.config[:rollout] end UI.user_error!("Cannot provide both apk(s) and aab - use `skip_upload_apk`, `skip_upload_aab`, or make sure to remove any existing .apk or .aab files that are no longer needed") if could_upload_apk && could_upload_aab could_upload_aab = Supply.config[:aab] && !Supply.config[:skip_upload_aab] could_upload_apk = !apk_paths.empty? && !Supply.config[:skip_upload_apk] apk_paths = [Supply.config[:apk], Supply.config[:apk_paths]].flatten.compact # Need to error out users when there both apks and aabs are detected # Can't upload both at apk and aab at same time end UI.user_error!("No local metadata, apks, aab, or track to promote were found, make sure to run `fastlane supply init` to setup supply") unless metadata_path || Supply.config[:apk] || Supply.config[:apk_paths] || Supply.config[:aab] || Supply.config[:aab_paths] || (Supply.config[:track] && Supply.config[:track_promote_to]) def verify_config! end client.update_track(Supply.config[:track], track) end UI.user_error!("Unable to find version to rollout in track '#{Supply.config[:track]}'") else track.releases.delete_if { |r| !(r.version_codes || []).map(&:to_s).include?(version_code) } if completed # Deleted other version codes if completed because only allowed on completed version in a release release.status = Supply::ReleaseStatus::COMPLETED if completed release.user_fraction = completed ? nil : Supply.config[:rollout] completed = Supply.config[:rollout].to_f == 1 if track && release UI.user_error!("Unable to find the requested track - '#{Supply.config[:track]}'") unless track UI.message("Updating #{version_code}'s rollout to '#{Supply.config[:rollout]}' on track '#{Supply.config[:track]}'...") version_code = release.version_codes.first track, release = fetch_track_and_release!(Supply.config[:track], Supply.config[:version_code], Supply::ReleaseStatus::IN_PROGRESS) def update_rollout end return track, releases.first end UI.user_error!("More than one release found in this track. Please specify with the :version_code option to select a release.") if releases.size > 1 releases = releases.select { |r| r.version_codes.map(&:to_s).include?(version_code.to_s) } releases = releases.select { |r| r.status == status } if status releases = track.releases track = tracks.first return nil, nil if tracks.empty?adj\PF>=&wvS  p h g [ Z S  P +  | - , - - -I - - - - } _  8.-|ia`8f6 ^TSN%TLK Dir.entries(metadata_path) def all_languages # returns only language directories from metadata_path end client.update_track(Supply.config[:track], track) end ) releases: [track_release] track: Supply.config[:track], track = AndroidPublisher::Track.new( else track.releases = [track_release] # Google Play will keep previous releases there this release is a partial rollout # Its okay to set releases to an array containing the newest release if track track = tracks.first tracks = client.tracks(Supply.config[:track]) end track_release.user_fraction = Supply.config[:rollout].to_f track_release.status = Supply::ReleaseStatus::IN_PROGRESS if Supply.config[:rollout] ) version_codes: apk_version_codes status: Supply.config[:release_status], name: Supply.config[:version_name], track_release = AndroidPublisher::TrackRelease.new( UI.message("Updating track '#{Supply.config[:track]}'...") return if apk_version_codes.empty? def update_track(apk_version_codes) end file_size) references_version, expansion_file_type, client.update_obb(apk_version_code, UI.message("Updating '#{expansion_file_type}' expansion file from version '#{references_version}'...") def update_obb(apk_version_code, expansion_file_type, references_version, file_size) end apk_version_code UI.message("\tVersion Code: #{apk_version_code}") end UI.message("No apk file found, you can pass the path to your apk using the `apk` option") else upload_obbs(apk_path, apk_version_code) end Supply.config[:obb_patch_file_size]) Supply.config[:obb_patch_references_version], 'patch', update_obb(apk_version_code, if Supply.config[:obb_patch_references_version] && Supply.config[:obb_patch_file_size] end Supply.config[:obb_main_file_size]) Supply.config[:obb_main_references_version], 'main', update_obb(apk_version_code, if Supply.config[:obb_main_references_version] && Supply.config[:obb_main_file_size] UI.user_error!("Could not upload #{apk_path}") unless apk_version_code apk_version_code = client.upload_apk(apk_path) UI.message("Preparing apk at path '#{apk_path}' for upload...") if apk_path apk_version_code = nil def upload_binary_data(apk_path) # @return [Integer] The apk version code returned after uploading, or nil if there was a problem # # Path of the apk file to upload. # @param [String] apk_path # # Upload binary apk and obb and corresponding change logs with client ## private end return aab_version_codes end aab_version_codes.push(bundle_version_code) bundle_version_code = client.upload_bundle(aab_path) UI.message("Preparing aab at path '#{aab_path}' for upload...") aab_paths.each do |aab_path| aab_version_codes = [] aab_paths.compact! return [] unless aab_paths aab_paths = [Supply.config[:aab]] unless (aab_paths = Supply.config[:aab_paths]) def upload_bundles end end end client.upload_mapping(mapping_path, version_code) if mapping_path mapping_paths.zip(apk_version_codes).each do |mapping_path, version_code|ad7aYkMC98 9 8 / u k j > "  - - - - -Q -I -H - - G = 1  qg_^>[BA e[SR-u@n,3qih> mapping_paths = [Supply.config[:mapping]] unless (mapping_paths = Supply.config[:mapping_paths]) def upload_mapping(apk_version_codes) end return apk_version_codes end apk_version_codes.push(upload_binary_data(apk_path)) apk_paths.each do |apk_path| apk_version_codes = [] apk_paths.compact! apk_paths = [Supply.config[:apk]] unless (apk_paths = Supply.config[:apk_paths]) def upload_apks end end end language: language) image_type: screenshot_type, client.upload_image(image_path: File.expand_path(path), UI.message("Uploading screenshot #{path}...") paths.sort.each do |path| client.clear_screenshots(image_type: screenshot_type, language: language) next unless paths.count > 0 paths = Dir.glob(search, File::FNM_CASEFOLD) search = File.join(metadata_path, language, Supply::IMAGES_FOLDER_NAME, screenshot_type, "*.#{IMAGE_FILE_EXTENSIONS}") Supply::SCREENSHOT_TYPES.each do |screenshot_type| def upload_screenshots(language) end end language: language) image_type: image_type, client.upload_image(image_path: File.expand_path(path), UI.message("Uploading image file #{path}...") next unless path path = Dir.glob(search, File::FNM_CASEFOLD).last search = File.join(metadata_path, language, Supply::IMAGES_FOLDER_NAME, image_type) + ".#{IMAGE_FILE_EXTENSIONS}" Supply::IMAGES_TYPES.each do |image_type| def upload_images(language) end end UI.user_error!("Metadata must be UTF-8 encoded. #{message}") message = (ex.message || '').capitalize rescue Encoding::InvalidByteSequenceError => ex listing.save begin end listing.send("#{key}=".to_sym, File.read(path, encoding: 'UTF-8')) if File.exist?(path) path = File.join(metadata_path, language, "#{key}.txt") Supply::AVAILABLE_METADATA_FIELDS.each do |key| def upload_metadata(language, listing) end client.upload_changelogs(track, Supply.config[:track]) release.release_notes = release_notes def upload_changelogs(release_notes, release, track) end }) text: changelog_text language: language, AndroidPublisher::LocalizedText.new({ end UI.message("Could not find changelog for '#{version_name}' and language '#{language}' at path #{path}...") else changelog_text = File.read(path, encoding: 'UTF-8') UI.message("Updating changelog for '#{version_name}' and language '#{language}'...") if File.exist?(path) changelog_text = '' path = File.join(Supply.config[:metadata_path], language, Supply::CHANGELOGS_FOLDER_NAME, "#{version_name}.txt") UI.user_error!("Cannot find changelog because no version name given - please specify :version_name") unless version_name def upload_changelog(language, version_name) end client.update_track(Supply.config[:track_promote_to], track_to) end ) releases: [release] track: Supply.config[:track_promote_to], track_to = AndroidPublisher::Track.new( else track_to.releases = [release] # Google Play will keep previous releases there this release is a partial rollout # Its okay to set releases to an array containing the newest release if track_to track_to = client.tracks(Supply.config[:track_promote_to]).first +l +M +$ + + w v d  8yml K?>^G?>xN!xw65vnmL +  track_release.status = Supply::ReleaseStatus::IN_PROGRESS if Supply.config[:rollout] ) version_codes: apk_version_codes status: Supply.config[:release_status], name: Supply.config[:version_name], track_release = AndroidPublisher::TrackRelease.new( UI.message("Updating track '#{Supply.config[:track]}'...") return if apk_version_codes.empty? def update_track(apk_version_codes) end file_size) references_version, expansion_file_type, client.update_obb(apk_version_code, UI.message("Updating '#{expansion_file_type}' expansion file from version '#{references_version}'...") def update_obb(apk_version_code, expansion_file_type, references_version, file_size) end apk_version_code UI.message("\tVersion Code: #{apk_version_code}") end UI.message("No apk file found, you can pass the path to your apk using the `apk` option") else upload_obbs(apk_path, apk_version_code) end Supply.config[:obb_patch_file_size]) Supply.config[:obb_patch_references_version], 'patch', update_obb(apk_version_code, if Supply.config[:obb_patch_references_version] && Supply.config[:obb_patch_file_size] end Supply.config[:obb_main_file_size]) Supply.config[:obb_main_references_version], 'main', update_obb(apk_version_code, if Supply.config[:obb_main_references_version] && Supply.config[:obb_main_file_size] UI.user_error!("Could not upload #{apk_path}") unless apk_version_code apk_version_code = client.upload_apk(apk_path) UI.message("Preparing apk at path '#{apk_path}' for upload...") if apk_path apk_version_code = nil def upload_binary_data(apk_path) # @return [Integer] The apk version code returned after uploading, or nil if there was a problem # # Path of the apk file to upload. # @param [String] apk_path # # Upload binary apk and obb and corresponding change logs with client ## private end return aab_version_codes end aab_version_codes.push(bundle_version_code) bundle_version_code = client.upload_bundle(aab_path) UI.message("Preparing aab at path '#{aab_path}' for upload...") aab_paths.each do |aab_path| aab_version_codes = [] aab_paths.compact! return [] unless aab_paths aab_paths = [Supply.config[:aab]] unless (aab_paths = Supply.config[:aab_paths]) def upload_bundles end end end client.upload_mapping(mapping_path, version_code) if mapping_path mapping_paths.zip(apk_version_codes).each do |mapping_path, version_code| mapping_paths = [Supply.config[:mapping]] unless (mapping_paths = Supply.config[:mapping_paths]) def upload_mapping(apk_version_codes) end return apk_version_codes end apk_version_codes.push(upload_binary_data(apk_path)) apk_paths.each do |apk_path| apk_version_codes = [] apk_paths.compact! apk_paths = [Supply.config[:apk]] unless (apk_paths = Supply.config[:apk_paths]) def upload_apks end end end language: language) image_type: screenshot_type, client.upload_image(image_path: File.expand_path(path),ad_P?q ] S R / ' &  ! } | + + + +c + + + ? 4 q@rI7-%$SIH#vj_ else end release.version_codes.include?(Supply.config[:version_code].to_s) releases = releases.select do |release| if Supply.config[:version_code].to_s != "" releases = track_from.releases end UI.user_error!("Cannot promote from track '#{Supply.config[:track]}' - track doesn't exist") unless track_from track_from = client.tracks(Supply.config[:track]).first def promote_track end end Supply.config[:version_codes_to_retain] = Supply.config[:version_codes_to_retain].map(&:to_i) unless Supply.config[:version_codes_to_retain].nil? end UI.user_error!(%(Cannot specify rollout percentage when the release status is set to 'draft')) if Supply.config[:release_status] == Supply::ReleaseStatus::DRAFT && Supply.config[:rollout] end UI.user_error!("Cannot provide both apk(s) and aab - use `skip_upload_apk`, `skip_upload_aab`, or make sure to remove any existing .apk or .aab files that are no longer needed") if could_upload_apk && could_upload_aab could_upload_aab = Supply.config[:aab] && !Supply.config[:skip_upload_aab] could_upload_apk = !apk_paths.empty? && !Supply.config[:skip_upload_apk] apk_paths = [Supply.config[:apk], Supply.config[:apk_paths]].flatten.compact # Need to error out users when there both apks and aabs are detected # Can't upload both at apk and aab at same time end UI.user_error!("No local metadata, apks, aab, or track to promote were found, make sure to run `fastlane supply init` to setup supply") unless metadata_path || Supply.config[:apk] || Supply.config[:apk_paths] || Supply.config[:aab] || Supply.config[:aab_paths] || (Supply.config[:track] && Supply.config[:track_promote_to]) def verify_config! end client.update_track(Supply.config[:track], track) end UI.user_error!("Unable to find version to rollout in track '#{Supply.config[:track]}'") else track.releases.delete_if { |r| !(r.version_codes || []).map(&:to_s).include?(version_code) } if completed # Deleted other version codes if completed because only allowed on completed version in a release release.status = Supply::ReleaseStatus::COMPLETED if completed release.user_fraction = completed ? nil : Supply.config[:rollout] completed = Supply.config[:rollout].to_f == 1 if track && release UI.message("Updating #{version_code}'s rollout to '#{Supply.config[:rollout]}' on track '#{Supply.config[:track]}'...") version_code = release.version_codes.first UI.user_error!("Unable to find the requested release on track - '#{Supply.config[:track]}'") unless release UI.user_error!("Unable to find the requested track - '#{Supply.config[:track]}'") unless track track, release = fetch_track_and_release!(Supply.config[:track], Supply.config[:version_code], Supply::ReleaseStatus::IN_PROGRESS) def update_rollout end return track, releases.first end UI.user_error!("More than one release found in this track. Please specify with the :version_code option to select a release.") if releases.size > 1 releases = releases.select { |r| r.version_codes.map(&:to_s).include?(version_code.to_s) } if version_code releases = releases.select { |r| r.status == status } if status releases = track.releases track = tracks.first return nil, nil if tracks.empty? tracks = client.tracks(track) def fetch_track_and_release!(track, version_code, status = nil) end end UI.success("Successfully finished the upload to Google Play") client.commit_current_edit! \ No newline at end of file