Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[snapshot] SnapshotHelper.swift has Swift Compiler Error #18792

Closed
4 tasks done
christin3 opened this issue Jun 2, 2021 · 12 comments · Fixed by #18930 or #20689
Closed
4 tasks done

[snapshot] SnapshotHelper.swift has Swift Compiler Error #18792

christin3 opened this issue Jun 2, 2021 · 12 comments · Fixed by #18930 or #20689

Comments

@christin3
Copy link

christin3 commented Jun 2, 2021

New Issue Checklist

Complete output when running fastlane, including the stack trace and command used
✅ fastlane environment ✅

Stack

Key Value
OS 11.3.1
Ruby 2.6.3
Bundler? false
Git git version 2.30.1 (Apple Git-130)
Installation Source ~/.gem/bin/fastlane
Host macOS 11.3.1 (20E241)
Ruby Lib Dir /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
OpenSSL Version LibreSSL 2.8.3
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 12.5

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
fastlane_require "spaceship"

$action = ""

before_all do |lane|
  ENV['SLACK_URL']="__SLACK_URL__"
  ENV['DELIVER_USER']="__APPLE_USER_ID__"
  ENV['DELIVER_PASSWORD']="__APPLE_PASSWORD__"
  ENV['FASTLANE_PASSWORD']="__APPLE_PASSWORD__"
  ENV['CONFIG_2_TOKEN']="__CONFIG_2_TOKEN__"
end

private_lane :produce_and_build do
  $action = $action.empty? ? "Produce And Build" : $action
  upload_app_privacy_details_to_app_store(
    username: "__APPLE_USER_ID__",
    team_name: "__APPLE_DEV_TEAM_NAME__",
    app_identifier: "__APPLE_BUNDLE_ID__",
    json_path:"fastlane/app_privacy_details.json"
  )
  produce({
    username: "__APPLE_USER_ID__",
    app_identifier: "__APPLE_BUNDLE_ID__", 
    app_name: "__APP_NAME__",
    company_name: "__APP_NAME__",
    language: "English",
    app_version: "__APP_VERSION_NUMBER__",
    sku: "__SKU__"
  })

  # __UPDATE_APPLE_ID_SCRIPT__ is the script that will update the plist file
  # with apple id. __PYTHON_PATH__ is required for the python3.6 script to work.
  sh "export PYTHONPATH=__PYTHON_PATH__; python3.6 __UPDATE_APPLE_ID_SCRIPT__ \"#{ENV['PRODUCE_APPLE_ID']}\" \"__PLIST_FILE__\""

  # get/create development certificate
  get_certificates(development: true, keychain_password: "__LOGIN_KEYCHAIN_PWD__")
  # get/create distribution certificate
  get_certificates(development: false, keychain_password: "__LOGIN_KEYCHAIN_PWD__")
  get_push_certificate
  get_provisioning_profile(
    force: true,
    filename: "__APPLE_BUNDLE_ID__.mobileprovision"
  )
  disable_automatic_code_signing(
    path: "__XCODE_PROJ_PATH__",
    targets: ["Camerons Pharmacy"]
  )
  update_project_provisioning(
    xcodeproj: "__XCODE_PROJ_PATH__",
    profile: "__APPLE_BUNDLE_ID__.mobileprovision",
    target_filter: "Camerons Pharmacy",
    certificate: "__PATH_TO_APPLE_CERT__"
  )
  screenshot
  build
end

lane :release do
  $action = $action.empty? ? "Publish" : $action
  produce_and_build
  deliver(submit_for_review: true, automatic_release: true)
end

lane :dp_testflight do
  $action = $action.empty? ? "TestFlight" : $action
  produce_and_build
  upload_to_testflight(wait_for_uploaded_build: true)
end

lane :build do
  $action = $action.empty? ? "Build" : $action
  gym  # see Gymfile for options
end

lane :screenshot do
  $action = $action.empty? ? "Snapshot" : $action
  snapshot
end

