KSPModdingLibs / KSPBuildTools

MIT License
2 stars 4 forks source link

Add a build target for installing CKAN dependencies #17

Closed drewcassidy closed 1 month ago

drewcassidy commented 1 month ago

For discussion on if this is the right path to take.

This allows describing CKAN dependencies from the csproj file. They can then be installed through msbuild like so:

msbuild Shabby.sln -t:"CKANInstall"

CKAN dependencies are marked as metadata under an assembly reference, like so:

    <Reference Include="0Harmony, Culture=neutral, PublicKeyToken=null">
      <HintPath>$(KSPRoot)/GameData/000_Harmony/0Harmony.dll</HintPath>
      <CKANID>Harmony2</CKANID>
    </Reference>

there's no way here to specify any mods that don't have dlls, which could be helpful for bundling dependencies in download packages. though I cant think of any non-dll mods you would want to bundle. It would be fairly easy to add a separate item list for such mods though.

JonnyOThan commented 1 month ago

I really like this!

Might want to add —no-recommends to the install command. Done

Could you add properties for:

- ckan install filter (to remove large files that don’t need to be extracted) - this is probably just better served in the action? - Ckan compatible version list Done

See here for an example: https://github.com/KSPModdingLibs/KSPBuildTools/blob/60651bc9e8e7e2f84a4a9df97ed031d3dcfae236/.github/actions/install-dependencies/action.yml#L43

Note that both of those commands can take multiple args (which reduces overhead) but I did it this way because the inputs usually had line breaks. There’s probably a smarter way to do that.

I’d expect the install filter to be provided on the msbuild command line (from the github action) and the compatible game versions to be set in the project properties somewhere (i.e. infrequently changing). Can even default to 1.8-1.12 if not specified.

I’d be fine with adding a list of additional identifiers to install but I’m pretty anti-bundling in general. But if people want to do that I won’t stop them.