äžè¬ã«ãç§ã®äŒç€Ÿã«ã¯ãã¢ããªã±ãŒã·ã§ã³ã®ãã³ãã«ãæ±ã10人以äžã®ioséçºéšéããããšããäºå®ããå§ãã䟡å€ããããŸãã ã«ãŒãã³äœæ¥ãèªååããããã«ãCIãµãŒããŒãå±éããå¿ èŠããããŸããïŒç¹å¥ãªæŽå²ççç±ã«ããïŒä»ã®ãã¹ãŠã®äººãšåæ§ã«ïŒèªå·±èšè¿°ã§ãjenkinsã«ç§»è¡ããäºå®ã§ãïŒã ç§ã¯æ¥åžžçãªããšãèããŸã-ãããžã§ã¯ãã®çµã¿ç«ãŠããã¹ãã®å®è¡ïŒãã¡ãããããªããæžããŠããªãéãïŒããã¹ã¿ãŒçšãšã¢ããªã¹ãã¢ã§ã®ã¬ã€ã¢ãŠãçšã®ipashkaã®äœæã äžè¬çã«ãgitaã§ãã¿ã³ãŸãã¯ããã¯ãæŒãããšã§ãããããã¹ãŠãæ©èœããããšãæãã§ããŸããã éçºè ããã¿ã³ãã¯ãªãã¯ããã ãã§ãã¹ãŠãæ©èœããŸãããããã°ã©ã ã¯ãããŸã§ã®ãšããèšç»å ã«ãããŸãã ãã®èšäºã§ã¯ããããžã§ã¯ããã³ã³ãã€ã«ãããããipaãã¡ã€ã«ã«ããã¯ãããšãããããã¯ã«ã€ããŠã®ã¿è§ŠããŸãã CIãµãŒããŒåŽã®ããã€ã¹ã§ãããžã§ã¯ããèµ·åããæ©èœã¯ãŸã éçºäžã§ãããããã±ãŒãžã³ã°ããã»ã¹èªäœã¯é·ãéãæŠããã«ããã誰ãã«åœ¹ç«ã€å¯èœæ§ããããŸãã
ç§ãã¡ã¯äœãèšç»ããŠããŸããïŒ
- ã¢ããªã±ãŒã·ã§ã³ãã¢ã»ã³ãã«ããã·ãã¥ã¬ãŒã¿ãŒã§å®è¡ããŸã
- IPAãåéããŠãå®éã®ããã€ã¹ã§å®è¡ããŸããã
- åžå Žã«ã¢ããããŒãããããã«IPAãåéããŸããã
- ããããªçµã¿ç«ãŠãšã©ãŒ
ç§ãã¡ãæã£ãŠããŸãïŒ
- OS X 10.10.5
- Xcode 7.1
å®éšã®é »åºŠã«ã€ããŠã¯ããµãŒãããŒãã£ã®ã¢ããªã±ãŒã·ã§ã³ã䜿çšããŠã芪æãªãèªè ãèšäºã§èª¬æãããŠããããšãç¹°ãè¿ãããšãã§ããããã«ããŸãã ãªãŒãã³ãœãŒã¹ã®researchKit apple-ovãã¬ãŒã ã¯ãŒã¯ã®ãã¹ãã¢ããªã±ãŒã·ã§ã³ã䜿çšããŸãã
git clone https://github.com/ResearchKit/ResearchKit.git ~/Downloads/researchkit
cd ~/Downloads/researchkit
ãããžã§ã¯ããã³ã³ãã€ã«ããåã«ãapple doc generator github.com/tomaz/appledocãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãïŒã€ã³ã¹ããŒã«æ¹æ³ã®èª¬æããããŸãïŒã
ããŠã³ããŒããããããžã§ã¯ãã«æž¡ããŸãã ã«ãŒããããžã§ã¯ãã¯ResearchKitãã¬ãŒã ã¯ãŒã¯èªäœã§ããããã¹ãã¢ããªã±ãŒã·ã§ã³èªäœã¯å¥ã®å Žæã«ãããŸãã
cd samples/ORKCatalog/
ã¢ããªã±ãŒã·ã§ã³ãã³ã³ãã€ã«ããããšããŠããŸãã ã·ãã¥ã¬ãŒã¿çšã®ãããžã§ã¯ãã®ã¢ã»ã³ããªã«ã¯èšŒææžãå¿ èŠãªããããã·ãã¥ã¬ãŒã¿çšã«åéããŸã/ãã¡ã€ã«ãæäŸãããŸãã
xcodebuild -project ORKCatalog.xcodeproj -scheme ORKCatalog -arch x86_64 VALID_ARCHS=x86_64 -sdk iphonesimulator
ãšã©ãŒãçºçããŸãïŒ

