OpenAPITools / openapi-generator-bazel

Bazel plugin for OpenAPI Generator
Apache License 2.0
66 stars 48 forks source link

Bad checksums reported #28

Closed msiebuhr closed 2 years ago

msiebuhr commented 2 years ago

Building a project with openapi-generator-bazel in it currently fails for me:

% bazel build //...
INFO: Invocation ID: 21808f70-c6bd-4789-830f-af21d62af905
INFO: Repository openapi_tools_generator_bazel_cli instantiated at:
  /home/x/Source/cthulhu/WORKSPACE:165:43: in <toplevel>
  /home/x/.cache/bazel/_bazel_x/b577005c7d98997ad4f9c8a84bcb15ca/external/openapi_tools_generator_bazel/internal/openapi_generator.bzl:6:30: in openapi_tools_generator_bazel_repositories
  /home/x/.cache/bazel/_bazel_x/b577005c7d98997ad4f9c8a84bcb15ca/external/bazel_tools/tools/build_defs/repo/jvm.bzl:285:24: in jvm_maven_import_external
Repository rule jvm_import_external defined at:
  /home/x/.cache/bazel/_bazel_x/b577005c7d98997ad4f9c8a84bcb15ca/external/bazel_tools/tools/build_defs/repo/jvm.bzl:217:38: in <toplevel>
WARNING: Download from https://jcenter.bintray.com/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException Checksum was 62f9842f0fcd91e4afeafc33f19a7af41f2927c7472c601310cedfc72ff1bb19 but wanted e4e45d5441283b2f0f4bf988d02186b85425e7b708b4be0b06e3bfd7c7aa52c7
WARNING: Download from https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException Checksum was 62f9842f0fcd91e4afeafc33f19a7af41f2927c7472c601310cedfc72ff1bb19 but wanted e4e45d5441283b2f0f4bf988d02186b85425e7b708b4be0b06e3bfd7c7aa52c7
...

I guess something has changed in the openapi-generator-cli 5.1.0...

My import of openapi-generator-bazel:

# >>> https://github.com/OpenAPITools/openapi-generator-bazel
http_archive(
    name = "openapi_tools_generator_bazel",
    sha256 = "c6e4c253f1ae0fbe4d4ded8a719f6647273141d0dc3c0cd8bb074aa7fc3c8d1c",
    urls = ["https://github.com/OpenAPITools/openapi-generator-bazel/releases/download/0.1.5/openapi-tools-generator-bazel-0.1.5.tar.gz"],
)

load("@openapi_tools_generator_bazel//:defs.bzl", "openapi_tools_generator_bazel_repositories")

# You can provide any version of the CLI that has been uploaded to Maven
openapi_tools_generator_bazel_repositories(
    openapi_generator_cli_version = "5.1.0",
)
# <<< https://github.com/OpenAPITools/openapi-generator-bazel
msiebuhr commented 2 years ago

Found the solution in https://github.com/OpenAPITools/openapi-generator-bazel/issues/21#issuecomment-833565957:

WORKSPACE can define the hash:

http_archive(
    name = "openapi_tools_generator_bazel",
    sha256 = "c6e4c253f1ae0fbe4d4ded8a719f6647273141d0dc3c0cd8bb074aa7fc3c8d1c",
    urls = ["https://github.com/OpenAPITools/openapi-generator-bazel/releases/download/0.1.5/openapi-tools-generator-bazel-0.1.5.tar.gz"],
)

load("@openapi_tools_generator_bazel//:defs.bzl", "openapi_tools_generator_bazel_repositories")

# You can provide any version of the CLI that has been uploaded to Maven
openapi_tools_generator_bazel_repositories(
    openapi_generator_cli_version = "5.1.0",
    sha256 = "62f9842f0fcd91e4afeafc33f19a7af41f2927c7472c601310cedfc72ff1bb19", # ADD THIS LINE!
)