dotutils / MSBuild.BuildLink

0 stars 0 forks source link

Improve build.json schema #5

Open JanKrivanek opened 1 year ago

JanKrivanek commented 1 year ago

Suggestion by @mmitche:

It looks like MsBuildProject, MsBuildProjectFilePerLibAsset, and BuildScript, and BuildScriptPerLibAsset would be mutually exclusive, but it’s not obvious. I wonder whether you could combine them into a single object that makes it more obvious how to construct it. Maybe something like:

{
  "PackageName": "Package03",
  "Build": [
    "*": {
      "BuildScript": "foo.cmd"
    }
  ],
}

// With per-lib projects.

{
  "PackageName": "Package03",

  "Build": [
    "net6/Package03.dll": {
      "ProjectFile": "src/package03/net6/package03.vbproj"
    },
    "net7/Package03.dll": {
      "ProjectFile": "src/package03/net7/package03.csproj"
    },
  ]
}
mmitche commented 1 year ago

Did you say you did find community projects with different projects per TFM? If so, allowing things like this may be more flexible if the lib folder contains multiple assemblies:

"Build": [
    "net6/*": {
      "ProjectFile": "src/package03/net6/package03.vbproj"
    },
    "net7/*": {
      "ProjectFile": "src/package03/net7/package03.csproj"
    },
  ]
JanKrivanek commented 1 year ago

Yes - HtmlAgilityPack is one example of such: https://github.com/zzzprojects/html-agility-pack/tree/master/src

I'm just thinking about the benfits of wildcard at the spot of lib name - is there any use for that? There will either be 1:1 maping between lib per TFM and project (e.g. the HtmlAgilityPack case) - then the original suggestion would apply

  "net6/Package03.dll": {
      "ProjectFile": "src/package03/net6/package03.vbproj"
    },
    "net7/Package03.dll": {
      "ProjectFile": "src/package03/net7/package03.csproj"
    },

Or single multitargeted project, producing multiple versions of the single lib in package - then the wildcarded original suggestion would apply:

"*": {
      "ProjectFile": "src/package03/package03.vbproj"
    },

Or there can be multiple libs, each produced by a separate multitargeted project - then we can wildcard the TFM:

"*/Package03.dll": {
      "ProjectFile": "src/package03/package03.vbproj"
    },

The last sample could be applicable for the single lib as well - for explicit clarity on the lib naming.

Is there other scenario that's left out?