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

C++のパッケージマネージャ「poac」を開発した話 / Poac is a package manager for C++

C62fe8f90cf120dcc0a894461990e3e2?s=47 Ken Matsui
February 20, 2019

C++のパッケージマネージャ「poac」を開発した話 / Poac is a package manager for C++

C62fe8f90cf120dcc0a894461990e3e2?s=128

Ken Matsui

February 20, 2019
Tweet

Transcript

  1. $ ͷύοέʔδϚωʔδϟ
 ʮQPBDʯΛ։ൃͨ͠࿩ ·͚ͭΜ !NBULFO ໋ཱؗେֶ৘ใཧ޻ֶ෦̎೥ੜ

  2. ύοέʔδϚωʔδϟͱ͸ ϥΠϒϥϦͷ഑ஔ΍όʔδϣϯ؅ཧɼґଘؔ܎ ղܾ౳ͷ൥ࡶͳ࡞ۀΛϚωδϝϯτͯ͘͠ΕΔ

  3. ▸ /PEFKTͷOQN΍ZBSO ▸ &MJYJSͷIFY ▸ $ ͷDPOBO ▸ 3VTUͷDBSHP ▸

    )BTLFMMͷDBCBM ৭ʑͳύοέʔδϚωʔδϟ
  4. $ ͷDPOBO͸࢖͍ͮΒ͍

  5. poac ▸ ΠϯλϑΣʔε͕௚ײత ▸ ཚཱͨ͠ྑ͍ࢿ࢈ΛవΊͯఏڙ ▸ ύοέʔδϚωʔδϟ݉ϏϧυγεςϜ ▸ GitHub: https://github.com/poacpm

    Website: https://poac.io
  6. None
  7. QPBDͷ༝དྷᶃ Plus of Cͷpocͩͱ঎ඪ͕େྔʹऔΒΕ͍ͯͯා͔ͬͨ

  8. ൃԻʹӨڹΛ༩͑ͳͦ͞͏ͳ฼ԻΛೖΕͯɼpoacʹͨ͠ QPBDͷ༝དྷᶃ

  9. QPBDͷ༝དྷᶄ ίϚϯυͱͯ͠Կ౓΋ೖྗ͢ΔͷͰɼ
 ଧͪ΍͘͢ɼยख͚ͩʹෛ୲͕ภΒͳ͍ࣄΛॏࢹ ྲྀΕΔΑ͏ʹଧͭ͜ͱ͕Մೳ P, O ӈख A, C ࠨख

  10. QPBDͷ༝དྷᶅ /p/͸࠷΋໌Δ͍ҹ৅Λ༩͑Δ ग़యɿ೔ຊޠΦϊϚτϖͷجຊײ৘࣍ݩͱ೔ຊޠԻײૉͷجຊϨϕϧʹ͍ͭͯ (http://hdl.handle.net/10112/12311)

  11. QPBDͷ༝དྷᶅ /p/͸࠷΋ॊΒ͔͍ҹ৅Λ༩͑Δ ग़యɿ೔ຊޠΦϊϚτϖͷجຊײ৘࣍ݩͱ೔ຊޠԻײૉͷجຊϨϕϧʹ͍ͭͯ (http://hdl.handle.net/10112/12311)

  12. QPBDͷϩΰ ੨ ਫ ւ ޫ ਂւ C++ͷҋ

  13. QPBDͷϩΰ ޫ C++ͷҋ

  14. ରԠ04 ▸ NBD04 TJFSSB  ▸ -JOVY Y@  ▸

    8JOEPXT 84-
  15. ࢖༻ٕज़ 4FSWFS Frontend Elm firebase
 hos2ng $MJFOU C++ Backend TypeScript

    firebase
 func2ons Upload API Golang App Engine
  16. ▸ JOTUBMM   ύοέʔδΛΠϯετʔϧ ▸ VOJOTUBMM  ύοέʔδΛΞϯΠϯετʔϧ ▸

    TFBSDI  ύοέʔδΛݕࡧ ▸ JOJU    QPBDZNMϑΝΠϧΛੜ੒ ▸ OFX    ϓϩδΣΫτςϯϓϨʔτΛੜ੒ ▸ QVCMJTI  ࣗ࡞ύοέʔδΛެ։ ▸ UFTU   ςετΛߦ͏ ▸ VQEBUF  ύοέʔδΛΞοϓσʔτ ▸ CVJME   Ϗϧυ͢Δ ▸ SVO   Ϗϧυͱ࣮ߦΛߦ͏ αϒίϚϯυ Ұ෦
  17. None
  18. None
  19. None
  20. None
  21. ΞʔΩςΫνϟ $ poac args... vector<string> Command I/O Builder Resolver components

    Inference
  22. *OGFSFODF template <typename S, typename OpTypeE, typename VS, typename=std::enable_if_t<std::is_rvalue_reference_v<VS&&>>> auto

    _apply(S&& func, const OpTypeE& cmd, VS&& arg) { return branch(std::move(func), cmd, std::move(arg)); } template <typename S, typename VS, typename=std::enable_if_t<std::is_rvalue_reference_v<VS&&>>> std::string apply(S&& func, const S& cmd, VS&& arg) { namespace except = core::exception; if (auto itr = subcmd_map.find(cmd); itr != subcmd_map.end()) return _apply(std::move(func), itr->second, std::move(arg)); else if (itr = option_map.find(cmd); itr != option_map.end()) return _apply(std::move(func), itr->second, std::move(arg)); else throw except::invalid_first_arg("Invalid argument"); }
  23. *OGFSFODF // Create function pointer table: { &func<0>, &func<1>, ...

    } // Execute function: &func<idx>[idx]() template <size_t... Is, typename VS, typename = std::enable_if_t<std::is_rvalue_reference_v<VS&&>>> static auto execute(std::index_sequence<Is...>, int idx, VS&& vs) { // Return ""(empty string) because match the type to the other two functions. return make_array({ +[](VS&& vs){ return (op_type_list_t::at_t<Is>()(std::move(vs)), ""); }... })[idx](std::move(vs)); } template <size_t... Is> static auto summary(std::index_sequence<Is...>, int idx) { return make_array({ +[]{ return op_type_list_t::at_t<Is>::summary(); }... })[idx](); } template <size_t... Is> static auto options(std::index_sequence<Is...>, int idx) { return make_array({ +[]{ return op_type_list_t::at_t<Is>::options(); }... })[idx](); }
  24. ($$ͷόά #if BOOST_COMP_GNUC template <typename T, typename VS, typename =

    std::enable_if_t<std::is_rvalue_reference_v<VS&&>>> static auto execute2(VS&& vs) { return (T()(std::move(vs)), ""); } template <typename T> static auto summary2() { return T::summary(); } template <typename T> static auto options2() { return T::options(); } template <size_t... Is, typename VS, typename = std::enable_if_t<std::is_rvalue_reference_v<VS&&>>> static auto execute(std::index_sequence<Is...>, int idx, VS&& vs) { using func_t = decltype(&execute2<op_type_list_t::at_t<0>, VS>); static func_t func_table[] = { &execute2<op_type_list_t::at_t<Is>>... }; return func_table[idx](std::move(vs)); } template <size_t... Is> static auto summary(std::index_sequence<Is...>, int idx) { using func_t = decltype(&summary2<op_type_list_t::at_t<0>>); static func_t func_table[] = { &summary2<op_type_list_t::at_t<Is>>... }; return func_table[idx](); } template <size_t... Is> static auto options(std::index_sequence<Is...>, int idx) { using func_t = decltype(&options2<op_type_list_t::at_t<0>>); static func_t func_table[] = { &options2<op_type_list_t::at_t<Is>>... }; return func_table[idx](); } #else
  25. ΞʔΩςΫνϟ $ poac args... vector<string> Inference Command I/O Builder Resolver

    components
  26. 3FTPMWFS core semver SAT solver

  27. compiler shell-command core #VJMEFS

  28. *0 cli network file

  29. ΞʔΩςΫνϟ $ poac args... vector<string> Inference Command I/O Resolver Builder

    components
  30. ΞʔΩςΫνϟ vect B Re com Client API

  31. Client ΞʔΩςΫνϟ API

  32. "1* #BTJD 6QMPBE (PMBOH 5ZQFTDSJQU

  33. None
  34. ࠓޙ΍͍ͬͯ͘͜ͱ ▸ ύοέʔδͷ௥Ճɾ੔උ ▸ υΩϡϝϯτͷ֦ॆ ▸ ϏϧυγεςϜվળ ▸ ଎౓ͷվળ ▸

    ιʔείʔυͷվળ ▸ ΤσΟλͷ֦ுػೳ։ൃ ▸ ϏϧυࡁΈύοέʔδͷΠϯετʔϧ ▸ άϩʔόϧΠϯετʔϧ ▸ EFW%FQFOEFODZɾUFTU%FQFOEFODZ ▸ EPDίϚϯυɾGNUίϚϯυ
  35. poac ▸ ΠϯλϑΣʔε͕௚ײత ▸ ཚཱͨ͠ྑ͍ࢿ࢈ΛవΊͯఏڙ ▸ ύοέʔδϚωʔδϟ݉ϏϧυγεςϜ ▸ GitHub: https://github.com/poacpm

    Website: https://poac.io