Skip to content

Commit

Permalink
Clean up build after update to 7.2.0
Browse files Browse the repository at this point in the history
Closes bazelbuild#22400.

PiperOrigin-RevId: 642564375
Change-Id: I1326aa33ddd30d29a51b928adcea0def42304fe9
  • Loading branch information
fmeum authored and bazel-io committed Jun 12, 2024
1 parent 7a75d7a commit 09604c8
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 202 deletions.
4 changes: 1 addition & 3 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ pkg_tar(
write_file(
name = "gen_maven_repo_name",
out = "MAVEN_CANONICAL_REPO_NAME",
# TODO: Use this instead after building with Bazel 7.1.0 or later.
# content = [get_canonical_repo_name("@maven")],
content = ["rules_jvm_external~~maven~maven"],
content = [get_canonical_repo_name("@maven")],
)

# The @maven repository is created by maven_install from rules_jvm_external.
Expand Down
3 changes: 0 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ bazel_dep(name = "rules_testing", version = "0.6.0")
bazel_dep(name = "googletest", version = "1.14.0", repo_name = "com_google_googletest")
bazel_dep(name = "with_cfg.bzl", version = "0.2.4")

# TODO(fmeum): Remove the dependency on buildozer after Bazel is built with 7.2.0.
bazel_dep(name = "buildozer", version = "7.1.2")

# TODO(pcloudy): Add remoteapis and googleapis as Bazel modules in the BCR.
bazel_dep(name = "remoteapis", version = "")
bazel_dep(name = "googleapis", version = "")
Expand Down
41 changes: 5 additions & 36 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ DIST_ARCHIVE_REPOS = [get_canonical_repo_name(repo) for repo in [
"apple_support",
"bazel_skylib",
"blake3",
"buildozer",
"c-ares",
"com_github_grpc_grpc",
"com_google_protobuf",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.google.devtools.build.lib.bazel.bzlmod;

import com.google.auto.value.AutoValue;
import com.google.common.collect.Maps;
import com.ryanharter.auto.value.gson.GenerateTypeAdapter;
import javax.annotation.Nullable;

Expand Down Expand Up @@ -52,28 +51,11 @@ public static Builder builder() {
public abstract static class Builder {
public abstract Builder setBzlFile(String bzlFile);

abstract String bzlFile();

public abstract Builder setRuleClassName(String name);

public abstract Builder setAttributes(AttributeValues attributes);

abstract AttributeValues attributes();

abstract RepoSpec autoBuild();

public final RepoSpec build() {
// Ensure backwards compatibility with old lockfiles that still specify the 'name' attribute.
// TODO: Remove this after both the lockfile version has been bumped and Bazel is built with
// with Bazel 7.1.0.
AttributeValues attributes = attributes();
if (attributes.attributes().containsKey("name")) {
setAttributes(
AttributeValues.create(
Maps.filterKeys(attributes.attributes(), k -> !k.equals("name"))));
}
return autoBuild();
}
abstract RepoSpec build();
}

public boolean isNativeRepoRule() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,8 @@ public final class BzlmodRepoRuleFunction implements SkyFunction {
* in unambiguous canonical form and thus require no mapping, except instances read from old
* lockfiles.
*/
// TODO(fmeum): Make this mapping truly empty after bumping LOCK_FILE_VERSION.
private static final RepositoryMapping EMPTY_MAIN_REPO_MAPPING =
RepositoryMapping.create(
ImmutableMap.of("", RepositoryName.MAIN, "bazel_tools", RepositoryName.BAZEL_TOOLS),
RepositoryName.MAIN);
RepositoryMapping.create(ImmutableMap.of(), RepositoryName.MAIN);

public BzlmodRepoRuleFunction(RuleClassProvider ruleClassProvider, BlazeDirectories directories) {
this.ruleClassProvider = ruleClassProvider;
Expand Down
5 changes: 2 additions & 3 deletions src/test/shell/bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("//:workspace_deps.bzl", "gen_workspace_stanza")
load("//src/tools/bzlmod:utils.bzl", "get_canonical_repo_name")

package(default_visibility = ["//visibility:private"])

Expand Down Expand Up @@ -220,9 +221,7 @@ sh_test(
write_file(
name = "gen_rules_java_repo_name",
out = "RULES_JAVA_REPO_NAME",
# TODO: Revert to the following when building with Bazel 7.1.0.
# content = [get_canonical_repo_name("@rules_java")],
content = ["rules_java~"],
content = [get_canonical_repo_name("@rules_java")],
)

sh_test(
Expand Down
Loading

0 comments on commit 09604c8

Please sign in to comment.