github.com/google/osv-scalibr@v0.4.1/build_protos.ps1 (about)

     1  Remove-Item -Recurse -Force binary/proto/*_go_proto
     2  
     3  # Install and prepare osv-schema protos.
     4  if (-not (Test-Path binary/proto/vulnerability.proto)) {
     5    $OSV_SCHEMA_VERSION='1.7.4'
     6    Invoke-WebRequest -Uri "https://github.com/ossf/osv-schema/archive/refs/tags/v$OSV_SCHEMA_VERSION.tar.gz" -OutFile "v$OSV_SCHEMA_VERSION.tar.gz"
     7    tar -xf v$OSV_SCHEMA_VERSION.tar.gz
     8    Move-Item -Path "osv-schema-$OSV_SCHEMA_VERSION/proto/vulnerability.proto" -Destination 'binary/proto/vulnerability.proto'
     9    Remove-Item -Recurse -Force "v$OSV_SCHEMA_VERSION.tar.gz", "osv-schema-$OSV_SCHEMA_VERSION"
    10  }
    11  
    12  # Make sure scan_result.proto is referenceing the vulnerability.proto file on the right path.
    13  # This is only needed to successfully compile the scan_result.proto file.
    14  (Get-Content binary/proto/scan_result.proto) -creplace 'third_party/osvschema/vulnerability.proto', 'proto/vulnerability.proto' | Set-Content binary/proto/scan_result.proto
    15  
    16  protoc -I=binary --go_out=binary/proto binary/proto/*.proto
    17  Move-Item binary/proto/github.com/google/osv-scalibr/binary/proto/* binary/proto/
    18  Remove-Item -Recurse -Force binary/proto/github.com, binary/proto/vulnerability.proto