signJarDlls.ps1 823 B

1234567891011121314151617181920212223
  1. <#
  2. 1. Select jar file
  3. 2. extract jar to own directory
  4. 3. Sign everything
  5. 4. Update dlls in the jar
  6. #>
  7. New-Item -Path ".\extract" -ItemType Directory
  8. Get-ChildItem -Path "." -File *.jar | ForEach-Object {
  9. $jar = Copy-Item $_ -Destination ".\extract" -PassThru
  10. Set-Location -Path ".\extract"
  11. "Extracting jar $($jar.FullName)"
  12. jar --file=$($_.FullName) --extract
  13. Get-ChildItem -Path "." -Recurse -File "*.dll" | ForEach-Object {
  14. <# pipe into signtool, here we are just writing something into the file #>
  15. Set-Content -Path $_ -Value "Hello"
  16. jar --file=$($jar.FullName) --update $(Resolve-Path -Relative -Path $_)
  17. }
  18. Move-Item -Path $($jar.FullName) -Destination $_ -Force
  19. Remove-Item -Path ".\*" -Force -Recurse
  20. Set-Location -Path ".."
  21. }
  22. Remove-Item -Path ".\extract"