Cycling74 / min-devkit

Tools, documentation, and reference implementation of a Max Package built using the Min-API.
MIT License
156 stars 30 forks source link

New CMake overwrites existing package-info.json #196

Closed mourendxu closed 2 years ago

mourendxu commented 2 years ago

When I was trying to update an existing project to the latest min devkit with the new cmake, the initial call to cmake failed inside of max-sdk-base/script/max-package.cmake, line 70 for missing package-info.json.in. When I copied over the one from min-devkit, it overwrote the package-info.json that I had originally.

This is a bit annoying, as I have to retype/copy-paste all the package info. Any chance you can add a line to check if one already exists, if so, then just skip?

Thank you.

isabelgk commented 2 years ago

Hi @mourendxu

We are unlikely to change this behavior.

The reasoning is that this *.in file is the template for the package-info.json and is expected to be overwritten whenever CMake builds your package. CMake simply substitutes in the most recent git tag revision into the template and creates the package-info.json from that. So generally you shouldn't be editing package-info.json directly -- you should modify package-info.json.in.

In your case, you can either:

  1. Rename your old package-info.json to package-info.json.in. You'll have to manually update the package revision since CMake will just copy over the .in file to the package-info.json.
  2. Modify that package-info.json.in you've copied to match your original package-info.json (leaving the package-info.json.in version tag handling line).

e.g.

    "version" : "@GIT_VERSION_MAJ@.@GIT_VERSION_MIN@.@GIT_VERSION_SUB@",
mourendxu commented 2 years ago

Thank you for the response! That sounds like a good solution.