ORKCatalogã¹ããŒãããªãããããã«ããã¯ã©ãã·ã¥ããŸãã å ã®ãããžã§ã¯ãã®ã¹ããŒã ã¯å ±æãšããŠããŒã¯ãããŠããªãã£ããããgitããã®ããã¬ã€ã³ãã®åŸãxcodeã¯ãŸã ãã®ã¹ããŒã ã«ã€ããŠäœãç¥ããªãã®ã§ãéªãéãã®ã§ããããžã§ã¯ããéãã ãã§ãã ãããã£ãŠããããžã§ã¯ããéãã ãã§ãïŒ
open ORKCatalog.xcodeproj
ãããŠãããã«ãã¹ããŒã ã衚瀺ããããã xcodebuild -listã䜿çšããŠã¹ããŒã ã確èªã§ããŸã ã å床åéãè©Šã¿ãŸãã
xcodebuild -project ORKCatalog.xcodeproj -scheme ORKCatalog -arch x86_64 VALID_ARCHS=x86_64 -sdk iphonesimulator
åŸ ã¡ã«åŸ ã£ã** BUILD SUCCEEDED **ã確èªããåŸã çŽ æŽãããããã¹ãŠãæ©èœããŸãã
ã·ãã¥ã¬ãŒã¿ãŒã§ãããžã§ã¯ããå®è¡ãã
ã·ãã¥ã¬ãŒã¿ãŒã§ã³ã³ãã€ã«ããŸããã¢ãŒããã¯ãã£ãŒã¯i386 / x86_64ã§ãã SYMROOTã䜿çšããŠããã«ãçµæã®ãã¹ãèšå®ããŸãã
xcodebuild -project ORKCatalog.xcodeproj -scheme ORKCatalog ARCHS='x86_64 i386' VALID_ARCHS='x86_64 i386' -sdk iphonesimulator -configuration Debug SYMROOT=$(pwd)/build build
ïŒèãã声ã«åºããŠãã ããïŒèšäºãæžãããšãããªãªãŒã¹ã¢ãŒãã§ã®ã³ã³ãã€ã«ã¯æ©èœããŠããŸããããèšäºãå ¬éããåã«ãã¹ãŠã®ã¹ããããå床確èªãããã®ã¢ãŒãã§ã®ã³ã³ãã€ã«ãæ©èœããªããªã£ãããããããã°ã§åéããŠãããããæåŸã®ã³ãããã®ããã€ãããããç ŽããŸãããïŒ
ãã«ããæåããåŸã build / Debug-iphonesimulator /ã« ORKCatalog.appãã¡ã€ã«ãåãåããŸããã ã·ãã¥ã¬ãŒã¿ã§ãããå®è¡ããããšã¯æ®ã£ãŠããŸãã ããã«ã¯ã ios-simãŠãŒãã£ãªãã£github.com/phonegap/ios-simã䜿çšããŸãã 䜿ãæ¹ã¯ãšãŠãç°¡åã§ãã
å©çšå¯èœãªã·ãã¥ã¬ãŒã¿ãŒã®ãªã¹ããååŸããŸãã
ios-sim showdevicetypes

