Skip to content

Vendor bazel's starlark package #307

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
125 changes: 0 additions & 125 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ bazel_dep(name = "rules_license", version = "0.0.8")
bazel_dep(name = "rules_pkg", version = "0.10.1")
bazel_dep(name = "rules_python", version = "0.31.0")

non_module_deps = use_extension("//:repositories.bzl", "non_module_deps")
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps rules_python dependency can be dropped as well? It seems it's only needed by io_bazel and not referenced in this repo

use_repo(non_module_deps, "io_bazel")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
name = "copybara_maven",
Expand Down Expand Up @@ -68,125 +65,3 @@ maven.install(
],
)
use_repo(maven, "copybara_maven")

# Copied from bazelbuild/bazel/MODULE.bazel, has to be kept in sync
# TODO(hsudhof): Vendor bazel's starlark package instead
maven.install(
artifacts = [

"com.github.ben-manes.caffeine:caffeine:3.0.5",
"com.github.kevinstern:software-and-algorithms:1.0",
"com.github.stephenc.jcip:jcip-annotations:1.0-1",
"com.google.api-client:google-api-client-gson:1.35.2",
"com.google.api-client:google-api-client:1.35.2",
"com.google.auth:google-auth-library-credentials:1.6.0",
"com.google.auth:google-auth-library-oauth2-http:1.6.0",
"com.google.auto.service:auto-service-annotations:1.0.1",
"com.google.auto.service:auto-service:1.0",
"com.google.auto.value:auto-value-annotations:1.9",
"com.google.auto.value:auto-value:1.8.2",
"com.google.auto:auto-common:1.2.1",
"com.google.code.findbugs:jsr305:3.0.2",
"com.google.code.gson:gson:2.9.0",
"com.google.code.java-allocation-instrumenter:java-allocation-instrumenter:3.3.0",
"com.google.errorprone:error_prone_annotation:2.23.0",
"com.google.errorprone:error_prone_annotations:2.23.0",
"com.google.errorprone:error_prone_check_api:2.23.0",
"com.google.errorprone:error_prone_core:2.23.0",
"com.google.errorprone:error_prone_type_annotations:2.23.0",
"com.google.flogger:flogger-system-backend:0.5.1",
"com.google.flogger:flogger:0.5.1",
"com.google.flogger:google-extensions:0.5.1",
"com.google.guava:failureaccess:1.0.1",
"com.google.guava:guava:33.0.0-jre",
"com.google.http-client:google-http-client-gson:1.42.0",
"com.google.http-client:google-http-client:1.42.0",
"com.google.j2objc:j2objc-annotations:1.3",
"com.google.turbine:turbine:0.5.0",
"com.ryanharter.auto.value:auto-value-gson-extension:1.3.1",
"com.ryanharter.auto.value:auto-value-gson-runtime:1.3.1",
"com.ryanharter.auto.value:auto-value-gson-factory:1.3.1",
"com.squareup:javapoet:1.12.0",
"commons-collections:commons-collections:3.2.2",
"commons-lang:commons-lang:2.6",
"io.github.java-diff-utils:java-diff-utils:4.12",
"io.grpc:grpc-api:1.48.1",
"io.grpc:grpc-auth:1.48.1",
"io.grpc:grpc-context:1.48.1",
"io.grpc:grpc-core:1.48.1",
"io.grpc:grpc-netty:1.48.1",
"io.grpc:grpc-protobuf-lite:1.48.1",
"io.grpc:grpc-protobuf:1.48.1",
"io.grpc:grpc-stub:1.48.1",
"io.netty:netty-buffer:4.1.93.Final",
"io.netty:netty-codec-http2:4.1.93.Final",
"io.netty:netty-codec-http:4.1.93.Final",
"io.netty:netty-codec:4.1.93.Final",
"io.netty:netty-common:4.1.93.Final",
"io.netty:netty-handler-proxy:4.1.93.Final",
"io.netty:netty-handler:4.1.93.Final",
"io.netty:netty-resolver-dns:4.1.93.Final",
"io.netty:netty-resolver:4.1.93.Final",
"io.netty:netty-tcnative-boringssl-static:jar:linux-aarch_64:2.0.56.Final",
"io.netty:netty-tcnative-boringssl-static:jar:linux-x86_64:2.0.56.Final",
"io.netty:netty-tcnative-boringssl-static:jar:osx-aarch_64:2.0.56.Final",
"io.netty:netty-tcnative-boringssl-static:jar:osx-x86_64:2.0.56.Final",
"io.netty:netty-tcnative-boringssl-static:jar:windows-x86_64:2.0.56.Final",
"io.netty:netty-tcnative-classes:2.0.56.Final",
"io.netty:netty-transport-classes-epoll:4.1.93.Final",
"io.netty:netty-transport-classes-kqueue:4.1.93.Final",
"io.netty:netty-transport-native-epoll:jar:linux-aarch_64:4.1.93.Final",
"io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.93.Final",
"io.netty:netty-transport-native-kqueue:jar:osx-aarch_64:4.1.93.Final",
"io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.93.Final",
"io.netty:netty-transport-native-unix-common:4.1.93.Final",
"io.netty:netty-transport-native-unix-common:jar:linux-aarch_64:4.1.93.Final",
"io.netty:netty-transport-native-unix-common:jar:linux-x86_64:4.1.93.Final",
"io.netty:netty-transport-native-unix-common:jar:osx-aarch_64:4.1.93.Final",
"io.netty:netty-transport-native-unix-common:jar:osx-x86_64:4.1.93.Final",
"io.netty:netty-transport:4.1.93.Final",
"io.reactivex.rxjava3:rxjava:3.1.2",
"it.unimi.dsi:fastutil:7.2.1",
"javax.activation:javax.activation-api:1.2.0",
"javax.annotation:javax.annotation-api:1.3.2",
"javax.inject:javax.inject:1",
"net.bytebuddy:byte-buddy-agent:1.14.5",
"net.bytebuddy:byte-buddy:1.14.5",
"org.apache.commons:commons-compress:1.20",
"org.apache.commons:commons-pool2:2.8.0",
"org.apache.tomcat:tomcat-annotations-api:8.0.5",
"org.apache.velocity:velocity:1.7",
"org.checkerframework:checker-qual:3.19.0",
"org.jcommander:jcommander:2.0",
"org.ow2.asm:asm-analysis:9.2",
"org.ow2.asm:asm-commons:9.2",
"org.ow2.asm:asm-tree:9.2",
"org.ow2.asm:asm-util:9.2",
"org.ow2.asm:asm:9.2",
"org.pcollections:pcollections:3.1.4",
"org.threeten:threeten-extra:1.5.0",
"org.tukaani:xz:1.9",
"org.yaml:snakeyaml:1.28",
"tools.profiler:async-profiler:3.0",
# The following jars are for testing.
# junit is not test only due to //src/java_tools/junitrunner/java/com/google/testing/junit/junit4:runner,
# and hamcrest is a dependency of junit.
"junit:junit:4.13.2",
"org.hamcrest:hamcrest-core:1.3",
],
excluded_artifacts = [
# org.apache.httpcomponents and org.eclipse.jgit:org.eclipse.jgit
# require java.security.jgss module to be embedded in the Bazel binary.
"org.apache.httpcomponents:httpclient",
"org.apache.httpcomponents:httpcore",
"org.eclipse.jgit:org.eclipse.jgit",
# We build protobuf Java library from source, exclude protobuf jars to be safe.
"com.google.protobuf:protobuf-java",
"com.google.protobuf:protobuf-javalite",
],
repositories = [
"https://repo1.maven.org/maven2",
],
strict_visibility = True,
)
use_repo(maven, "maven")
42 changes: 0 additions & 42 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//third_party:bazel.bzl", "bazel_sha256", "bazel_version")
load("//third_party:bazel_skylib.bzl", "skylib_sha256", "skylib_version")

