Search Unity

Best practices when developing packages.

Discussion in 'Package Manager' started by Lobolopez, Jun 19, 2019.

  1. Lobolopez

    Lobolopez

    Joined:
    Feb 26, 2018
    Posts:
    25
    Hi there!
    So, when developing a package, how do you guys manage the data flow? The key issue if, for me, that repo-based packages will use the repo root as the package root, which means that, one way or the other, you'll need to point your package sub-dir to an external repo (which is what you'll share) That approach leaves you dealing with the development project being a repo around the package repo or some such.
    To the Collab guys: this would be simpler if we could just set a dir when linking, so I could do
    "the.company.product": "https://bitbucket.org/blah/bleh.git/Package" that would allow a single Git repo to do the job.


    But meanwhile, what I am considering:

    Collab + Git:
    The idea is, you develop your feature in a Collab project and, at the point of publication you create a Git repo from the package subdir and push that.
    -pros: simple to setup
    -cons: Collab doesn't know about the inner Git repo, so getting the project in a different computer means then linking manually the dir with the external Git. Which can or not be trivial. Pushing to external repo won't scale.

    Git Modules:
    Develop the feature in an Unity project that's hosted in Git and then set the package dir as a submodule
    -pros: easy to pull and push (git sub-module update --recursive 'ish)
    -cons: complicated to setup, plus I don't want to fix this other guy's merge issue (or mine) inside a sub-module. Submodules require special commands for pulling/pushing.


    Do those approaches sound kosher enough? What do you guys use?
     
  2. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    756
    Hi @Lobolopez

    I know that, internally, some teams are planning to use two Git repositories. One private for hosting the package development project and another one public to share the package with external users (letting users use the package through Git URL dependencies). Managing two repositories for your package is not a great development workflow. We have on our roadmap a feature to support Git package dependencies inside a repository sub-folder. This will enable merging both repositories into one.

    But for now, any of the solutions you shared seems fine in my point of view. I believe this is more of personal preference. Hopefully, other users will pitch in to share their experience/workflow!

    Regards,

    Pascal
     
  3. Lobolopez

    Lobolopez

    Joined:
    Feb 26, 2018
    Posts:
    25
    That sounds about right to me.
    Yeah, being able to have a single repo and pointing the package manager at a dir would definitely ease things but, at that point it would seem relatively easy to merge the two repos.
    Cheers man! (and pass greetings to Andre, Dominic and so on, you guys keep on doing a bloody great job (ex-unity myself :)
    Salut!
     
  4. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    756
    Will do! Cheers! :)
     
  5. RGV

    RGV

    Joined:
    Jan 25, 2016
    Posts:
    48
    It's cheerful to see such a wholesome yet concise thread.
    It's been a while, though, and yet we dont' have the chance to support git package dependencies inside a repo sub-folder — may I miss something?
    I guess it's not too easy — multi packages in one repo, and so forth —, but I think is still a core, missing feature on moving to remote packages paradigm.
     
  6. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    756
    Hi @RGV,

    This feature has landed in Unity early last year. It is available starting with 2019.3.4f1. You can find more information about this feature in the Unity User Manual.

    Hope this helps!

    Regards,

    Pascal
     
  7. RGV

    RGV

    Joined:
    Jan 25, 2016
    Posts:
    48
    Thanks @okcompute_unity!

    If you talk about path query parameter, I might be wrong but this way doesn't fix the private-public repo problem, as you said:
    “I know that, internally, some teams are planning to use two Git repositories. One private for hosting the package development project and another one public to share the package with external users (letting users use the package through Git URL dependencies)”.
    Insofar as the dev repository must be public, musn't it?

    It's really helpful for only-public cases, tho. Thanks! :)
     
  8. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    756
    Sorry @RGV, it feels like I misunderstood your request :(. I'm still unsure what you would like to see in the Package Manager. The request discussed in this thread, as far as I understand, is adding support for packages to be located in a Git repository subfolder (i.e. not exclusively at the root as it uses to be limited to). Dealing with private vs public Git registry is out of scope for the Package Manager. But maybe you have something in mind that I don't foresee :)
     
  9. RGV

    RGV

    Joined:
    Jan 25, 2016
    Posts:
    48
    Nevermind! — First and foremost perhaps I'm suffering from Lost In Translation stuff as English is not a language I really manage with :( —.
    It was just a matter of curiosity. I was searching about that two-git-repositories problem, as I hadn't figured out how to deal with that. Then I finally found this thread so I knew you can specify a path folder in package manager git URL (thanks y'all Unity people for this, phew). Then I said: ok, you never need those two repositories anymore, yay! But, wait, I may wanna hide the dev project (it is, the whole repository) from the package clients. So I need the repo to be private? That was the question, but it was just a silly doubt, you see.
    Sorry if I'm not able to properly communicate what I think of. As Gloria said once on Modern Family TV series: you don't even know how smart I am in Spanish!
     
  10. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    756
    @RGV, No worries. English is not my native tongue too :)

    Regards,

    Pascal