crabnebula-dev / cargo-packager

Rust executable packager, bundler and updater.
https://docs.crabnebula.dev/packager/
Apache License 2.0
241 stars 16 forks source link

Lack of helpful error messages #159

Closed rafaga closed 1 week ago

rafaga commented 7 months ago

I'm trying to build packages on windows and macOS, when I ran the command cargo packager on project directory

the following error is shown on terminal

ERROR No such file or directory. (os error 2)`

When I used the --verbose flag, the error message is not better in terms of information

DEBUG cargo_packager::shell: Running Command `"rustc" "--print" "cfg"`
DEBUG cargo_packager::shell: debug_assertions
DEBUG cargo_packager::shell: panic="unwind"
DEBUG cargo_packager::shell: target_arch="x86_64"
DEBUG cargo_packager::shell: target_endian="little"
DEBUG cargo_packager::shell: target_env="msvc"
DEBUG cargo_packager::shell: target_family="windows"
DEBUG cargo_packager::shell: target_feature="fxsr"
DEBUG cargo_packager::shell: target_feature="sse"
DEBUG cargo_packager::shell: target_feature="sse2"
DEBUG cargo_packager::shell: target_has_atomic="16"
DEBUG cargo_packager::shell: target_has_atomic="32"
DEBUG cargo_packager::shell: target_has_atomic="64"
DEBUG cargo_packager::shell: target_has_atomic="8"
DEBUG cargo_packager::shell: target_has_atomic="ptr"
DEBUG cargo_packager::shell: target_os="windows"
DEBUG cargo_packager::shell: target_pointer_width="64"
DEBUG cargo_packager::shell: target_vendor="pc"
DEBUG cargo_packager::shell: windows
ERROR cargo_packager::cli: No such file or directory. (os error 2)

I'm using packager.json with the following content:

{
    "name": "telescope",
    "description": "description",
    "longDescription": null,
    "enabled": true,
    "productName": "Telescope",
    "version": "0.0.1",
    "binaries": [
      {
        "path": "telescope",
        "main": true
      }
    ],
    "identifier": "org.rafaga.telescope",
    "beforePackagingCommand": null,
    "beforeEachPackageCommand": null,
    "logLevel": "info",
    "formats": null,
    "targetTriple": null,
    "homepage": "http://github.com/",
    "icons": ["../assets/icon01-256.png","../assets/icon01-1024.png"],
    "authors": [
      "Rafael Amador Galván"
    ],
    "publisher": null,
    "licenseFile": "../LICENSE.md",
    "copyright": null,
    "category": "Utility",
    "fileAssociations": null,
    "resources": [
      {
        "src": "assets/icon01-*.png",
        "target": "assets/icon01.*.png"
      },
      "Lorem ipsum"
    ],
    "externalBinaries": null,
    "windows": {
      "tsp": true,
      "allowDowngrades": true
    },
    "macos": {
      "frameworks": null,
      "entitlements": null
    },
    "deb": null,
    "appimage": null,
    "pacman": null,
    "wix": null,
    "nsis": {
      "compression": "lzma",
      "headerImage": null,
      "installerIcon": null,
      "installMode": "currentUser",
      "languages": [
        "English",
        "Spanish"
      ],
      "displayLanguageSelector": true,
      "appdataPaths": ["$LOCALAPPDATA/$PRODUCTNAME"]
    },
    "dmg":{
      "background": null
    }
  }

There is any way to get more helpful error messages?

amr-crabnebula commented 7 months ago

Thank you for reaching out, will try to fix the error messages soon.

As for your issue, seems like it maybe the resources paths are incorrect? you have your icons specified as ../assets/icon01-256.png but then in resources they are assets/icon01-*, I suppose resources should be ../assets/icon01-* as well. Might be helpful if you provide your repo structure.

rafaga commented 7 months ago

I tried your suggestion, yet no success. Thank you for taking some time in solving this issue

amr-crabnebula commented 7 months ago

could you share the repo with the issue or a simple replica of it so I can take a better look?

rafaga commented 7 months ago

This is the repository

Https://GitHub.com/rafaga/telescope.git

amr-crabnebula commented 7 months ago

I can see two issues here:

rafaga commented 7 months ago

OK thank you for the feedback, I will make the suggested changes. Returning to the issue there is any way to make the error messages more explicit and helpful, because it is not feasible to debug cargo-packager every time an error like this appears.

rafaga commented 7 months ago

Ok, it runs but ... in the config file in the repo I'm Using Wix Toolkit, and builds the installer on NSIS , nsis configuration part has null value. Why ?

amr-crabnebula commented 7 months ago

wix installer is not built by default, set "formats": ["wix", "nsis", "app", ...etc ] in the config