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

Outdated SnapshotHelper.swift is found in SPM package #17828

Closed
4 tasks done
everlof opened this issue Dec 19, 2020 · 6 comments · Fixed by #17833
Closed
4 tasks done

Outdated SnapshotHelper.swift is found in SPM package #17828

everlof opened this issue Dec 19, 2020 · 6 comments · Fixed by #17833

Comments

@everlof
Copy link
Contributor

everlof commented Dec 19, 2020

New Issue Checklist

Issue Description

Fastlane complains about outdated SnapshotHelper.swift for files that is fetched from SPM. In my case, it's finding an old SnapshotHelper.swift in Stripe's library.

I'd believe that stuff from the SPM shouldn't be something that stops the execution of the snapshot-script.

Command executed

fastlane snapshot

Complete output when running fastlane, including the stack trace and command used
 $ bundle exec fastlane snapshots --verbose
[✔] 🚀 
DEBUG [2020-12-19 23:57:06.94]: Checking if there are any plugins that should be loaded...
Successfully loaded Appfile at path '/Users/davideverlof/repo/XXXXX/fastlane/Appfile'
- apple_id: 'XXXX@gmail.com'
- itc_team_id: 'XXXXXX'
- team_id: 'XXXXXXXX'
-------
INFO [2020-12-19 23:57:07.23]: ------------------------------
INFO [2020-12-19 23:57:07.23]: --- Step: default_platform ---
INFO [2020-12-19 23:57:07.23]: ------------------------------
INFO [2020-12-19 23:57:07.23]: Driving the lane 'ios snapshots' 🚀
INFO [2020-12-19 23:57:08.07]: ---------------------------------
INFO [2020-12-19 23:57:08.07]: --- Step: capture_screenshots ---
INFO [2020-12-19 23:57:08.07]: ---------------------------------
INFO [2020-12-19 23:57:08.07]: Successfully loaded '/Users/davideverlof/repo/XXXX/fastlane/Snapfile' 📄

+----------------------------+-------------------+
| Detected Values from './fastlane/Snapfile' |
+----------------------------+-------------------+
| devices | ["iPhone 12 Pro"] |
| languages | ["en-US"] |
| scheme | XXXXXUITests |
| clear_previous_screenshots | true |
| override_status_bar | true |
| launch_arguments | ["-favColor red"] |
+----------------------------+-------------------+

