openupm cli add package will not add packages for non-up-to-date unity versions
maxhimmel opened this issue ยท 8 comments
I have Unity 2019.4.17f1
I'm trying to add a list of unity packages from a shell script:
I run the command openupm add com.unity.postprocessing
Response:
WARN editor.version requires 2019.4.19f1 but found 2019.4.17f1
notice suggest upgrade the editor to 2019.4.19f1, or run with option -f to ignore the warning
I also run the command openupm add com.unity.render-pipelines.universal
Response:
WARN editor.version requires 2020.2.3f1 but found 2019.4.17f1
notice suggest upgrade the editor to 2020.2.3f1, or run with option -f to ignore the warning
It seems like a bug to me that this cli tool wouldn't auto-select the most up-to-date version of the package that is valid for the current version of the unity editor. Much like how the UPM does so. At least those are my expectations.
Am I using this tool incorrectly? Am I missing an option in the CLI?
The -f
option isn't working for me either because it installs the most up-to-date version of the package into the editor which isn't supported by my current version of the editor.
Also, this tool is amazing and it was great fun integrating it into my tooling for expedited project creation.
I hope this is an easy fix or I'm just doing something dumb!
Hi @maxhimmel,
Thank you for the report, I confirm it's a bug. When providing a package without a version, it shall install the most up-to-date version of the package that is valid for the current version of the unity editor.
I think this bug still remains with some packages.
It is OK for com.unity.postprocessing, but this bug still happens with com.unity.render-pipelines.universal
The latest version of com.unity.render-pipelines.universal is now 14.0.9, however,
openupm add com.unity.render-pipelines.universal@14.0.1
outputs the error, and maximum version which can be installed is 10.10.1
WARN 404 version 14.0.1 is not a valid choice of: 7.0.0, 7.0.1, 7.1.1, 7.1.2, 7.1.5, 7.1.6, 7.1.7, 7.1.8, 7.2.0, 7.2.1, 8.0.1, 7.3.1, 9.0.0-preview.14, 8.1.0, 7.4.1, 9.0.0-preview.35, 8.2.0, 10.0.0-preview.26, 7.4.2, 7.4.3, 9.0.0-preview.55, 7.5.1, 10.1.0, 9.0.0-preview.72, 10.2.0, 8.3.1, 10.2.1, 7.5.2, 10.2.2, 10.3.1, 7.5.3, 10.3.2, 10.4.0, 7.6.0, 10.5.0, 7.7.0, 10.5.1, 10.6.0, 7.7.1, 10.7.0, 10.8.0, 10.8.1, 10.9.0, 10.10.0, 10.10.1
Because of this, I cannot add dependencies which requires com.unity.render-pipelines.universal 14.0.1 such as
com.unity.polyspatial@0.7.1 in my package.
Please take a look. I will use -f option until this bug fixes.
Thank you for the great service, anyway.
Best
The naive fix for this is to walk back package versions from the latest until a version is found that works for the current editor-version. This could involve a lot of web-requests. I could implement it this way, but I wanted to first ask if there are alternative suggestions.
The naive fix for this is to walk back package versions from the latest until a version is found that works for the current editor-version. This could involve a lot of web-requests. I could implement it this way, but I wanted to first ask if there are alternative suggestions.
For the original issue from @maxhimmel, it can be solved by going through a reverse sorted of Packument.versions
, then find which entry.unity
is empty or fits (<=) the current editorVersion
.
That's true, I did not think of that. I will look into this.
@all-contributors please add @maxhimmel for bug.
I've put up a pull request to add @maxhimmel! ๐