éžæãããªã¹ãããããiPhone-6-Plusãã ãã®äžã§ã¢ããªã±ãŒã·ã§ã³ãå®è¡ããŸãã
ios-sim --devicetypeid iPhone-6-Plus launch build/Debug-iphonesimulator/ORKCatalog.app
ãã¹ãŠãæ£ããè¡ãããå Žåãã¢ããªã±ãŒã·ã§ã³ãåããã·ãã¥ã¬ãŒã¿ãŒãéå§ããã¯ãã§ãïŒctrl + Cã䜿çšããŠãã³ã³ãœãŒã«ã§å ¥åã¢ãŒãã«å ¥ããŸãïŒã

IPAãã¡ã€ã«ãäœæããå®éã®ããã€ã¹ã§èµ·åãã
ããã§ã¯ããå°ãè€éã§ããéçºçšã®mobileprovisionãã¡ã€ã«ïŒéçºè ïŒãšãã·ã³äžã®èšŒææžïŒp12ãã¡ã€ã«ïŒãå¿ èŠã§ãããxcodeã®ã¢ã«ãŠã³ãã¯å¿ èŠãããŸããã ã³ã³ãœãŒã«ããã¢ããªã±ãŒã·ã§ã³ã«çœ²å/ããã±ãŒãžåããå Žåãxcodeã§ã¢ã«ãŠã³ããè¿œå ããå¿ èŠã¯ãããŸãããããã¯ãããšãã°ãp12ãã¡ã€ã«ã®ã¿ãä¿åã§ããCIãµãŒããŒã§éåžžã«åœ¹ç«ã¡ãŸãã
ãã·ã³ã«ã¯å¯Ÿå¿ãã蚌ææžããããšæ³å®ããŠããŸãã ã¢ã«ãŠã³ãã®developer.apple.comã§éçºè mobileprovisionãçæãããã·ã³ã«ããŠã³ããŒããããïŒtest.mobileprovisionãšããååãä»ãããã³ãã«IDã¯ru.habrahabr.testã«ãªããŸãïŒã xcodeãååŸã§ãããã£ã¬ã¯ããªã«ã³ããŒããåŸïŒ
cp test.mobileprovision ~/Library/MobileDevice/Provisioning Profiles/
ããã€ã¹ã®ã¢ãŒã«ã€ããåéããŸãïŒããã¯arm64 / armv7ã®ã¢ãŒããã¯ãã£ã§ãïŒã
xcodebuild -project ORKCatalog.xcodeproj -scheme ORKCatalog ARCHS='arm64 armv7' VALID_ARCHS='arm64 armv7' -sdk iphoneos -configuration Debug archive -archivePath build/archive
ãã³ãã«IDãã¢ããªã±ãŒã·ã§ã³ã«ãŸã ç»é²ããŠããããmobileprovisionããªã³ã¯ããŠããªããããã³ã³ãã€ã«ã¯å€±æããŸãããšã©ãŒã¯æ¬¡ã®ããã«ãªããŸãã

