diff --git a/bitrise.yml b/bitrise.yml index 0c83e41a..c29d0f4c 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -1,4 +1,4 @@ -format_version: 8 +format_version: 11 default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git app: @@ -6,273 +6,34 @@ app: - ORIG_BITRISE_SOURCE_DIR: $BITRISE_SOURCE_DIR workflows: - ci: - before_run: - - audit-this-step + check: steps: - - go-list: {} - - golint: {} - - errcheck: {} - - go-test: {} - after_run: - - test + - git::https://github.com/bitrise-steplib/steps-check.git: {} - test: - after_run: - # headless tests first, as otherwise running emulator is reused - - ci-objc_headless_mode - - _script_wrapper_for_headless_failing_ui_test - - ci-objc_headless_mode_xcpretty - - ci-parallel_headless_mode - - tvos_headless_mode - - debug: - envs: - # Remote or local URL - - SAMPLE_APP_URL: $SAMPLE_APP_URL - - SAMPLE_APP_BRANCH: $SAMPLE_APP_BRANCH # main - - BITRISE_PROJECT_PATH: $BITRISE_PROJECT_PATH - - BITRISE_SCHEME: $BITRISE_SCHEME - - SIMULATOR_DEVICE: $SIMULATOR_DEVICE # iPhone 8 Plus - - SIMULATOR_OS_VERSION: $SIMULATOR_OS_VERSION # latest - - SIMULATOR_PLATFORM: $SIMULATOR_PLATFORM # iOS Simulator - - OUTPUT_TOOL: xcpretty - - HEADLESS_MODE: "yes" - - RETRY_ON_FAIL: "yes" - after_run: - - _test - - check_exported_artifacts - - manual_test-retry_after_fail: - envs: - - SAMPLE_APP_URL: https://github.com/bitrise-io/sample-apps-ios-simple-objc-with-uitest.git - - SAMPLE_APP_BRANCH: failing-ui-test - - OUTPUT_TOOL: xcpretty - - BITRISE_PROJECT_PATH: ios-simple-objc/ios-simple-objc.xcodeproj - - BITRISE_SCHEME: ios-simple-objc - - SIMULATOR_DEVICE: iPhone 8 Plus - - SIMULATOR_PLATFORM: iOS Simulator - - HEADLESS_MODE: "yes" - - RETRY_ON_FAIL: "yes" - after_run: - - _test - - check_exported_artifacts - - ci-objc_headless_mode: - envs: - - SAMPLE_APP_URL: https://github.com/bitrise-io/sample-apps-ios-simple-objc-with-uitest.git - - SAMPLE_APP_BRANCH: master - - OUTPUT_TOOL: xcodebuild - - BITRISE_PROJECT_PATH: ios-simple-objc/ios-simple-objc.xcodeproj - - BITRISE_SCHEME: ios-simple-objc - - SIMULATOR_DEVICE: iPhone 8 Plus - - SIMULATOR_OS_VERSION: "latest" - - SIMULATOR_PLATFORM: iOS Simulator - - HEADLESS_MODE: "yes" - - RETRY_ON_FAIL: "no" - after_run: - - _test - - check_exported_artifacts - - ci-objc_headless_mode_xcpretty: - envs: - - SAMPLE_APP_URL: https://github.com/bitrise-io/sample-apps-ios-simple-objc-with-uitest.git - - SAMPLE_APP_BRANCH: master - - OUTPUT_TOOL: xcpretty - - BITRISE_PROJECT_PATH: ios-simple-objc/ios-simple-objc.xcodeproj - - BITRISE_SCHEME: ios-simple-objc - - SIMULATOR_DEVICE: iPhone 8 Plus - - SIMULATOR_OS_VERSION: "latest" - - SIMULATOR_PLATFORM: iOS Simulator - - HEADLESS_MODE: "yes" - - RETRY_ON_FAIL: "no" - after_run: - - _test - - check_exported_artifacts - - check_xcpretty_html_report - - _script_wrapper_for_headless_failing_ui_test: - steps: - - script: - title: Start a failing workflow, wrapped in a script. - inputs: - - content: |- - #!/bin/env bash - bitrise run ci-objc_headless_mode_failing_ui_test - if [ $? -ne 1 ] ; then - echo "Workflow was excepted to fail, exit code not 1." - exit 1 - fi - - ci-objc_headless_mode_failing_ui_test: + sample: envs: - - SAMPLE_APP_URL: https://github.com/bitrise-io/sample-apps-ios-simple-objc-with-uitest.git - - SAMPLE_APP_BRANCH: failing-ui-test - - OUTPUT_TOOL: xcodebuild + - TEST_APP_URL: https://github.com/bitrise-io/sample-apps-ios-simple-objc-with-uitest.git # Remote or local URL + - TEST_APP_BRANCH: master - BITRISE_PROJECT_PATH: ios-simple-objc/ios-simple-objc.xcodeproj - BITRISE_SCHEME: ios-simple-objc - - SIMULATOR_DEVICE: iPhone 8 Plus - - SIMULATOR_OS_VERSION: "latest" - - SIMULATOR_PLATFORM: iOS Simulator - - HEADLESS_MODE: "yes" - - RETRY_ON_FAIL: "no" - after_run: - - _test - - check_exported_artifacts - - tvos_headless_mode: - envs: - - SAMPLE_APP_URL: https://github.com/bitrise-io/sample-apps-tvos-swift.git - - SAMPLE_APP_BRANCH: master - - OUTPUT_TOOL: xcodebuild - - BITRISE_PROJECT_PATH: NPO Live.xcworkspace - - BITRISE_SCHEME: NPO Live - - SIMULATOR_DEVICE: Apple TV - - SIMULATOR_OS_VERSION: "latest" - - SIMULATOR_PLATFORM: tvOS Simulator - - HEADLESS_MODE: "yes" - - RETRY_ON_FAIL: "no" - after_run: - - _test - - ci-parallel_headless_mode: - envs: - - SAMPLE_APP_URL: https://github.com/bitrise-io/sample-swift-project-with-parallel-ui-test.git - - SAMPLE_APP_BRANCH: master - - OUTPUT_TOOL: xcodebuild - - BITRISE_PROJECT_PATH: BullsEye.xcodeproj - - BITRISE_SCHEME: BullsEye - - SIMULATOR_DEVICE: iPhone 8 Plus - - SIMULATOR_OS_VERSION: "latest" - - SIMULATOR_PLATFORM: iOS Simulator - - HEADLESS_MODE: "yes" - - RETRY_ON_FAIL: "no" - after_run: - - _test - - _test: steps: - script: inputs: - content: |- #!/bin/env bash - set -e - set -v + set -ex rm -rf ./_tmp - - change-workdir: - title: Switch working dir to test / _tmp dir - run_if: true - inputs: - - path: ./_tmp - - is_create_path: true - - script: - inputs: - - content: |- - #!/bin/env bash - echo BITRISE_SOURCE_DIR: ${BITRISE_SOURCE_DIR} - echo ORIG_BITRISE_SOURCE_DIR: ${ORIG_BITRISE_SOURCE_DIR} - echo working directory: $(pwd) - - git::https://github.com/bitrise-steplib/bitrise-step-simple-git-clone.git@master: + - git::https://github.com/bitrise-steplib/bitrise-step-simple-git-clone.git: inputs: - - repository_url: $SAMPLE_APP_URL - - clone_into_dir: . - - branch: $SAMPLE_APP_BRANCH - - certificate-and-profile-installer: {} + - repository_url: $TEST_APP_URL + - branch: $TEST_APP_BRANCH + - clone_into_dir: ./_tmp - path::./: inputs: - - output_tool: $OUTPUT_TOOL - - is_clean_build: "yes" - - should_retry_test_on_fail: $RETRY_ON_FAIL - - generate_code_coverage_files: "no" - - simulator_device: $SIMULATOR_DEVICE - - simulator_os_version: $SIMULATOR_OS_VERSION - - simulator_platform: $SIMULATOR_PLATFORM - - should_build_before_test: "yes" + # Inputs with non-default value or using environemnt variables + - project_path: ./_tmp/$BITRISE_PROJECT_PATH + - scheme: $BITRISE_SCHEME - xcodebuild_test_options: -verbose - export_uitest_artifacts: "true" - verbose: "yes" - - collect_simulator_diagnostics: "never" - - headless_mode: $HEADLESS_MODE - - script: - title: Output test - is_always_run: true - inputs: - - content: |- - echo "BITRISE_XCODE_TEST_RESULT: ${BITRISE_XCODE_TEST_RESULT}" - if [ ! -f "$BITRISE_XCODE_RAW_TEST_RESULT_TEXT_PATH" ] ; then - echo "No BITRISE_XCODE_RAW_TEST_RESULT_TEXT_PATH file generated!" - exit 1 - fi - - if [ ! -d $BITRISE_XCRESULT_PATH ]; then - echo "Xcode results not found in $BITRISE_XCRESULT_PATH" - exit 1 - fi - zip -rTy $BITRISE_DEPLOY_DIR/Test.xcresult$(gdate +%Y%m%d%H%M%S).zip $BITRISE_XCRESULT_PATH > /dev/null - - # Check and REMOVE test-info.json - if [ $(find ${BITRISE_TEST_DEPLOY_DIR} -type f -delete -print -regex "${BITRISE_TEST_DEPLOY_DIR}/.*/${BITRISE_SCHEME}/test-info\.json" | grep -q .) ]; then - echo "${BITRISE_TEST_DEPLOY_DIR} does not contain test-info.json." - exit 1 - fi - - echo "BITRISE_XCODE_RAW_TEST_RESULT_TEXT_PATH: ${BITRISE_XCODE_RAW_TEST_RESULT_TEXT_PATH}" - echo "BITRISE_XCODE_TEST_ATTACHMENTS_PATH: ${BITRISE_XCODE_TEST_ATTACHMENTS_PATH}" - echo "BITRISE_XCRESULT_PATH: $BITRISE_XCRESULT_PATH" - echo "BITRISE_TEST_DEPLOY_DIR: $BITRISE_TEST_DEPLOY_DIR" - - change-workdir: - title: Switch back to work dir at the start. - inputs: - - path: ${ORIG_BITRISE_SOURCE_DIR} - - check_exported_artifacts: - steps: - - script: - title: Exported attachment test - is_always_run: true - inputs: - - content: |- - #!/bin/env bash - set -e - version=`xcodebuild -version` - regex="Xcode ([0-9]*)." - if [[ $version =~ $regex ]]; then - if [[ ${BASH_REMATCH[1]} -ge 11 ]]; then - exit 0 - fi - fi - if [ ! -f $BITRISE_DEPLOY_DIR/ios-simple-objc-xc-test-Attachments.zip ]; then - echo "Exported artifacts - ios-simple-objc-xc-test-Attachments.zip - not found in $BITRISE_DEPLOY_DIR" - exit 1 - fi - - echo "Exported attachments found: $BITRISE_DEPLOY_DIR/ios-simple-objc-xc-test-Attachments.zip" - - check_xcpretty_html_report: - steps: - - script: - title: Check xcpretty html report - is_always_run: true - inputs: - - content: |- - #!/bin/env bash - set -e - - if [ ! -f $BITRISE_DEPLOY_DIR/xcode-test-results-ios-simple-objc.html ]; then - echo "Exported xcpretty html report - xcode-test-results-ios-simple-objc.html - not found in $BITRISE_DEPLOY_DIR" - exit 1 - fi - - echo "Exported xcpretty html report found: $BITRISE_DEPLOY_DIR/xcode-test-results-ios-simple-objc.html" - - # ---------------------------------------------------------------- - # --- workflows to Share this step into a Step Library - audit-this-step: - steps: - - script: - inputs: - - content: |- - #!/bin/env bash - set -ex - stepman audit --step-yml ./step.yml diff --git a/e2e/bitrise.yml b/e2e/bitrise.yml new file mode 100644 index 00000000..974de4ea --- /dev/null +++ b/e2e/bitrise.yml @@ -0,0 +1,190 @@ +format_version: 11 +default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git + +app: + envs: + - XCODE_OUTPUT_TOOL: xcodebuild + +workflows: + test_objc: + envs: + - TEST_APP_URL: https://github.com/bitrise-io/sample-apps-ios-simple-objc-with-uitest.git + - TEST_APP_BRANCH: master + - BITRISE_PROJECT_PATH: ios-simple-objc/ios-simple-objc.xcodeproj + - BITRISE_SCHEME: ios-simple-objc + - XCODE_SIMULATOR_DEVICE: iPhone 8 Plus + - XCODE_SIMULATOR_OS_VERSION: "latest" + - XCODE_SIMULATOR_PLATFORM: iOS Simulator + after_run: + - _run + - _check_outputs + - _check_exported_artifacts + + test_objc_xcpretty: + envs: + - TEST_APP_URL: https://github.com/bitrise-io/sample-apps-ios-simple-objc-with-uitest.git + - TEST_APP_BRANCH: master + - XCODE_OUTPUT_TOOL: xcpretty + - BITRISE_PROJECT_PATH: ios-simple-objc/ios-simple-objc.xcodeproj + - BITRISE_SCHEME: ios-simple-objc + - XCODE_SIMULATOR_DEVICE: iPhone 8 Plus + - XCODE_SIMULATOR_OS_VERSION: "latest" + - XCODE_SIMULATOR_PLATFORM: iOS Simulator + after_run: + - _run + - _check_outputs + - _check_exported_artifacts + - _check_xcpretty_html_report + + test_failing_ui_test: + steps: + - script: + title: Start a failing workflow, wrapped in a script. + inputs: + - content: |- + #!/bin/env bash + set -x # Do not set -e as bitrise command is excepted to fail + bitrise run --config=./e2e/bitrise.yml utility_objc_failing_ui_test + if [ $? -ne 1 ] ; then + echo "Workflow was excepted to fail, exit code not 1." + exit 1 + fi + + utility_objc_failing_ui_test: + envs: + - TEST_APP_URL: https://github.com/bitrise-io/sample-apps-ios-simple-objc-with-uitest.git + - TEST_APP_BRANCH: failing-ui-test + - BITRISE_PROJECT_PATH: ios-simple-objc/ios-simple-objc.xcodeproj + - BITRISE_SCHEME: ios-simple-objc + - XCODE_SIMULATOR_DEVICE: iPhone 8 Plus + - XCODE_SIMULATOR_OS_VERSION: "latest" + - XCODE_SIMULATOR_PLATFORM: iOS Simulator + after_run: + - _run + - _check_outputs + - _check_exported_artifacts + + test_tvos: + envs: + - TEST_APP_URL: https://github.com/bitrise-io/sample-apps-tvos-swift.git + - TEST_APP_BRANCH: master + - BITRISE_PROJECT_PATH: NPO Live.xcworkspace + - BITRISE_SCHEME: NPO Live + - XCODE_SIMULATOR_DEVICE: Apple TV + - XCODE_SIMULATOR_OS_VERSION: "latest" + - XCODE_SIMULATOR_PLATFORM: tvOS Simulator + after_run: + - _run + - _check_outputs + + test_parallel: + envs: + - TEST_APP_URL: https://github.com/bitrise-io/sample-swift-project-with-parallel-ui-test.git + - TEST_APP_BRANCH: master + - BITRISE_PROJECT_PATH: BullsEye.xcodeproj + - BITRISE_SCHEME: BullsEye + - XCODE_SIMULATOR_DEVICE: iPhone 8 Plus + - XCODE_SIMULATOR_OS_VERSION: "latest" + - XCODE_SIMULATOR_PLATFORM: iOS Simulator + after_run: + - _run + - _check_outputs + + _run: + steps: + - script: + inputs: + - content: |- + #!/bin/env bash + set -ex + rm -rf ./_tmp + - git::https://github.com/bitrise-steplib/bitrise-step-simple-git-clone.git: + inputs: + - repository_url: $TEST_APP_URL + - clone_into_dir: ./_tmp + - branch: $TEST_APP_BRANCH + - certificate-and-profile-installer: {} + - path::./: + inputs: + - project_path: ./_tmp/$BITRISE_PROJECT_PATH + - scheme: $BITRISE_SCHEME + - output_tool: $XCODE_OUTPUT_TOOL + - simulator_device: $XCODE_SIMULATOR_DEVICE + - simulator_os_version: $XCODE_SIMULATOR_OS_VERSION + - simulator_platform: $XCODE_SIMULATOR_PLATFORM + - is_clean_build: "yes" + - should_build_before_test: "yes" + - xcodebuild_test_options: -verbose + - export_uitest_artifacts: "true" + - verbose: "yes" + + _check_outputs: + steps: + - script: + title: Output test + is_always_run: true + inputs: + - content: |- + echo "BITRISE_XCODE_TEST_RESULT: ${BITRISE_XCODE_TEST_RESULT}" + if [ ! -f "$BITRISE_XCODE_RAW_TEST_RESULT_TEXT_PATH" ] ; then + echo "No BITRISE_XCODE_RAW_TEST_RESULT_TEXT_PATH file generated!" + exit 1 + fi + + if [ ! -d $BITRISE_XCRESULT_PATH ]; then + echo "Xcode results not found in $BITRISE_XCRESULT_PATH" + exit 1 + fi + zip -rTy $BITRISE_DEPLOY_DIR/Test.xcresult$(gdate +%Y%m%d%H%M%S).zip $BITRISE_XCRESULT_PATH > /dev/null + + # Check and REMOVE test-info.json + if [ $(find ${BITRISE_TEST_DEPLOY_DIR} -type f -delete -print -regex "${BITRISE_TEST_DEPLOY_DIR}/.*/${BITRISE_SCHEME}/test-info\.json" | grep -q .) ]; then + echo "${BITRISE_TEST_DEPLOY_DIR} does not contain test-info.json." + exit 1 + fi + + echo "BITRISE_XCODE_RAW_TEST_RESULT_TEXT_PATH: ${BITRISE_XCODE_RAW_TEST_RESULT_TEXT_PATH}" + echo "BITRISE_XCODE_TEST_ATTACHMENTS_PATH: ${BITRISE_XCODE_TEST_ATTACHMENTS_PATH}" + echo "BITRISE_XCRESULT_PATH: $BITRISE_XCRESULT_PATH" + echo "BITRISE_TEST_DEPLOY_DIR: $BITRISE_TEST_DEPLOY_DIR" + + _check_exported_artifacts: + steps: + - script: + title: Exported attachment test + is_always_run: true + inputs: + - content: |- + #!/bin/env bash + set -e + version=`xcodebuild -version` + regex="Xcode ([0-9]*)." + if [[ $version =~ $regex ]]; then + if [[ ${BASH_REMATCH[1]} -ge 11 ]]; then + exit 0 + fi + fi + + if [ ! -f $BITRISE_DEPLOY_DIR/ios-simple-objc-xc-test-Attachments.zip ]; then + echo "Exported artifacts - ios-simple-objc-xc-test-Attachments.zip - not found in $BITRISE_DEPLOY_DIR" + exit 1 + fi + + echo "Exported attachments found: $BITRISE_DEPLOY_DIR/ios-simple-objc-xc-test-Attachments.zip" + + _check_xcpretty_html_report: + steps: + - script: + title: Check xcpretty html report + is_always_run: true + inputs: + - content: |- + #!/bin/env bash + set -e + + if [ ! -f $BITRISE_DEPLOY_DIR/xcode-test-results-ios-simple-objc.html ]; then + echo "Exported xcpretty html report - xcode-test-results-ios-simple-objc.html - not found in $BITRISE_DEPLOY_DIR" + exit 1 + fi + + echo "Exported xcpretty html report found: $BITRISE_DEPLOY_DIR/xcode-test-results-ios-simple-objc.html" diff --git a/go.mod b/go.mod index 9c7b527f..bcd6bb85 100644 --- a/go.mod +++ b/go.mod @@ -3,16 +3,14 @@ module github.com/bitrise-steplib/steps-xcode-test go 1.16 require ( - github.com/bitrise-io/bitrise v0.0.0-20210513161711-09b1442cf3e0 - github.com/bitrise-io/go-steputils v0.0.0-20210507072936-92fde382fb33 - github.com/bitrise-io/go-utils v0.0.0-20210507100250-37de47dfa6ce - github.com/bitrise-io/go-xcode v0.0.0-20210512084902-047d3c3d372a + github.com/bitrise-io/bitrise v0.0.0-20210519130014-380842fb41c1 + github.com/bitrise-io/go-steputils v0.0.0-20210527075147-910ce7a105a1 + github.com/bitrise-io/go-utils v0.0.0-20210520073355-367fa34178f5 + github.com/bitrise-io/go-xcode v0.0.0-20210521101355-fb6a1eb6e05b github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.0 // indirect github.com/hashicorp/go-version v1.3.0 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/stretchr/testify v1.7.0 - golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect - golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect - golang.org/x/text v0.3.6 // indirect + golang.org/x/sys v0.0.0-20210531080801-fdfd190a6549 // indirect ) diff --git a/go.sum b/go.sum index 256a79a6..b03c0382 100644 --- a/go.sum +++ b/go.sum @@ -1,30 +1,29 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/bitrise-io/bitrise v0.0.0-20210513161711-09b1442cf3e0 h1:Ym7cBQs7pqKEEp5eD/snnXKQse6sQr4ouijrHjpaU2Q= -github.com/bitrise-io/bitrise v0.0.0-20210513161711-09b1442cf3e0/go.mod h1:Jqf2PLwOKL1bYdbQIhVkNd55YyYKJBXyY0EtlRg5uw4= +github.com/bitrise-io/bitrise v0.0.0-20210519130014-380842fb41c1 h1:PERqeGZZkMrGYSSN/Stk+YkhErgdk37aVqc5UgnIEoo= +github.com/bitrise-io/bitrise v0.0.0-20210519130014-380842fb41c1/go.mod h1:Jqf2PLwOKL1bYdbQIhVkNd55YyYKJBXyY0EtlRg5uw4= github.com/bitrise-io/colorstring v0.0.0-20180614154802-a8cd70115192/go.mod h1:CIHVcxZUvsG99XUJV6JlR7okNsMMGY81jMvPC20W+O0= github.com/bitrise-io/envman v0.0.0-20200512105748-919e33f391ee/go.mod h1:m8pTp1o3Sw9uzDxb1WRm5IBRnMau2iOvPMSnRCAhQNI= -github.com/bitrise-io/go-steputils v0.0.0-20210507072936-92fde382fb33 h1:4QpxkX2oNefww7k76ZUD4C7unfP4c8H0c0QP7SdfrTQ= -github.com/bitrise-io/go-steputils v0.0.0-20210507072936-92fde382fb33/go.mod h1:YCtb1VETn/rF9tCt9oInhd/cwbt1ETPm+dTlDIfyD+A= -github.com/bitrise-io/go-utils v0.0.0-20201019131314-6cc2aa4d248a/go.mod h1:tTEsKvbz1LbzuN/KpVFHXnLtcAPdEgIdM41s0lL407s= +github.com/bitrise-io/go-plist v0.0.0-20210301100253-4b1a112ccd10/go.mod h1:pARutiL3kEuRLV3JvswidvfCj+9Y3qMZtji2BDqLFsA= +github.com/bitrise-io/go-steputils v0.0.0-20210514150206-5b6261447e77/go.mod h1:H0iZjgsAR5NA6pnlD/zKB6AbxEsskq55pwJ9klVmP8w= +github.com/bitrise-io/go-steputils v0.0.0-20210527075147-910ce7a105a1 h1:gi29hTdxGXAGQvZckPZ9V8BAEfP3eK/tiZgTC5s6h1c= +github.com/bitrise-io/go-steputils v0.0.0-20210527075147-910ce7a105a1/go.mod h1:H0iZjgsAR5NA6pnlD/zKB6AbxEsskq55pwJ9klVmP8w= github.com/bitrise-io/go-utils v0.0.0-20210505091801-98b7dc39ee61/go.mod h1:nhdaDQFvaMny1CugVV6KjK92/q97ENo0RuKSW5I4fbA= github.com/bitrise-io/go-utils v0.0.0-20210505121718-07411d72e36e/go.mod h1:nhdaDQFvaMny1CugVV6KjK92/q97ENo0RuKSW5I4fbA= -github.com/bitrise-io/go-utils v0.0.0-20210506064210-b22e2b7b3ad3/go.mod h1:nhdaDQFvaMny1CugVV6KjK92/q97ENo0RuKSW5I4fbA= -github.com/bitrise-io/go-utils v0.0.0-20210507100250-37de47dfa6ce h1:z9t020cBpCZdwO4teTXbj7XyLwQDvMcMmfnhHe36mWc= github.com/bitrise-io/go-utils v0.0.0-20210507100250-37de47dfa6ce/go.mod h1:15EZZf02noI5nWFqXMZEoyb1CyqYRXTMz5Fyu4CWFzI= -github.com/bitrise-io/go-xcode v0.0.0-20210512084902-047d3c3d372a h1:4XaNh674hGnNY0izax4b9VAdCfrO0m1v4YvHP2Z7xTI= -github.com/bitrise-io/go-xcode v0.0.0-20210512084902-047d3c3d372a/go.mod h1:e03FCUQftAwBAdcxVJ4/sn59M50AXqujkX/lJr/Ldak= +github.com/bitrise-io/go-utils v0.0.0-20210520073355-367fa34178f5 h1:kclxBfygfNK6kWUB+9xcsfPLBen8Us9gubhitfL/Z6c= +github.com/bitrise-io/go-utils v0.0.0-20210520073355-367fa34178f5/go.mod h1:DRx7oFuAqk0dbKpAKCqWl0TgrowfJUb/MqYPRscxJOQ= +github.com/bitrise-io/go-xcode v0.0.0-20210521101355-fb6a1eb6e05b h1:JyTlzvdOBOxtYZ7aZVCog2dZUv8LgA8UftT+TpVWtZY= +github.com/bitrise-io/go-xcode v0.0.0-20210521101355-fb6a1eb6e05b/go.mod h1:6Nv5RAsAVS745xN5IihUExVmCA9n9f7s/DSVow4hXrI= github.com/bitrise-io/goinp v0.0.0-20210504152833-8559b0680ab1/go.mod h1:iRbd8zAXLeNy+0gic0eqNCxXvDGe8ZEY/uYX2CCeAoo= github.com/bitrise-io/gows v0.0.0-20210505125306-dd92ff463938/go.mod h1:3Cp9ceJ8wHl1Av6oEE2ff1iWaYLliQuD+oaNdyM0NWQ= github.com/bitrise-io/pkcs12 v0.0.0-20210430063833-0da06eb56630/go.mod h1:UiXKNs0essbC14a2TvGlnUKo9isP9m4guPrp8KJHJpU= github.com/bitrise-io/stepman v0.0.0-20210505110307-5c2296bcc558/go.mod h1:WLh58JYBgbD1Z/yyw1AkFz/90F6oBL0HS/luBpUW9dI= -github.com/bitrise-io/xcode-project v0.0.0-20201203153351-7ad13a1dd021/go.mod h1:R2iDrjJlNQtVwIdXT+F9bcx/YTNJPdd0tXfFRJsxHaM= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -34,20 +33,18 @@ github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrj github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= -github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw= github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -63,49 +60,41 @@ github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/whilp/git-urls v1.0.0/go.mod h1:J16SAmobsqc3Qcy98brfl5f5+e0clUvg1krgwk/qCfE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200219091948-cb0a6d8edb6c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210531080801-fdfd190a6549 h1:OL5GcZ2XPkte3dpfuFQ9o884vrE3BZQhajdntNMruv4= +golang.org/x/sys v0.0.0-20210531080801-fdfd190a6549/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w= golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200220224806-8a925fa4c0df/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/viktorbenei/cobra.v0 v0.0.0-20160704194906-5513220bc3d9/go.mod h1:ES58JZUprnB7l7btSIgwT2KtWLFz7nleq84TF6wsCjg= +gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/gows.yml b/gows.yml deleted file mode 100644 index 9a2494a2..00000000 --- a/gows.yml +++ /dev/null @@ -1 +0,0 @@ -package_name: github.com/bitrise-steplib/steps-xcode-test diff --git a/step.yml b/step.yml index 3b98ae36..1bb1acc4 100644 --- a/step.yml +++ b/step.yml @@ -179,13 +179,6 @@ inputs: value_options: - "yes" - "no" - - workdir: $BITRISE_SOURCE_DIR - opts: - category: Debug - title: "Working directory" - description: |- - Working directory of the step. - You can leave it empty to leave the working directory unchanged. - is_clean_build: "no" opts: category: Debug diff --git a/vendor/github.com/bitrise-io/go-steputils/cache/cache.go b/vendor/github.com/bitrise-io/go-steputils/cache/cache.go index 51b790b5..866b1352 100644 --- a/vendor/github.com/bitrise-io/go-steputils/cache/cache.go +++ b/vendor/github.com/bitrise-io/go-steputils/cache/cache.go @@ -1,62 +1,133 @@ package cache -import "github.com/bitrise-io/go-steputils/tools" -import "os" -import "strings" +import ( + "os" + "strings" -// GlobalCachePathsEnvironmentKey ... -const GlobalCachePathsEnvironmentKey = "BITRISE_CACHE_INCLUDE_PATHS" + "github.com/bitrise-io/go-steputils/tools" +) -// GlobalCacheIgnorePathsEnvironmentKey ... -const GlobalCacheIgnorePathsEnvironmentKey = "BITRISE_CACHE_EXCLUDE_PATHS" +// CacheIncludePathsEnvKey ... +const CacheIncludePathsEnvKey = "BITRISE_CACHE_INCLUDE_PATHS" + +// CacheExcludePathsEnvKey ... +const CacheExcludePathsEnvKey = "BITRISE_CACHE_EXCLUDE_PATHS" + +// VariableSetter ... +type VariableSetter interface { + Set(key, value string) error +} + +// OSVariableSetter ... +type OSVariableSetter struct{} + +// NewOSVariableSetter ... +func NewOSVariableSetter() VariableSetter { + return OSVariableSetter{} +} + +// Set ... +func (e OSVariableSetter) Set(key, value string) error { + return os.Setenv(key, value) +} + +// EnvmanVariableSetter ... +type EnvmanVariableSetter struct { +} + +// NewEnvmanVariableSetter ... +func NewEnvmanVariableSetter() VariableSetter { + return EnvmanVariableSetter{} +} + +// Set ... +func (e EnvmanVariableSetter) Set(key, value string) error { + return tools.ExportEnvironmentWithEnvman(key, value) +} + +// VariableGetter ... +type VariableGetter interface { + Get(key string) (string, error) +} + +// OSVariableGetter ... +type OSVariableGetter struct{} + +// NewOSVariableGetter ... +func NewOSVariableGetter() VariableGetter { + return OSVariableGetter{} +} + +// Get ... +func (e OSVariableGetter) Get(key string) (string, error) { + return os.Getenv(key), nil +} // Cache ... type Cache struct { + variableGetter VariableGetter + variableSetters []VariableSetter + include []string exclude []string } +// Config ... +type Config struct { + VariableGetter VariableGetter + VariableSetters []VariableSetter +} + +// NewCache ... +func (c Config) NewCache() Cache { + return Cache{variableGetter: c.VariableGetter, variableSetters: c.VariableSetters} +} + // New ... func New() Cache { - return Cache{} + defaultConfig := Config{NewOSVariableGetter(), []VariableSetter{NewOSVariableSetter(), NewEnvmanVariableSetter()}} + return defaultConfig.NewCache() } // IncludePath ... -func (cache *Cache) IncludePath(item string) { - cache.include = append(cache.include, item) +func (cache *Cache) IncludePath(item ...string) { + cache.include = append(cache.include, item...) } // ExcludePath ... -func (cache *Cache) ExcludePath(item string) { - cache.exclude = append(cache.exclude, item) +func (cache *Cache) ExcludePath(item ...string) { + cache.exclude = append(cache.exclude, item...) } // Commit ... func (cache *Cache) Commit() error { - err := appendCacheItem(cache.include) - if err != nil { - return err - } - return appendCacheIgnoreItem(cache.exclude) -} - -func appendCacheItem(values []string) error { - return combineEnvContent(GlobalCachePathsEnvironmentKey, values) -} + commitCachePath := func(key string, values []string) error { + content, err := cache.variableGetter.Get(key) + if err != nil { + return err + } -func appendCacheIgnoreItem(values []string) error { - return combineEnvContent(GlobalCacheIgnorePathsEnvironmentKey, values) -} + if content != "" { + content += "\n" + } -func combineEnvContent(envVar string, values []string) error { - content := os.Getenv(envVar) + content += strings.Join(values, "\n") + content += "\n" - content += "\n" + strings.Join(values, "\n") + "\n" + for _, setter := range cache.variableSetters { + if err := setter.Set(key, content); err != nil { + return err + } + } + return nil + } - // Set envirmonet varible so that an other cache usage does not override - if err := os.Setenv(envVar, content); err != nil { + if err := commitCachePath(CacheIncludePathsEnvKey, cache.include); err != nil { return err } - return tools.ExportEnvironmentWithEnvman(envVar, content) + if err := commitCachePath(CacheExcludePathsEnvKey, cache.exclude); err != nil { + return err + } + return nil } diff --git a/vendor/github.com/bitrise-io/go-steputils/cache/itemcollector.go b/vendor/github.com/bitrise-io/go-steputils/cache/itemcollector.go new file mode 100644 index 00000000..28569796 --- /dev/null +++ b/vendor/github.com/bitrise-io/go-steputils/cache/itemcollector.go @@ -0,0 +1,19 @@ +package cache + +// Level defines the extent to which caching should be used. +// - LevelNone: no caching +// - LevelDeps: only dependencies will be cached +// - LevelAll: dependencies and build files will be cache +type Level string + +// Cache level +const ( + LevelNone = Level("none") + LevelDeps = Level("only_deps") + LevelAll = Level("all") +) + +// ItemCollector ... +type ItemCollector interface { + Collect(dir string, cacheLevel Level) ([]string, []string, error) +} diff --git a/vendor/github.com/bitrise-io/go-steputils/stepconf/stepconf.go b/vendor/github.com/bitrise-io/go-steputils/stepconf/stepconf.go index 9f7654af..da06ab34 100644 --- a/vendor/github.com/bitrise-io/go-steputils/stepconf/stepconf.go +++ b/vendor/github.com/bitrise-io/go-steputils/stepconf/stepconf.go @@ -102,9 +102,43 @@ func parseTag(tag string) (string, string) { return tag, "" } -// Parse populates a struct with the retrieved values from environment variables -// described by struct tags and applies the defined validations. -func Parse(conf interface{}) error { +// EnvProvider ... +type EnvProvider interface { + Getenv(key string) string +} + +// OSEnvProvider ... +type OSEnvProvider struct{} + +// NewOSEnvProvider ... +func NewOSEnvProvider() EnvProvider { + return OSEnvProvider{} +} + +// Getenv ... +func (p OSEnvProvider) Getenv(key string) string { + return os.Getenv(key) +} + +// EnvParser ... +type EnvParser struct { + envProvider EnvProvider +} + +// NewDefaultEnvParser ... +func NewDefaultEnvParser() EnvParser { + return NewEnvParser(NewOSEnvProvider()) +} + +// NewEnvParser ... +func NewEnvParser(envProvider EnvProvider) EnvParser { + return EnvParser{ + envProvider: envProvider, + } +} + +// Parse ... +func (p EnvParser) Parse(conf interface{}) error { c := reflect.ValueOf(conf) if c.Kind() != reflect.Ptr { return ErrNotStructPtr @@ -122,7 +156,7 @@ func Parse(conf interface{}) error { continue } key, constraint := parseTag(tag) - value := os.Getenv(key) + value := p.envProvider.Getenv(key) if err := setField(c.Field(i), value, constraint); err != nil { errs = append(errs, &ParseError{t.Field(i).Name, value, err}) @@ -141,6 +175,22 @@ func Parse(conf interface{}) error { return nil } +var defaultEnvParser *EnvParser + +func getDefaultEnvParser() EnvParser { + if defaultEnvParser == nil { + parser := NewDefaultEnvParser() + defaultEnvParser = &parser + } + return *defaultEnvParser +} + +// Parse populates a struct with the retrieved values from environment variables +// described by struct tags and applies the defined validations. +func Parse(conf interface{}) error { + return getDefaultEnvParser().Parse(conf) +} + func setField(field reflect.Value, value, constraint string) error { if err := validateConstraint(value, constraint); err != nil { return err diff --git a/vendor/github.com/bitrise-io/go-xcode/utility/glob.go b/vendor/github.com/bitrise-io/go-utils/pathutil/glob.go similarity index 95% rename from vendor/github.com/bitrise-io/go-xcode/utility/glob.go rename to vendor/github.com/bitrise-io/go-utils/pathutil/glob.go index 1333c6f4..232dd514 100644 --- a/vendor/github.com/bitrise-io/go-xcode/utility/glob.go +++ b/vendor/github.com/bitrise-io/go-utils/pathutil/glob.go @@ -1,4 +1,4 @@ -package utility +package pathutil // EscapeGlobPath escapes a partial path, determined at runtime, used as a parameter for filepath.Glob func EscapeGlobPath(path string) string { diff --git a/vendor/github.com/bitrise-io/go-utils/pathutil/path_filter.go b/vendor/github.com/bitrise-io/go-utils/pathutil/path_filter.go new file mode 100644 index 00000000..0bfd0fc5 --- /dev/null +++ b/vendor/github.com/bitrise-io/go-utils/pathutil/path_filter.go @@ -0,0 +1,143 @@ +package pathutil + +import ( + "errors" + "io/ioutil" + "os" + "path/filepath" + "regexp" + "strings" +) + +// FilterPaths ... +func FilterPaths(fileList []string, filters ...FilterFunc) ([]string, error) { + var filtered []string + + for _, pth := range fileList { + allowed := true + for _, filter := range filters { + if allows, err := filter(pth); err != nil { + return []string{}, err + } else if !allows { + allowed = false + break + } + } + if allowed { + filtered = append(filtered, pth) + } + } + + return filtered, nil +} + +// FilterFunc ... +type FilterFunc func(string) (bool, error) + +// BaseFilter ... +func BaseFilter(base string, allowed bool) FilterFunc { + return func(pth string) (bool, error) { + b := filepath.Base(pth) + return allowed == strings.EqualFold(base, b), nil + } +} + +// ExtensionFilter ... +func ExtensionFilter(ext string, allowed bool) FilterFunc { + return func(pth string) (bool, error) { + e := filepath.Ext(pth) + return allowed == strings.EqualFold(ext, e), nil + } +} + +// RegexpFilter ... +func RegexpFilter(pattern string, allowed bool) FilterFunc { + return func(pth string) (bool, error) { + re := regexp.MustCompile(pattern) + found := re.FindString(pth) != "" + return allowed == found, nil + } +} + +// ComponentFilter ... +func ComponentFilter(component string, allowed bool) FilterFunc { + return func(pth string) (bool, error) { + found := false + pathComponents := strings.Split(pth, string(filepath.Separator)) + for _, c := range pathComponents { + if c == component { + found = true + } + } + return allowed == found, nil + } +} + +// ComponentWithExtensionFilter ... +func ComponentWithExtensionFilter(ext string, allowed bool) FilterFunc { + return func(pth string) (bool, error) { + found := false + pathComponents := strings.Split(pth, string(filepath.Separator)) + for _, c := range pathComponents { + e := filepath.Ext(c) + if e == ext { + found = true + } + } + return allowed == found, nil + } +} + +// IsDirectoryFilter ... +func IsDirectoryFilter(allowed bool) FilterFunc { + return func(pth string) (bool, error) { + fileInf, err := os.Lstat(pth) + if err != nil { + return false, err + } + if fileInf == nil { + return false, errors.New("no file info available") + } + return allowed == fileInf.IsDir(), nil + } +} + +// InDirectoryFilter ... +func InDirectoryFilter(dir string, allowed bool) FilterFunc { + return func(pth string) (bool, error) { + in := filepath.Dir(pth) == dir + return allowed == in, nil + } +} + +// DirectoryContainsFileFilter returns a FilterFunc that checks if a directory contains a file +func DirectoryContainsFileFilter(fileName string) FilterFunc { + return func(pth string) (bool, error) { + isDir, err := IsDirectoryFilter(true)(pth) + if err != nil { + return false, err + } + if !isDir { + return false, nil + } + + absPath := filepath.Join(pth, fileName) + if _, err := os.Lstat(absPath); err != nil { + if !os.IsNotExist(err) { + return false, err + } + return false, nil + } + return true, nil + } +} + +// FileContainsFilter ... +func FileContainsFilter(pth, str string) (bool, error) { + bytes, err := ioutil.ReadFile(pth) + if err != nil { + return false, err + } + + return strings.Contains(string(bytes), str), nil +} diff --git a/vendor/github.com/bitrise-io/go-utils/pathutil/pathutil.go b/vendor/github.com/bitrise-io/go-utils/pathutil/pathutil.go index a88ff5f0..db577e3b 100644 --- a/vendor/github.com/bitrise-io/go-utils/pathutil/pathutil.go +++ b/vendor/github.com/bitrise-io/go-utils/pathutil/pathutil.go @@ -184,3 +184,55 @@ func NormalizedOSTempDirPath(tmpDirNamePrefix string) (retPth string, err error) func GetFileName(path string) string { return strings.TrimSuffix(filepath.Base(path), filepath.Ext(path)) } + +// ListPathInDirSortedByComponents ... +func ListPathInDirSortedByComponents(searchDir string, relPath bool) ([]string, error) { + searchDir, err := filepath.Abs(searchDir) + if err != nil { + return []string{}, err + } + + var fileList []string + + if err := filepath.Walk(searchDir, func(path string, _ os.FileInfo, walkErr error) error { + if walkErr != nil { + return walkErr + } + + if relPath { + rel, err := filepath.Rel(searchDir, path) + if err != nil { + return err + } + path = rel + } + + fileList = append(fileList, path) + + return nil + }); err != nil { + return []string{}, err + } + return SortPathsByComponents(fileList) +} + +// ListEntries filters contents of a directory using the provided filters +func ListEntries(dir string, filters ...FilterFunc) ([]string, error) { + absDir, err := filepath.Abs(dir) + if err != nil { + return []string{}, err + } + + entries, err := ioutil.ReadDir(absDir) + if err != nil { + return []string{}, err + } + + var paths []string + for _, entry := range entries { + pth := filepath.Join(absDir, entry.Name()) + paths = append(paths, pth) + } + + return FilterPaths(paths, filters...) +} diff --git a/vendor/github.com/bitrise-io/go-utils/pathutil/sortable_path.go b/vendor/github.com/bitrise-io/go-utils/pathutil/sortable_path.go new file mode 100644 index 00000000..4bed6bf2 --- /dev/null +++ b/vendor/github.com/bitrise-io/go-utils/pathutil/sortable_path.go @@ -0,0 +1,88 @@ +package pathutil + +import ( + "os" + "path/filepath" + "sort" + "strings" +) + +// SortablePath ... +type SortablePath struct { + Pth string + AbsPth string + Components []string +} + +// NewSortablePath ... +func NewSortablePath(pth string) (SortablePath, error) { + absPth, err := AbsPath(pth) + if err != nil { + return SortablePath{}, err + } + + components := strings.Split(absPth, string(os.PathSeparator)) + fixedComponents := []string{} + for _, comp := range components { + if comp != "" { + fixedComponents = append(fixedComponents, comp) + } + } + + return SortablePath{ + Pth: pth, + AbsPth: absPth, + Components: fixedComponents, + }, nil +} + +// BySortablePathComponents .. +type BySortablePathComponents []SortablePath + +func (s BySortablePathComponents) Len() int { + return len(s) +} +func (s BySortablePathComponents) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} +func (s BySortablePathComponents) Less(i, j int) bool { + path1 := s[i] + path2 := s[j] + + d1 := len(path1.Components) + d2 := len(path2.Components) + + if d1 < d2 { + return true + } else if d1 > d2 { + return false + } + + // if same component size, + // do alphabetic sort based on the last component + base1 := filepath.Base(path1.AbsPth) + base2 := filepath.Base(path2.AbsPth) + + return base1 < base2 +} + +// SortPathsByComponents ... +func SortPathsByComponents(paths []string) ([]string, error) { + sortableFiles := []SortablePath{} + for _, pth := range paths { + sortable, err := NewSortablePath(pth) + if err != nil { + return []string{}, err + } + sortableFiles = append(sortableFiles, sortable) + } + + sort.Sort(BySortablePathComponents(sortableFiles)) + + sortedFiles := []string{} + for _, pth := range sortableFiles { + sortedFiles = append(sortedFiles, pth.Pth) + } + + return sortedFiles, nil +} diff --git a/vendor/github.com/bitrise-io/go-utils/stringutil/stringutil.go b/vendor/github.com/bitrise-io/go-utils/stringutil/stringutil.go index 5dde3111..581dd7b2 100644 --- a/vendor/github.com/bitrise-io/go-utils/stringutil/stringutil.go +++ b/vendor/github.com/bitrise-io/go-utils/stringutil/stringutil.go @@ -19,18 +19,6 @@ func ReadFirstLine(s string, isIgnoreLeadingEmptyLines bool) string { return firstLine } -// CaseInsensitiveEquals ... -func CaseInsensitiveEquals(a, b string) bool { - a, b = strings.ToLower(a), strings.ToLower(b) - return a == b -} - -// CaseInsensitiveContains ... -func CaseInsensitiveContains(s, substr string) bool { - s, substr = strings.ToLower(s), strings.ToLower(substr) - return strings.Contains(s, substr) -} - // MaxLastChars returns the last maxCharCount characters, // or in case maxCharCount is more than or equal to the string's length // it'll just return the whole string. diff --git a/vendor/github.com/bitrise-io/go-xcode/utility/path.go b/vendor/github.com/bitrise-io/go-xcode/utility/path.go index 45830d3f..99db9138 100644 --- a/vendor/github.com/bitrise-io/go-xcode/utility/path.go +++ b/vendor/github.com/bitrise-io/go-xcode/utility/path.go @@ -2,75 +2,11 @@ package utility import ( "fmt" - "io/ioutil" "path/filepath" - "strings" "github.com/bitrise-io/go-utils/pathutil" ) -// FilterFunc ... -type FilterFunc func(pth string) (bool, error) - -// FilterPaths ... -func FilterPaths(paths []string, filters ...FilterFunc) ([]string, error) { - filtered := []string{} - - for _, pth := range paths { - allowed := true - for _, filter := range filters { - if allows, err := filter(pth); err != nil { - return []string{}, err - } else if !allows { - allowed = false - break - } - } - if allowed { - filtered = append(filtered, pth) - } - } - - return filtered, nil -} - -// ListEntries ... -func ListEntries(dir string, filters ...FilterFunc) ([]string, error) { - absDir, err := filepath.Abs(dir) - if err != nil { - return []string{}, err - } - - entries, err := ioutil.ReadDir(absDir) - if err != nil { - return []string{}, err - } - - paths := []string{} - for _, entry := range entries { - pth := filepath.Join(absDir, entry.Name()) - paths = append(paths, pth) - } - - return FilterPaths(paths, filters...) -} - -// ExtensionFilter ... -func ExtensionFilter(ext string, allowed bool) FilterFunc { - return func(pth string) (bool, error) { - e := filepath.Ext(pth) - return (allowed == strings.EqualFold(ext, e)), nil - } -} - -// BaseFilter ... -func BaseFilter(base string, allowed bool) FilterFunc { - return func(pth string) (bool, error) { - b := filepath.Base(pth) - return (allowed == strings.EqualFold(base, b)), nil - } -} - // FindFileInAppDir ... func FindFileInAppDir(appDir, fileName string) (string, error) { filePth := filepath.Join(appDir, fileName) @@ -82,13 +18,13 @@ func FindFileInAppDir(appDir, fileName string) (string, error) { // --- // It's somewhere else - let's find it! - apps, err := ListEntries(appDir, ExtensionFilter(".app", true)) + apps, err := pathutil.ListEntries(appDir, pathutil.ExtensionFilter(".app", true)) if err != nil { return "", err } for _, app := range apps { - pths, err := ListEntries(app, BaseFilter(fileName, true)) + pths, err := pathutil.ListEntries(app, pathutil.BaseFilter(fileName, true)) if err != nil { return "", err } diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_386.s b/vendor/golang.org/x/sys/unix/asm_bsd_386.s index 7f29275f..e0fcd9b3 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_386.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_386.s @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (darwin || freebsd || netbsd || openbsd) && gc -// +build darwin freebsd netbsd openbsd +//go:build (freebsd || netbsd || openbsd) && gc +// +build freebsd netbsd openbsd // +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_arm.s b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s index 98ebfad9..d702d4ad 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (darwin || freebsd || netbsd || openbsd) && gc -// +build darwin freebsd netbsd openbsd +//go:build (freebsd || netbsd || openbsd) && gc +// +build freebsd netbsd openbsd // +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 007358af..2dd9013a 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -258,6 +258,7 @@ struct ltchars { #include #include +#include #include #if defined(__sparc__) @@ -593,6 +594,9 @@ ccflags="$@" $2 == "HID_MAX_DESCRIPTOR_SIZE" || $2 ~ /^_?HIDIOC/ || $2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ || + $2 ~ /^MTD_/ || + $2 ~ /^OTP/ || + $2 ~ /^MEM/ || $2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)} $2 ~ /^__WCOREFLAG$/ {next} $2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)} diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 47572aaa..4e4583b6 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -1406,6 +1406,10 @@ const ( MCAST_LEAVE_SOURCE_GROUP = 0x2f MCAST_MSFILTER = 0x30 MCAST_UNBLOCK_SOURCE = 0x2c + MEMGETREGIONINFO = 0xc0104d08 + MEMREADOOB64 = 0xc0184d16 + MEMWRITE = 0xc0304d18 + MEMWRITEOOB64 = 0xc0184d15 MFD_ALLOW_SEALING = 0x2 MFD_CLOEXEC = 0x1 MFD_HUGETLB = 0x4 @@ -1494,7 +1498,35 @@ const ( MS_SYNCHRONOUS = 0x10 MS_UNBINDABLE = 0x20000 MS_VERBOSE = 0x8000 + MTD_ABSENT = 0x0 + MTD_BIT_WRITEABLE = 0x800 + MTD_CAP_NANDFLASH = 0x400 + MTD_CAP_NORFLASH = 0xc00 + MTD_CAP_NVRAM = 0x1c00 + MTD_CAP_RAM = 0x1c00 + MTD_CAP_ROM = 0x0 + MTD_DATAFLASH = 0x6 MTD_INODE_FS_MAGIC = 0x11307854 + MTD_MAX_ECCPOS_ENTRIES = 0x40 + MTD_MAX_OOBFREE_ENTRIES = 0x8 + MTD_MLCNANDFLASH = 0x8 + MTD_NANDECC_AUTOPLACE = 0x2 + MTD_NANDECC_AUTOPL_USR = 0x4 + MTD_NANDECC_OFF = 0x0 + MTD_NANDECC_PLACE = 0x1 + MTD_NANDECC_PLACEONLY = 0x3 + MTD_NANDFLASH = 0x4 + MTD_NORFLASH = 0x3 + MTD_NO_ERASE = 0x1000 + MTD_OTP_FACTORY = 0x1 + MTD_OTP_OFF = 0x0 + MTD_OTP_USER = 0x2 + MTD_POWERUP_LOCK = 0x2000 + MTD_RAM = 0x1 + MTD_ROM = 0x2 + MTD_SLC_ON_MLC_EMULATION = 0x4000 + MTD_UBIVOLUME = 0x7 + MTD_WRITEABLE = 0x400 NAME_MAX = 0xff NCP_SUPER_MAGIC = 0x564c NETLINK_ADD_MEMBERSHIP = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index e91a1a95..33b401dd 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -60,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -123,6 +125,18 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc00c4d03 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -132,6 +146,10 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index a9cbac64..aec8754c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -60,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -123,6 +125,18 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -132,6 +146,10 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index d74f3c15..e96fc5c4 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -60,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -121,6 +123,18 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc00c4d03 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -130,6 +144,10 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index e1538995..c429c485 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -60,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -124,6 +126,18 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -133,6 +147,10 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 5e8e71ff..aaa4871a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -60,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -121,6 +123,18 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc00c4d03 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -130,6 +144,10 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index e670ee14..64816410 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -60,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -121,6 +123,18 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -130,6 +144,10 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index dd11eacb..a5a65d09 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -60,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -121,6 +123,18 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -130,6 +144,10 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index a0a5b22a..88ce2661 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -60,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -121,6 +123,18 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc00c4d03 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -130,6 +144,10 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index d9530e5f..98f1ef7b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -60,6 +60,8 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 ECHOE = 0x2 ECHOK = 0x4 @@ -121,6 +123,18 @@ const ( MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc00c4d03 NFDBITS = 0x20 NL2 = 0x200 NL3 = 0x300 @@ -132,6 +146,10 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index e60102f6..6b29a58e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -60,6 +60,8 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 ECHOE = 0x2 ECHOK = 0x4 @@ -121,6 +123,18 @@ const ( MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 NFDBITS = 0x40 NL2 = 0x200 NL3 = 0x300 @@ -132,6 +146,10 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 838ff4ea..f60ca861 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -60,6 +60,8 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 ECHOE = 0x2 ECHOK = 0x4 @@ -121,6 +123,18 @@ const ( MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 NFDBITS = 0x40 NL2 = 0x200 NL3 = 0x300 @@ -132,6 +146,10 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 7cc98f09..86fdffed 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -60,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -121,6 +123,18 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -130,6 +144,10 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 6d30e6fd..de677919 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -60,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -121,6 +123,18 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -130,6 +144,10 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index d5e2dc94..9ebc9d66 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -63,6 +63,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -126,6 +128,18 @@ const ( MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -135,6 +149,10 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x40 O_CLOEXEC = 0x400000 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 08732359..c9b2c9aa 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -3742,3 +3742,89 @@ const ( NLMSGERR_ATTR_OFFS = 0x2 NLMSGERR_ATTR_COOKIE = 0x3 ) + +type ( + EraseInfo struct { + Start uint32 + Length uint32 + } + EraseInfo64 struct { + Start uint64 + Length uint64 + } + MtdOobBuf struct { + Start uint32 + Length uint32 + Ptr *uint8 + } + MtdOobBuf64 struct { + Start uint64 + Pad uint32 + Length uint32 + Ptr uint64 + } + MtdWriteReq struct { + Start uint64 + Len uint64 + Ooblen uint64 + Data uint64 + Oob uint64 + Mode uint8 + _ [7]uint8 + } + MtdInfo struct { + Type uint8 + Flags uint32 + Size uint32 + Erasesize uint32 + Writesize uint32 + Oobsize uint32 + _ uint64 + } + RegionInfo struct { + Offset uint32 + Erasesize uint32 + Numblocks uint32 + Regionindex uint32 + } + OtpInfo struct { + Start uint32 + Length uint32 + Locked uint32 + } + NandOobinfo struct { + Useecc uint32 + Eccbytes uint32 + Oobfree [8][2]uint32 + Eccpos [32]uint32 + } + NandOobfree struct { + Offset uint32 + Length uint32 + } + NandEcclayout struct { + Eccbytes uint32 + Eccpos [64]uint32 + Oobavail uint32 + Oobfree [8]NandOobfree + } + MtdEccStats struct { + Corrected uint32 + Failed uint32 + Badblocks uint32 + Bbtblocks uint32 + } +) + +const ( + MTD_OPS_PLACE_OOB = 0x0 + MTD_OPS_AUTO_OOB = 0x1 + MTD_OPS_RAW = 0x2 +) + +const ( + MTD_FILE_MODE_NORMAL = 0x0 + MTD_FILE_MODE_OTP_FACTORY = 0x1 + MTD_FILE_MODE_OTP_USER = 0x2 + MTD_FILE_MODE_RAW = 0x3 +) diff --git a/vendor/golang.org/x/sys/windows/exec_windows.go b/vendor/golang.org/x/sys/windows/exec_windows.go index a020caee..7a11e83b 100644 --- a/vendor/golang.org/x/sys/windows/exec_windows.go +++ b/vendor/golang.org/x/sys/windows/exec_windows.go @@ -9,6 +9,8 @@ package windows import ( errorspkg "errors" "unsafe" + + "golang.org/x/sys/internal/unsafeheader" ) // EscapeArg rewrites command line argument s as prescribed @@ -135,8 +137,8 @@ func FullPath(name string) (path string, err error) { } } -// NewProcThreadAttributeList allocates a new ProcThreadAttributeList, with the requested maximum number of attributes. -func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeList, error) { +// NewProcThreadAttributeList allocates a new ProcThreadAttributeListContainer, with the requested maximum number of attributes. +func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeListContainer, error) { var size uintptr err := initializeProcThreadAttributeList(nil, maxAttrCount, 0, &size) if err != ERROR_INSUFFICIENT_BUFFER { @@ -145,10 +147,9 @@ func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeList, } return nil, err } - const psize = unsafe.Sizeof(uintptr(0)) // size is guaranteed to be ≥1 by InitializeProcThreadAttributeList. - al := (*ProcThreadAttributeList)(unsafe.Pointer(&make([]unsafe.Pointer, (size+psize-1)/psize)[0])) - err = initializeProcThreadAttributeList(al, maxAttrCount, 0, &size) + al := &ProcThreadAttributeListContainer{data: (*ProcThreadAttributeList)(unsafe.Pointer(&make([]byte, size)[0]))} + err = initializeProcThreadAttributeList(al.data, maxAttrCount, 0, &size) if err != nil { return nil, err } @@ -156,11 +157,39 @@ func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeList, } // Update modifies the ProcThreadAttributeList using UpdateProcThreadAttribute. -func (al *ProcThreadAttributeList) Update(attribute uintptr, flags uint32, value unsafe.Pointer, size uintptr, prevValue unsafe.Pointer, returnedSize *uintptr) error { - return updateProcThreadAttribute(al, flags, attribute, value, size, prevValue, returnedSize) +// Note that the value passed to this function will be copied into memory +// allocated by LocalAlloc, the contents of which should not contain any +// Go-managed pointers, even if the passed value itself is a Go-managed +// pointer. +func (al *ProcThreadAttributeListContainer) Update(attribute uintptr, value unsafe.Pointer, size uintptr) error { + alloc, err := LocalAlloc(LMEM_FIXED, uint32(size)) + if err != nil { + return err + } + var src, dst []byte + hdr := (*unsafeheader.Slice)(unsafe.Pointer(&src)) + hdr.Data = value + hdr.Cap = int(size) + hdr.Len = int(size) + hdr = (*unsafeheader.Slice)(unsafe.Pointer(&dst)) + hdr.Data = unsafe.Pointer(alloc) + hdr.Cap = int(size) + hdr.Len = int(size) + copy(dst, src) + al.heapAllocations = append(al.heapAllocations, alloc) + return updateProcThreadAttribute(al.data, 0, attribute, unsafe.Pointer(alloc), size, nil, nil) } // Delete frees ProcThreadAttributeList's resources. -func (al *ProcThreadAttributeList) Delete() { - deleteProcThreadAttributeList(al) +func (al *ProcThreadAttributeListContainer) Delete() { + deleteProcThreadAttributeList(al.data) + for i := range al.heapAllocations { + LocalFree(Handle(al.heapAllocations[i])) + } + al.heapAllocations = nil +} + +// List returns the actual ProcThreadAttributeList to be passed to StartupInfoEx. +func (al *ProcThreadAttributeListContainer) List() *ProcThreadAttributeList { + return al.data } diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index bb6aaf89..183173af 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -220,6 +220,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CancelIo(s Handle) (err error) //sys CancelIoEx(s Handle, o *Overlapped) (err error) //sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW +//sys CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessAsUserW //sys initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) = InitializeProcThreadAttributeList //sys deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) = DeleteProcThreadAttributeList //sys updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) = UpdateProcThreadAttribute diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 23fe18ec..1f733398 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -909,14 +909,15 @@ type StartupInfoEx struct { // ProcThreadAttributeList is a placeholder type to represent a PROC_THREAD_ATTRIBUTE_LIST. // -// To create a *ProcThreadAttributeList, use NewProcThreadAttributeList, and -// free its memory using ProcThreadAttributeList.Delete. -type ProcThreadAttributeList struct { - // This is of type unsafe.Pointer, not of type byte or uintptr, because - // the contents of it is mostly a list of pointers, and in most cases, - // that's a list of pointers to Go-allocated objects. In order to keep - // the GC from collecting these objects, we declare this as unsafe.Pointer. - _ [1]unsafe.Pointer +// To create a *ProcThreadAttributeList, use NewProcThreadAttributeList, update +// it with ProcThreadAttributeListContainer.Update, free its memory using +// ProcThreadAttributeListContainer.Delete, and access the list itself using +// ProcThreadAttributeListContainer.List. +type ProcThreadAttributeList struct{} + +type ProcThreadAttributeListContainer struct { + data *ProcThreadAttributeList + heapAllocations []uintptr } type ProcessInformation struct { diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 559bc845..86989b54 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -185,6 +185,7 @@ var ( procCreateMutexW = modkernel32.NewProc("CreateMutexW") procCreateNamedPipeW = modkernel32.NewProc("CreateNamedPipeW") procCreatePipe = modkernel32.NewProc("CreatePipe") + procCreateProcessAsUserW = modkernel32.NewProc("CreateProcessAsUserW") procCreateProcessW = modkernel32.NewProc("CreateProcessW") procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW") procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot") @@ -1577,6 +1578,18 @@ func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, return } +func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) { + var _p0 uint32 + if inheritHandles { + _p0 = 1 + } + r1, _, e1 := syscall.Syscall12(procCreateProcessAsUserW.Addr(), 11, uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) { var _p0 uint32 if inheritHandles { diff --git a/vendor/modules.txt b/vendor/modules.txt index 5a4df7cd..7053848f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,13 +1,13 @@ -# github.com/bitrise-io/bitrise v0.0.0-20210513161711-09b1442cf3e0 +# github.com/bitrise-io/bitrise v0.0.0-20210519130014-380842fb41c1 ## explicit github.com/bitrise-io/bitrise/configs -# github.com/bitrise-io/go-steputils v0.0.0-20210507072936-92fde382fb33 +# github.com/bitrise-io/go-steputils v0.0.0-20210527075147-910ce7a105a1 ## explicit github.com/bitrise-io/go-steputils/cache github.com/bitrise-io/go-steputils/command/rubycommand github.com/bitrise-io/go-steputils/stepconf github.com/bitrise-io/go-steputils/tools -# github.com/bitrise-io/go-utils v0.0.0-20210507100250-37de47dfa6ce +# github.com/bitrise-io/go-utils v0.0.0-20210520073355-367fa34178f5 ## explicit github.com/bitrise-io/go-utils/colorstring github.com/bitrise-io/go-utils/command @@ -22,7 +22,7 @@ github.com/bitrise-io/go-utils/progress github.com/bitrise-io/go-utils/retry github.com/bitrise-io/go-utils/stringutil github.com/bitrise-io/go-utils/ziputil -# github.com/bitrise-io/go-xcode v0.0.0-20210512084902-047d3c3d372a +# github.com/bitrise-io/go-xcode v0.0.0-20210521101355-fb6a1eb6e05b ## explicit github.com/bitrise-io/go-xcode/models github.com/bitrise-io/go-xcode/plistutil @@ -53,9 +53,8 @@ github.com/sirupsen/logrus ## explicit github.com/stretchr/testify/assert # golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a -## explicit golang.org/x/crypto/ssh/terminal -# golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 +# golang.org/x/sys v0.0.0-20210531080801-fdfd190a6549 ## explicit golang.org/x/sys/internal/unsafeheader golang.org/x/sys/plan9 @@ -64,7 +63,6 @@ golang.org/x/sys/windows # golang.org/x/term v0.0.0-20210503060354-a79de5458b56 golang.org/x/term # golang.org/x/text v0.3.6 -## explicit golang.org/x/text/transform golang.org/x/text/unicode/norm # gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b