Jiseob Kim

iOS Developer

Tool - Fastlane Lane ์‚ฌ์šฉ๋ฒ•

28 Apr 2019 » Tool

์ด์ „ ํฌ์ŠคํŒ…

ํฌ์ŠคํŒ… ํ• ๊ฑด ๋งŽ์€๋ฐ, ๋Š๋‚Œ์ด ์™”์„๋•Œ ์ƒˆ๋กœ ์“ฐ๋Š”๊ฒŒ ๋‚˜์„์ง€, ์•„๋‹ˆ๋ฉด ์ด๊ฒƒ์ฒ˜๋Ÿผ ์‹œ์ž‘ํ•œ๊ฒƒ์€ ๋๋‚ด๊ณ  ์“ฐ๋Š”๊ฒŒ ์ข‹์„์ง€ ๋ชจ๋ฅด๊ฒ ๋‹ค. ๋ญ”๊ฐ€ ์ฝ์„๋•Œ๋Š” ์ˆœ์ฐจ์ ์ธ๊ฒŒ ์ข‹์„๋“ฏ ํ•œ๋ฐ, ๋Š๋‚Œ์ด ์™”์„๋•Œ ๋ฐ”๋กœ ๋ชป์“ฐ๋‹ˆ ๊น€์ƒˆ๋Š” ๋Š๋‚Œ์ด ์žˆ๋‹ค. ์žก๋‹ด ๋.



Lane์— ๋Œ€ํ•˜์—ฌ

FastLane์˜ ๊ฝƒ์€ Lane์ด ์•„๋‹๊นŒ ํ•˜๋Š” ์ƒ๊ฐ์ด ๋“ ๋‹ค. FastLane์˜ ์žฅ์ ์€ Xcode์—์„œ ์—ฌ๋Ÿฌ๋ฒˆ ํด๋ฆญ์„ ์—ฌ๋Ÿฌ๋ฒˆ ํ•ด์•ผํ•˜๋Š” ๋ถ€๋ถ„๋“ค์„ ๋ช…๋ น์–ด ํ•˜๋‚˜๋กœ ํ•ด๊ฒฐํ•ด์ฃผ๋Š” ์ ์ธ๋“ฏ ํ–ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ , ๊ทธ ๋‹จ์ˆœํ™” ๊ณผ์ • ๋งˆ์ €๋„ ํ•œ๋ฒˆ์— ๋ฌถ์–ด์ฃผ๋Š” Lane, ๊ทธ๋ž˜์„œ ๊ฝƒ์ด๋ผ ์นญํ•ด๋ณด์•˜๋‹ค.


๋ช…๋ น์–ด ๋ช‡๊ฐ€์ง€๋ฅผ ๋ณด์ž

  • Derived ํŒŒ์ผ ์ œ๊ฑฐ
    fastlane action clear_derived_data
    
  • IPA ์ถ”์ถœํ•˜๊ธฐ
    fastlane gym
    

Derived ์ œ๊ฑฐ ๊ด€๋ จ์˜ ๊ฒฝ์šฐ, ๊ฐ€๋” ๋นŒ๋“œ์‹œ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธธ์‹œ ์—ฌ๊ธฐ ํŒŒ์ผ์„ ์ง€์›Œ์ฃผ๋ฉด ํ•ด๊ฒฐ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๋‹ค. ๋นŒ๋“œ์‹œ ๊ณ„์† ์ƒ์„ฑ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์–ธ์ œ๋“  ์ง€์›Œ๋„ ๋˜๋Š” ํŒŒ์ผ! IPA ์ถ”์ถœ์€ TestFlight๋ฅผ ์•ˆ์“ด๋‹ค๋ฉด ์‚ฌ๋‚ด ํ…Œ์ŠคํŠธ์šฉ์œผ๋กœ ํ•„์š”๋กœ ๋ฝ‘์•„๋‘๋Š” ๋ถ„๋“ค์ด ๋งŽ์„๊ฑฐ๋ผ ์ƒ๊ฐ๋œ๋‹ค. ๋ช…๋ น์–ด ํ•˜๋‚˜๋กœ ์†์‰ฝ๊ฒŒ ์ถ”์ถœ! (IPA ์ถ”์ถœ์˜ ๊ฒฝ์šฐ dSYM ํŒŒ์ผ๋„ ๊ฐ™์ด ๋‚˜์˜จ๋‹ค.)