ã³ã³ãœãŒã«ãããã³ãã«IDãæž¡ããInfo.plistãã¡ã€ã«ã«ç»é²ããå¿ èŠããããŸãã ãŸããã³ã³ãœãŒã«ãä»ããŠãªã³ã¯ãmobileprovisionã«è»¢éããŸãã ãã¹ORKCatalog / Supporting Files / Info.plistã«æ²¿ã£ãŠPlistãã¡ã€ã«ãèŠã€ããŸããCFBundleIdentifierããŒã®å Žåãå€ãru.habrahabr.testã«èšå®ããŸãã ãã³ãã«IDã¯ãID PRODUCT_BUNDLE_IDENTIFIER = en.habrahabr.testã®å€ãæã€ããŒãä»ããŠæž¡ãããŸãã mobileprovisionã«ç»é²ãããŠããUUIDã䜿çšããŠãPROVISIONIG_PROFILEããŒãä»ããŠmobileprovisionãžã®ãªã³ã¯ãæž¡ããŸãã
UUIDãååŸããŸãã
security cms -D -i test.mobileprovision | grep -o "\w\{8\}-\w\{4\}-\w\{4\}-\w\{4\}-\w\{12\}"
å€ã¯87b0df89-793a-4a0f-92bf-c5f9c35f1405ã«äŒŒãŠããŸãã å床åéããŸãã
xcodebuild -project ORKCatalog.xcodeproj -scheme ORKCatalog ARCHS='arm64 armv7' VALID_ARCHS='arm64 armv7' -sdk iphoneos -configuration Debug archive -archivePath build/archive PRODUCT_BUNDLE_IDENTIFIER=ru.habrahabr.test PROVISIONING_PROFILE=87b0df89-793a-4a0f-92bf-c5f9c35f1405
ãã®çµæã build / archive.xcarchiveã¢ãŒã«ã€ããååŸããŸãããããã¯ipaã«ããã±ãŒãžåããããŸãŸã§ãã Xcode 7ã¯æ°ããããã±ãŒãžã³ã°æ¹æ³ãå°å ¥ããããã䜿çšããŸãã ããã®åã«ã次ã®å 容ã§æ§æãã¡ã€ã«options.plistãäœæããŸãã
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>method</key> <string>development</string> <key>uploadSymbols</key> <false/> </dict> </plist>
IPAãæ§ç¯ããããšããŠããŸãïŒ
xcodebuild -exportArchive -exportOptionsPlist options.plist -archivePath build/archive.xcarchive -exportPath build/dev-ipa/
ãã°ã«ãããšãã¢ã»ã³ããªãã¯ã©ãã·ã¥ããäœãã«è³æ Œãããããšãç解ã§ããŸãã

