Class: FastlaneCore::JavaTransporterExecutor
- Inherits:
-
TransporterExecutor
- Object
- TransporterExecutor
- FastlaneCore::JavaTransporterExecutor
- Defined in:
- fastlane_core/lib/fastlane_core/itunes_transporter.rb
Overview
Generates commands and executes the iTMSTransporter by invoking its Java app directly, to avoid the crazy parameter escaping problems in its accompanying shell script.
Instance Method Summary collapse
- #build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil) ⇒ Object
- #build_provider_ids_command(username, password, jwt = nil) ⇒ Object
- #build_upload_command(username, password, source = "/tmp", provider_short_name = "", jwt = nil) ⇒ Object
- #build_verify_command(username, password, source = "/tmp", provider_short_name = "", jwt = nil) ⇒ Object
- #execute(command, hide_output) ⇒ Object
- #handle_error(password) ⇒ Object
- #java_code_option ⇒ Object
Methods inherited from TransporterExecutor
Instance Method Details
#build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil) ⇒ Object
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 357 def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil) use_jwt = !jwt.to_s.empty? if !Helper.user_defined_itms_path? && Helper.mac? && Helper.xcode_at_least?(11) [ ("ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}" unless use_jwt), 'xcrun iTMSTransporter', '-m lookupMetadata', ("-u #{username.shellescape}" unless use_jwt), ("-p @env:ITMS_TRANSPORTER_PASSWORD" unless use_jwt), ("-jwt #{jwt}" if use_jwt), "-apple_id #{apple_id.shellescape}", "-destination #{destination.shellescape}", ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?), '2>&1' # cause stderr to be written to stdout ].compact.join(' ') else [ Helper.transporter_java_executable_path.shellescape, "-Djava.ext.dirs=#{Helper.transporter_java_ext_dir.shellescape}", '-XX:NewSize=2m', '-Xms32m', '-Xmx1024m', '-Xms1024m', '-Djava.awt.headless=true', '-Dsun.net.http.retryPost=false', java_code_option, '-m lookupMetadata', ("-u #{username.shellescape}" unless use_jwt), ("-p #{password.shellescape}" unless use_jwt), ("-jwt #{jwt}" if use_jwt), "-apple_id #{apple_id.shellescape}", "-destination #{destination.shellescape}", ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?), '2>&1' # cause stderr to be written to stdout ].compact.join(' ') end end |
#build_provider_ids_command(username, password, jwt = nil) ⇒ Object
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 395 def build_provider_ids_command(username, password, jwt = nil) use_jwt = !jwt.to_s.empty? if !Helper.user_defined_itms_path? && Helper.mac? && Helper.xcode_at_least?(11) [ ("ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}" unless use_jwt), 'xcrun iTMSTransporter', '-m provider', ("-u #{username.shellescape}" unless use_jwt), ("-p @env:ITMS_TRANSPORTER_PASSWORD" unless use_jwt), ("-jwt #{jwt}" if use_jwt), '2>&1' # cause stderr to be written to stdout ].compact.join(' ') else [ Helper.transporter_java_executable_path.shellescape, "-Djava.ext.dirs=#{Helper.transporter_java_ext_dir.shellescape}", '-XX:NewSize=2m', '-Xms32m', '-Xmx1024m', '-Xms1024m', '-Djava.awt.headless=true', '-Dsun.net.http.retryPost=false', java_code_option, '-m provider', ("-u #{username.shellescape}" unless use_jwt), ("-p #{password.shellescape}" unless use_jwt), ("-jwt #{jwt}" if use_jwt), '2>&1' # cause stderr to be written to stdout ].compact.join(' ') end end |
#build_upload_command(username, password, source = "/tmp", provider_short_name = "", jwt = nil) ⇒ Object
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 281 def build_upload_command(username, password, source = "/tmp", provider_short_name = "", jwt = nil) use_jwt = !jwt.to_s.empty? if !Helper.user_defined_itms_path? && Helper.mac? && Helper.xcode_at_least?(11) [ ("ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}" unless use_jwt), 'xcrun iTMSTransporter', '-m upload', ("-u #{username.shellescape}" unless use_jwt), ("-p @env:ITMS_TRANSPORTER_PASSWORD" unless use_jwt), ("-jwt #{jwt}" if use_jwt), file_upload_option(source), additional_upload_parameters, # that's here, because the user might overwrite the -t option '-k 100000', ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?), '2>&1' # cause stderr to be written to stdout ].compact.join(' ') # compact gets rid of the possibly nil ENV value else [ Helper.transporter_java_executable_path.shellescape, "-Djava.ext.dirs=#{Helper.transporter_java_ext_dir.shellescape}", '-XX:NewSize=2m', '-Xms32m', '-Xmx1024m', '-Xms1024m', '-Djava.awt.headless=true', '-Dsun.net.http.retryPost=false', java_code_option, '-m upload', ("-u #{username.shellescape}" unless use_jwt), ("-p #{password.shellescape}" unless use_jwt), ("-jwt #{jwt}" if use_jwt), file_upload_option(source), additional_upload_parameters, # that's here, because the user might overwrite the -t option '-k 100000', ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?), '2>&1' # cause stderr to be written to stdout ].compact.join(' ') # compact gets rid of the possibly nil ENV value end end |
#build_verify_command(username, password, source = "/tmp", provider_short_name = "", jwt = nil) ⇒ Object
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 321 def build_verify_command(username, password, source = "/tmp", provider_short_name = "", jwt = nil) use_jwt = !jwt.to_s.empty? if !Helper.user_defined_itms_path? && Helper.mac? && Helper.xcode_at_least?(11) [ ("ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}" unless use_jwt), 'xcrun iTMSTransporter', '-m verify', ("-u #{username.shellescape}" unless use_jwt), ("-p @env:ITMS_TRANSPORTER_PASSWORD" unless use_jwt), ("-jwt #{jwt}" if use_jwt), "-f #{source.shellescape}", ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?), '2>&1' # cause stderr to be written to stdout ].compact.join(' ') # compact gets rid of the possibly nil ENV value else [ Helper.transporter_java_executable_path.shellescape, "-Djava.ext.dirs=#{Helper.transporter_java_ext_dir.shellescape}", '-XX:NewSize=2m', '-Xms32m', '-Xmx1024m', '-Xms1024m', '-Djava.awt.headless=true', '-Dsun.net.http.retryPost=false', java_code_option, '-m verify', ("-u #{username.shellescape}" unless use_jwt), ("-p #{password.shellescape}" unless use_jwt), ("-jwt #{jwt}" if use_jwt), "-f #{source.shellescape}", ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?), '2>&1' # cause stderr to be written to stdout ].compact.join(' ') # compact gets rid of the possibly nil ENV value end end |
#execute(command, hide_output) ⇒ Object
443 444 445 446 447 448 449 450 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 443 def execute(command, hide_output) # The Java command needs to be run starting in a working directory in the iTMSTransporter # file area. The shell script takes care of changing directories over to there, but we'll # handle it manually here for this strategy. FileUtils.cd(Helper.itms_path) do return super(command, hide_output) end end |
#handle_error(password) ⇒ Object
435 436 437 438 439 440 441 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 435 def handle_error(password) unless File.exist?(Helper.transporter_java_jar_path) UI.error("The iTMSTransporter Java app was not found at '#{Helper.transporter_java_jar_path}'.") UI.error("If you're using Xcode 6, please select the shell script executor by setting the environment variable "\ "FASTLANE_ITUNES_TRANSPORTER_USE_SHELL_SCRIPT=1") end end |
#java_code_option ⇒ Object
427 428 429 430 431 432 433 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 427 def java_code_option if Helper.mac? && Helper.xcode_at_least?(9) return "-jar #{Helper.transporter_java_jar_path.shellescape}" else return "-classpath #{Helper.transporter_java_jar_path.shellescape} com.apple.transporter.Application" end end |