๋‘ ๋ช…๋ น์–ด๋‹ค ์•„์ฃผ ์ข‹์€ ๋ช…๋ น์–ด์ด๋‹ค. ๊ทธ๋ ‡์ง€๋งŒ ์‚ฌ๋žŒ์€ ์–ธ์ œ๋‚˜ ๊ท€์ฐฎ์€ ์ž‘์—… ํ•˜๋‚˜๋ผ๋„ ์ค„์ด๋ ค๋Š”๊ฒŒ ๋ถ„๋ช…ํ•˜๋‹ค. ์œ„์™€ ๊ฐ™์ด IPA ์ถ”์ถœ์„ ํ–ˆ์„ ๊ฒฝ์šฐ Clean๊ณผ Derived ์ œ๊ฑฐ๋ฅผ ๊ฐ™์ด ํ•  ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๋‹ค. ํ•œ์ค„ ํ•œ์ค„ ์ž…๋ ฅํ•˜๋Š”๊ฒƒ๋„ ๊ท€์ฐฎ์•˜๋‚˜๋ณด๋‹ค. ๊ทธ๋ž˜์„œ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ช…๋ น์–ด๋ฅผ ํ•œ๋ฒˆ์— ์‹คํ–‰ํ•˜๊ณ  ์‹ถ์—ˆ๋˜๊ฑธ๊นŒ?

๊ทธ๋ž˜์„œ Lane์ด๋ผ๋Š” ๊ฒƒ์ด ๋‚˜์˜จ๋“ฏ ํ•˜๋‹ค.



Lane ์ƒ์„ฑํ•˜๊ธฐ

์ด์ „ ํฌ์ŠคํŒ… ๋‚ด์šฉํ•ด fastlane init์„ ํ–ˆ๋‹ค๋ฉด, ํ•ด๋‹น ํ”„๋กœ์ ํŠธ ํด๋”๋‚ด์— 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
  desc "Description of what the lane does"
  lane :custom_lane do
    # add actions here: https://docs.fastlane.tools/actions
  end
end