after_all do |lane|
  slack({
        message: "__SKU__ __APP_NAME__ #$action Successful",
        success: true, 
        channel: "__SLACK_CHANNEL__",
        payload: {
                   'App Name' => "__APP_NAME__",
                   'SKU' => "__SKU__",
                   'Run ID' => "__RUN_ID__",
                   'Version' => "ios __APP_VERSION_NUMBER__ tag:__GIT_TAG__",
                 },
        default_payloads: []
  })
end

error do |lane, exception|
  # In case of error, log appropriate error message to config-2
  sh "export PYTHONPATH=__PYTHON_PATH__; python3.6 \"__FASTLANE_EXCEPTION_SCRIPT__\" \"#{ENV['CONFIG_2_TOKEN']}\" \"__CONFIG_2_APP_ID__\" \"__CONFIG_2_APP_RELEASE_ID__\" __FAILURE_STATUS_ID__ \"#{exception.message}\" "

  slack({
        message: "__SKU__ __APP_NAME__ #$action Failed",
        success: false, 
        channel: '__SLACK_CHANNEL__',
        payload: {
                   'App Name' => "__APP_NAME__",
                   'SKU' => "__SKU__",
                   'Run ID' => "__RUN_ID__",
                   'Version' => "ios __APP_VERSION_NUMBER__ tag:__GIT_TAG__",
                   'Error Message' => exception.message
                 },
        default_payloads: []
   })
end
`./fastlane/Appfile`
app_identifier "__APPLE_BUNDLE_ID__" # The Bundle ID that you will see for the app
apple_id "__APPLE_USER_ID__" # Your Apple email address

team_name "__APPLE_DEV_TEAM_NAME__" # Developer Portal Team Name
team_id "__APPLE_DEV_TEAM_ID__" # Developer Portal Team ID

# To select a team for iTunes Connect use
itc_team_name "__ITC_TEAM_NAME__"
itc_team_id "__ITC_TEAM_ID__"

fastlane gems

Gem Version Update-Status
fastlane 2.184.1 ✅ Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.3.0
atomos 0.1.3
CFPropertyList 2.3.6
claide 1.0.3
colored2 3.1.2
nanaimo 0.3.0
xcodeproj 1.19.0
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 2.0.0
unicode-display_width 1.7.0
terminal-table 1.8.0
plist 3.6.0
public_suffix 4.0.6
addressable 2.7.0
multipart-post 2.0.0
word_wrap 1.0.0
tty-screen 0.8.1
tty-cursor 0.7.1
tty-spinner 0.9.3
artifactory 3.0.15
babosa 1.0.4
colored 1.2
highline 2.0.3
commander 4.6.0
excon 0.81.0
faraday-excon 1.1.0
faraday-net_http 1.0.1
faraday-net_http_persistent 1.1.0
ruby2_keywords 0.0.4
faraday 1.4.1
unf_ext 0.0.7.7
unf 0.1.4
domain_name 0.5.20190701
http-cookie 1.0.3
faraday-cookie_jar 0.0.7
faraday_middleware 1.0.0
fastimage 2.2.3
gh_inspector 1.1.3
json 2.1.0
mini_magick 4.11.0
naturally 2.2.1
rubyzip 2.3.0
security 0.1.3
xcpretty-travis-formatter 1.0.1
dotenv 2.7.6
bundler 2.1.4
simctl 1.6.8
jwt 2.2.3
uber 0.1.0
declarative 0.0.20
trailblazer-option 0.1.1
representable 3.1.1
retriable 3.1.2
mini_mime 1.1.0
multi_json 1.15.0
signet 0.15.0
memoist 0.16.2
os 1.1.1
googleauth 0.16.2
httpclient 2.8.3
rexml 3.1.9
webrick 1.4.2
google-apis-core 0.3.0
google-apis-playcustomapp_v1 0.2.0
google-apis-androidpublisher_v3 0.2.0
google-cloud-env 1.5.0
google-cloud-errors 1.1.0
google-cloud-core 1.6.0
google-apis-iamcredentials_v1 0.3.0
google-apis-storage_v1 0.3.0
rake 12.3.2
digest-crc 0.6.3
google-cloud-storage 1.31.0
emoji_regex 3.2.2
jmespath 1.4.0
aws-partitions 1.457.0
aws-eventstream 1.1.1
aws-sigv4 1.2.3
aws-sdk-core 3.114.0
aws-sdk-kms 1.43.0
aws-sdk-s3 1.94.1
forwardable 1.2.0
logger 1.3.0
date 2.0.0
stringio 0.0.2
zlib 1.0.0
ipaddr 1.2.2
openssl 2.1.2
ostruct 0.1.0
strscan 1.0.0
io-console 0.4.7
fileutils 1.1.0
etc 1.0.1
libxml-ruby 3.1.0
psych 3.1.0
mutex_m 0.1.0

