Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load JavaInfo and java_common from rules_java #1027

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ bzl_library(
# stardoc.
"//visibility:public",
],
deps = [
"@rules_java//java:rules",
],
)

alias(
Expand Down
50 changes: 9 additions & 41 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ bazel_dep(
name = "platforms",
version = "0.0.8",
)
bazel_dep(
name = "rules_java",
version = "7.3.2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend staying on a lower version as this one requires Bazel 7. 7.2.0 still works with Bazel 6.4.0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already use use_repo_rule, so we're already expecting Bazel 7 when people use bzlmod

)
bazel_dep(
name = "rules_kotlin",
version = "1.9.0",
)

# Remove this once rules_android has rolled out official Bzlmod support
remote_android_extensions = use_extension("@bazel_tools//tools/android:android_extensions.bzl", "remote_android_tools_extensions")

use_repo(remote_android_extensions, "android_gmaven_r8", "android_tools")

maven = use_extension(":extensions.bzl", "maven")

maven.install(
name = "rules_jvm_external_deps",
artifacts = [
Expand All @@ -38,14 +40,12 @@ maven.install(
],
lock_file = "//:rules_jvm_external_deps_install.json",
)

maven.install(
name = "maven_jar_migrator",
artifacts = [
"com.google.guava:guava:28.0-jre",
],
)

use_repo(
maven,
"maven_jar_migrator",
Expand Down Expand Up @@ -100,46 +100,44 @@ http_file(

bazel_dep(
name = "aspect_rules_js",
dev_dependency = True,
version = "1.34.1",
dev_dependency = True,
)
bazel_dep(
name = "rules_nodejs",
dev_dependency = True,
version = "5.8.2",
dev_dependency = True,
)

node = use_extension(
"@rules_nodejs//nodejs:extensions.bzl",
"node",
dev_dependency = True,
)

node.toolchain(node_version = "16.17.0")

bazel_dep(
name = "protobuf",
dev_dependency = True,
version = "21.7",
dev_dependency = True,
)
bazel_dep(
name = "rules_android",
dev_dependency = True,
version = "0.1.1",
dev_dependency = True,
)
bazel_dep(
name = "stardoc",
version = "0.5.6",
dev_dependency = True,
repo_name = "io_bazel_stardoc",
version = "0.5.6",
)

npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
dev_dependency = True,
)

npm.npm_translate_lock(
name = "npm",
data = ["//:package.json"],
Expand All @@ -150,23 +148,20 @@ npm.npm_translate_lock(
verify_node_modules_ignored = "//:.bazelignore",
yarn_lock = "//:yarn.lock",
)

use_repo(npm, "npm")

dev_maven = use_extension(
":extensions.bzl",
"maven",
dev_dependency = True,
)

dev_maven.install(
artifacts = [
"com.google.guava:guava:31.1-jre",
"org.hamcrest:hamcrest-core:2.1",
],
lock_file = "@rules_jvm_external//:maven_install.json",
)

dev_maven.install(
name = "duplicate_version_warning",
artifacts = [
Expand All @@ -181,23 +176,20 @@ dev_maven.install(
"https://maven.google.com",
],
)

dev_maven.artifact(
name = "duplicate_version_warning",
artifact = "jffi",
classifier = "native",
group = "com.github.jnr",
version = "1.3.3",
)

dev_maven.artifact(
name = "duplicate_version_warning",
artifact = "jffi",
classifier = "native",
group = "com.github.jnr",
version = "1.3.2",
)

dev_maven.install(
name = "duplicate_version_warning_same_version",
artifacts = [
Expand All @@ -209,23 +201,20 @@ dev_maven.install(
"https://maven.google.com",
],
)

dev_maven.artifact(
name = "duplicate_version_warning_same_version",
artifact = "jffi",
classifier = "native",
group = "com.github.jnr",
version = "1.3.3",
)

dev_maven.artifact(
name = "duplicate_version_warning_same_version",
artifact = "jffi",
classifier = "native",
group = "com.github.jnr",
version = "1.3.3",
)

dev_maven.artifact(
name = "exclusion_testing",
artifact = "guava",
Expand All @@ -236,7 +225,6 @@ dev_maven.artifact(
group = "com.google.guava",
version = "27.0-jre",
)

dev_maven.install(
name = "global_exclusion_testing",
artifacts = [
Expand All @@ -249,7 +237,6 @@ dev_maven.install(
"org.codehaus.mojo:animal-sniffer-annotations",
],
)

dev_maven.install(
name = "java_export_exclusion_testing",
artifacts = [
Expand All @@ -273,14 +260,12 @@ dev_maven.install(
"https://repo.spring.io/plugins-release/",
],
)

dev_maven.install(
name = "jvm_import_test",
artifacts = [
"com.google.code.findbugs:jsr305:3.0.2",
],
)

dev_maven.install(
name = "m2local_testing",
artifacts = [
Expand All @@ -294,7 +279,6 @@ dev_maven.install(
"https://repo1.maven.org/maven2",
],
)

dev_maven.install(
name = "m2local_testing_ignore_empty_files",
artifacts = [
Expand All @@ -309,7 +293,6 @@ dev_maven.install(
"https://repo1.maven.org/maven2",
],
)

dev_maven.install(
name = "m2local_testing_ignore_empty_files_repin",
artifacts = [
Expand All @@ -325,7 +308,6 @@ dev_maven.install(
"https://repo1.maven.org/maven2",
],
)

dev_maven.install(
name = "m2local_testing_repin",
artifacts = [
Expand All @@ -339,7 +321,6 @@ dev_maven.install(
"https://repo1.maven.org/maven2",
],
)

dev_maven.install(
name = "m2local_testing_without_checksum",
artifacts = [
Expand All @@ -354,7 +335,6 @@ dev_maven.install(
"https://repo1.maven.org/maven2",
],
)

dev_maven.install(
name = "manifest_stamp_testing",
artifacts = [
Expand All @@ -365,13 +345,11 @@ dev_maven.install(
],
lock_file = "//tests/custom_maven_install:manifest_stamp_testing_install.json",
)

dev_maven.install(
name = "maven_install_in_custom_location",
artifacts = ["com.google.guava:guava:27.0-jre"],
lock_file = "//tests/custom_maven_install:maven_install.json",
)

dev_maven.install(
name = "override_target_in_deps",
artifacts = [
Expand All @@ -380,13 +358,11 @@ dev_maven.install(
],
lock_file = "@rules_jvm_external//tests/custom_maven_install:override_target_in_deps_install.json",
)

dev_maven.override(
name = "override_target_in_deps",
coordinates = "io.opentelemetry:opentelemetry-api",
target = "@//tests/integration/override_targets:additional_deps",
)

dev_maven.install(
name = "policy_pinned_testing",
artifacts = [
Expand Down Expand Up @@ -465,7 +441,6 @@ dev_maven.install(
"https://packages.confluent.io/maven/",
],
)

dev_maven.override(
name = "regression_testing",
coordinates = "com.google.ar.sceneform:rendering",
Expand Down Expand Up @@ -501,7 +476,6 @@ dev_maven.artifact(
group = "com.google.apis",
version = "v1-rev235-1.25.0",
)

dev_maven.install(
name = "starlark_aar_import_test",
# Not actually necessary since this is the default value, but useful for
Expand All @@ -517,7 +491,6 @@ dev_maven.install(
],
use_starlark_android_rules = True,
)

dev_maven.install(
name = "starlark_aar_import_with_sources_test",
# Not actually necessary since this is the default value, but useful for
Expand All @@ -533,7 +506,6 @@ dev_maven.install(
],
use_starlark_android_rules = True,
)

dev_maven.install(
name = "strict_visibility_testing",
artifacts = [
Expand All @@ -551,7 +523,6 @@ dev_maven.artifact(
group = "org.eclipse.jetty",
version = "9.4.20.v20190813",
)

dev_maven.install(
name = "strict_visibility_with_compat_testing",
artifacts = [
Expand All @@ -561,14 +532,12 @@ dev_maven.install(
generate_compat_repositories = True,
strict_visibility = True,
)

dev_maven.artifact(
name = "testonly_testing",
artifact = "guava",
group = "com.google.guava",
version = "27.0-jre",
)

dev_maven.artifact(
name = "testonly_testing",
testonly = True,
Expand All @@ -584,7 +553,6 @@ dev_maven.install(
"io.grpc:grpc-netty-shaded:1.29.0",
],
)

dev_maven.install(
name = "v1_lock_file_format",
artifacts = [
Expand Down
2 changes: 2 additions & 0 deletions private/rules/has_maven_deps.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "JavaInfo")

MavenInfo = provider(
fields = {
# Fields to do with maven coordinates
Expand Down
1 change: 1 addition & 0 deletions private/rules/javadoc.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_java//java:defs.bzl", "JavaInfo")
load(":maven_project_jar.bzl", "DEFAULT_EXCLUDED_WORKSPACES")

_JavadocInfo = provider(
Expand Down
1 change: 1 addition & 0 deletions private/rules/jvm_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# [0]: https://github.com/square/bazel_maven_repository/pull/48
# [1]: https://github.com/bazelbuild/bazel/issues/4549

load("@rules_java//java:defs.bzl", "JavaInfo")
load("//settings:stamp_manifest.bzl", "StampManifestProvider")

def _jvm_import_impl(ctx):
Expand Down
1 change: 1 addition & 0 deletions private/rules/maven_bom_fragment.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_java//java:defs.bzl", "JavaInfo")
load(":has_maven_deps.bzl", "MavenInfo", "has_maven_deps")

MavenBomFragmentInfo = provider(
Expand Down
1 change: 1 addition & 0 deletions private/rules/maven_project_jar.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_java//java:defs.bzl", "JavaInfo", "java_common")
load(":has_maven_deps.bzl", "MavenInfo", "calculate_artifact_jars", "calculate_artifact_source_jars", "has_maven_deps")
load(":maven_utils.bzl", "determine_additional_dependencies")

Expand Down
1 change: 1 addition & 0 deletions private/rules/pom_file.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_java//java:defs.bzl", "JavaInfo")
load(":has_maven_deps.bzl", "MavenInfo", "calculate_artifact_jars", "has_maven_deps")
load(":maven_utils.bzl", "determine_additional_dependencies", "generate_pom")

Expand Down
Loading