1 84
100%
Actual Size
Fit Width
Fit Height
Fit Page
Automatic
ビルド番号の新について ネットで教えてもらったこと EZNET 熊友宏 @eskumagai http://program.station.eznet.jp/ • Info.plist & Run Script • agvtool • Info.plist Preprocessor
Build 番号の自動更新スクリプトについて #cocoa_kansai
Embed Size (px)
344 x 292
429 x 357
514 x 422
599 x 487
DESCRIPTION
ツイッターを眺めていたら Info.plist の書き換えについてのお話が流れてきました。 その話題の中心にあった agvtool と、そこから派生して Build 番号を Info.plist そのものは更新せずにビルド時に細工をしてバンドルに埋め込む方法に興味を惹かれ、それについて少し深追いしてみました。 特に Info.plist Preprocessor はなかなか面白い仕組みでした。どのような場面で便利に使えるかは別としまして。
Citation preview
1. EZ-NET @es_kumagai http://program.station.ez-net.jp/
Info.plist & Run Script agvtool Info.plist Preprocessor
2. @es_kumagai EZ-NET IP Phone for iPad for iPhone EZ-NET
http://program.station.ez-net.jp/
3. Xcode http://ez-net.jp/sp/xcode5/
4.
5. agvtool
6. @tokorom
h"ps://speakerdeck.com/tokorom/agvtooldechao-katukoyokubaziyoningudekimasuka
7. Apple-Generic Versioning Tool agvtool
8. Apple-Generic Versioning Tool agvtool Build Settings
9. Apple-Generic Versioning Tool
10. Apple-Generic Versioning Tool Current Project Version
Versioning System Apple Generic
11. Apple-Generic Versioning Tool
12. Apple-Generic Versioning Tool agvtool
13. Apple-Generic Versioning Tool CURRENT_PROJECT_VERSION
agvtool what-version Current version of project $(PROJECT_NAME) is:
1
14. Apple-Generic Versioning Tool CURRENT_PROJECT_VERSION
agvtool what-version -terse 1
15. Apple-Generic Versioning Tool CURRENT_PROJECT_VERSION
agvtool new-version 2
16. Apple-Generic Versioning Tool CFBundleVersion
CURRENT_PROJECT_VERSION Info.plist CFBundleVersion agvtool
new-version -all 3
17. Apple-Generic Versioning Tool agvtool next-version
-all
18. Apple-Generic Versioning Tool Info.plist
CFBundleShortVersionString agvtool what-marketing-version No
marketing version number (CFBundleShortVersionString) in native
targets... Found CFBundleShortVersionString of 1.0 in
PROJ.xcodeproj/../PROJNAME/PROJ-Info.plist Found
CFBundleShortVersionString of 1.0 in
PROJ.xcodeproj/../PROJNAME/PROJTest-Info.plist
19. Apple-Generic Versioning Tool Info.plist
CFBundleShortVersionString agvtool what-marketing-version -terse
PROJ.xcodeproj/../PROJNAME/PROJ-Info.plist=1.0
PROJ.xcodeproj/../PROJNAME/PROJTest-Info.plist=1.0
20. Apple-Generic Versioning Tool agvtool
what-marketing-version -terse1 1.0
21. Apple-Generic Versioning Tool Info.plist
CFBundleShortVersionString agvtool new-marketing-version 2.0
22. Apple-Generic Versioning Tool
23. Apple-Generic Versioning Tool CVS defaults write agvtool
CVSEnabled YES defaults write agvtool CVSSubmitByTag YES defaults
write agvtool CVSToolPath PATH Subversion defaults write agvtool
SVNEnabled YES defaults write agvtool SVNSubmitByTag YES defaults
write agvtool SVNToolPath PATH Git
24. Apple-Generic Versioning Tool VERSIONING_INFO_PREFIX
Versioning Name Prex
25. Apple-Generic Versioning Tool VERSIONING_NAME_PREFIX
dev-
26. Apple-Generic Versioning Tool $(PROJECT_NAME)_vers.c double
dev-
27. Apple-Generic Versioning Tool CURRENT_PROJECT_VERSION
VERSIONING_NAME_PREFIX
28. Apple-Generic Versioning Tool Derived Data
(Intermediates)
29. Apple-Generic Versioning Tool $(PROJECT_NAME)_vers.c
30. Apple-Generic Versioning Tool extern
31. Apple-Generic Versioning Tool agvtool
32. Apple-Generic Versioning Tool VERSIONING_SYSTEM Versioning
System Apple Generic CURRENT_PROJECT_VERSION Current Project
Version agvtool VERSION_INFO_EXPORT_DECL Generated Versioning
Variables (export ) VERSION_INFO_FILE Generate Versioning Source
Filename VERSION_INFO_PREFIX Versioning Name Prex
VERSION_INFO_SUFFIX Versioning Name Sux VERSION_INFO_BUILDER
Versioning Username
33. Apple-Generic Versioning Tool agvtool Run Script
34. #ifdef DEBUG Conguration #ifdef DEBUG
35. #ifdef DEBUG ?! Info.plist
36. Info.plist Preprocessor Info.plist
37. Info.plist Preprocessor Objective-C C
38. Info.plist Preprocessor #import MyClass.h #dene
MyClassMaxValue 1000 #ifdef DEBUG NSLog(Value = %d, object.value);
#endif
39. Info.plist Preprocessor Info.plist
40. Info.plist Preprocessor Preprocess Info.list File Yes
OK
41. Info.plist Preprocessor Build Settings Info.plist
42. Info.plist Preprocessor Info.list Preprocessor Denitions
KEY=VALUE
43. Info.plist Preprocessor Info.plist Info.plist Preprocessor
Denitions
44. Info.plist Preprocessor Conguration
45. Info.plist Preprocessor Info.plist
46. Info.plist Preprocessor 1. Info.plist Preprocessor Prex
File 2. Info.plist Preprocessor Denitions
$(GCC_PREPROCESSOR_DEFINITIONS) $(GCC_PREPROCESSOR_DEFINITIONS)
Preprocessor Macros
47. Info.plist Preprocessor Info.list Preprocessor Prex File
#dene KEY VALUE
48. Info.plist Preprocessor Info.plist Info.plist Preprocessor
Denitions
49. Info.plist Preprocessor Info.list Preprocessor Prex File
Info.plist Info.plist Info.plist
50. Info.plist Preprocessor INFOPLIST_PREPROCESS Preprocess
Info.plist File Yes Info.plist INFOPLIST_PREFIX_HEADER Info.plist
Preprocessor Prex File INFOPLIST_PREPROCESSOR_DEFINITIONS
Info.plist Preprocessor Denitions
INFOPLIST_OTHER_PREPROCESSOR_FLAGS Info.plist Other Preprocessor
Flags -DDEBUG=1 Info.plist
51. Info.plist Preprocessor Based on Conguration File
Info.plist Conguration
52. Xcode 5 9.10 Conguration Based on Conguration File
53.
54. h"ps://github.com/kishikawakatsumi/BuildNumber
55.
56. Info.plist Compile Sources Run Script
57. Info.plist
58. Info.plist Info.plist Run Script
59. PlistBuddy Info.plist /usr/libexec/PlistBuddy
60. PlistBuddy Info.plist CFBundleVersion
infoPlistFile="${SRCROOT}/${INFOPLIST_FILE}
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion"
"${infoPlistFile}") buildNumber=$((${buildNumber%%.*} + 1))
/usr/libexec/PlistBuddy -c Set CFBundleVersion $buildNumber"
"${infoPlistFile}"
61. PlistBuddy Print KEY KEY Set KEY VALUE KEY VALUE Copy
srcKEY dstKEY srcKEY dstKEY Delete KEY KEY Add KEY TYPE [VALUE]
TYPE KEY Clear TYPE TYPE Root TYPE Array Dictionary Merge FILE
[KEY] FILE KEY KEY FILE Root , Root Import KEY FILE Data KEY
/usr/libexec/PlistBuddy c
62. Info.plist
63. Info.plist Target Dependencies [1] Compile Sources Link
Binary With Libraries [2] Copy Bundle Resources 1 2
64. Info.plist
65. Info.plist
66. Info.plist
67. Info.plist Info.plist Target Dependencies Preprocess
Info.plist File [1] Compile Sources Link Binary With Libraries [2]
Copy Bundle Resources 1 2 Preprocessed-Info.plist
68. Info.plist Target Dependencies Build Phase Info.plist
Info.plist Run Script Build Phase
69. Info.plist Info.plist Info.plist
Preprocessed-Info.plist
70. Info.plist Info.plist
71. Info.plist Preprocessed-Info.plist
72. Info.plist Target Dependencies Preprocess Info.plist File
[*] Compile Sources [*] Link Binary With Libraries Copy Bundle
Resources * Copy Bundle Resources
73. Info.plist Preprocessed-Info.plist
${TEMP_DIR}/Preprocessed-Info.plist Run Script
infoPlistFile="${TEMP_DIR}/Preprocessed-Info.plist
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion"
"${infoPlistFile}") buildNumber=$((${buildNumber%%.*} + 1))
/usr/libexec/PlistBuddy -c "Set:CFBundleVersion $buildNumber"
"${infoPlistFile}"
74. Info.plist
75. Info.plist Preprocess Info.plist File
$(SRCROOT)/${INFOPLIST_FILE}
76. Info.plist
77. Info.plist Info.plist
78. Info.plist Copy Bundle Resources Run Script
infoPlistFile=${BUILT_PRODUCTS_DIR}/
${FULL_PRODUCT_NAME}/Info.plist
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion"
"${infoPlistFile}") buildNumber=$((${buildNumber%%.*} + 1))
/usr/libexec/PlistBuddy -c "Set:CFBundleVersion $buildNumber"
"${infoPlistFile}"
79. Info.plist Target Dependencies Compile Sources Link Binary
With Libraries [*] Copy Bundle Resources Run Script * Copy Bundle
Resources Info.plist
80. Info.plist
81. Info.plist Build Phases
82. Info.plist 1. Run Script 2. Info.plist Run Script
83.
84. Info.plist
LOAD MORE