Skip to content

Commit

Permalink
Merge branch 'release-6.4.0' into release-6.4.0-19387
Browse files Browse the repository at this point in the history
  • Loading branch information
iancha1992 authored Sep 11, 2023
2 parents a532278 + fb4cc46 commit 4126380
Show file tree
Hide file tree
Showing 48 changed files with 529 additions and 103 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bazel_dep(name = "rules_license", version = "0.0.3")
bazel_dep(name = "bazel_skylib", version = "1.2.0")
bazel_dep(name = "protobuf", version = "3.19.6", repo_name = "com_google_protobuf")
bazel_dep(name = "grpc", version = "1.47.0", repo_name = "com_github_grpc_grpc")
bazel_dep(name = "platforms", version = "0.0.5")
bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "rules_pkg", version = "0.7.0")
bazel_dep(name = "stardoc", version = "0.5.0", repo_name = "io_bazel_skydoc")
bazel_dep(name = "zstd-jni", version = "1.5.2-3")
Expand Down
9 changes: 5 additions & 4 deletions distdir_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ DIST_DEPS = {
#
########################################
"platforms": {
"archive": "platforms-0.0.5.tar.gz",
"sha256": "379113459b0feaf6bfbb584a91874c065078aa673222846ac765f86661c27407",
"archive": "platforms-0.0.7.tar.gz",
"sha256": "3a561c99e7bdbe9173aa653fd579fe849f1d8d67395780ab4770b1f381431d51",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
"package_version": "0.0.7",
},
"bazelci_rules": {
"archive": "bazelci_rules-1.0.0.tar.gz",
Expand Down
26 changes: 12 additions & 14 deletions scripts/release/relnotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ def git(*args):
list(args)).decode("utf-8").strip().split("\n")


def extract_relnotes(commit_message_lines, is_major_release):
def extract_pr_title(commit_message_lines):
"""Extracts first line from commit message (passed in as a list of lines)."""
return re.sub(
r"\[\d+\.\d+\.\d\]\s?", "", commit_message_lines[0].strip()
)


def extract_relnotes(commit_message_lines):
"""Extracts relnotes from a commit message (passed in as a list of lines)."""
relnote_lines = []
in_relnote = False
Expand All @@ -45,18 +52,7 @@ def extract_relnotes(commit_message_lines, is_major_release):
relnote = " ".join(relnote_lines)
relnote_lower = relnote.strip().lower().rstrip(".")
if relnote_lower == "n/a" or relnote_lower == "none" or not relnote_lower:
if is_major_release:
return None
relnote = re.sub(
r"\[\d+\.\d+\.\d\]\s?", "", commit_message_lines[0].strip()
)
else:
issue_id = re.search(
r"\(\#[0-9]+\)$", commit_message_lines[0].strip().split()[-1]
)
if issue_id:
relnote = relnote + " " + issue_id.group(0).strip()

return None
return relnote


Expand All @@ -78,7 +74,9 @@ def get_relnotes_between(base, head, is_major_release):
rolled_back_commits.add(m[1])
# The rollback commit itself is also skipped.
continue
relnote = extract_relnotes(lines, is_major_release)
relnote = (
extract_relnotes(lines) if is_major_release else extract_pr_title(lines)
)
if relnote is not None:
relnotes.append(relnote)
return relnotes
Expand Down
2 changes: 1 addition & 1 deletion src/MODULE.tools
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bazel_dep(name = "rules_license", version = "0.0.3")
bazel_dep(name = "rules_proto", version = "4.0.0")
bazel_dep(name = "rules_python", version = "0.4.0")

bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "protobuf", version = "3.19.6", repo_name = "com_google_protobuf")
bazel_dep(name = "zlib", version = "1.2.13")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#end

