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

update_plist does partial updating when quotes in not used #19912

Closed
aytunch opened this issue Feb 4, 2022 · 4 comments
Closed

update_plist does partial updating when quotes in not used #19912

aytunch opened this issue Feb 4, 2022 · 4 comments

Comments

@aytunch
Copy link

aytunch commented Feb 4, 2022

The documentation of update_plist show a syntax as follows for representing keys: plist[:CLIENT_ID]

update_plist( # Updates the CLIENT_ID and GOOGLE_APP_ID string entries in the plist-file
      plist_path: "./Runner/GoogleService-Info.plist",
      block: proc do |plist|
        plist[:CLIENT_ID] = "xxxxxxx"

However, we had problems with this and found out that changing the above syntax to plist["CLIENT_ID"] makes it work. If you can confirm this, please update the documents.

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

@aytunch
Copy link
Author

aytunch commented Feb 4, 2022

🚫 fastlane environment 🚫

Stack

Key Value
OS 12.1
Ruby 2.6.8
Bundler? false
Git git version 2.30.1 (Apple Git-130)
Installation Source /usr/local/bin/fastlane
Host macOS 12.1 (21C52)
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 13.1
Swift Version 5.5.1

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL
LANGUAGE

fastlane files:

`./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
  desc "Fastlane Github Action Lane"
  lane :github do
    get_certificates(
      development: true,
      username: ENV['DEV_ACCOUNT'],
      team_name: ENV['TEAM_ID']
    )
    
    sigh(
      username: ENV['DEV_ACCOUNT'],
      team_name: ENV['TEAM_ID'],
      development: true,
      app_identifier: ENV['APP_IDENTIFIER']
    )

    update_code_signing_settings(
      use_automatic_signing: false,
      path: "./Runner.xcodeproj"
    )
    update_plist(
      plist_path: "./Runner/Info.plist",
      block: proc do |plist|
        plist["CFBundleURLSchemes"] = ["com.googleusercontent.apps.849342230913-r6fdhf927o1qan0mh2u7c1qh5ovr7ji4"]
      end
    )
    build_app(
      scheme: "Runner",
      archive_path: "./build/Runner.xcarchive",
      export_method: ENV["EXPORT_METHOD"],
      output_directory: "./build/Runner"
    )
    firebase_app_distribution(
      app: ENV["FIREBASE_APP_ID"],
      groups: ENV["FIREBASE_GROUPS"],
      release_notes: ENV["GITHUB_CHANGELOG"],
      ipa_path: "./build/Runner/Runner.ipa",
      googleservice_info_plist_path:"./build/Runner/GoogleService-Info.plist"
    )
  end

  # desc "Set Development Plist":
  # lane :plist_dev do
  #   copy_files(source: "test.rb", destination: "lib")
  # end

  desc "Fastlane Deploy To Foodsnob V0"
  lane :development do
 
    update_app_identifier(
      app_identifier: 'com.foodsnob.flutter',
      plist_path: './Runner/Info.plist'
    )
    update_plist(
      plist_path: "./Runner/Info.plist",
      block: proc do |plist|
        urlScheme = plist["CFBundleURLTypes"].find{|scheme| scheme["CFBundleURLName"] == "Firebase"}
        urlScheme["CFBundleURLSchemes"] = ["com.googleusercontent.apps.849342230913-r6fdhf927o1qan0mh2u7c1qh5ovr7ji4"]
    end
    )
    update_plist( # Updates the CLIENT_ID and GOOGLE_APP_ID string entries in the plist-file
      plist_path: "./Runner/GoogleService-Info.plist",
      block: proc do |plist|
        plist["API_KEY"] = "AIzaSyCTEPwQiHr85btgWWO-2SP8VWFQQxgHvQ8"
        plist["BUNDLE_ID"] = "com.foodsnob.flutter"
        plist["CLIENT_ID"] = "849342230913-r6fdhf927o1qan0mh2u7c1qh5ovr7ji4.apps.googleusercontent.com"
        plist["GCM_SENDER_ID"] = "849342230913"
        plist["GOOGLE_APP_ID"] = "1:849342230913:ios:1d14685cb0b251c312f880"
        plist["PROJECT_ID"] = "silver-approach-321905"
        plist["REVERSED_CLIENT_ID"] = "com.googleusercontent.apps.849342230913-r6fdhf927o1qan0mh2u7c1qh5ovr7ji4"
        plist["STORAGE_BUCKET"] = "silver-approach-321905.appspot.com"
      end
    )
    changelog = prompt(
      text: "Release Notes: ",
      multi_line_end_keyword: "END"
    )
    build_app(
      scheme: "Runner",
      archive_path: "./build/Runner.xcarchive",
      xcargs: "-allowProvisioningUpdates",
      export_method: "development",
      output_directory: "./build/Runner"
    )
    firebase_app_distribution(
      app: "1:849342230913:ios:1d14685cb0b251c312f880",
      groups: "internal-testing",
      release_notes: changelog,
      ipa_path: "./build/Runner/Runner.ipa",
      googleservice_info_plist_path:"./build/Runner/GoogleService-Info.plist"
    )
  end
  desc "Fastlane Deploy To Foodsnob Beta"
  lane :beta do
    update_app_identifier(
      app_identifier: 'com.foodsnob.beta',
      plist_path: './Runner/Info.plist'
    )
    update_plist(
      plist_path: "./Runner/GoogleService-Info.plist",
      block: proc do |plist|
        plist["API_KEY"] = "AIzaSyBZJG3gPrIcX07ckGt2tJOwKXQoaGBrtCs"
        plist["CLIENT_ID"] = "761530102517-c31u3d9ie79dlk9cgoivn98sgf57hcqo.apps.googleusercontent.com"
        plist["REVERSED_CLIENT_ID"] = "com.googleusercontent.apps.761530102517-c31u3d9ie79dlk9cgoivn98sgf57hcqo"
        plist["GCM_SENDER_ID"] = "761530102517"
        plist["BUNDLE_ID"] = "com.foodsnob.beta"
        plist["PROJECT_ID"] = "foodsnob-beta"
        plist["STORAGE_BUCKET"] = "foodsnob-beta.appspot.com"
        plist["GOOGLE_APP_ID"] = "1:761530102517:ios:312dc715119f7a7b2b8bbc"
      end
    )
    update_plist(
      plist_path: "./Runner/Info.plist",
      block: proc do |plist|
        urlScheme = plist["CFBundleURLTypes"].find{|scheme| scheme["CFBundleURLName"] == "Firebase"}
        urlScheme["CFBundleURLSchemes"] = ["com.googleusercontent.apps.761530102517-c31u3d9ie79dlk9cgoivn98sgf57hcqo"]
    end
    )
    changelog = prompt(
      text: "Release Notes: ",
      multi_line_end_keyword: "END"
    )
    build_app(
      scheme: "Runner",
      archive_path: "./build/Runner.xcarchive",
      xcargs: "-allowProvisioningUpdates",
      export_method: "development",
      output_directory: "./build/Runner"
    )
    firebase_app_distribution(
      app: "1:761530102517:ios:312dc715119f7a7b2b8bbc",
      groups: "beta-testers",
      release_notes: changelog,
      ipa_path: "./build/Runner/Runner.ipa",
      googleservice_info_plist_path:"./build/Runner/GoogleService-Info.plist"
    )
  end
end
`./Appfile`
# app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app
# apple_id("[[APPLE_ID]]") # Your Apple email address

for_platform :ios do
    for_lane :github do
        app_identifier(ENV["APP_IDENTIFIER"])
        team_id(ENV["TEAM_ID"])
    end
    for_lane :development do
        app_identifier("com.foodsnob.flutter")
        team_id("M9XNFNPUM2")
    end
    for_lane :beta do
        app_identifier("com.foodsnob.beta")
        team_id("M9XNFNPUM2")
    end
end
# For more information about the Appfile, see:
#     https://docs.fastlane.tools/advanced/#appfile

fastlane gems

Gem Version Update-Status
fastlane 2.201.0 🚫 Update available

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-firebase_app_distribution 0.3.2 ✅ Up-To-Date
Loaded gems
Gem Version
did_you_mean 1.3.0
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 2.0.0
terminal-table 1.8.0
plist 3.6.0
public_suffix 4.0.6
addressable 2.8.0
multipart-post 2.0.0
word_wrap 1.0.0
optparse 0.1.1
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
faraday-cookie_jar 0.0.7
gh_inspector 1.1.3
mini_magick 4.11.0
naturally 2.2.1
security 0.1.3
xcpretty-travis-formatter 1.0.1
dotenv 2.7.6
bundler 2.2.16
simctl 1.6.8
rexml 3.2.5
nanaimo 0.3.0
colored2 3.1.2
claide 1.0.3
CFPropertyList 3.0.5
atomos 0.1.3
xcodeproj 1.21.0
unicode-display_width 1.8.0
excon 0.88.0
ruby2_keywords 0.0.5
faraday-rack 1.0.0
faraday-patron 1.0.0
faraday-net_http_persistent 1.2.0
faraday-net_http 1.0.1
faraday-httpclient 1.0.1
faraday-excon 1.1.0
faraday-em_synchrony 1.0.0
faraday-em_http 1.0.0
faraday 1.8.0
unf_ext 0.0.8
unf 0.1.4
domain_name 0.5.20190701
http-cookie 1.0.4
faraday_middleware 1.2.0
fastimage 2.2.5
json 2.6.1
rubyzip 2.3.2
jwt 2.3.0
webrick 1.7.0
httpclient 2.8.3
multi_json 1.15.0
signet 0.16.0
os 1.1.4
memoist 0.16.2
googleauth 1.1.0
mini_mime 1.1.2
retriable 3.1.2
trailblazer-option 0.1.2
declarative 0.0.20
uber 0.1.0
representable 3.1.1
google-apis-core 0.4.1
google-apis-playcustomapp_v1 0.6.0
google-apis-androidpublisher_v3 0.13.0
rake 13.0.6
digest-crc 0.6.4
google-apis-storage_v1 0.9.0
google-apis-iamcredentials_v1 0.8.0
google-cloud-errors 1.2.0
google-cloud-env 1.5.0
google-cloud-core 1.6.0
google-cloud-storage 1.34.1
emoji_regex 3.2.3
aws-eventstream 1.2.0
aws-sigv4 1.4.0
aws-partitions 1.536.0
jmespath 1.4.0
aws-sdk-core 3.123.0
aws-sdk-kms 1.51.0
aws-sdk-s3 1.108.0
forwardable 1.2.0
logger 1.3.0
date 2.0.0
stringio 0.0.2
ipaddr 1.2.2
openssl 2.1.2
zlib 1.0.0
mutex_m 0.1.0
ostruct 0.1.0
strscan 1.0.0
io-console 0.4.7
fileutils 1.1.0
etc 1.0.1
libxml-ruby 3.2.1
psych 3.1.0
fastlane-plugin-firebase_app_distribution 0.3.2

generated on: 2022-02-04

@max-ott
Copy link
Contributor

max-ott commented Feb 11, 2022

We're not having any issues here with other values, so it might be related to GoogleService-Info.plist and how it's structured.

The following works without any issues:

block: proc do |plist|
    plist[:ITSAppUsesNonExemptEncryption] = "false"
    plist[:NSLocationWhenInUseUsageDescription] = "#{privacy_location}"
end

@max-ott max-ott closed this as completed Feb 11, 2022
@fastlane fastlane locked and limited conversation to collaborators Apr 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@aytunch @max-ott @fastlane-bot and others