Giter VIP home page Giter VIP logo

project-utils's People

Contributors

bromeon avatar halzy avatar karroffel avatar phelioz avatar richardhallett avatar waridley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

project-utils's Issues

Issues with the created gdnlib file

with the release of 0.1.3 (although its working with the template) I found small issues when the gdnlib file was created

  • it created another gdnlib file alongside the template's gdnlib file (I suggest not to create another one if one already exist)
  • the path to the library is pointing to debug (users will keep changing this if we want a debug or release)
  • absolute paths (I suggest using relative paths instead)
  • its pointing to the wrong target folder (this is a bug for users not using the template)

for your reference this is the gdnlib file created by project-utils

[entry]
Android.armeabi-v7a="/home/macalimlim/workspace/godot-rust-template/my-awesome-game/target/x86_64-unknown-linux-gnu/armv7-linux-androideabi/debug/libmy_awesome_game.so"
Android.arm64-v8a="/home/macalimlim/workspace/godot-rust-template/my-awesome-game/target/x86_64-unknown-linux-gnu/aarch64-linux-android/debug/libmy_awesome_game.so"
Android.x86="/home/macalimlim/workspace/godot-rust-template/my-awesome-game/target/x86_64-unknown-linux-gnu/i686-linux-android/debug/libmy_awesome_game.so"
Android.x86_64="/home/macalimlim/workspace/godot-rust-template/my-awesome-game/target/x86_64-unknown-linux-gnu/x86_64-linux-android/debug/libmy_awesome_game.so"
X11.64="/home/macalimlim/workspace/godot-rust-template/my-awesome-game/target/x86_64-unknown-linux-gnu/debug/libmy_awesome_game.so"
OSX.64="/home/macalimlim/workspace/godot-rust-template/my-awesome-game/target/x86_64-unknown-linux-gnu/debug/libmy_awesome_game.dylib"
Windows.64="/home/macalimlim/workspace/godot-rust-template/my-awesome-game/target/x86_64-unknown-linux-gnu/debug/my_awesome_game.dll"

[dependencies]

Android.armeabi-v7a=[  ]
Android.arm64-v8a=[  ]
Android.x86=[  ]
Android.x86_64=[  ]
X11.64=[  ]
OSX.64=[  ]

[general]

singleton=false
load_once=true
symbol_prefix="godot_"
reloadable=true

@karroffel

Handle renames and/or detect whether the crate is being built or checked

I'm not entirely sure if there is a universally sane way to handle this, but I'm seeing a lot of spurious gdns files being made during development when I try various type names, since I've configured rust-analyzer to check the project on save. The easiest way, I believe, would be adding an option to automatically delete orphaned gdns files in the output directory. This would of course destroy any custom changes made on the files, so it's not ideal, but it should suffice for simple use cases.

Another approach might be somehow detecting whether the crate is actually being built with a cargo build command, if possible, and skip generation if not. An option might also be added for this, although I doubt it'll be very useful to opt out of this.

Generating invalid paths on Windows

Hi!
Really great idea with this cargo :) Only have a small problem.
Have only tested on Windows 10 and it seams that the path generation is wrong.
Probably has to do with the code trying to adapt to the platform by using \ for directories when it should be using /.

For example the *.gdnlib looks like this:
X11.64="res://libs\game\target\debug\libGame.so"
OSX.64="res://libs\game\target\debug\libGame.dylib"
Windows.64="res://libs\game\target\debug\Game.dll"

And the *.gdns looks like this:
[ext_resource path="\\?\C:\Users\user\Documents\Projects\Game\native\Game.gdnlib" type="GDNativeLibrary" id=1]

Option to always regenerate gdnlib

Use case:

I use cargo build during development and then cargo build --release to prepare for release. If I forget to delete the scripts before switching to release mode, they still refer to the debug build outputs. I'd be less likely to make that mistake if the tool always regenerated the output files. Essentially, I'd like the build script to be the authoritative source of the gdnlib and gdns files, overwriting anything that's already there.

This would overwrite handwritten changes to the files. I'm okay with this (especially as an opt-in option), but if we want to avoid that an alternative approach would be to make the gdnlib refer to outputs in a third directory that doesn't include "debug" or "release" in the path, then modify build scripts to output to that directory. That way, we only need to generate the gdnlib once, and simply swap out the libraries in the third directory as needed.

Looking at the docs, I don't see a way to set the target dir without a build mode, so if the latter route is chosen that's the option that would be needed.

gdnlib file has UNC Paths generated on Windows, prevents lib loading in godot

Description

When generating the .gdnlib file on Windows this causes the paths to be generated using UNC paths see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN

So e.g. .gdnlib file will look something like:

[entry]
X11.64="\\?\C:/myproject/target/debug/mylib.so"
OSX.64="\\?\C:/myproject/target/debug/mylib.dylib"
Windows.64="\\?\C:/myproject/target/debug/mylib.dll"

The effect this has is godot will fail to load the library.

Reproduce

Any simple build script will work and just generate on Windows where it's not seperate target dir to the godot directory i.e. not needing res://

Initial investigation

I did some initial investigation and it's related to how the code is using fs::canonicalize which has different behaviour on Windows
See rust-lang/rust#42869
and https://doc.rust-lang.org/std/fs/fn.canonicalize.html

Error type is in public API and is not exported.

Exporting the error would be helpful when ignoring parse errors in build.rs, otherwise the cargo check result will not show what the parse errors are.

    let classes_res = scan_crate(&crate_src);

    if let Err(ScanError::Parse(_)) = classes_res {
        // ignore parse errors
        return Ok(());
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.