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

list fails when version does not follow standard format, e.g. MagicLeap versions #331

Closed
4 tasks done
danielresolutiongames opened this issue Nov 16, 2018 · 4 comments
Closed
4 tasks done
Assignees

Comments

@danielresolutiongames
Copy link

Issue Checklist

  • I'm using the latest u3d version
  • I ran u3d --help
  • I read the README
  • I made sure that a similar issue doesn't exit

Issue Description

Hey!

Looks like a super cool tool; probably looking to replace our own in-house super simple tool with this as it seems to solve the same issues but hopefully a bit more robust.

On that note though, when using versions not available from u3d, e.g. Magic Leap editors, this happens:

λ ls -lAh  | grep Unity
drwxr-xr-x 1 danie 197609    0 May  3  2018 Unity_2017.3.0f3
drwxr-xr-x 1 danie 197609    0 Apr  9  2018 Unity_2017.3.1f1
drwxr-xr-x 1 danie 197609    0 Apr  4  2018 Unity_2018.1.0b13
drwxr-xr-x 1 danie 197609    0 May 16  2018 Unity_2018.1.0f2
drwxr-xr-x 1 danie 197609    0 Jun  4 15:53 Unity_2018.1.1f1
drwxr-xr-x 1 danie 197609    0 Oct  4 10:02 Unity_2018.1.9f1-MLTP8.1
drwxr-xr-x 1 danie 197609    0 Oct 17 10:27 Unity_2018.2.11f1
drwxr-xr-x 1 danie 197609    0 Nov 16 15:46 Unity_2018.2.16f1
drwxr-xr-x 1 danie 197609    0 Aug 27 17:22 Unity_2018.2.5f1
drwxr-xr-x 1 danie 197609    0 May  3  2018 Unity_5.5.3f1
drwxr-xr-x 1 danie 197609    0 Apr  4  2018 Unity_5.6.0p2
drwxr-xr-x 1 danie 197609    0 Apr  4  2018 Unity_5.6.1f1
drwxr-xr-x 1 danie 197609    0 Oct 12 15:07 Unity_5.6.2f1
drwxr-xr-x 1 danie 197609    0 Apr  3  2018 Unity_5.6.3p1
drwxr-xr-x 1 danie 197609    0 May  4  2018 Unity_5.6.4p2
C:\
λ u3d list --trace
Version 5.5.3f1         [4d2f809fd6f3]  (C:/Unity_5.5.3f1)
Version 5.6.0p2         [bbd5ca01a0ea]  (C:/Unity_5.6.0p2)
Version 5.6.1f1         [2860b30f0b54]  (C:/Unity_5.6.1f1)
Version 5.6.2f1         [a2913c821e27]  (C:/Unity_5.6.2f1)
Version 5.6.3p1         [9c92e827232b]  (C:/Unity_5.6.3p1)
Version 5.6.4p2         [278fc6850ee0]  (C:/Unity_5.6.4p2)
Version 2017.3.0f3      [a9f86dcd79df]  (C:/Unity_2017.3.0f3)
Version 2017.3.1f1      [fc1d3344e6ea]  (C:/Unity_2017.3.1f1)
Version 2018.1.0b13     [43de91b8ac41]  (C:/Unity_2018.1.0b13)
Version 2018.1.0f2      [d4d99f31acba]  (C:/Unity_2018.1.0f2)
Version 2018.1.1f1      [b8cbb5de9840]  (C:/Unity_2018.1.1f1)
Traceback (most recent call last):
        13: from C:/Ruby25-x64/bin/u3d:23:in `<main>'
        12: from C:/Ruby25-x64/bin/u3d:23:in `load'
        11: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/u3d-1.1.2/exe/u3d:7:in `<top (required)>'
        10: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/u3d-1.1.2/lib/u3d/commands_generator.rb:40:in `start'
         9: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/u3d-1.1.2/lib/u3d/commands_generator.rb:260:in `run'
         8: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/commander-4.4.7/lib/commander/delegates.rb:15:in `run!'
         7: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/commander-4.4.7/lib/commander/runner.rb:68:in `run!'
         6: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/commander-4.4.7/lib/commander/runner.rb:446:in `run_active_command'
         5: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/commander-4.4.7/lib/commander/command.rb:153:in `run'
         4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/commander-4.4.7/lib/commander/command.rb:182:in `call'
         3: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/u3d-1.1.2/lib/u3d/commands_generator.rb:109:in `block (2 levels) in run'
         2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/u3d-1.1.2/lib/u3d/commands.rb:53:in `list_installed'
         1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/u3d-1.1.2/lib/u3d/commands.rb:53:in `each'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/u3d-1.1.2/lib/u3d/commands.rb:55:in `block in list_installed': undefined method `do_not_move?' for nil:NilClass (NoMethodError)

Yes, I have temporarily changed the DEFAULT_WINDOWS_INSTALL to C:, which is where our in-house system places versions. The same happens when I symlink each folder from C:\ into "C:\Program Files".

I hope the symlinks or DEFAULT_WINDOWS_INSTALL aren't relevant for this bug report. I did see #229 , which makes me wonder if it might be relevant, and if so this is another angle at the same limitation and feature request. :)

@niezbop
Copy link
Member

niezbop commented Dec 5, 2018

Hey @danielresolutiongames !

Thanks for pointing this issue to us. So after a bit of digging around, I believe I know where your issue comes from. Thankfully, it's not because of DEFAULT_WINDOWS_INSTALL, I tried to play a bit with it by setting it to C:/ and it seems to work just fine (plus it worked on your station with most of the other versions until it broke).

So, my assumption is that it has to do with the fact that it is a custom version (thank you captain obvious):

Technical rambling: ON

In the installer.rb, you can find the following code:

def installed_sorted_by_versions
  list = installed
  return [] if list.empty?
  # version -> installations
  arraym = list.map { |a| [a.version, a] }
  map = Hash[*arraym.flatten]
  # sorted versions
  vcomparators = map.keys.map { |k| UnityVersionComparator.new(k) }
  sorted_keys = vcomparators.sort.map { |v| v.version.to_s }
  sorted_keys.map { |k| map[k] }
end

The issue in this is that while installed returns the value it reads from the ivy.xml found in the PlaybackEngines modules, which is basically a string and probably is 2018.1.9f1-MLTP8.1 in your case but the vcomparators.sort.map { |v| v.version.to_s } returns versions that are parsed by us and get rid of anything after the unity version, then sorted_keys.map { |k| map[k] } cannot find the version and puts nil in there.

Technical rambling: OFF

So we have a few options going on from there:

  • we could parse the raw version string in the installation so it returns clean versions
  • we could modify a bit the parser so that it accepts custom versions (or postfixed at least)
  • we could simply modify the behaviour of UnityVersions#installed_sorted_by_versions

WDYT @lacostej ?

What you can do in the meantime @danielresolutiongames if you're willing to give us a hand is confirm my assumption. I tested it locally and managed to replicate your issue I believe:

$ u3d list --trace
Version 5.6.1f1         [2860b30f0b54]  (C:/Program Files/Unity_5.6.1f1)
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/u3d-1.1.3/lib/u3d/commands.rb:55:in `block in list_installed': undefined method `do_not_move?' for nil:NilClass (NoMethodError)
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/u3d-1.1.3/lib/u3d/commands.rb:53:in `each'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/u3d-1.1.3/lib/u3d/commands.rb:53:in `list_installed'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/u3d-1.1.3/lib/u3d/commands_generator.rb:109:in `block (2 levels) in run'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/commander-4.4.7/lib/commander/command.rb:182:in `call'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/commander-4.4.7/lib/commander/command.rb:153:in `run'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/commander-4.4.7/lib/commander/runner.rb:446:in `run_active_command'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/commander-4.4.7/lib/commander/runner.rb:68:in `run!'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/commander-4.4.7/lib/commander/delegates.rb:15:in `run!'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/u3d-1.1.3/lib/u3d/commands_generator.rb:260:in `run'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/u3d-1.1.3/lib/u3d/commands_generator.rb:40:in `start'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/u3d-1.1.3/exe/u3d:7:in `<top (required)>'
        from C:/Ruby23-x64/bin/u3d:23:in `load'
        from C:/Ruby23-x64/bin/u3d:23:in `<main>'

I did that by changing the value of the attribute e:unityVersion in the info node of C:\Program Files\Unity_5.6.5f1\Editor\Data\PlaybackEngines\AndroidPlayer\ivy.xml. You could tell us what's in the ivy.xml of the different folders inside the PlaybackEngines folder of your Unity_2018.1.9f1-MLTP8.1 installation!

I hope this helps a bit! If my assumption is correct, the fix should be quite simple!

@danielresolutiongames
Copy link
Author

Hey @niezbop ! Thanks for connecting back.

Yeah, I'll gladly give you whats in those files.

So, contents of
C:\Unity_2018.1.9f1-MLTP8.1\Editor\Data\PlaybackEngines\lumin\ivy.xml :

<?xml version="1.0" encoding="utf-8"?>
<ivy-module version="2.0">
  <info version="2018.1.9" organisation="Unity" module="Lumin" e:packageType="PlaybackEngine" e:unityVersion="2018.1.9f1-MLTP8.1" xmlns:e="http://ant.apache.org/ivy/extra" />
  <publications xmlns:e="http://ant.apache.org/ivy/extra">
    <artifact name="UnityEditor.Lumin.Extensions" type="dll" ext="dll" />
  </publications>
</ivy-module>

And the contents of
C:\Unity_2018.1.9f1-MLTP8.1\Editor\Data\PlaybackEngines\windowsstandalonesupport\ivy.xml :

<?xml version="1.0" encoding="utf-8"?>
<ivy-module version="2.0">
  <info version="2018.1.9" organisation="Unity" module="StandaloneWindows" e:packageType="PlaybackEngine" e:unityVersion="2018.1.9f1-MLTP8.1" xmlns:e="http://ant.apache.org/ivy/extra" />
  <publications xmlns:e="http://ant.apache.org/ivy/extra">
    <artifact name="UnityEditor.WindowsStandalone.Extensions" type="dll" ext="dll" />
  </publications>
</ivy-module>

And for another version, C:\Unity_2018.1.6f1-MLTP7, here's its lumin\ivy.xml :

<?xml version="1.0" encoding="utf-8"?>
<ivy-module version="2.0">
  <info version="2018.1.6" organisation="Unity" module="Lumin" e:packageType="PlaybackEngine" e:unityVersion="2018.1.6f1-MLTP7" xmlns:e="http://ant.apache.org/ivy/extra" />
  <publications xmlns:e="http://ant.apache.org/ivy/extra">
    <artifact name="UnityEditor.Lumin.Extensions" type="dll" ext="dll" />
  </publications>
</ivy-module>

and its windowsstandalonesupport\ivy.xml :

<?xml version="1.0" encoding="utf-8"?>
<ivy-module version="2.0">
  <info version="2018.1.6" organisation="Unity" module="StandaloneWindows" e:packageType="PlaybackEngine" e:unityVersion="2018.1.6f1-MLTP7" xmlns:e="http://ant.apache.org/ivy/extra" />
  <publications xmlns:e="http://ant.apache.org/ivy/extra">
    <artifact name="UnityEditor.WindowsStandalone.Extensions" type="dll" ext="dll" />
  </publications>
</ivy-module>

@niezbop
Copy link
Member

niezbop commented Dec 5, 2018

Ok that's great! Thanks a bunch

So you did valid my assumption: the info node, e:unityVersion is e:unityVersion="2018.1.9f1-MLTP8.1" for C:\Unity_2018.1.9f1-MLTP8.1, and e:unityVersion="2018.1.6f1-MLTP7" for C:\Unity_2018.1.6f1-MLTP7. So the issue should be fixed relatively soon 😃

@niezbop niezbop self-assigned this Dec 5, 2018
@danielresolutiongames
Copy link
Author

Great, looking forward to it!

lacostej added a commit that referenced this issue Feb 23, 2019
u3d/list: support Magic Leap Versions parsing and sorting (fixes #331)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants