From 53c381f57e3780381c6a8f84b01141d7c216ecf2 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Sat, 23 Nov 2019 20:15:04 -0500 Subject: [PATCH 1/2] Update README as http_archive workspace rule was deprecated --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a5d85b3..8625c35 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() ``` From dcc5813cc1cfb924a6c3efbe1b79b9697b68303f Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Sat, 23 Nov 2019 22:10:35 -0500 Subject: [PATCH 2/2] Deprecate maven_jar rule in favor of jvm_maven_import_external Add licenses field Update syntax --- openapi/openapi.bzl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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",