DEBUG [2020-12-19 23:57:08.07]: Fetching available simulator devices
WARN [2020-12-19 23:57:08.32]: Resolving Swift Package Manager dependencies...
INFO [2020-12-19 23:57:08.32]: $ xcodebuild -resolvePackageDependencies -scheme XXXXXUITests -project iOS/XXXX.xcodeproj
INFO [2020-12-19 23:57:09.16]: ▸ Command line invocation:
INFO [2020-12-19 23:57:09.16]: ▸ /Applications/Xcode-12.2.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -scheme XXXXXUITests -project iOS/XXXXXXX.xcodeproj
INFO [2020-12-19 23:57:09.53]: ▸ 2020-12-19 23:57:09.530 xcodebuild[70606:8767973] DTDeviceKit: deviceType from 00008030-0006086A01D0802E was NULL
INFO [2020-12-19 23:57:09.61]: ▸ 2020-12-19 23:57:09.616 xcodebuild[70606:8767970] DTDeviceKit: deviceType from 00008030-0006086A01D0802E was NULL
INFO [2020-12-19 23:57:09.61]: ▸ 2020-12-19 23:57:09.616 xcodebuild[70606:8767970] DTDeviceKit: deviceType from 00008030-0006086A01D0802E was NULL
INFO [2020-12-19 23:57:09.79]: ▸ Resolve Package Graph
INFO [2020-12-19 23:57:25.27]: ▸ Resolved source packages:
INFO [2020-12-19 23:57:25.27]: ▸ GTMSessionFetcher: https://github.com/google/gtm-session-fetcher.git @ 1.5.0
INFO [2020-12-19 23:57:25.27]: ▸ ColorThiefSwift: https://github.com/yamoridon/ColorThiefSwift.git @ 0.4.1
INFO [2020-12-19 23:57:25.27]: ▸ UIImageColors: https://github.com/jathu/UIImageColors.git @ 2.2.0
INFO [2020-12-19 23:57:25.27]: ▸ Pulsator: https://github.com/shu223/Pulsator.git @ 0.6.3
INFO [2020-12-19 23:57:25.27]: ▸ EmptyDataSet-Swift: https://github.com/everlof/EmptyDataSet-Swift.git @ spm
INFO [2020-12-19 23:57:25.27]: ▸ Promises: https://github.com/google/promises.git @ 1.2.11
INFO [2020-12-19 23:57:25.27]: ▸ abseil: https://github.com/firebase/abseil-cpp-SwiftPM.git @ 0.20200225.0
INFO [2020-12-19 23:57:25.27]: ▸ ProgressHUD: https://github.com/relatedcode/ProgressHUD.git @ master
INFO [2020-12-19 23:57:25.27]: ▸ nanopb: https://github.com/firebase/nanopb.git @ 2.30906.0
INFO [2020-12-19 23:57:25.27]: ▸ Stripe: https://github.com/stripe/stripe-ios.git @ 21.0.1
INFO [2020-12-19 23:57:25.27]: ▸ BLTNBoard: https://github.com/everlof/BulletinBoard.git @ 78788db
INFO [2020-12-19 23:57:25.27]: ▸ RAMAnimatedTabBarController: https://github.com/Ramotion/animated-tab-bar.git @ 5.2.0
INFO [2020-12-19 23:57:25.27]: ▸ gRPC: https://github.com/firebase/grpc-SwiftPM.git @ 1.28.2
INFO [2020-12-19 23:57:25.27]: ▸ DZNEmptyDataSet: https://github.com/dzenbot/DZNEmptyDataSet.git @ master
INFO [2020-12-19 23:57:25.27]: ▸ Firebase: https://github.com/firebase/firebase-ios-sdk.git @ 7.1.0
INFO [2020-12-19 23:57:25.27]: ▸ leveldb: https://github.com/firebase/leveldb.git @ 1.22.1
INFO [2020-12-19 23:57:25.27]: ▸ SnapshotTesting: https://github.com/pointfreeco/swift-snapshot-testing.git @ 1.8.2
INFO [2020-12-19 23:57:25.27]: ▸ BoringSSL-GRPC: https://github.com/firebase/boringssl-SwiftPM.git @ 0.0.7
INFO [2020-12-19 23:57:25.27]: ▸ NameThatColor: https://github.com/everlof/NameThatColor.git @ master
INFO [2020-12-19 23:57:25.27]: ▸ PickColor: https://github.com/everlof/PickColor.git @ master
INFO [2020-12-19 23:57:25.28]: ▸ resolved source packages: GTMSessionFetcher, ColorThiefSwift, UIImageColors, Pulsator, EmptyDataSet-Swift, Promises, abseil, ProgressHUD, nanopb, Stripe, BLTNBoard, RAMAnimatedTabBarController, gRPC, DZNEmptyDataSet, Firebase, leveldb, SnapshotTesting, BoringSSL-GRPC, NameThatColor, PickColor
INFO [2020-12-19 23:57:25.30]: $ xcodebuild -showBuildSettings -scheme XXXXXXUITests -project iOS/XXXXXX.xcodeproj
WARN [2020-12-19 23:57:28.31]: Command timed out after 3 seconds on try 1 of 4, trying again with a 6 second timeout...
2020-12-19 23:57:29.515 xcodebuild[70849:8769395] DTDeviceKit: deviceType from 00008030-0006086A01D0802E was NULL
2020-12-19 23:57:29.635 xcodebuild[70849:8769529] DTDeviceKit: deviceType from 00008030-0006086A01D0802E was NULL
2020-12-19 23:57:29.635 xcodebuild[70849:8769529] DTDeviceKit: deviceType from 00008030-0006086A01D0802E was NULL
WARN [2020-12-19 23:57:34.31]: Command timed out after 6 seconds on try 2 of 4, trying again with a 12 second timeout...
2020-12-19 23:57:35.309 xcodebuild[70866:8769721] DTDeviceKit: deviceType from 00008030-0006086A01D0802E was NULL
2020-12-19 23:57:35.413 xcodebuild[70866:8769881] DTDeviceKit: deviceType from 00008030-0006086A01D0802E was NULL
2020-12-19 23:57:35.413 xcodebuild[70866:8769881] DTDeviceKit: deviceType from 00008030-0006086A01D0802E was NULL
DEBUG [2020-12-19 23:57:41.50]: Fetching available simulator devices
DEBUG [2020-12-19 23:57:41.73]: Found 37 simulators.
DEBUG [2020-12-19 23:57:41.73]: Fetching available simulator devices
DEBUG [2020-12-19 23:57:41.94]: Checking that helper files contain SnapshotHelperVersion [1.24]
ERROR [2020-12-19 23:57:43.13]: Your './ios/DerivedData/XXXXXXX/SourcePackages/checkouts/stripe-ios/fastlane/SnapshotHelper.swift' is outdated, please run fastlane snapshot update
ERROR [2020-12-19 23:57:43.13]: to update your Helper file
WARN [2020-12-19 23:57:43.13]: Lane Context:
INFO [2020-12-19 23:57:43.13]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios snapshots"}
ERROR [2020-12-19 23:57:43.13]: Please update your Snapshot Helper file using fastlane snapshot update
INFO [2020-12-19 23:57:43.13]: Successfully generated documentation at path '/Users/davideverlof/repo/XXXXXX/fastlane/README.md'

