Skip to content

Commit

Permalink
Update the .net/NuGet example.
Browse files Browse the repository at this point in the history
  • Loading branch information
waynebeaton committed Feb 15, 2024
1 parent 2b47ebe commit abe16ab
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,26 @@ This content is either not correctly mapped by the system, or requires review.

Use the `dotnet` command to get the list of transitive dependencies, filter out all but the actual dependency references, strip out the "system" components, convert the remaining entries into ClearlyDefined format, and then feed the results to the Eclipse Dash License Tool.

**NOTE** the example below is a guess at something that we believe should work in PowerShell. It's based on an example of the output provided to us that was generated by executing `dotnet list package --include-transitive` on what we believe is a Windows host system, but the post processing was all done in Linux. Again, we believe that this should work in PowerShell, but have not tested it there. Your feedback and pull requests are welcome.
**NOTE** the example below is a guess at something that we believe _should work_ in PowerShell. It's based on an example of the output provided to us that was generated by executing `dotnet list package --include-transitive` on what we believe is a Windows host system, but the post processing was all done in Linux. Again, we believe that this should work in PowerShell, but have not tested it there. Your feedback and pull requests are welcome.

```
dotnet list package --include-transitive | grep ">" | grep -Pv "\s(Microsoft|NETStandard|NuGet|System|runtime)" | sed -E -e "s/\s+> ([a-zA-Z\.\-]+).+\s([0-9]+\.[0-9]+\.[0-9]+)\s+/nuget\/nuget\/\-\/\1\/\2/g" | java -jar org.eclipse.dash.licenses-<version>.jar -
$ dotnet list package --include-transitive \
| grep ">" \
| grep -Pv "\s(Microsoft|NETStandard|NuGet|System|runtime)" \
| sed -E -e "s/\s+> ([a-zA-Z\.\-]+).+\s([0-9]+\.[0-9]+\.[0-9]+)\s+/nuget\/nuget\/\-\/\1\/\2/g"
| java -jar org.eclipse.dash.licenses-<version>.jar -
```

Steps:

1. Use `dotnet list package` to generate a dependency list;
2. Pull out the entries that represent dependencies (lines start with `>`);
3. Skip lines containing "system" content;
4. Convert each line into a ClearlyDefined ID;
5. Invoke the tool.

It may make sense to tune the expression to, for example, also skip your project content.

### Example: Rust/Cargo

The `cargo tree -e normal --prefix none --no-dedupe` command can give us a list of dependencies. If we reformat those dependencies as ClearlyDefined IDs, they can be piped directly into the Dash License Tool.
Expand Down

0 comments on commit abe16ab

Please sign in to comment.