Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iOS、AndroidアプリをRubyで

6e8aca910e7ee095397d3b90acb25f6c?s=47 Watson
March 05, 2016
340

 iOS、AndroidアプリをRubyで

RubyMotionの内部について、Hirosima Ruby Conferenceで発表した資料です。

6e8aca910e7ee095397d3b90acb25f6c?s=128

Watson

March 05, 2016
Tweet

Transcript

  1. iOSɺAndroidΞϓϦΛRubyͰ HipByte ౻ా ੩உ

  2. ࣗݾ঺հ • 2012೥͔ΒHipByteࣾͰRubyMotionͷ։ൃɾ αϙʔτ • ͨ·ʹɺRubyͷόάΛݟ͚ͭͨΓ

  3. RubyBiz ಛผ৆

  4. ࣮੷

  5. RubyMotion ͱ͸ʁ

  6. ೥ɺԯ୆ͷεϚʔτϑΥϯ͕ग़ՙ

  7. RubyMotion ͱ͸ʁ http://www.rubymotion.com/download/ ແྉ

  8. RubyMotion ͱ͸ʁ • ωΠςΟϒΞϓϦΛ Ruby Ͱ։ൃՄೳ • iOS, OS X,

    tvOS, watchOS • Android • ίϯύΠϥɺϏϧυγεςϜɺϥϯλΠϜ͔Β ͳΔπʔϧνΣʔϯ
  9. • ίϯύΠϥ • Rubyίʔυ͔ΒωΠςΟϒͳόΠφϦΛग़ྗ • ϏϧυγεςϜ • ίϯύΠϧ͞ΕͨόΠφϦ΍ɺϥϯλΠϜɺը૾ͳͲ ͷϦιʔεϑΝΠϧΛΞϓϦέʔγϣϯʹ·ͱΊΔ •

    ϥϯλΠϜ • DispatcherɺϝϞϦ؅ཧɺ૊ΈࠐΈΫϥε
  10. ; Function Attrs: uwtable define internal i64 @"rb_scope__application:didFinishLaunchingWithOptions:__"(i64 %self, i8*

    %sel, i64 %application, i64 %launchOptions) #11 { MainBlock: %argv1 = alloca i64, i32 2 call void @llvm.dbg.declare(metadata i64 %self, metadata !20, metadata !77), !dbg !81 %0 = alloca i64* %1 = alloca i64 store i64* %1, i64** %0 store i64 %application, i64* %1 %2 = alloca i8 store volatile i8 0, i8* %2 call void @llvm.dbg.declare(metadata i64 %application, metadata !21, metadata !77), ! dbg !81 %3 = alloca i64* %4 = alloca i64 store i64* %4, i64** %3 store i64 %launchOptions, i64* %4 %5 = alloca i8 store volatile i8 0, i8* %5 call void @llvm.dbg.declare(metadata i64 %launchOptions, metadata !22, metadata !77), ! dbg !81 LLVM-IR όΠφϦ ϥϯλΠϜ΍ ը૾ ΞϓϦ ίϯύΠϥ ϏϧυγεςϜ
  11. RubyMotion Runtime

  12. "OESPJE4%, %BMWJL"35 3VCZ.PUJPO +/* +BWB J044%, 0CKFDUJWF$SVOUJNF 3VCZ.PUJPO 0CKFDUJWF$ iOS

    Android
  13. RubyMotion ϥϯλΠϜ %JTQBUDIFS ϝϞϦ؅ཧ ૊ΈࠐΈΫϥε

  14. Dispatcher

  15. Dispatcher entry_point: ; preds = %MainBlock %6 = load i8**

    @3 %7 = load i8** @4 %8 = load i32* @1 %9 = load i8** @5 %10 = load i32* @6 %11 = load i8** @2 %12 = call fastcc i32 @vm_get_const(i32 %8, i8* %9, i32 %10, i32 1, i8* %11), !dbg !97 %13 = call fastcc i32 @vm_dispatch(i32 %self, i32 %12, i8* %7, i8* null, i8 0, i32 0, i32* null), !dbg !97
  16. Dispatcher • ίϯύΠϧ͞Εͨશͯͷϝιουݺͼग़͠͸ Dispatcher Λܦ༝ • Ruby ͸શͯΦϒδΣΫτ • Objective-C

    ͸ΦϒδΣΫτҎ֎ʹ C ݴޠ༝དྷͷ int, double, char, long ,… ͳͲܕ͕͋Δ ϝιουݺͼग़͠ɺϦλʔϯ࣌ʹม׵
  17. Dispatcher • ม׵ॲཧͷ಺༰͸ίϯύΠϧ࣌ʹຒΊࠐΉ

  18. ϝϞϦ؅ཧ ɿ iOS • Objective-C • ίϯύΠϧ࣌ʹɺΦϒδΣΫτ͕ෆཁʹͳΔՕॴ ʹ release ॲཧ͕ຒΊࠐ·ΕΔ

    • RubyMotion • ࣮ߦ࣌ʹɺෆཁͳΦϒδΣΫτΛ release ͍ͯ͠Δ
  19. ϝϞϦ؅ཧ ɿ iOS • Objective-C • ίϯύΠϧ࣌ʹɺΦϒδΣΫτ͕ෆཁʹͳΔՕॴ ʹ release ͢Δॲཧ͕ຒΊࠐ·ΕΔ

    • RubyMotion • ࣮ߦ࣌ʹɺෆཁͳΦϒδΣΫτΛ release ͍ͯ͠Δ ΍͍ͬͯΔ͜ͱ͸ಉ͡
  20. ϝϞϦ؅ཧ ɿ Android • RubyMotion • ΦϒδΣΫτ͸શͯ Java ΦϒδΣΫτ •

    Java ͷ GC ͕ద੾ʹॲཧ͢Δ 3VCZ.PUJPO͸Կ΋͍ͯ͠ͳ͍
  21. Ruby? • Ruby1.9 ϕʔε • No GVL

  22. RubyMotion • Objective-C ΍ Java Ͱ։ൃ͢ΔͷͱḮ৭͕ͳ ͍ύϑΥʔϚϯεͷΞϓϦΛ։ൃՄೳ • ϓϥοτϑΥʔϜ API

    Λࣗ༝ʹ࢖༻Մೳ http://www.rubymotion.com/download/
  23. • iOS ͱ Android ͰίʔυΛ࢖͍ճͤΔʁ

  24. Cross-platform libraries

  25. motion-game • cocos2d-x Λར༻ͨ͠ɺΫϩεϓϥοτϑΥʔϜήʔϜ ΤϯδϯϥΠϒϥϦ

  26. Flow • ΫϩεϓϥοτϑΥʔϜͳɺωοτϫʔΫͳͲར༻ස౓ ͷߴ͍APIΛఏڙ

  27. http://www.rubymotion.com/ download/