Skip to content

Commit

Permalink
Update examples to use rules_bazel_integration_test
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Dierkens <adam@dierkens.com>
  • Loading branch information
adierkens committed Jul 19, 2024
1 parent 8643480 commit 729fd07
Show file tree
Hide file tree
Showing 49 changed files with 111 additions and 47 deletions.
2 changes: 0 additions & 2 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
javascript/examples
kotlin/example
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ coverage --remote_download_toplevel
coverage --remote_timeout=3600
coverage --build_metadata=REPO_URL=https://github.com/player-ui/rules_player.git

# To update these lines, execute
# `bazel run @rules_bazel_integration_test//tools:update_deleted_packages`
build --deleted_packages=examples/kotlin,examples/ts-monorepo,examples/ts-monorepo/packages/module-a,examples/ts-monorepo/packages/module-b
query --deleted_packages=examples/kotlin,examples/ts-monorepo,examples/ts-monorepo/packages/module-a,examples/ts-monorepo/packages/module-b

try-import %workspace%/.bazelrc.local
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
command: bazel test //...
- run:
name: Test Examples
command: ./scripts/test.sh
command: bazel test //examples:all_integration_tests

release:
executor: base
Expand Down
18 changes: 18 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
filegroup(
name = "all_files",
srcs = glob(["*"]),
visibility = ["//:__subpackages__"],
)

filegroup(
name = "local_repository_files",
# Include every package that is required by the child workspaces.
srcs = [
":all_files",
"//javascript:all_files",
"//javascript/private:all_files",
"//kotlin:all_files",
"//kotlin/private:all_files",
],
visibility = ["//:__subpackages__"],
)
11 changes: 9 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,24 @@ maven.install(
"org.junit.jupiter:junit-jupiter-engine:5.7.2",
"org.junit.platform:junit-platform-suite-api:1.7.2",
"org.junit.platform:junit-platform-console:1.7.2",
"org.junit.platform:junit-platform-launcher:1.7.2"
"org.junit.platform:junit-platform-launcher:1.7.2",
],
fetch_sources = True,
repositories = [
"https://repo1.maven.org/maven2",
"https://maven.google.com/",
"https://plugins.gradle.org/m2/",
]
],
)
use_repo(maven, "rules_player_maven")

## Rule Dependencies
bazel_dep(name = "rules_swift", version = "1.18.0", repo_name = "build_bazel_rules_swift")
bazel_dep(name = "rules_apple", version = "3.5.1", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "rules_ios", version = "4.3.1", repo_name = "build_bazel_rules_ios")

bazel_dep(name = "rules_bazel_integration_test", version = "0.24.1", dev_dependency = True)
bazel_binaries = use_extension("@rules_bazel_integration_test//:extensions.bzl", "bazel_binaries", dev_dependency = True)
bazel_binaries.download(version_file = ".bazelversion")

use_repo(bazel_binaries, "bazel_binaries")
35 changes: 35 additions & 0 deletions examples/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
load("@bazel_binaries//:defs.bzl", "bazel_binaries")
load("@rules_bazel_integration_test//bazel_integration_test:defs.bzl", "bazel_integration_test", "default_test_runner", "integration_test_utils")

default_test_runner(name = "simple_test_runner")

bazel_integration_test(
name = "ts-monorepo-test",
bazel_binaries = bazel_binaries,
bazel_version = bazel_binaries.versions.current,
test_runner = ":simple_test_runner",
workspace_files = integration_test_utils.glob_workspace_files("ts-monorepo") + [
"//:local_repository_files",
],
workspace_path = "ts-monorepo",
)

bazel_integration_test(
name = "kotlin-test",
bazel_binaries = bazel_binaries,
bazel_version = bazel_binaries.versions.current,
test_runner = ":simple_test_runner",
workspace_files = integration_test_utils.glob_workspace_files("kotlin") + [
"//:local_repository_files",
],
workspace_path = "kotlin",
)

test_suite(
name = "all_integration_tests",
tags = integration_test_utils.DEFAULT_INTEGRATION_TEST_TAGS,
tests = [
":kotlin-test",
":ts-monorepo-test",
],
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module(name = "ts-monorepo-example")

bazel_dep(name = "rules_player")
local_path_override(module_name = "rules_player", path = "../../..")
local_path_override(module_name = "rules_player", path = "../..")

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_rules_js", version = "1.33.1")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions javascript/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

exports_files(["defs.bzl"])

filegroup(
name = "all_files",
srcs = glob(["*"]),
visibility = ["//:__subpackages__"],
)

bzl_library(
name = "defs",
srcs = ["defs.bzl"],
Expand Down
8 changes: 7 additions & 1 deletion javascript/private/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@aspect_rules_js//js:defs.bzl", "js_binary")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

filegroup(
name = "all_files",
srcs = glob(["*"]),
visibility = ["//:__subpackages__"],
)

exports_files(
glob(["*.bzl"]),
Expand Down
12 changes: 9 additions & 3 deletions kotlin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

exports_files(["defs.bzl"])

filegroup(
name = "all_files",
srcs = glob(["*"]),
visibility = ["//:__subpackages__"],
)

bzl_library(
name = "defs",
srcs = ["defs.bzl"],
visibility = ["//visibility:public"],
deps = [
"//kotlin/private:lint",
"//kotlin/private:distribution",
"//kotlin/private:kt_jvm"
"//kotlin/private:kt_jvm",
"//kotlin/private:lint",
],
)
)
31 changes: 20 additions & 11 deletions kotlin/private/BUILD
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

filegroup(
name = "all_files",
srcs = glob(["*"]),
visibility = ["//:__subpackages__"],
)

bzl_library(
name = "lint",
srcs = ["lint.bzl"],
visibility = [
"//kotlin:__subpackages__",
],
deps = [
":scope_name"
]
":scope_name",
],
)

bzl_library(
name = "junit",
srcs = ["junit_test.bzl", "junit5.bzl"],
srcs = [
"junit5.bzl",
"junit_test.bzl",
],
visibility = [
"//kotlin:__subpackages__",
],
Expand All @@ -28,24 +37,24 @@ bzl_library(
deps = [
":scope_name",
"@rules_jvm_external//:defs.bzl",
]
],
)

bzl_library(
name = "kt_jvm",
srcs = ["kt_jvm.bzl",],
srcs = ["kt_jvm.bzl"],
visibility = [
"//kotlin:__subpackages__",
],
deps = [
":lint",
":distribution",
":kt_jvm_library_and_test.bzl",
":junit",
"@rules_kotlin//kotlin",
"@rules_jvm_external//:implementation",
":kt_jvm_library_and_test.bzl",
":lint",
"@rules_java//java:rules",
]
"@rules_jvm_external//:implementation",
"@rules_kotlin//kotlin",
],
)

bzl_library(
Expand All @@ -55,4 +64,4 @@ bzl_library(
"//kotlin:__subpackages__",
],
deps = [],
)
)
26 changes: 0 additions & 26 deletions scripts/test.sh

This file was deleted.

0 comments on commit 729fd07

Please sign in to comment.