+------+---------------------+-------------+
| fastlane summary |
+------+---------------------+-------------+
| Step | Action | Time (in s) |
+------+---------------------+-------------+
| 1 | default_platform | 0 |
| 💥 | capture_screenshots | 35 |
+------+---------------------+-------------+

ERROR [2020-12-19 23:57:43.14]: fastlane finished with errors
bundler: failed to load command: fastlane (/usr/local/bin/fastlane)
FastlaneCore::Interface::FastlaneError: [!] Please update your Snapshot Helper file using fastlane snapshot update
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane_core/lib/fastlane_core/ui/interface.rb:141:in user_error!' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane_core/lib/fastlane_core/ui/ui.rb:17:in method_missing'
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/snapshot/lib/snapshot/runner.rb:140:in block in verify_helper_is_current' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/snapshot/lib/snapshot/runner.rb:134:in each'
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/snapshot/lib/snapshot/runner.rb:134:in verify_helper_is_current' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/snapshot/lib/snapshot/runner.rb:29:in work'
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/actions/capture_ios_screenshots.rb:14:in run' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/runner.rb:263:in block (2 levels) in execute_action'
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in execute_action' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/runner.rb:255:in block in execute_action'
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/runner.rb:229:in chdir' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/runner.rb:229:in execute_action'
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/runner.rb:157:in trigger_action_by_name' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/fast_file.rb:159:in method_missing'
Fastfile:58:in block (2 levels) in parsing_binding' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/lane.rb:33:in call'
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/runner.rb:49:in block in execute' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/runner.rb:45:in chdir'
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/runner.rb:45:in execute' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/lane_manager.rb:47:in cruise_lane'
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/command_line_handler.rb:36:in handle' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/commands_generator.rb:108:in block (2 levels) in run'
/Library/Ruby/Gems/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in call' /Library/Ruby/Gems/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in run'
/Library/Ruby/Gems/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in run_active_command' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in run!'
/Library/Ruby/Gems/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in run!' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/commands_generator.rb:352:in run'
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/commands_generator.rb:41:in start' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in take_off'
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/bin/fastlane:23:in <top (required)>' /usr/local/bin/fastlane:23:in load'
/usr/local/bin/fastlane:23:in `<top (required)>'

Environment

 
✅ fastlane environment ✅

Stack

Key Value
OS 11.0.1
Ruby 2.6.3
Bundler? false
Git git version 2.28.0
Installation Source /usr/local/bin/fastlane
Host macOS 11.0.1 (20B50)
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-12.2.app/Contents/Developer/
Xcode Version 12.2

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:ios)

platform :ios do
  def send_beta(bump_type)
    increment_version_number(
      bump_type: bump_type
    )
    increment_build_number({
      build_number: latest_testflight_build_number + 1
    })
    curent_build_number = get_build_number(xcodeproj: "Calendarly.xcodeproj")
    current_version = get_version_number(xcodeproj: "Calendarly.xcodeproj", target: "Calendarly")

    build_app(workspace: "Calendarly.xcworkspace", scheme: "Calendarly")

    upload_to_testflight(
      distribute_external: true,
      changelog: changelog_from_git_commits.split(/\n/).select { |msg| msg =~ /^- / }.join("\n"),
      groups: 'Selected Beta'
    )

    upload_symbols_to_crashlytics

    git_add(path: [
      'Calendarly.xcodeproj/project.pbxproj',
      '*/Info.plist'
    ])
    git_commit(
      path: [
        'Calendarly.xcodeproj/project.pbxproj',
        '*/Info.plist'
      ],
      message: "Release #{current_version}, build #{curent_build_number}"
    )
    add_git_tag(
      tag: "#{current_version}-#{curent_build_number}"
    )
  end

  desc "Take screenshots"
  lane :snapshots do
    #build_app(workspace: "Calendarly.xcworkspace", scheme: "Calendarly")
    capture_screenshots(project: "ios/Calendarly.xcodeproj", scheme: "CalendarlyUITests")
    #upload_to_app_store
  end

  desc "Push a new beta build to TestFlight (updates version by bumping patch)"
  lane :beta_patch do
    send_beta("patch")
  end

  desc "Push a new beta build to TestFlight (updates version by bumping minor)"
  lane :beta_minor do
    send_beta("minor")
  end

  desc "Push a new beta build to TestFlight (updates version by bumping major)"
  lane :beta_major do
    send_beta("major")
  end
end
`./fastlane/Appfile`
apple_id("XXXXX@gmail.com") # Your Apple email address

itc_team_id("XXXXX") # App Store Connect Team ID
team_id("YYYYY") # Developer Portal Team ID

# For more information about the Appfile, see:
#     https://docs.fastlane.tools/advanced/#appfile

fastlane gems

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

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.3.0
slack-notifier 2.3.2
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 2.0.0
terminal-table 1.8.0
plist 3.5.0
multipart-post 2.0.0
word_wrap 1.0.0
babosa 1.0.4
colored 1.2
highline 1.7.10
commander-fastlane 4.4.6
ruby2_keywords 0.0.2
faraday 1.1.0
faraday_middleware 1.0.0
gh_inspector 1.1.3
rubyzip 2.3.0
security 0.1.3
xcpretty-travis-formatter 1.0.0
bundler 1.17.2
uber 0.1.0
declarative-option 0.1.0
representable 3.0.4
retriable 3.1.2
mini_mime 1.0.2
httpclient 2.8.3
google-api-client 0.38.0
nanaimo 0.3.0
colored2 3.1.2
claide 1.0.3
CFPropertyList 3.0.3
atomos 0.1.3
xcodeproj 1.19.0
unicode-display_width 1.7.0
public_suffix 4.0.6
addressable 2.7.0
tty-screen 0.8.1
tty-cursor 0.7.1
tty-spinner 0.9.3
excon 0.78.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
fastimage 2.2.0
json 2.4.1
mini_magick 4.11.0
dotenv 2.7.6
naturally 2.2.0
simctl 1.6.8
jwt 2.2.2
declarative 0.0.20
multi_json 1.15.0
signet 0.14.0
os 1.1.1
memoist 0.16.2
googleauth 0.14.0
rake 12.3.3
digest-crc 0.6.2
google-cloud-errors 1.0.1
google-cloud-env 1.4.0
google-cloud-core 1.5.0
google-cloud-storage 1.29.2
emoji_regex 3.2.1
aws-eventstream 1.1.0
aws-sigv4 1.2.2
aws-partitions 1.410.0
jmespath 1.4.0
aws-sdk-core 3.110.0
aws-sdk-kms 1.40.0
aws-sdk-s3 1.86.2
forwardable 1.2.0
logger 1.3.0
stringio 0.0.2
ipaddr 1.2.2
openssl 2.1.2
ostruct 0.1.0
strscan 1.0.0
date 2.0.0
fileutils 1.1.0
etc 1.0.1
io-console 0.4.7
zlib 1.0.0
libxml-ruby 3.1.0
rexml 3.1.9
psych 3.1.0
mutex_m 0.1.0

generated on: 2020-12-20

@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 👍

@rogerluan
Copy link
Member

If anyone wanna dig deeper into this, the issue seems to be here:

def self.find_helper
paths = Dir["./**/SnapshotHelper.swift"] + Dir["./**/SnapshotHelperXcode8.swift"]
# exclude assets in gym
paths.reject { |p| p.include?("snapshot/lib/assets/") }
end

I don't know where we would search for the SnapshotHelper.swift if not done recursively using glob 🤔 but that seems to be the root cause of the issue (it happens to find it first in Stripe's directory than the user's) 😬

@everlof
Copy link
Contributor Author

everlof commented Dec 20, 2020

I see, yes, that looks suspicious. How do I try my fix out?

I've tried cloning fastlane and run bin/fastlane from the repo, but seems like it doesn't pick up my fixes? :S

I was going to try, like:

paths.reject { |p| p.include?("snapshot/lib/assets/") || p.include?("DerivedData") }

@rogerluan
Copy link
Member

rogerluan commented Dec 20, 2020

Clone fastlane, make your changes and then update your gemfile such as:

gem 'fastlane', :path => "full-path-to-fastlane"

And run bundle install 👍

Your fix sounds reasonable, let me know how that goes 🙌 If it works out for you, you can open a PR with the proposed fix 🚀 Check our contributing.md for more info 💪 and feel free to tag me to review your PR 🤗

everlof added a commit to everlof/fastlane that referenced this issue Dec 20, 2020
If Xcode is configured with 'Relative' path for DerivedData, fastlane would
look for outdated 'SnapshotHelper.swift'-files in the checked out SPM-packages.

This fix makes sure fastlane doesn't complain about '.swift'-files that exists
in the DerivedData-folder.
@everlof
Copy link
Contributor Author

everlof commented Dec 20, 2020

@rogerluan That fix worked great once I was able to test it 👍 I've created a PR as you can see above!

joshdholtz pushed a commit that referenced this issue Jan 20, 2021
If Xcode is configured with 'Relative' path for DerivedData, fastlane would
look for outdated 'SnapshotHelper.swift'-files in the checked out SPM-packages.

This fix makes sure fastlane doesn't complain about '.swift'-files that exists
in the DerivedData-folder.

Co-authored-by: Roger Oba <rogerluan.oba@gmail.com>
@fastlane-bot
Copy link

The pull request #17833 that closed this issue was merged and released as part of fastlane 2.172.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 Mar 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants