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

あらためて AssemblyDefinition についてまとめてみた/About AssemblyDefinition

あらためて AssemblyDefinition についてまとめてみた/About AssemblyDefinition

2018/07/25 (Wed) に開催された Gotanda.unity #7 での登壇資料です。

P.29, P.37, P.41 の画像については、 http://monry.hatenablog.com/entry/2018/07/26/124434 にて Animated GIF を公開しています。

Tetsuya Mori

July 25, 2018
Tweet

More Decks by Tetsuya Mori

Other Decks in Programming

Transcript

  1. גࣜձࣾΩοζελʔ CTO
    ৿ɹ఩࠸
    ͋ΒͨΊͯ
    Assembly Definition
    ʹ͍ͭͯ·ͱΊͯΈͨ
    - Ԟٛʂ͋ͤΜͿΓ͌Ͱ͌;͌ʹ͡ΐΜ!! -

    View full-size slide

  2. 2
    ͜Μ͹Μ͸ʂ

    View full-size slide

  3. 3
    ಥવͰ͕͢

    View full-size slide

  4. 4
    Assembly Definition
    ͔ͭͬͯ·͔͢ʁ

    View full-size slide

  5. 6
    {
    "name": "kidsstar@pretendland",
    "references": [
    "kidsstar@firebase_utility_lifecyclehandler",
    "kidsstar@pretendland_common_dialog",
    "kidsstar@pretendland_common_downloader",
    "kidsstar@pretendland_common_pavilionloader",
    "kidsstar@pretendland_common_projects",
    "umm@assetbundle_management",
    "umm@cafu_core",
    "umm@cafu_generics",
    "umm@cafu_routing",
    "umm@commandline_arguments",
    "umm@context_management",
    "umm@git",
    "umm@jenkins",
    "umm@project_setting",
    "umm@singleton_monobehaviour",
    "umm@unirx",
    "umm@unirx_observablelifecyclemonobehaviour",
    "umm@unirx_observableunitywebrequest",
    "umm@xcode_manipulation_api",
    "pretendland_academy",
    "pretendland_ecc",
    "pretendland_gummi",
    "pretendland_ippudo",
    "pretendland_kao",
    "pretendland_nissincisco",
    "pretendland_sugi",
    "pretendland_sushiro"
    ],
    "optionalUnityReferences": [],
    "includePlatforms": [],
    "excludePlatforms": [],
    "allowUnsafeCode": false
    }

    View full-size slide

  6. 7
    ։ൃ࣌ͷίϯύΠϧ͕଎͘ͳΔ

    ʢ͔΋͠Εͳ͍ʣ

    Assembly Definition

    ʹ͍ͭͯղઆ͠·͢ʂ

    View full-size slide

  7. w৿ɹ఩࠸ʢBLB΋ΜΓ͌ઌੜʣ
    w೥࡛ۄݝ࢈
    wגࣜձࣾΩοζελʔ$50
    wࠓ݄ࡀʹͳΔ່ʹκοίϯ-07&
    w͓ञͱ߹এͱϓϩάϥϛϯά͕झຯ
    w5XJUUFS!NPOSZ(JU)VC!NPOSZ
    9
    Who am I ?
    ࣗݾ঺հ

    View full-size slide

  8. 10
    Who am I ?
    ϚϯΨͰΘ͔Δ6OJUZ޷ධ࿈ࡌதʂ
    ࣗݾ঺հ

    View full-size slide

  9. w ࢠͲ΋޲͚εϚϗΞϓϦ

    ։ൃͳͲ
    w ೥͋ͨΓ͔Β

    6OJUZΨοπϦ
    w ͬ͜͝ϥϯυ

    ྦྷܭສ%-
    w "QQ4UPSF(PPHMF1MBZ

    ʹͯࢠͲ΋޲͚ΧςΰϦ

    ϥϯΩϯά501
    11
    ͓͠͝ͱ
    ࣗݾ঺հ

    View full-size slide

  10. ΞδΣϯμ
    12

    View full-size slide

  11. w"TTFNCMZ%FpOJUJPOͱ͸ʁ
    w"TTFNCMZ%FpOJUJPOͷ࢖͍ํ
    w"TTFNCMZ%FpOJUJPOͷ5JQT
    13
    ͓͠ͳ͕͖
    ΞδΣϯμ

    View full-size slide

  12. w"TTFNCMZ%FpOJUJPOͱ͸ʁ
    w"TTFNCMZ%FpOJUJPOͷ࢖͍ํ
    w"TTFNCMZ%FpOJUJPOͷ5JQT
    14
    ͓͠ͳ͕͖
    ΞδΣϯμ

    View full-size slide

  13. Assembly Definition ͱ͸ʁ
    15

    View full-size slide

  14. 16
    Assembly

    Λ

    Definition

    ͢ΔͨΊͷػೳ

    View full-size slide

  15. 17
    Assembly ?
    Assembly Definition ͱ͸ʁ
    ग़య.4%/ʮ/&5ͷΞηϯϒϦͱ໊લۭؒͷཧղͱ࢖༻ʯ
    lΞηϯϒϦ͸ɺػೳͷ࿦ཧత୯ҐΛ

    ߏ੒͢ΔܕͱϦιʔεͷू·ΓͰ͢ɻz

    View full-size slide

  16. 18
    Assembly ?
    Assembly Definition ͱ͸ʁ
    wૈ͘ݴ͑͹ʮϓϩάϥϜͷմʯ
    w"TTFNCMZ%FpOJUJPO͸ɺ

    ͜ͷմΛ࡞ΔͨΊͷઃఆϑΝΠϧ

    View full-size slide

  17. 19
    Կ͕خ͍͠ͷʁ
    Assembly Definition ͱ͸ʁ
    wίϯύΠϧ࣌ؒͷ୹ॖ
    wϞδϡʔϧͷૄ݁߹Խʢ෭࣍తʣ

    View full-size slide

  18. 20
    Assembly Definition ͷجຊ
    Assembly Definition ͱ͸ʁ
    w6OJUZͰ௥Ճ
    w5FTU"TTFNCMJFTͱ͔VOTBGFίʔυ
    ͱ͔ͷରԠ͸6OJUZ͔Β

    View full-size slide

  19. 21
    Assembly Definition ͷجຊ
    Assembly Definition ͱ͸ʁ

    hoge.asmdef

    hoge.dll

    View full-size slide

  20. 22
    Assembly Definition ͷجຊ
    Assembly Definition ͱ͸ʁ
    Assets/
    ├hoge.asmdef
    ├Foo.cs
    └Fuga/
    └Bar.cs

    hoge.dll

    View full-size slide

  21. 23
    Assembly Definition ͷجຊ
    Assembly Definition ͱ͸ʁ
    Assets/
    ├hoge.asmdef
    ├Foo.cs
    └Fuga/
    ├fuga.asmdef
    └Bar.cs

    hoge.dll

    fuga.dll

    View full-size slide

  22. 24
    ίϯύΠϧ࣌ؒͷ୹ॖʁ
    Assembly Definition ͱ͸ʁ

    View full-size slide

  23. ίϯύΠϧ࣌ؒͷ୹ॖʁ
    Assembly Definition ͱ͸ʁ
    wεΫϦϓτͷมߋΛݕ஌͢Δͱ

    ౎౓"TTFNCMZ$4IBSQEMMͱ͍͏

    ڊେͳEMMʹίϯύΠϧ͠௚͍ͯͨ͠
    w"TTFNCMZ͕෼͔ΕΔͱɺ

    มߋͱ͸ແؔ܎ͳ"TTFNCMZͷ

    ίϯύΠϧ͕ߦΘΕͳ͘ͳΔ

    View full-size slide

  24. 26
    Ϟδϡʔϧͷૄ݁߹Խʁ
    Assembly Definition ͱ͸ʁ
    wࠓ·Ͱ͸୯Ұͷ"TTFNCMZʹ

    શεΫϦϓτؚ͕·Ε͍ͯͨͷͰɺ

    ϥΠϒϥϦ։ൃऀ͕ҙਤ͠ͳ͍

    ࢀরͳͲ΋Մೳͩͬͨ
    w"TTFNCMZΛ෼ׂ͢Δ͜ͱͰɺ

    ҙਤ͠ͳ͍ࢀরΛߦ͑ͳ͘ͳΔͷͰ

    ݁Ռͱͯ͠ૄ݁߹Խʹܨ͕Δʢ͜ͱ΋͋Δʣ

    View full-size slide

  25. w"TTFNCMZ%FpOJUJPOͱ͸ʁ
    w"TTFNCMZ%FpOJUJPOͷ࢖͍ํ
    w"TTFNCMZ%FpOJUJPOͷ5JQT
    27
    ͓͠ͳ͕͖
    ΞδΣϯμ

    View full-size slide

  26. Assembly Definition ͷ࢖͍ํ
    28

    View full-size slide

  27. 29
    .asmdef ϑΝΠϧΛ࡞Δ
    Assembly Definition ͷ࢖͍ํ

    View full-size slide

  28. 30
    .asmdef ϑΝΠϧΛ࡞Δ
    Assembly Definition ͷ࢖͍ํ
    Ҏ্ɻ

    View full-size slide

  29. 31
    AD ొ৔લ
    Assembly Definition ͷ࢖͍ํ
    •Assembly-CSharp.dll
    •Assets/**/*.cs
    •Assembly-CSharp-Editor.dll
    •Assets/**/Editor/**/*.cs
    •Assembly-CSharp-firstpass.dll
    •Assets/Plugins/**/*.cs
    •Assembly-CSharp-Editor-firstpass.dll
    •Assets/Plugins/**/Editor/**/*.cs

    View full-size slide

  30. 32
    AD ొ৔લ
    Assembly Definition ͷ࢖͍ํ

    View full-size slide

  31. 33
    AD ొ৔ޙ
    Assembly Definition ͷ࢖͍ํ
    •Assembly-CSharp.dll
    •.asmdef ͕ଘࡏ͠ͳ͍σΟϨΫτϦҎԼͷ
    *.cs
    •.dll
    •Assets/**/.asmdef

    ͱಉ֊૚σΟϨΫτϦҎԼͷ*.cs

    View full-size slide

  32. 34
    AD ొ৔ޙ
    Assembly Definition ͷ࢖͍ํ

    View full-size slide

  33. 35
    AD ొ৔ޙ
    Assembly Definition ͷ࢖͍ํ

    View full-size slide

  34. 36
    ґଘ؅ཧ
    Assembly Definition ͷ࢖͍ํ
    ͋Δ"TTFNCMZ͸
    ଞͷ"TTFNCMZͷ
    ΫϥεΛඞཁͱ͢Δ
    ґଘ

    View full-size slide

  35. 37
    ґଘ؅ཧ
    Assembly Definition ͷ࢖͍ํ

    View full-size slide

  36. w"TTFNCMZ%FpOJUJPOͱ͸ʁ
    w"TTFNCMZ%FpOJUJPOͷ࢖͍ํ
    w"TTFNCMZ%FpOJUJPOͷ5JQT
    38
    ͓͠ͳ͕͖
    ΞδΣϯμ

    View full-size slide

  37. Assembly Definition ͷ Tips
    39

    View full-size slide

  38. 40
    Editor Assembly
    Tips
    •UnityEditor Λࢀর͢Δ"TTFNCMZ
    wϏϧυʹ͸ؚΊͨ͘ͳ͍

    ʢͱ͍͏ؚ͔ΊΔͱΤϥʔʹͳΔʣ

    View full-size slide

  39. 41
    Editor Assembly
    Tips

    View full-size slide

  40. 42
    Test Assembly
    Tips
    •NUnit Λࢀর͢Δ"TTFNCMZ
    w௨ৗͷ"TTFNCMZ͸NUnitͷࢀরෆՄ

    View full-size slide

  41. 43
    Test Assembly
    Tips

    View full-size slide

  42. 44
    unsafe ίʔυ
    Tips

    View full-size slide

  43. 45
    unsafe ίʔυ
    Tips
    wVOTBGFͳίʔυ΋औΓѻ͑Δ
    wJM$QQ4FU0QUJPOͱ͔࢖͏৔߹͸ɺ

    ผ్ࢀরઃఆΛߦ͏ඞཁ͕͋Δ

    View full-size slide

  44. 46
    .NET Framework Version
    Tips
    w/&5ͷόʔδϣϯ͸ݸผબ୒Ͱ͖ͳ͍
    wProjectSettings.assetͷઃఆʹґଘ͢Δ
    wόʔδϣϯΛݻఆ͍ͨ͠৔߹͸

    "TTFNCMZ%FpOJUJPOΛ࢖Θͣʹ

    ࣗલͰEMMίϯύΠϧ͢Δ͔͠ແͦ͞͏

    View full-size slide

  45. 47
    AssemblyDefinition
    ×
    AssetBundle
    Tips
    w"TTFU#VOEMFΛ༻͍͍ͯΔ৔߹ɺ

    ͪΐͬͱ࿩͕ϠϠίγΫͳΔ
    w"%Խ͢Δͱɺ4DFOFͳͲͷ"TTFU͕ࢀর͢Δ

    $PNQPOFOU΍4DSJQUBCMF0CKFDUͷ

    "TTFNCMZ৘ใ͕มԽ͢ΔίτʹͳΔ
    wجຊతʹ"TTFU#VOEMFͷ࠶ߏங͕ඞཁ
    wϒϩάॻ͍ͨͷͰɺ࢔ࡉ͸ͦͪΒΛ͝ࢀর͍ͩ͘͞

    View full-size slide

  46. 48
    static Ϋϥεɾϝιου
    Tips
    w௚઀తʹ࢖͍ͬͯͳ͍ϋζͳͷʹ

    ʮͦͷ"TTFNCMZࢀরͰ͖ͳ͍Αʂʯ

    ΤϥʔͰౖΒΕΔ͜ͱ͕͋Δ
    w͜Ε͸ɺ਌ΫϥεͷTUBUJDϝιουΛ

    ࢀর͍ͯ͠Δ৔߹ͳͲʹى͖͕ͪ

    View full-size slide

  47. •class Hoge :
    SingletonMonoBehaviour {}
    •Hoge.Instance;
    w͜Ε͸࣮࣭తʹ͸
    SingletonMonoBehaviour.Instance Λ

    ࢀর͍ͯ͠ΔͷͰɺ

    SingletonMonoBehaviourؚ͕·ΕΔ

    "TTFNCMZ΁ͷࢀর͕ඞཁʹͳΔ
    49
    static Ϋϥεɾϝιου
    Tips

    View full-size slide

  48. 50
    partial Ϋϥε
    Tips
    w$ʹ͸QBSUJBMͱ͍͏ɺΫϥεͳͲͷ

    ఆٛΛ෼ׂͰ͖ΔΑ͏ͳ࢓૊Έ͕͋Δ
    w͜Ε͸ɺಉҰ"TTFNCMZ಺ͰͷΈ༗ޮ
    w"TTFNCMZΛ෼ׂ͢ΔͱQBSUJBMఆ͕ٛ

    ޮ͔ͳ͘ͳΔͷͰ஫ҙ

    View full-size slide

  49. 51
    -batchmode
    Tips
    w$*ͳͲΛ͢ΔࡍʹඞਢʹͳΔҾ਺
    wԿΒ͔ͷ৚݅Ͱ"TTFNCMZ͕࠶ίϯύΠϧ͞
    Εͳ͘ͳΔ͜ͱ͕͋Δ
    w.JTTJOH4DSJQUTతͳΤϥʔ͕େྔൃੜ
    wݪҼෆ໌͕ͩ6OJUZͷόʔδϣϯΛ

    ੾Γସ͑ͨΓ͢Δͱ௚Δίτ͕ଟ͍

    View full-size slide

  50. w5IFBTTPDJBUFETDSJQUDBO
    OPUCFMPBEFEʜ

    ͱ͔ݴΘΕΔ
    wCBUDINPEFͷιϨͱ͍ۙʁ
    wݪҼෆ໌
    w௚͠ํ͸6OJUZͷ

    όʔδϣϯΛ੾Γସ͑ͯىಈ
    w

    52
    εΫϦϓτണ͕Ε
    Tips

    View full-size slide

  51. w"TTFNCMZ%FpOJUJPOΛ༻͍Δͱ

    ίϯύΠϧ͕଎͘ͳΔʢ͔΋ʣ
    wͪΐͬͱΫη͕ڧ͍͚Ͳ

    ࣮༻Ϩϕϧʹ͸ୡͯ͠Δ
    54
    ·ͱΊ

    View full-size slide

  52. wࠓ೔͓࿩ͨ͠͠಺༰ͷαϯϓϧΛ
    (JU)VCʹެ։͓ͯ͠Γ·͢
    w IUUQTHJUIVCDPNNPOSZ"TTFNCMZ%FpOJUJPO@4BNQMF
    56
    ͓·͚

    View full-size slide

  53. 57
    Thank you for your
    attention!!

    View full-size slide