diff --git a/README.md b/README.md index e86d2c5..a45cf43 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,18 @@ To use the OpenAPI rules, add the following to your projects `WORKSPACE` file ```python -rules_open_api_version = "bc060274349e137c0eb6ccf6f5f06de94551fe00" # update this as needed +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +RULES_OPEN_API_VERSION = "19518c16fa67cb272ffb6055bf90e0f1628ce99b" +RULES_OPEN_API_SHA256 = "50564187aa01200f9eff01e0fcc541af50b535fd968fe25a4d401e3aa2e8bd87" + http_archive( name = "io_bazel_rules_openapi", - strip_prefix = "rules_openapi-%s" % rules_open_api_version, - type = "zip", - url = "https://github.com/meetup/rules_openapi/archive/%s.zip" % rules_open_api_version, - sha256 = "78503f072e4ca745854c986a34b478914d5242b4c6cada81069fa15b7309570b" + strip_prefix = "rules_openapi-%s" % RULES_OPEN_API_VERSION, + url = "https://github.com/meetup/rules_openapi/archive/%s.tar.gz" % RULES_OPEN_API_VERSION, + sha256 = RULES_OPEN_API_SHA256 ) + load("@io_bazel_rules_openapi//openapi:openapi.bzl", "openapi_repositories") openapi_repositories() ``` diff --git a/openapi/openapi.bzl b/openapi/openapi.bzl index 527e1c6..44009cb 100644 --- a/openapi/openapi.bzl +++ b/openapi/openapi.bzl @@ -1,11 +1,17 @@ """Bazel rules for generating sources and libraries from openapi schemas """ + +load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external") + + def openapi_repositories(swagger_codegen_cli_version = "2.2.2", swagger_codegen_cli_sha256 = "d4e640503482a423ae97e3f487347c9e08cc0e34d90e360ed7de987cfad24299", prefix = "io_bazel_rules_openapi"): - native.maven_jar( + jvm_maven_import_external( name = prefix + "_io_swagger_swagger_codegen_cli", artifact = "io.swagger:swagger-codegen-cli:" + swagger_codegen_cli_version, - sha256 = swagger_codegen_cli_sha256, + artifact_sha256 = swagger_codegen_cli_sha256, + server_urls = ["http://central.maven.org/maven2"], + licenses = ["notice"], # Apache 2.0 License ) native.bind( name = prefix + "/dependency/openapi-cli",