From fa25ce9d51e1281e92a397c293636945fda2785f Mon Sep 17 00:00:00 2001 From: arunkumar9t2 Date: Thu, 19 Oct 2023 11:42:30 +0800 Subject: [PATCH] Update dependencies and unify rules under `//rules` (#114) Fixes #114 --- .bazelversion | 2 +- LICENSE.txt => LICENSE | 0 README.md | 8 ++++---- WORKSPACE | 14 +++++++------- {android => rules}/maven.bzl | 2 +- {android => rules}/repositories.bzl | 4 ++-- android/initialize.bzl => rules/setup.bzl | 12 +++++++++++- tools/buildifier/defs.bzl | 4 ++-- 8 files changed, 28 insertions(+), 18 deletions(-) rename LICENSE.txt => LICENSE (100%) rename {android => rules}/maven.bzl (75%) rename {android => rules}/repositories.bzl (94%) rename android/initialize.bzl => rules/setup.bzl (97%) diff --git a/.bazelversion b/.bazelversion index 4ac4fded..f9da12e1 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.2.0 \ No newline at end of file +6.3.2 \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE diff --git a/README.md b/README.md index 830fb6ab..a5b527f9 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,14 @@ bazel_common_dependencies() load("@grab_bazel_common//android:initialize.bzl", "bazel_common_initialize") -bazel_common_initialize( +bazel_common_setup( patched_android_tools = True, # Optionally use patched android_tools jars - buildifier_version = "5.1.0", + buildifier_version = "6.3.3", ) -load("@grab_bazel_common//android:maven.bzl", "pin_bazel_common_artifacts") +load("@grab_bazel_common//android:maven.bzl", "pin_bazel_common_dependencies") -pin_bazel_common_artifacts() +pin_bazel_common_dependencies() load("@grab_bazel_common//:workspace_defs.bzl", "GRAB_BAZEL_COMMON_ARTIFACTS") diff --git a/WORKSPACE b/WORKSPACE index b6a9cb62..a7cd9dbe 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,20 +1,20 @@ workspace(name = "grab_bazel_common") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@grab_bazel_common//android:repositories.bzl", "bazel_common_dependencies") +load("@grab_bazel_common//rules:repositories.bzl", "bazel_common_dependencies") bazel_common_dependencies() -load("@grab_bazel_common//android:initialize.bzl", "bazel_common_initialize") +load("@grab_bazel_common//rules:setup.bzl", "bazel_common_setup") -bazel_common_initialize( - buildifier_version = "6.0.1", +bazel_common_setup( + buildifier_version = "6.3.3", pinned_maven_install = True, ) -load("@grab_bazel_common//android:maven.bzl", "pin_bazel_common_artifacts") +load("@grab_bazel_common//rules:maven.bzl", "pin_bazel_common_dependencies") -pin_bazel_common_artifacts() +pin_bazel_common_dependencies() android_sdk_repository( name = "androidsdk", @@ -23,7 +23,7 @@ android_sdk_repository( load("@rules_jvm_external//:defs.bzl", "maven_install") load("@grab_bazel_common//:workspace_defs.bzl", "GRAB_BAZEL_COMMON_ARTIFACTS") -# Artifacts that need to be present on the consumer under @maven. They can be overriden +# Artifacts that need to be present on the consumer under @maven. They can be overridden # by the consumer's maven_install rule. maven_install( artifacts = GRAB_BAZEL_COMMON_ARTIFACTS, diff --git a/android/maven.bzl b/rules/maven.bzl similarity index 75% rename from android/maven.bzl rename to rules/maven.bzl index 34f3cb83..103bafc0 100644 --- a/android/maven.bzl +++ b/rules/maven.bzl @@ -1,4 +1,4 @@ load("@bazel_common_maven//:defs.bzl", _pinned_maven_install = "pinned_maven_install") -def pin_bazel_common_artifacts(): +def pin_bazel_common_dependencies(): _pinned_maven_install() diff --git a/android/repositories.bzl b/rules/repositories.bzl similarity index 94% rename from android/repositories.bzl rename to rules/repositories.bzl index e0db1522..071d484a 100644 --- a/android/repositories.bzl +++ b/rules/repositories.bzl @@ -27,9 +27,9 @@ def _maven(): ) def _kotlin(): - RULES_KOTLIN_VERSION = "1.8-RC-12" + RULES_KOTLIN_VERSION = "1.8.1" - RULES_KOTLIN_SHA = "8e5c8ab087e0fa3fbb58e1f6b99d8fe40f75bac44994c3d208eba723284465d6" + RULES_KOTLIN_SHA = "a630cda9fdb4f56cf2dc20a4bf873765c41cf00e9379e8d59cd07b24730f4fde" http_archive( name = "io_bazel_rules_kotlin", diff --git a/android/initialize.bzl b/rules/setup.bzl similarity index 97% rename from android/initialize.bzl rename to rules/setup.bzl index 62688113..abad59ef 100644 --- a/android/initialize.bzl +++ b/rules/setup.bzl @@ -3,12 +3,22 @@ load( "register_common_toolchains", _buildifier_version = "buildifier_version", ) + +# Internal load("@grab_bazel_common//:workspace_defs.bzl", "GRAB_BAZEL_COMMON_ARTIFACTS") load("@grab_bazel_common//tools/buildifier:defs.bzl", "BUILDIFIER_DEFAULT_VERSION") load("@grab_bazel_common//android/tools:defs.bzl", "android_tools") + +# Dagger load("@bazel_common_dagger//:workspace_defs.bzl", "DAGGER_ARTIFACTS", "DAGGER_REPOSITORIES") + +# Rules Jvm External load("@rules_jvm_external//:defs.bzl", "maven_install") + +# Kotlin load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version") + +# Proto # load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") # Setup android databinding compilation and optionally use patched android tools jar @@ -29,7 +39,7 @@ def _kotlin(): ) native.register_toolchains("//:kotlin_toolchain") -def bazel_common_initialize( +def bazel_common_setup( patched_android_tools = True, buildifier_version = BUILDIFIER_DEFAULT_VERSION, pinned_maven_install = True): diff --git a/tools/buildifier/defs.bzl b/tools/buildifier/defs.bzl index 69c6baee..c28478a9 100644 --- a/tools/buildifier/defs.bzl +++ b/tools/buildifier/defs.bzl @@ -13,8 +13,8 @@ # limitations under the License. """""" -BUILDIFIER_DEFAULT_VERSION = "5.1.0" -BUILDIFIER_RELEASE_URL_TEMPLATE = "https://github.com/bazelbuild/buildtools/releases/download/{version}/buildifier-{os}-{arch}" +BUILDIFIER_DEFAULT_VERSION = "6.3.3" +BUILDIFIER_RELEASE_URL_TEMPLATE = "https://github.com/bazelbuild/buildtools/releases/download/v{version}/buildifier-{os}-{arch}" BuildifierVersionInfo = provider( "Provides information about the buildifier release",