Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upm support #24

Open
starikcetin opened this issue Aug 14, 2019 · 46 comments
Open

upm support #24

starikcetin opened this issue Aug 14, 2019 · 46 comments
Labels
enhancement New feature or request

Comments

@starikcetin
Copy link

Can we convert this into a UPM package to be used with https://github.com/mob-sakai/UpmGitExtension? I can do it for you if you don't have time.

@Mathijs-Bakker
Copy link
Collaborator

Oh! That's quite cool! I never heard of it.
+1 for the idea.
And you can contribute if you like ;)

@starikcetin
Copy link
Author

Yeah I recently discovered it as well, I will see what I can do.

@starikcetin
Copy link
Author

starikcetin commented Aug 14, 2019

Alright so here are my current results:
I followed this article: https://www.patreon.com/posts/25070968

The UPM branch is orphan. It is created by git subtree split command.

But instead of leaving the split UPM branch as is, I soft reset to the first commit and squashed everything by amending the commit. This yielded a prettier result in my opinion.

UPM branch: https://github.com/starikcetin/Extenject/tree/upm

The problem is, all the other tags are showing up at the version select list, which are not compatible:
Capture

The reason they are not compatible is that, the UpmGitExtension plugin requires the package.json to be at the repository root, but we cannot just put it in there since we need to only publish the Plugins/Zenject folder as the package.

This is not a huge deal of course, since it rejects you from importing incompatible versions (i.e. when it cannot find the package.json at the repo root). But I think we should find a better way.

Maybe we can maintain a separate repository just for the UPM releases?

Or, maybe we can implement some tag-filtering mechanism in the UpmGitExtension plugin itself, so that it only shows compatible tags. I looked at it for a while but the code seems very complicated.

@starikcetin
Copy link
Author

starikcetin commented Aug 15, 2019

Alright, can you give me an orphan branch named "upm" here so I can send a pull request @svermeulen ?

@mob-sakai
Copy link

Hi @starikcetin

I released UpmGitExtension v1.0.0 with tag filter support.
This is just a short note to inform you. ;)
uge_0_9_1-2
1_0_0_uge-2

@starikcetin
Copy link
Author

Hi @starikcetin

I released UpmGitExtension v1.0.0 with tag filter support.
This is just a short note to inform you. ;)

you know what? you are amazing. :)

@Mathijs-Bakker
Copy link
Collaborator

@starikcetin Thanks for your contribution! It's much appreciated.
I like the fact that minor updates can be easily distributed to the users of Zenject.

UPM is an awesome thing for the future. However it's still in beta... If you've watched the Unite's Copenhagen there's a lot of new features coming to UPM. Like Asset Store Support, better Git support, etc. But the Package Developer tool is still not available.

The ultimate goal would be to have Zenject/Extenject in the UPM itself. And how cool would it be to have it in the Packages folder!

I am happy to create an UPM branch. But before that... could you enlighten me a bit more?

  • The package installs into the same Plugins/Zenject directory?
  • How does the GitHub link being advertised/registered? Does it automatically show up in the Package Manager? Is there any further action needed?
  • Can updates be made simpler/automated?
  • Does UPM automatically detects updates?
  • Is there anything what can cause a bad user experience?

Don't want to be a pain but just want to get these stuff clear ;)

@Mathijs-Bakker
Copy link
Collaborator

Btw the package validator gives an error:

