|
| 1 | +# Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +"""apple/rules_pkl""" |
| 16 | + |
| 17 | +module( |
| 18 | + name = "rules_pkl", |
| 19 | + version = "0.9.0", |
| 20 | + bazel_compatibility = [">=7.0.0"], |
| 21 | + compatibility_level = 1, |
| 22 | +) |
| 23 | + |
| 24 | +bazel_dep(name = "aspect_bazel_lib", version = "2.13.0") |
| 25 | +bazel_dep(name = "bazel_skylib", version = "1.7.1") |
| 26 | +bazel_dep(name = "platforms", version = "0.0.11") |
| 27 | +bazel_dep(name = "rules_java", version = "8.11.0") |
| 28 | +bazel_dep(name = "rules_jvm_external", version = "6.7") |
| 29 | +bazel_dep(name = "rules_shell", version = "0.4.0") |
| 30 | + |
| 31 | +bazel_dep(name = "buildifier_prebuilt", version = "7.3.1", dev_dependency = True) |
| 32 | +bazel_dep(name = "gazelle", version = "0.43.0", dev_dependency = True, repo_name = "bazel_gazelle") |
| 33 | +bazel_dep(name = "rules_bazel_integration_test", version = "0.29.0", dev_dependency = True) |
| 34 | +bazel_dep(name = "rules_python", version = "1.3.0", dev_dependency = True) |
| 35 | +bazel_dep(name = "stardoc", version = "0.8.0", dev_dependency = True) |
| 36 | + |
| 37 | +pkl = use_extension("//pkl/extensions:pkl.bzl", "pkl") |
| 38 | +use_repo( |
| 39 | + pkl, |
| 40 | + "pkl-cli-linux-aarch64", |
| 41 | + "pkl-cli-linux-amd64", |
| 42 | + "pkl-cli-macos-aarch64", |
| 43 | + "pkl-cli-macos-amd64", |
| 44 | +) |
| 45 | + |
| 46 | +register_toolchains( |
| 47 | + "@rules_pkl//pkl:pkl_toolchain_codegen_java", |
| 48 | + "@rules_pkl//pkl:pkl_toolchain_linux_aarch64", |
| 49 | + "@rules_pkl//pkl:pkl_toolchain_linux_amd64", |
| 50 | + "@rules_pkl//pkl:pkl_toolchain_macos_aarch64", |
| 51 | + "@rules_pkl//pkl:pkl_toolchain_macos_amd64", |
| 52 | +) |
| 53 | + |
| 54 | +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") |
| 55 | +maven.install( |
| 56 | + name = "rules_pkl_deps", |
| 57 | + artifacts = [ |
| 58 | + "org.pkl-lang:pkl-tools:0.28.2", |
| 59 | + "org.pkl-lang:pkl-config-java:0.28.2", |
| 60 | + "org.pkl-lang:pkl-tools:0.28.2", |
| 61 | + "org.jetbrains.kotlin:kotlin-stdlib:2.0.21", |
| 62 | + "com.google.code.gson:gson:2.12.1", |
| 63 | + "org.junit.vintage:junit-vintage-engine:5.7.0", |
| 64 | + ], |
| 65 | + lock_file = "//pkl/private:pkl_deps_install.json", |
| 66 | + repositories = [ |
| 67 | + "https://repo1.maven.org/maven2/", |
| 68 | + ], |
| 69 | +) |
| 70 | +use_repo( |
| 71 | + maven, |
| 72 | + "rules_pkl_deps", |
| 73 | + "unpinned_rules_pkl_deps", |
| 74 | +) |
| 75 | +maven.install( |
| 76 | + name = "custom_pkl_java_library_maven_deps", |
| 77 | + artifacts = [ |
| 78 | + "org.pkl-lang:pkl-config-java:0.28.2", |
| 79 | + ], |
| 80 | + lock_file = "//pkl/private:pkl_deps_custom_java_library_maven_deps_install.json", |
| 81 | + repositories = [ |
| 82 | + "https://repo1.maven.org/maven2/", |
| 83 | + ], |
| 84 | +) |
| 85 | +use_repo( |
| 86 | + maven, |
| 87 | + "custom_pkl_java_library_maven_deps", |
| 88 | + "unpinned_custom_pkl_java_library_maven_deps", |
| 89 | +) |
| 90 | + |
| 91 | +python = use_extension( |
| 92 | + "@rules_python//python/extensions:python.bzl", |
| 93 | + "python", |
| 94 | + dev_dependency = True, |
| 95 | +) |
| 96 | +python.toolchain( |
| 97 | + configure_coverage_tool = True, |
| 98 | + ignore_root_user_error = True, |
| 99 | + python_version = "3.12", |
| 100 | +) |
| 101 | + |
| 102 | +bazel_binaries = use_extension( |
| 103 | + "@rules_bazel_integration_test//:extensions.bzl", |
| 104 | + "bazel_binaries", |
| 105 | + dev_dependency = True, |
| 106 | +) |
| 107 | +bazel_binaries.download(version = "7.6.1") |
| 108 | +bazel_binaries.download(version = "8.2.1") |
| 109 | +use_repo( |
| 110 | + bazel_binaries, |
| 111 | + "bazel_binaries", |
| 112 | + "bazel_binaries_bazelisk", |
| 113 | + "build_bazel_bazel_7_6_1", |
| 114 | + "build_bazel_bazel_8_2_1", |
| 115 | +) |
| 116 | + |
| 117 | +http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
| 118 | + |
| 119 | +hawkeye_coordinates = [ |
| 120 | + { |
| 121 | + "name": "hawkeye-aarch64-apple-darwin", |
| 122 | + "url": "https://github.com/korandoru/hawkeye/releases/download/v6.0.2/hawkeye-aarch64-apple-darwin.tar.xz", |
| 123 | + "sha256": "9f300ad84201e500c4eb09ed710239797d2a6a17de5b7c08e1d3af1704ca6bb7", |
| 124 | + }, |
| 125 | + { |
| 126 | + "name": "hawkeye-x86_64-apple-darwin", |
| 127 | + "url": "https://github.com/korandoru/hawkeye/releases/download/v6.0.2/hawkeye-x86_64-apple-darwin.tar.xz", |
| 128 | + "sha256": "6f8850adb9204b6218f4912fb987106a71fcd8d742ce20227697ddccc44cec38", |
| 129 | + }, |
| 130 | + { |
| 131 | + "name": "hawkeye-x86_64-unknown-linux-gnu", |
| 132 | + "url": "https://github.com/korandoru/hawkeye/releases/download/v6.0.2/hawkeye-x86_64-unknown-linux-gnu.tar.xz", |
| 133 | + "sha256": "d5b9d3cdb4293ac84fa27e5021c77b6c062c61071760ab05fcacfbec1ac14850", |
| 134 | + }, |
| 135 | +] |
| 136 | + |
| 137 | +[ |
| 138 | + http_archive( |
| 139 | + name = coords["name"], |
| 140 | + build_file = "//scripts:hawkeye.BUILD", |
| 141 | + sha256 = coords["sha256"], |
| 142 | + strip_prefix = coords["name"], |
| 143 | + url = coords["url"], |
| 144 | + ) |
| 145 | + for coords in hawkeye_coordinates |
| 146 | +] |
0 commit comments