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

UnityTasks.UnityRunTests API does not DetectUnityVersion from project #1427

Open
chrisyarbrough opened this issue Sep 23, 2024 · 1 comment
Labels

Comments

@chrisyarbrough
Copy link

chrisyarbrough commented Sep 23, 2024

Usage Information

Nuke 8.1.0 / 8.0.201 / net8.0 / macOS Sonoma 14.3.1

Description

When using UnityTasks.Unity without specifying a Unity editor version, it defaults to auto-detecting the version from the ProjectSettings/ProjectVersion.txt file.

However, when using UnityTasks.UnityRunTests this doesn't happen, but I would expect it to behave the same way and call DetectUnityVersion within.

Reproduction Steps

Open the repro project:
Uploading NukeBugReport_UnityTasks_UnityAutoDetectNotImplementedForTests.zip…

This project uses Nuke 8.0.0, but the issue also happens in 8.1.0.

For full functionality, install Unity 2021.3.21.

Run:

Nuke Test

Expected Behavior

UnityTasks.UnityRunTests should detect the Unity editor version from the project and run successfully.

Actual Behavior

UnityTasks.UnityRunTests is used, but it doesn't detect the desired Unity editor version, instead it fails with:

System.ArgumentException: Expected file to exist: /Applications/Unity/Unity.app/Contents/MacOS/Unity (Parameter 'toolPath')

It is trying to run the (old legacy) default Unity editor path instead of the one specified in the project.

Analysis

Callstack with desired behaviour:

  • IReadOnlyCollection Unity(Configure configurator)
  • IReadOnlyCollection Unity(UnitySettings toolSettings = null)
  • PreProcess(ref UnitySettings unitySettings) (line 65)
  • DetectUnityVersion(ref UnitySettings unitySettings)

Callstack with undesired behaviour:

  • IReadOnlyCollection UnityRunTests(Configure configurator)
  • IReadOnlyCollection UnityRunTests(UnityRunTestsSettings toolSettings = null)
  • PreProcess(ref T unitySettings) where T : UnityBaseSettings (line 99)
    (no DetectUnityVersion call)

Regression?

No response

Known Workarounds

Yes:

Nuke TestWorkaround

Output:

 /Applications/Unity/Hub/Editor/2021.3.21f1/Unity.app/Contents/MacOS/Unity ...

This uses UnityTasks.Unity which uses DetectUnityVersion internally.

Could you help with a pull-request?

Yes

@chrisyarbrough
Copy link
Author

I went ahead and would like to propose a fix here: #1428
Feel free to implement a different solution. :)

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

No branches or pull requests

1 participant