Cannot perform upm operation: Unable to add package [https://github.com/starikcetin/Extenject/tree/upm]:
  Package name 'https://github.com/starikcetin/Extenject/tree/upm' is invalid. [InvalidParameter]

@dustinlacewell
Copy link

Just wanna chime in that I was able to install Extenject from https://github.com/starikcetin/Extenject.git#b2746939227c47de4b00de2a0f772df3d7831e6

@starikcetin
Copy link
Author

Just wanna chime in that I was able to install Extenject from https://github.com/starikcetin/Extenject.git#b2746939227c47de4b00de2a0f772df3d7831e6

hey, you can just use https://github.com/starikcetin/Extenject.git#9.1.0, tag names are also valid.

@starikcetin
Copy link
Author

@Mathijs-Bakker I'll write a detailed response when I get the chance. I've been very busy lately. But shortly, UPM is much better than any other asset sharing method I've used (and I used quite a lot of them). It keeps the assets folder clean of third party imports, provides version based updates with the click of a button, and it supports dependencies!

@umfahrem
Copy link

umfahrem commented Jan 8, 2020

@Mathijs-Bakker
As this has been uncommented for a while let me try and address your questions:

* The package installs into the same Plugins/Zenject directory?

No, the plugin installs into a Package/Extenject directory. Since the plugin name is pulled from the package defintion this becomes the new diretory name. Also Unity handles upm packages differently and stores them outside the "Assets" directory.

* How does the GitHub link being advertised/registered? Does it automatically show up in the Package Manager? Is there any further action needed?

The package manager does by default not show existing third party projects. Users will need to add the link by themselves.

* Can updates be made simpler/automated?

Yes. I in fact did this via GitHub actions. The workflow implemented on my fork creates a new commit on an orphan upm branch and tags it with a separate upm version tag once a new version tag with the existing semantic versioning theme is pushed to the repo. This approach sadly discards any history as it creates an orphan branch and also creates the need to create separate upm tags but eliminates the need for a second repository compared to the subtree approach.

* Does UPM automatically detects updates?

If you just specify a branch it will always get the head version of that branch. If you use the upm-extension by @mob-sakai it should be able to detect the most recent version. In the newest version it would not detect earlier versions for some reason though (nvm, it detects them fine after adding it, you can downgrade to earlier versions). If you're not using the extension I think you have to manually delete the reference to the used version from the manifest.json.

* Is there anything what can cause a bad user experience?

As previously stated to use the ui you pretty much should use the upm-extension.

Please feel free to correct me if i missed something @starikcetin :)

@Mathijs-Bakker
Copy link
Collaborator

Mathijs-Bakker commented Jan 8, 2020

Hi @umfahrem
Thank you for your reply.
There was a bug with UpmGitExtension. Which didn't allow me to install a git upm.
mob-sakai/UpmGitExtension#73
I will check it later if this has been resolved.

However. UPM should be supported. And actually I have a Zenject UPM version locally. Following Unity's package development recommendations.
I ended up with some optional packages.

  1. Zenject - DI framework
  2. Signals (from optional extras)
  3. Example demos (from optional extras)
  4. Moq Extension (from optional extras)
  5. NSubstitute Extension (from optional extras)

There are still some issues on Unity's side. Because they are still developing their UPM support. There's still something with the dependencies field in the package.js manifesto.

The last months of 2019 have been very busy for me to catch up with a lot of things. And this is one of them. I will see if I can get to it to push the local packages to the according tree.

Meanwhile just keep using the @starikcetin one.

@paulpach
Copy link

I tried the upm package from @starikcetin but I keep getting spammed with the following warning:

A meta data file (.meta) exists but its asset 'Packages/com.svermeulen.extenject/OptionalExtras/TestFramework/Editor/AutoSubstitute/__MACOSX/AutoSubstitute/NSubstitute' can't be found. When moving or deleting files outside of Unity, please ensure that the corresponding .meta file is moved or deleted along with it.

@paulpach
Copy link

Note these warnings are usually printed only once if the code is inside your project but in upm packages they keep getting printed over and over.

@Mathijs-Bakker
Copy link
Collaborator

Note these warnings are usually printed only once if the code is inside your project but in upm packages they keep getting printed over and over.

Yes you right! that's annoying.
More reason to raise this issue on @starikcetin fork

@paulpach
Copy link

@Mathijs-Bakker I can't, issues are disabled there, and he is not responding

@Mathijs-Bakker
Copy link
Collaborator

@Mathijs-Bakker I can't, issues are disabled there, and he is not responding