<li><a href="${bazelbuildGithub}/rules_appengine" target="_blank" rel="noopener">AppEngine</a></li>
<li><a href="${bazelbuildGithub}/rules_apple" target="_blank" rel="noopener">Apple (Swift, iOS, macOS, tvOS, watchOS)</a></li>
<li><a href="${bazelbuildGithub}/rules_apple" target="_blank" rel="noopener">Apple (Swift, iOS, macOS, tvOS, visionOS, watchOS)</a></li>
<li><a href="${bazelbuildGithub}/rules_dotnet" target="_blank" rel="noopener">C#</a></li>
<li><a href="${bazelbuildGithub}/rules_d" target="_blank" rel="noopener">D</a></li>
<li><a href="${bazelbuildGithub}/rules_docker" target="_blank" rel="noopener">Docker</a></li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ toc:
- title: AppEngine
path: https://github.com/bazelbuild/rules_appengine
status: external
- title: Apple (Swift, iOS, macOS, tvOS, watchOS)
- title: Apple (Swift, iOS, macOS, tvOS, visionOS, watchOS)
path: https://github.com/bazelbuild/rules_apple
status: external
- title: C#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.google.common.collect.Interner;
import com.google.common.collect.Iterables;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.collect.Sets;
import com.google.devtools.build.lib.actions.AbstractAction;
import com.google.devtools.build.lib.actions.ActionContinuationOrResult;
import com.google.devtools.build.lib.actions.ActionEnvironment;
Expand Down Expand Up @@ -683,7 +684,6 @@ public static class Builder {
private final List<Artifact> outputs = new ArrayList<>();
private final List<RunfilesSupplier> inputRunfilesSuppliers = new ArrayList<>();
private ResourceSetOrBuilder resourceSetOrBuilder = AbstractAction.DEFAULT_RESOURCE_SET;
private ActionEnvironment actionEnvironment = null;
private ImmutableMap<String, String> environment = ImmutableMap.of();
private ImmutableSet<String> inheritedEnvironment = ImmutableSet.of();
private ImmutableMap<String, String> executionInfo = ImmutableMap.of();
Expand Down Expand Up @@ -717,7 +717,6 @@ public Builder(Builder other) {
this.outputs.addAll(other.outputs);
this.inputRunfilesSuppliers.addAll(other.inputRunfilesSuppliers);
this.resourceSetOrBuilder = other.resourceSetOrBuilder;
this.actionEnvironment = other.actionEnvironment;
this.environment = other.environment;
this.executionInfo = other.executionInfo;
this.isShellCommand = other.isShellCommand;
Expand Down Expand Up @@ -762,12 +761,31 @@ public SpawnAction build(ActionOwner owner, BuildConfigurationValue configuratio
result.addCommandLine(pair);
}
CommandLines commandLines = result.build();
ActionEnvironment env =
actionEnvironment != null
? actionEnvironment
: useDefaultShellEnvironment
? configuration.getActionEnvironment()
: ActionEnvironment.create(environment, inheritedEnvironment);
ActionEnvironment env;
if (useDefaultShellEnvironment && environment != null) {
// Inherited variables override fixed variables in ActionEnvironment. Since we want the
// fixed part of the action-provided environment to override the inherited part of the
// user-provided environment, we have to explicitly filter the inherited part.
var userFilteredInheritedEnv =
ImmutableSet.copyOf(
Sets.difference(
configuration.getActionEnvironment().getInheritedEnv(), environment.keySet()));
// Do not create a new ActionEnvironment in the common case where no vars have been filtered
// out.
if (userFilteredInheritedEnv.equals(
configuration.getActionEnvironment().getInheritedEnv())) {
env = configuration.getActionEnvironment();
} else {
env =
ActionEnvironment.create(
configuration.getActionEnvironment().getFixedEnv(), userFilteredInheritedEnv);
}
env = env.withAdditionalFixedVariables(environment);
} else if (useDefaultShellEnvironment) {
env = configuration.getActionEnvironment();
} else {
env = ActionEnvironment.create(environment, inheritedEnvironment);
}
return buildSpawnAction(
owner, commandLines, configuration.getCommandLineLimits(), configuration, env);
}
Expand Down Expand Up @@ -984,13 +1002,6 @@ public Builder setResources(ResourceSetOrBuilder resourceSetOrBuilder) {
return this;
}

/** Sets the action environment. */
@CanIgnoreReturnValue
public Builder setEnvironment(ActionEnvironment actionEnvironment) {
this.actionEnvironment = actionEnvironment;
return this;
}

/**
* Sets the map of environment variables. Do not use! This makes the builder ignore the 'default
* shell environment', which is computed from the --action_env command line option.
Expand Down Expand Up @@ -1075,6 +1086,18 @@ public Builder executeUnconditionally() {
return this;
}

/**
* Same as {@link #useDefaultShellEnvironment()}, but additionally sets the provided fixed
* environment variables, which take precedence over the variables contained in the default
* shell environment.
*/
@CanIgnoreReturnValue
public Builder useDefaultShellEnvironmentWithOverrides(Map<String, String> environment) {
this.environment = ImmutableMap.copyOf(environment);
this.useDefaultShellEnvironment = true;
return this;
}

/**
* Sets the executable path; the path is interpreted relative to the execution root, unless it's
* a bare file name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@

package com.google.devtools.build.lib.analysis.configuredtargets;

import static net.starlark.java.eval.Module.ofInnermostEnclosingStarlarkFunction;

import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.Allowlist;
import com.google.devtools.build.lib.analysis.FileProvider;
import com.google.devtools.build.lib.analysis.PackageSpecificationProvider;
import com.google.devtools.build.lib.analysis.TargetContext;
import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
import com.google.devtools.build.lib.cmdline.BazelModuleContext;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
Expand All @@ -32,12 +28,6 @@
import com.google.devtools.build.lib.packages.PackageSpecification.PackageGroupContents;
import com.google.devtools.build.lib.packages.Provider;
import javax.annotation.Nullable;
import net.starlark.java.annot.Param;
import net.starlark.java.annot.ParamType;
import net.starlark.java.annot.StarlarkMethod;
import net.starlark.java.eval.EvalException;
import net.starlark.java.eval.Starlark;
import net.starlark.java.eval.StarlarkThread;

/**
* Dummy ConfiguredTarget for package groups. Contains no functionality, since package groups are
Expand Down Expand Up @@ -86,24 +76,4 @@ protected Info rawGetStarlarkProvider(Provider.Key providerKey) {
protected Object rawGetStarlarkProvider(String providerKey) {
return null;
}

@StarlarkMethod(
name = "isAvailableFor",
documented = false,
parameters = {
@Param(
name = "label",
allowedTypes = {@ParamType(type = Label.class)})
},
useStarlarkThread = true)
public boolean starlarkMatches(Label label, StarlarkThread starlarkThread) throws EvalException {
RepositoryName repository =
BazelModuleContext.of(ofInnermostEnclosingStarlarkFunction(starlarkThread))
.label()
.getRepository();
if (!"@_builtins".equals(repository.getNameWithAt())) {
throw Starlark.errorf("private API only for use by builtins");
}
return Allowlist.isAvailableFor(packageSpecificationProvider.getPackageSpecifications(), label);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -671,15 +671,24 @@ private void registerStarlarkAction(
} catch (IllegalArgumentException e) {
throw Starlark.errorf("%s", e.getMessage());
}
if (envUnchecked != Starlark.NONE) {
builder.setEnvironment(
ImmutableMap.copyOf(Dict.cast(envUnchecked, String.class, String.class, "env")));
}
if (progressMessage != Starlark.NONE) {
builder.setProgressMessageFromStarlark((String) progressMessage);
}

ImmutableMap<String, String> env = null;
if (envUnchecked != Starlark.NONE) {
env = ImmutableMap.copyOf(Dict.cast(envUnchecked, String.class, String.class, "env"));
}
if (Starlark.truth(useDefaultShellEnv)) {
builder.useDefaultShellEnvironment();
if (env != null
&& getSemantics()
.getBool(BuildLanguageOptions.INCOMPATIBLE_MERGE_FIXED_AND_DEFAULT_SHELL_ENV)) {
builder.useDefaultShellEnvironmentWithOverrides(env);
} else {
builder.useDefaultShellEnvironment();
}
} else if (env != null) {
builder.setEnvironment(env);
}

RuleContext ruleContext = getRuleContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private static String moduleFileContent(String repositoryName) {
"module(name = \"%s\")",
// Try to keep this updated with the src/MODULE.tools file. (Due to MVS, even if this is
// not kept up to date, we'll use the latest version anyhow)
"bazel_dep(name = \"platforms\", version = \"0.0.4\")"),
"bazel_dep(name = \"platforms\", version = \"0.0.7\")"),
repositoryName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public class RepositoryOptions extends OptionsBase {
@Option(
name = "lockfile_mode",
converter = LockfileMode.Converter.class,
defaultValue = "update",
defaultValue = "off",
documentationCategory = OptionDocumentationCategory.BZLMOD,
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
help =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@

import build.bazel.remote.execution.v2.Platform;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.common.flogger.GoogleLogger;
import com.google.common.hash.HashCode;
import com.google.devtools.build.lib.actions.ActionContext;
import com.google.devtools.build.lib.actions.ActionInput;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
import com.google.devtools.build.lib.actions.ExecException;
import com.google.devtools.build.lib.actions.FileArtifactValue;
import com.google.devtools.build.lib.actions.MetadataProvider;
Expand Down Expand Up @@ -100,6 +102,8 @@ public void logSpawn(
builder.addEnvironmentVariablesBuilder().setName(var).setValue(env.get(var));
}

ImmutableSet<? extends ActionInput> toolFiles = spawn.getToolFiles().toSet();

try {
for (Map.Entry<PathFragment, ActionInput> e : inputMap.entrySet()) {
ActionInput input = e.getValue();
Expand All @@ -111,7 +115,15 @@ public void logSpawn(
listDirectoryContents(inputPath, builder::addInputs, metadataProvider);
} else {
Digest digest = computeDigest(input, null, metadataProvider, xattrProvider);
builder.addInputsBuilder().setPath(input.getExecPathString()).setDigest(digest);
boolean isTool =
toolFiles.contains(input)
|| (input instanceof TreeFileArtifact
&& toolFiles.contains(((TreeFileArtifact) input).getParent()));
builder
.addInputsBuilder()
.setPath(input.getExecPathString())
.setDigest(digest)
.setIsTool(isTool);
}
}
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,19 @@ public final class BuildLanguageOptions extends OptionsBase {
help = "If enabled, targets that have unknown attributes set to None fail.")
public boolean incompatibleFailOnUnknownAttributes;

@Option(
name = "incompatible_merge_fixed_and_default_shell_env",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE},
help =
"If enabled, actions registered with ctx.actions.run and ctx.actions.run_shell with both"
+ " 'env' and 'use_default_shell_env = True' specified will use an environment"
+ " obtained from the default shell environment by overriding with the values passed"
+ " in to 'env'. If disabled, the value of 'env' is completely ignored in this case.")
public boolean incompatibleMergeFixedAndDefaultShellEnv;

@Option(
name = "incompatible_disable_objc_library_transition",
defaultValue = "false",
Expand Down Expand Up @@ -765,6 +778,9 @@ public StarlarkSemantics toStarlarkSemantics() {
EXPERIMENTAL_GET_FIXED_CONFIGURED_ACTION_ENV,
experimentalGetFixedConfiguredEnvironment)
.setBool(INCOMPATIBLE_FAIL_ON_UNKNOWN_ATTRIBUTES, incompatibleFailOnUnknownAttributes)
.setBool(
INCOMPATIBLE_MERGE_FIXED_AND_DEFAULT_SHELL_ENV,
incompatibleMergeFixedAndDefaultShellEnv)
.setBool(
INCOMPATIBLE_DISABLE_OBJC_LIBRARY_TRANSITION,
incompatibleDisableObjcLibraryTransition)
Expand Down Expand Up @@ -858,6 +874,8 @@ public StarlarkSemantics toStarlarkSemantics() {
"-experimental_get_fixed_configured_action_env";
public static final String INCOMPATIBLE_FAIL_ON_UNKNOWN_ATTRIBUTES =
"-incompatible_fail_on_unknown_attributes";
public static final String INCOMPATIBLE_MERGE_FIXED_AND_DEFAULT_SHELL_ENV =
"-experimental_merge_fixed_and_default_shell_env";
public static final String INCOMPATIBLE_DISABLE_OBJC_LIBRARY_TRANSITION =
"-incompatible_disable_objc_library_transition";

Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/google/devtools/build/lib/remote/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ java_library(
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/common/options",
"//src/main/protobuf:failure_details_java_proto",
"//src/main/protobuf:spawn_java_proto",
"//third_party:auth",
"//third_party:caffeine",
"//third_party:flogger",
Expand Down
Loading

0 comments on commit 4126380

Please sign in to comment.