def copybara_repositories():
Expand Down Expand Up @@ -50,33 +49,6 @@ def copybara_repositories():
url = "https://github.com/bazelbuild/bazel-skylib/archive/" + skylib_version + ".zip",
)

EXPORT_WORKSPACE_IN_BUILD_FILE = [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD",
]

EXPORT_WORKSPACE_IN_BUILD_FILE_WIN = [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force",
]

# Stuff used by Bazel Starlark syntax package transitively:
# LICENSE: The Apache Software License, Version 2.0
maybe(
http_archive,
name = "com_google_protobuf",
patch_args = ["-p1"],
patches = ["@io_bazel//third_party/protobuf:21.7.patch"],
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae",
strip_prefix = "protobuf-21.7",
urls = [
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz",
],
)

# Stuff used by Buildifier transitively:
# LICENSE: The Apache Software License, Version 2.0
maybe(
Expand Down Expand Up @@ -161,17 +133,3 @@ def copybara_repositories():
"http://github.com/keith/buildifier-prebuilt/archive/6.4.0.tar.gz",
],
)

_non_module_deps(None)

def _non_module_deps(_):
# LICENSE: The Apache Software License, Version 2.0
maybe(
http_archive,
name = "io_bazel",
sha256 = bazel_sha256,
strip_prefix = "bazel-" + bazel_version,
url = "https://github.com/bazelbuild/bazel/archive/" + bazel_version + ".zip",
)