誀ã£ãŠãã¢ããªã±ãŒã·ã§ã³ããšã³ã¿ã€ãã«ã¡ã³ãã«çœ²åããŠããããšã¯æããã§ãããšã³ã¿ã€ãã«ã¡ã³ãã®å€ã¯ãã¢ãã€ã«ããããžã§ãã³ã°ã®å€ãã€ãŸãcom.apple.developer.healthkitã«å¯Ÿå¿ããŠããŸããã çç±ãæ¢ããŠããŸãã ã¢ããªã±ãŒã·ã§ã³ã眲åãããŠããè³æ Œã確èªããŸãã
codesign -d --entitlements - build/archive.xcarchive/Products/Applications/ORKCatalog.app
ååŸãããã®ïŒ
<dict> <key>application-identifier</key> <string>XXXXX.ru.habrahabr.test</string> <key>beta-reports-active</key> <true/> <key>com.apple.developer.healthkit</key> <true/> <key>com.apple.developer.team-identifier</key> <string>XXXXX</string> <key>get-task-allow</key> <false/> </dict> </plist>
ãããé€ããŠããã¹ãŠãæ£åžžã§ããããšãããããŸãã
<key>com.apple.developer.healthkit</key> <true/>
mobileprovisionã«ã¯ãã®ãªãã·ã§ã³ããããŸããããããã©ãããæ¥ãã®ããç¥ãå¿ èŠããããŸãã
find ORKCatalog/ -name "*.entitlements" -type f
æ€çŽ¢ã«ããã ORKCatalog / Supporitng Files / ORKCatalog.entitlementsãåŸãããŸãã ã ç§ãã¡ã¯å éšãèŠãŸãïŒ
cat ORKCatalog/Supporting Files/ORKCatalog.entitlements
å€ã¯1ã€ã ãã§ãã
<plist version="1.0"> <dict> <key>com.apple.developer.healthkit</key> <true/> </dict> </plist>
è«ççã«ã¯ããã®å€ãè¿œå ããå¿ èŠãããmobileprovisionãåå²ãåœãŠããå¿ èŠããããŸãããç§ãã¡ã¯æ zyã§ããããã¹ãã®ããã«ãã®å€ã®ãªãè³æ Œã§ã¢ããªã±ãŒã·ã§ã³ã«å眲åããå¿ èŠããããŸãã
å°ãªããšã2ã€ã®ãªãã·ã§ã³ããããŸãã
1.æ¢åã®ãšã³ã¿ã€ãã«ã¡ã³ãïŒORKCatalog / Supporitng Files / ORKCatalog.entitlementsïŒãç·šéããŠãåæ§ç¯ããŸãïŒã¢ãŒã«ã€ãçµç±ïŒã
2.åæ§ç¯ããã«ãç§ãã¡èªèº«ãå¿ èŠãªè³æ Œã§ORKCatalog.appã«å眲åããŸãã
æåã®ãªãã·ã§ã³ãããã·ã³ãã«ã«éžæããŸãã ãããã£ãŠããã¡ã€ã«ORKCatalog / Supporitng Files / ORKCatalog.entitlementsãã次ã®è¡ãåé€ããã ãã§ã ã
<key>com.apple.developer.healthkit</key> <true/>
ã¢ãŒã«ã€ããå床åæ§ç¯ããŸãã
xcodebuild -project ORKCatalog.xcodeproj -scheme ORKCatalog ARCHS='arm64 armv7' VALID_ARCHS='arm64 armv7' -sdk iphoneos -configuration Debug archive -archivePath build/archive PRODUCT_BUNDLE_IDENTIFIER=ru.habrahabr.test PROVISIONING_PROFILE=87b0df89-793a-4a0f-92bf-c5f9c35f1405
ipaãäœæããåŸïŒ
xcodebuild -exportArchive -exportOptionsPlist options.plist -archivePath build/archive.xcarchive -exportPath build/dev-ipa/
åŸ æã®ã¡ãã»ãŒãž** EXPORT SUCCEEDED **ã衚瀺ãããŸãã build / dev-ipa /ã®äžã«ãããã€ã¹ã«ã€ã³ã¹ããŒã«ããipaãã¡ã€ã«ã衚瀺ãããŸãã ios-deploy github.com/phonegap/ios-deployã䜿çšããŠããã€ã¹ã«ã€ã³ã¹ããŒã«ããŸãã ããã€ã¹ãè»ã«ãã£ã€ããããã€ã¹IDãååŸããŸãïŒ
ios-deploy -c
ããã€ã¹ã«å±éããŸãã
ios-deploy -i <device id> -b build/dev-ipa/ORKCatalog.ipa
åžå Žã®IPAãã¡ã€ã«ãåéããŸã
ãã¹ãŠã¯éçºããŒãžã§ã³ãšåãã§ãããªãªãŒã¹mobileprovisionãžã®ãªã³ã¯ãå€æŽããã ãã§ã options.plistã§éçºã®ä»£ããã«ã¢ããªã¹ã㢠ãé 眮ããŸãïŒä»ã®ãªãã·ã§ã³ã«ã€ããŠã¯ãxcodebuild -helpãã«ããåç §ããŠãã ããïŒã
ãŸãšã
xcodeã䜿çšããªããŠãããã¹ãçšããã³ã¢ããªã¹ãã¢ã§ã®ã¬ã€ã¢ãŠãçšã«ipaãã¡ã€ã«ãåéã§ããŸããã ããã¯ãã¹ãŠãCIãµãŒããŒã§ç°¡åã«èªååã§ãããããéçºè ã®äœæ¥ã楜ã«ãªããŸãã
PSïŒè€éãªæ§é ã®ã¢ããªã±ãŒã·ã§ã³ãã³ã³ãã€ã«/眲åããããã»ã¹ã§ã¯ãè€æ°ã®ã¿ãŒã²ãããããããç¬èªã®ã¢ãã€ã«ããããžã§ãã³ã°ãã¡ã€ã«ïŒæ¡åŒµæ©èœãã¯ããã¯ãçµã¿èŸŒã¿ãã¬ãŒã ã¯ãŒã¯ãåããã¢ããªã±ãŒã·ã§ã³ïŒãå¿ èŠãšããå Žåãäžèšã®ããã»ã¹ã¯ãã¡ã€ã«ãªãã§ã¯æ©èœããªãããšã«æ³šæããŠãã ããã