generated on: 2021-06-02

 fastlane snapshot --capture_output does not work and says its an invalid option so I cannot add the log

Environment

 Using fastlane version 2.184.1 and xcode Version 12.5 (12E262) w/ SnapshotHelperVersion [1.25]
 SnapshotHelper.swift  keeps failing while trying to create a build I've added the error below
�[31m❌  �[0m/Users/christine/automator/builds/20210601172734/ios/4ece7424-99b1-46df-bf11-02ab2c87c5bf/RxMobileUITests/SnapshotHelper.swift:184:21: �[31mcall can throw but is not marked with 'try'�[0m

                    UIImagePNGRepresentation(image)?.write(to: path, options: .atomic)
�[36m^�[0m


** BUILD FAILED **


The following build commands failed:
	CompileSwift normal x86_64 /Users/christine/automator/builds/20210601172734/ios/4ece7424-99b1-46df-bf11-02ab2c87c5bf/RxMobileUITests/SnapshotHelper.swift
	CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
@fastlane-bot
Copy link

It seems like you have not included the output of fastlane env
To make it easier for us help you resolve this issue, please update the issue to include the output of fastlane env 👍

@fastlane fastlane deleted a comment Jun 3, 2021
@fastlane fastlane deleted a comment Jun 10, 2021
@minuscorp
Copy link
Collaborator

This is fixed for the next release, I'll close the issue but feel free to comment if any other issue arises.

@tmaly1980
Copy link

@minuscorp When will the release be ready? And how can I utilize the fix in the meantime?

@minuscorp
Copy link
Collaborator

You can always target your Gemfile to the master branch of fastlane, we release about once a week though.

@christin3
Copy link
Author

christin3 commented Jun 14, 2021

@minuscorp Is this fix in 2.185.1? I couldn't find an associated tag with issue number. If this fix is in this git tag, I am still getting the same error.

@minuscorp
Copy link
Collaborator

Your issue is with the snapshot helper project or with Swift fastlane?

@christin3
Copy link
Author

@minuscorp SnapshotHelper.swift, Its still thowing the same error, as above, after updating to the latest version of fastlane

@minuscorp
Copy link
Collaborator

I'll check it out asap!

@minuscorp minuscorp reopened this Jun 14, 2021
@minuscorp minuscorp changed the title [Fastlane.Swift] SnapshotHelper.swift has Swift Compiler Error [snapshot] SnapshotHelper.swift has Swift Compiler Error Jun 14, 2021
@christin3
Copy link
Author

christin3 commented Jun 16, 2021

@minuscorp by adding a try in front of try UIImagePNGRepresentation(image)?.write(to: path, options: .atomic) on line 184 in the SnapshotHelper.swift, fixed the issue.

@minuscorp
Copy link
Collaborator

I have to check this out during the weekend, to make sure this is still backwards compatible🙏

@fastlane-bot
Copy link

The pull request #18930 that closed this issue was merged and released as part of fastlane 2.186.0 🚀
Please let us know if the functionality works as expected as a reply here. If it does not, please open a new issue. Thanks!

@fastlane fastlane locked and limited conversation to collaborators Aug 23, 2021
@fastlane-bot
Copy link

The pull request #20689 that closed this issue was merged and released as part of fastlane 2.211.0 🚀
Please let us know if the functionality works as expected as a reply here. If it does not, please open a new issue. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants