vala-lang / valdo

Create new Vala projects from templates
GNU Lesser General Public License v2.1
49 stars 13 forks source link

Draft: Some improvements #20

Closed liferooter closed 2 years ago

liferooter commented 2 years ago

Some code and mechanism improvements

Prince781 commented 2 years ago

Thanks for your efforts, @liferooter . I'll take a look at this soon when I'm done with finals. One thing you should keep in mind is that I wrote this code to be compatible with Vala 0.48 and Ubuntu 20.04 / eOS 6. If you're changing things, please make sure that Valdo is still compatible with those OSes. For example, null-safe member accesses are nice but are too recent in Vala for me to use.

liferooter commented 2 years ago

If you're changing things, please make sure that Valdo is still compatible with those OSes.

Okay, I'll try to keep compability and test on these OSes

Prince781 commented 2 years ago

@liferooter You should try to get this stuff merged soon. I think I'd prefer if you sent me multiple PRs, that way I can evaluate your changes more thoroughly and merge them sooner before merge conflicts arise.

liferooter commented 2 years ago

You should try to get this stuff merged soon.

Okay, I'll finish today

liferooter commented 2 years ago

@Prince781 now PR has no conflicts and ready for review and merging

Prince781 commented 2 years ago

A couple of things:

  1. Running valdo without any arguments should show a list of all available templates. You must not remove this behavior.
  2. Deserializing the template JSON fails on Ubuntu 20.04:
    
    ubuntu@ubuntu:~/dev/valdo$ valdo -l

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate" Available templates:

lib - (null) gtk - (null) new - (null) swifty-gtk4 - (null) eos - (null) ubuntu@ubuntu:~/dev/valdo$

liferooter commented 2 years ago

Running valdo without any arguments should show a list of all available templates. You must not remove this behavior.

I think that such behavior is non-typical and non-intuitive, doesn't it?

Prince781 commented 2 years ago

I think that such behavior is non-typical and non-intuitive, doesn't it?

It's perfectly intuitive—the user sees all available templates if he/she didn't request one. There's no rule that says you can't do this. And if you want to talk about other programs that do a similar thing, dotnet new does this too.

Prince781 commented 2 years ago

I think the rest of the code is pretty well-organized. I wrote this quickly and so it's nice to see someone taking the time to make the code look nice. 😃

liferooter commented 2 years ago
2. Deserializing the template JSON fails on Ubuntu 20.04:
ubuntu@ubuntu:~/dev/valdo$ valdo -l

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"
Available templates:
--------------------
lib         - (null)
gtk         - (null)
new         - (null)
swifty-gtk4 - (null)
eos         - (null)
ubuntu@ubuntu:~/dev/valdo$ 

Just reproduces this bug in Ubuntu 20.04 VM. Have no idea what's wrong and how to fix it without manuary reading every property of every class. But all works on Elementary OS 6.1 with Vala 0.48.20 and there will be new Ubuntu LTS soon with even newer Vala. So may I spit on compatibility with too old Ubuntu which requires to make the app don't use some really needed Vala features?

Prince781 commented 2 years ago

But all works on Elementary OS 6.1 with Vala 0.48.20 and there will be new Ubuntu LTS soon with even newer Vala. So may I spit on compatibility with too old Ubuntu which requires to make the app don't use some really needed Vala features?

Yes, but then you must change meson.build to require json-glib >= 1.5.2

Prince781 commented 2 years ago

I had to keep a workaround for JSON-GLib 1.4.4 because eOS 7 won't come out for another 5-6 months and this package won't be updated for the current release.

Prince781 commented 2 years ago

@liferooter merged. Thanks a lot!