GlitchEnzo / NuGetForUnity

A NuGet Package Manager for Unity
MIT License
3.22k stars 317 forks source link

Support for installing NugetForUnity via UPM #223

Closed popcron closed 1 year ago

popcron commented 5 years ago

Unity recently implemented support for the package manager to be able to reference github repos as packages using the following format: "com.popcron.console": "https://github.com/popcron/console.git"

With support for commitish identifiers, so you are able to target a specific branch if you add #branch. They don't have any support for targeting a specific directory within a repository, so organizing it by folder isn't possible. Though they are planning on supporting it later on according to their forum replies here.

The format for making a repository recognizable as a package by UPM, is to have a package.json file inside, and any .meta files included and up to date (documentation). My workflow with this, is to work with the repository cloned to my desktop, and reference it locally so that I am able to generate valid .meta files. "com.popcron.console": "file:/Users/phill/source/repos/Popcron.Console"

Cheers!

Thaina commented 5 years ago

+1

jwittner commented 5 years ago

Not sure what the ask is for here from NuGetForUnity, i.e. how should the project support UPM? Closing for now, but if there's a good idea for how this project can leverage or support UPM we can reopen.

Thaina commented 5 years ago

@jwittner There is a way you could put some json file in format of UPM into the root of this repo and UPM could import the repo as package

jwittner commented 5 years ago

Ah, I see, you want this package to support being installed by UPM. I'll reopen and adjust the description. =)

popcron commented 5 years ago

The benefit is reducing the file size of a projects repo because you would be able to sync a package manifest file for all users instead of including it directly in the assets folder.

Thaina commented 5 years ago

Any progress?

jwittner commented 5 years ago

@Thaina - not that I know of, but we're always open to PRs if you want to add support for shaping a package out of the repo for distribution on UPM. I do have access to a public feed that I can distribute from once we have a package, but don't have bandwidth to do the packaging.

as3mbus commented 4 years ago

would love to see this happen. it would helps a lot with package that require dll fetched from nuget and less dependency handling through UPM.

i would like to implement this. but i haven't even tried the plugin. i'd try it later

just for an up vote i included a blog that can help anyone interested with UPM.

https://gametorrahod.com/how-to-asmdef-upm/

shiena commented 4 years ago

You can use path query parameter from unity2019.3.4f1 and unity2020.1a21. https://forum.unity.com/threads/some-feedback-on-package-manager-git-support.743345/#post-5425311

andybak commented 4 years ago

I'd just like to add my vote to this. The primary motivation for using packages is to keep my repo/project clean of 3rd party code.

It seems like a step backwards that the only way to make use of NuGet packages is to add a big glob of 3rd party code to my project.

popcron commented 4 years ago

Agreed

popcron commented 4 years ago

@Thaina - not that I know of, but we're always open to PRs if you want to add support for shaping a package out of the repo for distribution on UPM. I do have access to a public feed that I can distribute from once we have a package, but don't have bandwidth to do the packaging.

Are you suggesting that each nuget package could be delivered as a UPM package via a new registry (similar to how keijiro does it for his packages). If thats the case that could be awesome, though like you said, it does mean that the packages would have to hosted twice essentially and the bandwidth would have to be covered

@jwittner

jwittner commented 4 years ago

@andybak - we ignore the Assets/Packages folder and it's meta file in our .gitignore and it works great to keep third party stuff out of our repos. =)

Realized just now you might be referring to the NugetForUnity assets themselves, which are pretty small, but I agree would be better delivered through UPM.

jwittner commented 4 years ago

@popcron - this issue is about supporting the installation of NugetForUnity itself through UPM, not for supporting installation of Nuget packages through UPM. Right now the best way to get NugetForUnity initially installed is through the Releases here on GitHub. After that you can get updates through the Nuget menu in Unity, but it's just checking the Releases page and downloading the packages for you.

assert-not-singularity commented 4 years ago

I refactored the project so it is a valid UPM project using the reference provided by the Unity Manual. You can try out by pressing the + button in the Unity Package Manager, clicking Add package from git URL... and entering https://github.com/assert-not-singularity/NuGetForUnity.git#upm-package or by adding the dependency "com.glitchenzo.nugetforunity": "https://github.com/assert-not-singularity/NuGetForUnity.git#upm-package" to the manifest.json.

There are still the CreateDLL and Packager folders in this branch it but they are not required anymore. Therefore, I did not try out if creating the .unitypackage still works. In my opinion, providing this package using UPM makes these redundant.

Please try out if downloading the package via UPM works for you as well. I would then open a PR, if desired. But be aware to not use this in any productive project since I will might delete this testing branch some day.

popcron commented 4 years ago

That's great! A self updater would be handy too.

JoC0de commented 1 year ago

Implemented in #480