Skip to content

Commit

Permalink
[scan] resort and group options (fastlane#13711)
Browse files Browse the repository at this point in the history
* resort and group scan options

* wrap example toolchain in backticks

* wrap .xctestrun in backticks

* finish sorting

* fix
  • Loading branch information
janpio authored and Josh Holtz committed Dec 10, 2018
1 parent cd000a6 commit efb7a6f
Showing 1 changed file with 105 additions and 86 deletions.
191 changes: 105 additions & 86 deletions scan/lib/scan/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def self.available_options
containing = FastlaneCore::Helper.fastlane_enabled_folder_path

[
# app to test
FastlaneCore::ConfigItem.new(key: :workspace,
short_option: "-w",
env_name: "SCAN_WORKSPACE",
Expand All @@ -35,6 +36,13 @@ def self.available_options
UI.user_error!("Project file invalid") unless File.directory?(v)
UI.user_error!("Project file is not a project file, must end with .xcodeproj") unless v.include?(".xcodeproj")
end),
FastlaneCore::ConfigItem.new(key: :scheme,
short_option: "-s",
optional: true,
env_name: "SCAN_SCHEME",
description: "The project's scheme. Make sure it's marked as `Shared`"),

# device (simulator) to use for testing
FastlaneCore::ConfigItem.new(key: :device,
short_option: "-a",
optional: true,
Expand All @@ -45,12 +53,6 @@ def self.available_options
conflict_block: proc do |value|
UI.user_error!("You can't use 'device' and 'devices' options in one run")
end),
FastlaneCore::ConfigItem.new(key: :toolchain,
env_name: "SCAN_TOOLCHAIN",
conflicting_options: [:xctestrun],
description: "The toolchain that should be used for building the application (e.g. com.apple.dt.toolchain.Swift_2_3, org.swift.30p620160816a)",
optional: true,
is_string: false),
FastlaneCore::ConfigItem.new(key: :devices,
optional: true,
is_string: false,
Expand All @@ -66,11 +68,53 @@ def self.available_options
default_value: false,
type: Boolean,
optional: true),
FastlaneCore::ConfigItem.new(key: :scheme,
short_option: "-s",

# reinstall app
FastlaneCore::ConfigItem.new(key: :reinstall_app,
env_name: 'SCAN_REINSTALL_APP',
description: "Enabling this option will automatically uninstall the application before running it",
default_value: false,
is_string: false),
FastlaneCore::ConfigItem.new(key: :app_identifier,
env_name: 'SCAN_APP_IDENTIFIER',
optional: true,
env_name: "SCAN_SCHEME",
description: "The project's scheme. Make sure it's marked as `Shared`"),
description: "The bundle identifier of the app to uninstall (only needed when enabling reinstall_app)",
code_gen_sensitive: true,
default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier),
default_value_dynamic: true),

# tests to run
FastlaneCore::ConfigItem.new(key: :only_testing,
env_name: "SCAN_ONLY_TESTING",
description: "Array of strings matching Test Bundle/Test Suite/Test Cases to run",
optional: true,
is_string: false,
verify_block: proc do |value|
verify_type('only_testing', [Array, String], value)
end),
FastlaneCore::ConfigItem.new(key: :skip_testing,
env_name: "SCAN_SKIP_TESTING",
description: "Array of strings matching Test Bundle/Test Suite/Test Cases to skip",
optional: true,
is_string: false,
verify_block: proc do |value|
verify_type('skip_testing', [Array, String], value)
end),

# other test options
FastlaneCore::ConfigItem.new(key: :xctestrun,
short_option: "-X",
env_name: "SCAN_XCTESTRUN",
description: "Run tests using the provided `.xctestrun` file",
conflicting_options: [:build_for_testing],
is_string: true,
optional: true),
FastlaneCore::ConfigItem.new(key: :toolchain,
env_name: "SCAN_TOOLCHAIN",
conflicting_options: [:xctestrun],
description: "The toolchain that should be used for building the application (e.g. `com.apple.dt.toolchain.Swift_2_3, org.swift.30p620160816a`)",
optional: true,
is_string: false),
FastlaneCore::ConfigItem.new(key: :clean,
short_option: "-c",
env_name: "SCAN_CLEAN",
Expand Down Expand Up @@ -100,12 +144,13 @@ def self.available_options
conflict_block: proc do |value|
UI.user_error!("You can't use 'thread_sanitizer' and 'address_sanitizer' options in one run")
end),
FastlaneCore::ConfigItem.new(key: :skip_build,
description: "Should debug build be skipped before test build?",
short_option: "-r",
env_name: "SCAN_SKIP_BUILD",

# output
FastlaneCore::ConfigItem.new(key: :open_report,
short_option: "-g",
env_name: "SCAN_OPEN_REPORT",
description: "Should the HTML report be opened when tests are completed?",
is_string: false,
type: Boolean,
default_value: false),
FastlaneCore::ConfigItem.new(key: :output_directory,
short_option: "-o",
Expand Down Expand Up @@ -161,6 +206,31 @@ def self.available_options
description: "Pass in xcpretty additional command line arguments (e.g. '--test --no-color' or '--tap --no-utf')",
type: String,
optional: true),
FastlaneCore::ConfigItem.new(key: :derived_data_path,
short_option: "-j",
env_name: "SCAN_DERIVED_DATA_PATH",
description: "The directory where build products and other derived data will go",
optional: true),
FastlaneCore::ConfigItem.new(key: :should_zip_build_products,
short_option: "-Z",
env_name: "SCAN_SHOULD_ZIP_BUILD_PRODUCTS",
description: "Should zip the derived data build products and place in output path?",
optional: true,
is_string: false,
default_value: false),
FastlaneCore::ConfigItem.new(key: :result_bundle,
short_option: "-z",
env_name: "SCAN_RESULT_BUNDLE",
is_string: false,
description: "Should an Xcode result bundle be generated in the output directory",
default_value: false,
optional: true),
FastlaneCore::ConfigItem.new(key: :use_clang_report_name,
description: "Generate the json compilation database with clang naming convention (compile_commands.json)",
is_string: false,
default_value: false),

# concurrency
FastlaneCore::ConfigItem.new(key: :max_concurrent_simulators,
type: Integer,
env_name: "SCAN_MAX_CONCURRENT_SIMULATORS",
Expand All @@ -173,6 +243,14 @@ def self.available_options
description: "Do not run test bundles in parallel on the specified destinations. Testing will occur on each destination serially. Equivalent to -disable-concurrent-testing",
optional: true),

# build
FastlaneCore::ConfigItem.new(key: :skip_build,
description: "Should debug build be skipped before test build?",
short_option: "-r",
env_name: "SCAN_SKIP_BUILD",
is_string: false,
type: Boolean,
default_value: false),
FastlaneCore::ConfigItem.new(key: :test_without_building,
short_option: "-T",
env_name: "SCAN_TEST_WITHOUT_BUILDING",
Expand All @@ -189,55 +267,17 @@ def self.available_options
is_string: false,
type: Boolean,
optional: true),
FastlaneCore::ConfigItem.new(key: :xctestrun,
short_option: "-X",
env_name: "SCAN_XCTESTRUN",
description: "Run tests using the provided .xctestrun file",
conflicting_options: [:build_for_testing],
is_string: true,
optional: true),
FastlaneCore::ConfigItem.new(key: :derived_data_path,
short_option: "-j",
env_name: "SCAN_DERIVED_DATA_PATH",
description: "The directory where build products and other derived data will go",
optional: true),
FastlaneCore::ConfigItem.new(key: :should_zip_build_products,
short_option: "-Z",
env_name: "SCAN_SHOULD_ZIP_BUILD_PRODUCTS",
description: "Should zip the derived data build products and place in output path?",
optional: true,
is_string: false,
default_value: false),
FastlaneCore::ConfigItem.new(key: :result_bundle,
short_option: "-z",
env_name: "SCAN_RESULT_BUNDLE",
is_string: false,
description: "Should an Xcode result bundle be generated in the output directory",
default_value: false,
optional: true),
FastlaneCore::ConfigItem.new(key: :sdk,
short_option: "-k",
env_name: "SCAN_SDK",
description: "The SDK that should be used for building the application",
optional: true),
FastlaneCore::ConfigItem.new(key: :open_report,
short_option: "-g",
env_name: "SCAN_OPEN_REPORT",
description: "Should the HTML report be opened when tests are completed?",
is_string: false,
default_value: false),
FastlaneCore::ConfigItem.new(key: :configuration,
short_option: "-q",
env_name: "SCAN_CONFIGURATION",
description: "The configuration to use when building the app. Defaults to 'Release'",
default_value_dynamic: true,
optional: true),
FastlaneCore::ConfigItem.new(key: :destination,
short_option: "-d",
env_name: "SCAN_DESTINATION",
description: "Use only if you're a pro, use the other options instead",
is_string: false,
optional: true),
FastlaneCore::ConfigItem.new(key: :xcargs,
short_option: "-x",
env_name: "SCAN_XCARGS",
Expand All @@ -252,22 +292,8 @@ def self.available_options
verify_block: proc do |value|
UI.user_error!("File not found at path '#{File.expand_path(value)}'") unless File.exist?(value)
end),
FastlaneCore::ConfigItem.new(key: :only_testing,
env_name: "SCAN_ONLY_TESTING",
description: "Array of strings matching Test Bundle/Test Suite/Test Cases to run",
optional: true,
is_string: false,
verify_block: proc do |value|
verify_type('only_testing', [Array, String], value)
end),
FastlaneCore::ConfigItem.new(key: :skip_testing,
env_name: "SCAN_SKIP_TESTING",
description: "Array of strings matching Test Bundle/Test Suite/Test Cases to skip",
optional: true,
is_string: false,
verify_block: proc do |value|
verify_type('skip_testing', [Array, String], value)
end),

# slack
FastlaneCore::ConfigItem.new(key: :slack_url,
short_option: "-i",
env_name: "SLACK_URL",
Expand Down Expand Up @@ -297,29 +323,22 @@ def self.available_options
description: "Only post on Slack if the tests fail",
is_string: false,
default_value: false),
FastlaneCore::ConfigItem.new(key: :use_clang_report_name,
description: "Generate the json compilation database with clang naming convention (compile_commands.json)",
is_string: false,
default_value: false),

# misc
FastlaneCore::ConfigItem.new(key: :destination,
short_option: "-d",
env_name: "SCAN_DESTINATION",
description: "Use only if you're a pro, use the other options instead",
is_string: false,
optional: true),
FastlaneCore::ConfigItem.new(key: :custom_report_file_name,
env_name: "SCAN_CUSTOM_REPORT_FILE_NAME",
description: "Sets custom full report file name when generating a single report",
deprecated: "Use `--output_files` instead",
conflicting_options: [:output_files],
optional: true,
is_string: true),
FastlaneCore::ConfigItem.new(key: :app_identifier,
env_name: 'SCAN_APP_IDENTIFIER',
optional: true,
description: "The bundle identifier of the app to uninstall (only needed when enabling reinstall_app)",
code_gen_sensitive: true,
default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier),
default_value_dynamic: true),
FastlaneCore::ConfigItem.new(key: :reinstall_app,
env_name: 'SCAN_REINSTALL_APP',
description: "Enabling this option will automatically uninstall the application before running it",
default_value: false,
is_string: false)
is_string: true)

]
end
end
Expand Down

0 comments on commit efb7a6f

Please sign in to comment.