non_module_deps = module_extension(implementation = _non_module_deps)
6 changes: 0 additions & 6 deletions repositories.maven.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,3 @@ def copybara_maven_repositories():
artifacts = COPYBARA_MAVEN_ARTIFACTS,
repositories = COPYBARA_MAVEN_ARTIFACT_ADDITIONAL_REPOSITORIES + ["https://repo1.maven.org/maven2"],
)
maybe(
maven_install,
name = "maven",
artifacts = COPYBARA_MAVEN_ARTIFACTS,
repositories = COPYBARA_MAVEN_ARTIFACT_ADDITIONAL_REPOSITORIES + ["https://repo1.maven.org/maven2"],
)
16 changes: 6 additions & 10 deletions third_party/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ java_library(
java_library(
name = "jcommander",
exports = [
"@maven//:org_jcommander_jcommander",
"@copybara_maven//:org_jcommander_jcommander",
],
)

Expand Down Expand Up @@ -166,10 +166,10 @@ java_library(
java_library(
name = "starlark",
exports = [
"@io_bazel//src/main/java/net/starlark/java/annot",
"@io_bazel//src/main/java/net/starlark/java/eval",
"@io_bazel//src/main/java/net/starlark/java/lib/json",
"@io_bazel//src/main/java/net/starlark/java/syntax",
"//third_party/bazel/main/java/net/starlark/java/annot",
"//third_party/bazel/main/java/net/starlark/java/eval",
"//third_party/bazel/main/java/net/starlark/java/lib/json",
"//third_party/bazel/main/java/net/starlark/java/syntax",
],
)

Expand All @@ -186,7 +186,7 @@ java_library(
java_library(
name = "error_prone",
exports = [
"@io_bazel//third_party:error_prone_annotations",
"//third_party/bazel/third_party:error_prone_annotations",
],
)

Expand Down Expand Up @@ -225,7 +225,3 @@ java_library(
"@copybara_maven//:com_google_protobuf_protobuf_lite",
],
)

# Required temporarily until @io_bazel//src/main/java/com/google/devtools/build/lib/syntax/...
# is fixed
exports_files(["bazel.patch"])
19 changes: 0 additions & 19 deletions third_party/bazel.bzl

This file was deleted.

12 changes: 12 additions & 0 deletions third_party/bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_license//rules:license.bzl", "license")

licenses(["notice"]) # Apache 2.0

package(
Expand All @@ -6,6 +8,16 @@ package(
],
)

license(
name = "license",
package_name = "bazelbuild/bazel",
copyright_notice = "Copyright © 2014 The Bazel Authors. All rights reserved.",
license_kinds = [
"@rules_license//licenses/spdx:Apache-2.0",
],
license_text = "LICENSE",
)

java_library(
name = "shell",
srcs = glob(["main/**/*.java"]),
Expand Down
35 changes: 35 additions & 0 deletions third_party/bazel/main/java/net/starlark/java/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Bazel's Starlark interpreter

licenses(["notice"])

filegroup(
name = "srcs",
srcs = ["BUILD"],
visibility = [":bazel"],
)

# The java.starlark.net project, including its tests.
package_group(
name = "starlark",
packages = [
"//src/test/java/net/starlark/java/...",
"//third_party/bazel/main/java/net/starlark/java/...",
],
)

# Bazel and its tests.
package_group(
name = "bazel",
packages = ["//src/..."],
)

# The Java Starlark interpreter is not supported for general use as a public
# API. However, Copybara and Stardoc are approved clients.
#
# We do not use visibility to prevent other dependencies, because cross-repo
# visibility restrictions do not make sense. Just be aware this is not
# guaranteed as a stable API.
package_group(
name = "clients",
packages = ["public"],
)
32 changes: 32 additions & 0 deletions third_party/bazel/main/java/net/starlark/java/annot/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
load("@rules_java//java:defs.bzl", "java_library")

package(
default_applicable_licenses = ["//third_party/bazel:license"],
default_visibility = ["//visibility:public"],
)

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

# Annotations to make Java classes and methods accessible from Starlark.
# Depending on this library adds annotations processing to the build.
java_library(
name = "annot",
exported_plugins = ["//third_party/bazel/main/java/net/starlark/java/annot/processor"],
visibility = ["//third_party/bazel/main/java/net/starlark/java:clients"],
exports = [":annot_sans_processor"],
)

# Annotations without processor, to avoid a dependency cycle in the processor itself.
java_library(
name = "annot_sans_processor",
srcs = glob(["*.java"]),
visibility = ["//third_party/bazel/main/java/net/starlark/java/annot/processor:__pkg__"],
deps = [
"//third_party/bazel/third_party:guava",
"//third_party/bazel/third_party:jsr305",
],
)
Loading