(#) ๋ถ€๋ถ„์€ ํ•œ๋ฒˆ์ฏค ์ฝ์–ด๋ณด๋ฉด ๋˜๊ณ ,
์ค‘์š”ํ•œ ๋ถ€๋ถ„์€ ์—ฌ๊ธฐ๋‹ค.

desc "Description of what the lane does"
lane :custom_lane do
    # add actions here: https://docs.fastlane.tools/actions
end

์ด๊ฒƒ์ด lane์˜ ๊ธฐ๋ณธ ํ‹€์ด๋ผ ๋ณด๋ฉด ๋˜๊ณ , ๊ฐ ์„ค๋ช…์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

  • desc: lane์— ๋Œ€ํ•œ ์„ค๋ช….
  • custom_lane: lane๋ฅผ ์‹คํ–‰์‹œํ‚ฌ ๋ช…๋ น์–ด.
  • do ~ end: ์ด lane์œผ๋กœ ์ธํ•ด ์‹คํ–‰๋  ๋ช…๋ น์–ด๋“ค์„ ์ •์˜.



์œ„์— ์˜ˆ๋ฅผ ๋“ค์—ˆ๋˜ ๋ช…๋ น์–ด ๋‘๊ฐœ๋ฅผ ์ด์šฉํ•˜์—ฌ lane์„ ์ƒ์„ฑํ•ด๋ณด์ž

desc "Test Lane"
lane :test_lane do
    clear_derived_data
    gym
end

์ด๋ ‡๊ฒŒํ•˜๋ฉด ์ƒ์„ฑ์™„๋ฃŒ!
๊ทธ ํ›„์— ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ๋œ๋‹ค.

fastlane test_lane

๊ทธ๋Ÿผ ์œ„ test_lane๋‚ด์˜ ๋ช…๋ น์–ด๋“ค์ด ์ˆœ์ฐจ์ ์œผ๋กœ ์ง„ํ–‰๋˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ, ์—ฌ๊ธฐ์„œ ๋๋‚˜๋ฉด ์•„์‰ฌ์šธ๊ฒƒ์ด๋‹ค. gym(์•„์นด์ด๋ธŒ) ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ• ๋•Œ ์˜ต์…˜์„ ์ฃผ๋Š” ๊ฒฝ์šฐ๊ฐ€ ํ•„์š”ํ•˜๋‹ค.

์˜ˆ๋ฅผ ๋“ค๋ฉด ์ธ์ฆ์„œ๋ฅผ ์„ ํƒ(Distribution/Adhoc/Development)ํ•ด์•ผํ•˜๋Š” ๊ฒฝ์šฐ๋„ ํ•„์š”ํ•˜๋ฉฐ, ์•„์นด์ด๋ธŒ ์ „์— ๋นŒ๋“œ ํด๋ฆฐ์€ ํ•„์š”ํ•˜๊ธฐ์— ์ด๋Ÿฌํ•œ ๋ช…๋ น์–ด๋“ค์— ๋Œ€ํ•œ ์˜ต์…˜๋“ค์ด ํ•„์š”ํ•˜๋‹ค.



Lane ๋ช…๋ น์–ด์— ์˜ต์…˜์ฃผ๊ธฐ

์˜ต์…˜ ์ฃผ๋Š”๊ฒƒ์€ ๊ฐ„๋‹จํ•˜๋‹ค. ํ•ด๋‹น ๋ช…๋ น์–ด ๋’ค์— ๊ด„ํ˜ธ()๋ฅผ ์—ด์–ด ์ฃผ๊ณ  ์ ์œผ๋ฉด ๋œ๋‹ค.

desc "Test Lane"
lane :test_lane do
    clear_derived_data
    gym(
        scheme: "Foo",
        export_method: "ad-hoc",
        clean: true,
        output_directory: "path/to/dir"
    )
end

gym๋’ค์— ๊ด„ํ˜ธ๋ฅผ ์—ด์–ด์คฌ๊ณ , ๊ทธ ์•ˆ์— ์˜ต์…˜๋“ค์„ ๋‚˜์—ดํ–ˆ๋‹ค.

  • scheme: ํ•ด๋‹น ํ”„๋กœ์ ํŠธ์˜ ํƒ€๊ฒŸ์„ ์„ค์ •ํ•ด์ค€๋‹ค. (ํ•œ workspace์•ˆ์— ์—ฌ๋Ÿฌ ์•ฑ์ด ์žˆ์„ ๊ฒฝ์šฐ ํ•„์š”ํ•˜๋‹ค.)
  • export_method: ์ธ์ฆ์„œ ์˜ต์…˜ ์ฃผ๋Š” ๋ถ€๋ถ„์ด๋‹ค. (์ข…๋ฅ˜: app-store, ad-hoc, package, enterprise, development, developer-id)
  • clean: ๋นŒ๋“œ ํด๋ฆฐ ์—ฌ๋ถ€์ด๋‹ค, true or false ์ฃผ๋ฉด ๋œ๋‹ค.
  • output_directory: ๊ฒฐ๊ณผ๋ฌผ๋“ค์„ ์ €์ •ํ•  ์œ„์น˜๋ฅผ ์…‹ํŒ…ํ•ด์ฃผ๋Š” ๊ฐ’์ด๋‹ค. (์•ˆ์ ์œผ๋ฉด ํ•ด๋‹น ํ”„๋กœ์ ํŠธ ํด๋”)



PS.

๋งˆ์ง€๋ง‰ ๋ถ€๋ถ„์ฒ˜๋Ÿผ ์˜ต์…˜์ด ์ƒ๊ธฐ๋ฉด, ์ƒ๊ฐ๋ณด๋‹ค? ์ค„์ด ๊ธธ์–ด์ง„๋‹ค. ์™ธ์šฐ๊ธฐ๋„ ํž˜๋“ค๋ฉฐ, ํ•˜๋‚˜๊ฐ€ ์•„๋‹ˆ๋ผ ์—ฌ๋Ÿฌ๊ฒŒ ์ƒ๊ธธ์ˆ˜ ์žˆ๋‹ค. ํ•˜์ง€๋งŒ lane๋•์— ๋ฏธ๋ฆฌ ์…‹ํŒ…๋งŒ ํ•ด๋‘”๋‹ค๋ฉด, ๋‹จ 1์ค„์˜ ๋ช…๋ น์–ด๋กœ ๋๋‚ผ ์ˆ˜ ์žˆ๋‹ค.

์Šฌ๋ž™์œผ๋กœ ์•Œ๋ฆผ๋„ ์ค„ ์ˆ˜ ์žˆ๊ณ , ์•Œ์•„์„œ ์Šคํฌ๋ฆฐ์ƒท๋„ ์ฐ์–ด์ฃผ๊ณ , ์ถ”์ถœ๋„ ํ•ด์ฃผ๊ณ , ์—…๋กœ๋“œ๋„ ํ•ด์ฃผ๊ณ , ์ธ์ฆ์„œ ๊ด€๋ฆฌ๋ถ€ํ„ฐ ์ƒ์„ฑ๊นŒ์ง€ ํ•ด์ฃผ๋‹ˆ ์•Œ์•„๋‘๋ฉด ์ข‹์€ ๋„๊ตฌ์ž„์€ ํ™•์‹คํ•œ๋“ฏํ•˜๋‹ค. ๋‚˜์ค‘์— ๊ณ ๊ธ‰ํŽธ๋„ ํฌ์ŠคํŒ… ํ•ด์•ผ๊ฒ ๋‹ค.

์ด๊ฑธ๋กœ fastlane์€ ์ผ๋‹จ ๋!