That's bad. However... did you tried to delete the .meta file?
You only see them in your systems file browser window.
And you can open the current directory from right clicking on a file in Unity's project window.
Hope this helps.

@starikcetin
Copy link
Author

starikcetin commented Jan 19, 2020

Hey, sorry I have been very busy with work and school lately. I will look into it when I get the chance. @paulpach

@Mathijs-Bakker Mathijs-Bakker added the enhancement New feature or request label Jan 21, 2020
@MeikelLP
Copy link

@starikcetin Thank you for also pushing it to openupm :)

@MeikelLP
Copy link

MeikelLP commented Feb 10, 2020

Getting 2 warnings when installing (via openupm) and every time Unity re-focuses:

A meta data file (.meta) exists but its asset 'Packages/com.svermeulen.extenject/OptionalExtras/TestFramework/Editor/AutoSubstitute/__MACOSX/AutoSubstitute/NSubstitute' can't be found. When moving or deleting files outside of Unity, please ensure that the corresponding .meta file is moved or deleted along with it
Couldn't delete Packages/com.svermeulen.extenject/OptionalExtras/TestFramework/Editor/AutoSubstitute/__MACOSX/AutoSubstitute/NSubstitute.meta because it's in an immutable folder.

@paulpach
Copy link

@starikcetin any progress? that warning is so obnoxious

starikcetin added a commit to starikcetin/Extenject that referenced this issue Feb 17, 2020
@starikcetin
Copy link
Author

starikcetin commented Feb 17, 2020

Can you try 9.1.0-1.metaFileFix version? The warning is gone on my machine.
openupm add com.svermeulen.extenject@9.1.0-1.metaFileFix
@paulpach @MeikelLP

@MeikelLP
Copy link

@starikcetin looks good to me

@MeikelLP
Copy link

Another issue I have related to UPM:

I cannot use moq.dll right now. I'm using Unity 2019.3.1f1 and set the assembly overrides manually:

image

But I cannot use moq or NSubstitute at all. This might not be an issue with Extenject itself but with the latest Unity package manager. I had a similar bug the other day with testables in the new inputsystem: Unity-Technologies/InputSystem#989 (comment)

Can somebody confirm that this is not possible as of right now?

@MeikelLP
Copy link

I can confirm that this is not related to Extenject. Unity generates wrong .csproj files (?)

My references land inside MyProject.Items.csproj instead of MyProject.Items.Tests.csproj -_-

@Mathijs-Bakker
Copy link
Collaborator

Mathijs-Bakker commented Feb 17, 2020

Maybe a dumb question: But does adding Zenject-usage.dll to the assembly refs help?

@MeikelLP
Copy link

@Mathijs-Bakker seems to be (another) internal bug in Unity. It's related to

"defineConstraints": [
    "UNITY_INCLUDE_TESTS"
],

if this is not set the dll references work fine. I opened an issue at Unity (Case 1220959). Let's see how it goes.....

@MeikelLP
Copy link

So apparently Moq.dll (which I want to use) is not supported in play mode (?).
Do you know if this is something this package can fix or is it an actual Unity issue?

@shiena
Copy link

shiena commented Mar 9, 2020

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

Since package.json already exists, it can be set as follows.

{
  "dependencies": {
    "com.svermeulen.extenject": "https://github.com/svermeulen/Extenject.git?path=/UnityProject/Assets/Plugins/Zenject",
    ...
  }
}

@shiena
Copy link

shiena commented Mar 15, 2020

When Extenject is installed from Package Manager using path query parameter, the following sample scene cannot be opened.

If you add a samples section to package.json like ShaderGraph, it will be expanded to Assets folder, but an error will occur because the script is duplicated.
https://github.com/Unity-Technologies/Graphics/blob/v7.2.1/com.unity.shadergraph/package.json#L11-L16

If you put sample projects in a hidden folder like Sample~ in upm, it works well, but it will not be included in unitypackage.

Do you have an idea that both unitypackage and upm work?

