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

dotnet instructions feedback #341

Open
martafullen opened this issue Apr 26, 2024 · 0 comments
Open

dotnet instructions feedback #341

martafullen opened this issue Apr 26, 2024 · 0 comments

Comments

@martafullen
Copy link

We used the tool to check licenses of our dotnet project and would like to give you our feedback to the instructions provided in readme here:

https://github.com/eclipse/dash-licenses?tab=readme-ov-file#example-net

The command didn't quite work for us so we dug in and figured it out.
Here's our feedback and solution for a dotnet project, using PowerShell 7.4.2 on Windows 11.

  1. grep and sed are not available out of the box on Windows (cmd/powershell). A simple workaround is to use the binaries that come with git. (tip: Set-Alias in powershell makes things easier)

    With git installed under C:\Program Files\Git we can use
    C:\"Program Files"\Git\usr\bin\grep.exe and
    C:\"Program Files"\Git\usr\bin\sed.exe.

  2. the regex didn't quite work for us, needed to make minor changes (depends on the flavour used by the binary and powershell I guess). This worked for us using the git sed binary under powershell :

    sed -E -e 's/\s+> ([a-zA-Z0-9\.\_\-]+)\s+([0-9]+\.[0-9]+\.[0-9]+).*/nuget\/nuget\/\-\/\1\/\2/g'
    
  3. It is stated in the readme but can easily be overlooked by non-java developers ;)
    dash-licenses requires java SDK and not JRE (which is easier to come across). We got version 22 from
    https://jdk.java.net/22/

  4. Finally, the tested powershell commands (broken up into several steps):

    dotnet restore
    
    # filters packages and writes into packages-filtered.txt
    dotnet list package --include-transitive | Select-String -Pattern '>' | Select-String -Pattern '\s(Microsoft|NETStandard|NuGet|System|runtime)' -NotMatch | Out-file -FilePath 'packages.txt'
    
    # runs the replacement and dash-licences on the filtered package list
    # prints output to console and a summary to output.txt
    cat packages.txt | sed -E -e 's/\s+> ([a-zA-Z0-9\.\_\-]+)\s+([0-9]+\.[0-9]+\.[0-9]+).*/nuget\/nuget\/\-\/\1\/\2/g' | java -jar org.eclipse.dash.licenses-1.0.2.jar - | Out-file -FilePath 'output.txt'

That's it.
If you like, we could propose changes in a merge request, but feel free to copypaste from here.

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

No branches or pull requests

1 participant