Package.xml package name metadata

Is there a mechanism for reusing e.g. the Package/Name attribute inside the xml? For example:

<Package Name="TooLazyToTypeThisAllOutMultipleTimes" xmlns="http://opentap.io/schemas/package" InfoLink="" Version="0.1.0-alpha">
  <Files>
    <File Path="Packages/%(PackageName)/My.TapPlan"/>
  </Files>
</Package>

Hi @benstreek ,

This can be achieved by using a Variable block. OpenTAP uses this for toggling features, and shipping different native dependencies for different platforms: opentap/package.xml at a7ddc83f28ff2c3f16e1e0cd30114d30fa219ac7 · opentap/opentap · GitHub

In your case, you could do something like this:

<Package Name="$(PackageName)" xmlns="http://opentap.io/schemas/package" InfoLink="" Version="0.1.0-alpha">
  <Variables>
    <PackageName>TooLazyToTypeThisAllOutMultipleTimes</PackageName>
  </Variables>
  <Files>
    <File Path="Packages/$(PackageName)/My.TapPlan"/>
  </Files>
</Package>

Variables can also be set using environment variables instead of defining them in a Variables block. Refer to the documentation for more details: Advanced Packaging

4 Likes