@johanhelsing
Copy link

If you put sample projects in a hidden folder like Sample~ in upm, it works well, but it will not be included in unitypackage.

@shiena I made a PR #220 going right into that trap. Perhaps it could work to rename the folder removing the tilde from the .unitypackage build script?

@marwie
Copy link

marwie commented Apr 3, 2021

Hello, is there any chance to release it on OpenUPM to make package installation easier? Releasing it as a package makes updating 1000x easier and more reliable.

I think Unity is also hosting a version of moq via UPM (I've seen it as a dependency in a tiny sample project recently) so adding dependencies like that could be done via UPM as well / OpenUPM

@MeikelLP
Copy link

MeikelLP commented Apr 3, 2021

Correct me if I am wrong but isn't there already OpenUPM support?
https://openupm.com/packages/com.svermeulen.extenject/

Or is that another repo?

@Mathijs-Bakker
Copy link
Collaborator

Yes, it's a fork of Extenject, forked and maintained by starikcetin

@modesttree modesttree deleted a comment from starikcetin Apr 5, 2021
@chrPetry
Copy link

Is this still active?
I would really like the solution of a simple "git-link dependency" to this.

@MeikelLP
Copy link

@chrPetry
Copy link

@chrPetry use https://openupm.com/packages/com.svermeulen.extenject/

As I understand I would need to add OpenUPM with this solution, right?
I would rather not use OpenUPM but the built-in Unity Package Manager.

@starikcetin
Copy link
Author

starikcetin commented Jul 21, 2021

@chrPetry use https://openupm.com/packages/com.svermeulen.extenject/

As I understand I would need to add OpenUPM with this solution, right?
I would rather not use OpenUPM but the built-in Unity Package Manager.

OpenUPM is external, it doesn't replace UPM. It is just a tool that automates what you would be doing manually.

My fork is a little outdated however, I don't know when I would get the chance to update it, so be aware.

@Mathijs-Bakker
Copy link
Collaborator

Unity Package Installer would be a more suitable name.

Unlike its name suggests wat it should do, Unity Package Manager (UPM) does not manage packages for you.
UPM only installs and uninstalls packages.

At Unite 2019 in Copenhagen, the UPM dev team presented the upcoming UPM feats. and their package developer tool. Then it took just a few months before the UPM project was canceled by the board. There are no exact reasons given why this happened (to the outside world). But it has to do something with the fact that UPM would become a competitor of the Unity Asset Store. And Unity needs to make money somewhere.

No other option than OpenUPM

If you want real package managing behavior, as auto update, revert back to earlier versions (tags) then OpenUPM is the only option.

To be continued

Stay tuned...

@chrPetry
Copy link

Alright, then thanks for this info!

@shiena
Copy link

shiena commented Jul 22, 2021

upm can also be packaged in a tarball with npm pack, so it can be published to releases as well as unitypackage.
https://docs.unity3d.com/Manual/upm-ui-tarball.html

for example

@MeikelLP
Copy link

@Mathijs-Bakker I think the name is somewhat suited. As people can't host packages that are natively supported by UPM, OpenUPM is a free registry users can (with some work involved) upload packages which are free for everybody.

It is very sad that once again Unity is doing stuff very closed and not open to the public.

@denravonska
Copy link

What's the status of this? The install documentation hints at UPM being an option, but using that installs 9.2.0 whereas we're now at 9.3.1.

@johanhelsing
Copy link

What's the status of this? The install documentation hints at UPM being an option, but using that installs 9.2.0 whereas we're now at 9.3.1.

After modest tree won the lawsuit and got control of this repo, they basically just changed the branding and stopped maintaining the repo.

Instaling from @Mathijs-Bakker s maintained fork by git url seems like the best option https://github.com/Mathijs-Bakker/Extenject It's what I'm doing at least

@denravonska
Copy link

denravonska commented Nov 4, 2022

Ah, sorry. I thought I was in the fork :D
It seems to have the same problem but I'll head over there instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.