| workspace( | |
| name = "kotlin_example", | |
| managed_directories = {"@npm": ["node_modules"]}, | |
| ) | |
| load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | |
| http_archive( | |
| name = "build_bazel_rules_nodejs", | |
| sha256 = "9d93d4e1340c43dbf6b2fd66b683d89630a6310bf8be3bf40ec96685dcacc26c", | |
| urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/2.3.3/rules_nodejs-2.3.3.tar.gz"], | |
| ) | |
| # Install external npm dependencies | |
| load("@build_bazel_rules_nodejs//:index.bzl", "npm_install") | |
| npm_install( | |
| # Name this npm so that Bazel Label references look like @npm//package | |
| name = "npm", | |
| package_json = "//:package.json", | |
| package_lock_json = "//:package-lock.json", | |
| ) | |
| # Install external Kotlin/Java dependencies | |
| http_archive( | |
| name = "rules_jvm_external", | |
| sha256 = "f04b1466a00a2845106801e0c5cec96841f49ea4e7d1df88dc8e4bf31523df74", | |
| strip_prefix = "rules_jvm_external-2.7", | |
| url = "https://github.com/bazelbuild/rules_jvm_external/archive/2.7.zip", | |
| ) | |
| load("@rules_jvm_external//:defs.bzl", "maven_install") | |
| maven_install( | |
| name = "maven", | |
| artifacts = [ | |
| "org.jetbrains.kotlinx:kotlinx-html-js:0.6.12", | |
| "org.jetbrains.kotlin:kotlin-stdlib-js:1.2.71", | |
| ], | |
| fetch_sources = True, # Fetch source jars. Defaults to False. | |
| maven_install_json = "@kotlin_example//:maven_install.json", | |
| repositories = [ | |
| "http://dl.bintray.com/kotlin/kotlinx.html/", | |
| "https://maven.google.com", | |
| "https://repo1.maven.org/maven2", | |
| ], | |
| ) | |
| load("@maven//:defs.bzl", "pinned_maven_install") | |
| pinned_maven_install() | |
| # To test local edits, add this to .bazelrc.user: | |
| # build --override_repository=io_bazel_rules_kotlin=/my/path/to/rules_kotlin | |
| rules_kotlin_version = "40efd46789a06f06655e867dcaec2a84815461df" | |
| http_archive( | |
| name = "io_bazel_rules_kotlin", | |
| #sha256 = "fea280c0c3fbb40712c5e7994c36c1a7ab0be5c8d26c90d47ac55860c5d43b2d", | |
| strip_prefix = "rules_kotlin-%s" % rules_kotlin_version, | |
| type = "zip", | |
| urls = ["https://github.com/bazelbuild/rules_kotlin/archive/%s.zip" % rules_kotlin_version], | |
| ) | |
| load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains") | |
| kotlin_repositories() | |
| kt_register_toolchains() |