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

Kotlin Compiler Plugin のワークフローを知る

1821636ac95415aa6e84bc33b394283d?s=47 tommykw
December 21, 2020

Kotlin Compiler Plugin のワークフローを知る

1821636ac95415aa6e84bc33b394283d?s=128

tommykw

December 21, 2020
Tweet

Transcript

  1. ,PUMJO$PNQJMFS1MVHJOͷϫʔΫϑϩʔΛ஌Δ QPUBUPUJQTJ04"OESPJE։ൃ5JQTڞ༗ձ !UPNNZLX

  2. ࣗݾ঺հ w ෋ా݈ೋ!UPNNZLX w ίωώτגࣜձࣾ w "OESPJEΤϯδχΞ

  3. ࠓ೔࿩͢͜ͱ

  4. ࠓ೔࿩͢͜ͱ w ,PUMJO$PNQJMFS1MVHJOͱ͸ʁ w ,PUMJO$PNQJMFS1MVHJOͷϫʔΫϑϩʔ w αϯϓϧΛ࡞ͬͯΈΔ

  5. ,PUMJO$PNQJMFS1MVHJOͱ͸ʁ

  6. ,PUMJO$PNQJMFS1MVHJOͱ͸ʁ w όΠτίʔυΛ্ॻ͖Ͱ͖Δ w ίʔυهड़ͷࣗಈԽ͕Ͱ͖Δ w ,BQUͰ࢖ΘΕ͍ͯΔ w υΩϡϝϯτ͕ͳ͍ͷͰ஫ҙ͕ඞཁ

  7. ,PUMJO$PNQJMFS1MVHJOͱ͸ʁ w όΠτίʔυΛ্ॻ͖Ͱ͖Δ w ίʔυهड़ͷࣗಈԽ͕Ͱ͖Δ w ,BQUͰ࢖ΘΕ͍ͯΔ w υΩϡϝϯτ͕ͳ͍ͷͰ஫ҙ͕ඞཁ ࡞Γํ͕શ͘Θ͔Βͳ͍ʜ

    υΩϡϝϯτ͕ͳ͍ͱ͍͏͜ͱ͸ίʔυΛ ಡΉ͔͠ͳ͍ͷ͔ʜ
  8. ࿕ใͰ͢ʂ

  9. IUUQTXXXESPJEDPODPNNFEJBEFUBJM WJEFP

  10. IUUQTXXXESPJEDPODPNNFEJBEFUBJM WJEFP ,PUMJO$PNQJMFS1MVHJOͷϫʔΫϑϩʔ͕ɺ Θ͔Γ΍͘͢·ͱΊΒΕ͍ͯͯײँʂ ॳΊͯ,PUMJO$PNQJMFS1MVHJOΛ࡞ͬͯΈ͍ͨͱࢥ͏ ํʹ͓͢͢ΊͷಈըͰ͢ɻ

  11. ,PUMJO$PNQJMF1MVHJOͷϫʔΫϑϩʔ

  12. ,PUMJO$PNQJMFS1MVHJOΛ࡞ΔͨΊͷͭͷεςοϓ Kotlin Compiler Plugin - Write your own code transformer

    without dealing with bytecode By Jingbo Yang  (SBEMF1MVHJO  ,PUMJO$PNQJMFS1MVHJO  5SFF7JTJUPS
  13. (SBEMF1MVHJO  ,PUMJO(SBEMF4VC1MVHJOΛհ ͯ͠,PUMJO$PNQJMFS1MVHJO Λݺͼग़͢  ੒Ռ෺Λൃߦ͢Δ Kotlin Compiler Plugin

    - Write your own code transformer without dealing with bytecode By Jingbo Yang
  14. ,PUMJO$PNQJMFS1MVHJO  $PNNBOE-JOF1SPDFTTPSɺ $PNQPOFOU3FHJTUSBSΛఆٛ ͢Δ  "OBMZTJT)BOEMFS&YUFOTJPOΛ հͯ͠ίʔυղੳ͢ΔͨΊͷ 5SFF7JTJUPSΛݺͼग़͢ 

    ղੳͨ͠಺༰Λ೚ҙͷܗʹม ߋ͠ɺ$PMMFDUJPO,U'JMFͱ ͯ͠౉͢ Kotlin Compiler Plugin - Write your own code transformer without dealing with bytecode By Jingbo Yang
  15. 5SFF7JTJUPS  ࣮ߦ͞ΕͨϑΝΠϧɺΫϥ εɺؔ਺ɺϓϩύςΟͳͲ ΛղੳͰ͖Δ Kotlin Compiler Plugin - Write

    your own code transformer without dealing with bytecode By Jingbo Yang
  16. αϯϓϧΛ࡞ͬͯΈΔ

  17. ؔ਺ʹ!)FMMP8PSME͕෇Ճ͞Ε͍ͯΕ͹ɺ ʮ)FMMP8PSMEʯΛग़ྗ͢Δ ࣮ߦ݁Ռ ࠓճͷΰʔϧ IUUQTHJUIVCDPNUPNNZLXLPUMJO DPNQJMF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MFS1MVHJO w

    5SFF7JTJUPS w ϫʔΫϑϩʔΛ஌Δ͜ͱͰશମ૾Λ஌Δ
  33. ࢀߟࢿྉ • Kotlin Compiler Plugin - Write your own code

    transformer without dealing with bytecode https://www.droidcon.com/media-detail? video=481164487 • Writing Kotlin Compiler Plugins with Arrow Meta https:// speakerdeck.com/heyitsmohit/writing-kotlin-compiler-plugins-with-arrow- meta?slide=172 • Kotlin metaprogramming with kotlinpoet https://kotlin.christmas/2020/14
  34. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