Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve compatibility with SDK Pack for tools #188

Merged
merged 1 commit into from
May 31, 2022
Merged

Improve compatibility with SDK Pack for tools #188

merged 1 commit into from
May 31, 2022

Conversation

kzu
Copy link
Member

@kzu kzu commented May 31, 2022

This brings nugetizer pretty much to parity with SDK Pack for CLI tools too :).

We leverage the SDK tool packing targets to determine the files to pack, but otherwise preserve nugetizer's inference and packing behavior. Best of both worlds!

The new InferToolContents target is the one that transforms the PackTool target's TfmSpecificPackageFile into our own None items for packing. It can also be extended to trim the tool's contents via a custom target that removes items, such as::

  <Target Name="TrimRuntimes" AfterTargets="InferToolContents">
    <ItemGroup>
      <None Remove="@(None)" Condition="$([MSBuild]::ValueOrDefault('%(None.PackagePath)', '').Contains('/runtimes/'))" />
    </ItemGroup>
  </Target>

(this target would remove all runtimes from the tool package, but otherwise preserve the package contents).

Fixes #134

This brings nugetizer pretty much to parity with SDK Pack for CLI tools too :).

We leverage the SDK tool packing targets to determine the files to pack, but otherwise preserve nugetizer's inference and packing behavior. Best of both worlds!

The new `InferToolContents` target is the one that transforms the `PackTool` target's `TfmSpecificPackageFile` into our own `None` items for packing. It can also be extended to trim the tool's contents via a custom target that removes items, such as::

```xml
  <Target Name="TrimRuntimes" AfterTargets="InferToolContents">
    <ItemGroup>
      <None Remove="@(None)" Condition="$([MSBuild]::ValueOrDefault('%(None.PackagePath)', '').Contains('/runtimes/'))" />
    </ItemGroup>
  </Target>
```

(this target would remove all runtimes from the tool package, but otherwise preserve the package contents).

Fixes #134
@kzu kzu enabled auto-merge (rebase) May 31, 2022 22:16
@kzu kzu merged commit 4991a85 into main May 31, 2022
@kzu kzu deleted the dev/pack-tool branch May 31, 2022 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve compatibility with SDK Pack for tools
1 participant