Skip to content

Commit

Permalink
Merge branch 'bazelbuild:master' into release_test
Browse files Browse the repository at this point in the history
  • Loading branch information
iancha1992 authored Jul 31, 2023
2 parents 73c6624 + cb0cf7f commit 372fa1c
Show file tree
Hide file tree
Showing 40 changed files with 281 additions and 235 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.3.0
6.3.1
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
## Release 6.3.1 (2023-07-31)

```
Baseline: 0f231ac8acabcd8aa309da041c98ab90a1552418

Release Notes:

+ Mark isolated extension usages as experimental (#19050)
+ Fix a bug where frozen targets list was mutated while expanding env attribute (#19052)
+ Add documentation for --experimental_isolated_extension_usage (#19071)
+ Advertise CcInfo from cc_import (#19086)
+ Create .bazelversion to address postsubmit issues (#19089)
+ Update java_tools version to 12.6 (#19091)
+ Disable lockfiles by default (#19106)

Acknowledgements:

This release contains contributions from many people at Google, as well as Brentley Jones, Fabian Meumertzheim, oquenchil, Xùdōng Yáng.
```

## Release 7.0.0-pre.20230710.5 (2023-07-28)

```
Expand Down
2 changes: 1 addition & 1 deletion site/en/release/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ on Github.
| LTS release | Support stage | Latest version | End of support |
| ----------- | ------------- | -------------- | -------------- |
| Bazel 7 | Rolling| [Check GitHub release page](https://github.com/bazelbuild/bazel/releases){: .external} | N/A |
| Bazel 6 | Active | [6.3.0](https://github.com/bazelbuild/bazel/releases/tag/6.3.0){: .external} | Dec 2025 |
| Bazel 6 | Active | [6.3.1](https://github.com/bazelbuild/bazel/releases/tag/6.3.1){: .external} | Dec 2025 |
| Bazel 5 | Maintenance | [5.4.1](https://github.com/bazelbuild/bazel/releases/tag/5.4.1){: .external} | Jan 2025 |
| Bazel 4 | Maintenance | [4.2.4](https://github.com/bazelbuild/bazel/releases/tag/4.2.4){: .external} | Jan 2024 |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ public class AnalysisOptions extends OptionsBase {
)
public boolean discardAnalysisCache;

@Option(
name = "allow_analysis_cache_discard",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.EAGERNESS_TO_EXIT},
help =
"If discarding the analysis cache due to a change in the build system, setting this"
+ " option to false will cause bazel to exit, rather than continuing with the build."
+ " This option has no effect when 'discard_analysis_cache' is also set.")
public boolean allowAnalysisCacheDiscards;

@Option(
name = "max_config_changes_to_show",
defaultValue = "3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ public AnalysisResult update(
}

skyframeBuildView.setConfiguration(
eventHandler, topLevelConfig, viewOptions.maxConfigChangesToShow);
eventHandler,
topLevelConfig,
viewOptions.maxConfigChangesToShow,
viewOptions.allowAnalysisCacheDiscards);

eventBus.post(new MakeEnvironmentEvent(topLevelConfig.getMakeEnvironment()));
eventBus.post(topLevelConfig.toBuildEvent());
Expand Down Expand Up @@ -510,7 +513,7 @@ private AnalysisResult createResult(
ImmutableMap<Label, Target> labelToTargetMap,
boolean includeExecutionPhase)
throws InterruptedException {
Set<Label> testsToRun = loadingResult.getTestsToRunLabels();
ImmutableSet<Label> testsToRun = loadingResult.getTestsToRunLabels();
Set<ConfiguredTarget> configuredTargets =
Sets.newLinkedHashSet(skyframeAnalysisResult.getConfiguredTargets());
ImmutableMap<AspectKey, ConfiguredAspect> aspects = skyframeAnalysisResult.getAspects();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,20 @@ public static class Options extends FragmentOptions {
help = "If enabled, visibility checking also applies to toolchain implementations.")
public boolean checkVisibilityForToolchains;

@Option(
name = "incompatible_remove_exec_tools",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS},
metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE},
help = "If enabled, use of genrule's exec_tools attribute will cause an error..")
public boolean removeExecTools;

@Override
public FragmentOptions getExec() {
Options exec = (Options) getDefault();
exec.checkVisibilityForToolchains = checkVisibilityForToolchains;
exec.removeExecTools = removeExecTools;

return exec;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster",
"//src/main/java/com/google/devtools/build/lib/analysis:config/execution_transition_factory",
"//src/main/java/com/google/devtools/build/lib/analysis:rule_definition_environment",
"//src/main/java/com/google/devtools/build/lib/bazel:bazel_configuration",
"//src/main/java/com/google/devtools/build/lib/packages",
"//src/main/java/com/google/devtools/build/lib/rules/genrule",
"//src/main/java/com/google/devtools/build/lib/util:filetype",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

package com.google.devtools.build.lib.bazel.rules.genrule;

import com.google.devtools.build.lib.analysis.CommandHelper;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.bazel.BazelConfiguration;
import com.google.devtools.build.lib.packages.BuildType;
import com.google.devtools.build.lib.packages.Type;
import com.google.devtools.build.lib.rules.genrule.GenRuleBase;

Expand All @@ -30,4 +33,24 @@ protected boolean isStampingEnabled(RuleContext ruleContext) {
}
return ruleContext.attributes().get("stamp", Type.BOOLEAN);
}

// TODO(https://github.com/bazelbuild/bazel/issues/19132): Remove this override once downstream
// projects are migrated.
@Override
protected CommandHelper.Builder commandHelperBuilder(RuleContext ruleContext) {
BazelConfiguration.Options bazelOptions =
ruleContext.getConfiguration().getOptions().get(BazelConfiguration.Options.class);

if (bazelOptions.removeExecTools
&& ruleContext.attributes().has("exec_tools", BuildType.LABEL_LIST)
&& !ruleContext.attributes().get("exec_tools", BuildType.LABEL_LIST).isEmpty()) {
ruleContext.attributeError(
"exec_tools", "genrule.exec_tools has been removed, use tools instead");
}

return CommandHelper.builder(ruleContext)
.addToolDependencies("tools")
.addToolDependencies("exec_tools")
.addToolDependencies("toolchains");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@

import static com.google.devtools.build.lib.packages.Attribute.attr;
import static com.google.devtools.build.lib.packages.BuildType.LABEL;
import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST;
import static com.google.devtools.build.lib.packages.Type.BOOLEAN;

import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.analysis.config.ExecutionTransitionFactory;
import com.google.devtools.build.lib.packages.RuleClass;
import com.google.devtools.build.lib.rules.genrule.GenRuleBaseRule;
import com.google.devtools.build.lib.util.FileTypeSet;

/**
* Rule definition for genrule for Bazel.
Expand All @@ -44,6 +46,23 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
.cfg(ExecutionTransitionFactory.createFactory())
.value(env.getToolsLabel(GENRULE_SETUP_LABEL)))

// TODO(https://github.com/bazelbuild/bazel/issues/19132): Remove this once downstream
// projects are migrated.
/* <!-- #BLAZE_RULE(genrule).ATTRIBUTE(exec_tools) -->
<b>Deprecated. Use <a href="#genrule.tools"><code>tools</code></a> instead.</b>
<p>
There was a period of time when <code>exec_tools</code> and <code>tools</code> behaved
differently, but they are now equivalent and the Blaze team will be migrating all uses of
<code>exec_tools</code> to <code>tools</code>.
</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("exec_tools", LABEL_LIST)
.cfg(ExecutionTransitionFactory.createFactory())
.allowedFileTypes(FileTypeSet.ANY_FILE)
.dontCheckConstraints())

// TODO(bazel-team): stamping doesn't seem to work. Fix it or remove attribute.
.add(attr("stamp", BOOLEAN).value(false))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/skyframe:build_configuration",
"//src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec",
"//src/main/java/com/google/devtools/build/lib/util",
"//src/main/java/com/google/devtools/build/lib/util:detailed_exit_code",
"//src/main/java/com/google/devtools/build/lib/util:exit_code",
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildEventId;
import com.google.devtools.build.lib.util.DetailedExitCode;
import com.google.devtools.build.lib.util.ExitCode;
import com.google.protobuf.util.Timestamps;
import java.util.Collection;
import javax.annotation.Nullable;

/**
* Class all events completing a build inherit from.
Expand All @@ -27,18 +29,28 @@
* However, subclasses do not have to implement anything.
*/
public abstract class BuildCompletingEvent implements BuildEvent {
@Nullable private final DetailedExitCode detailedExitCode;
private final ExitCode exitCode;
private final long finishTimeMillis;

private final Collection<BuildEventId> children;

public BuildCompletingEvent(
ExitCode exitCode, long finishTimeMillis, Collection<BuildEventId> children) {
this.detailedExitCode = null;
this.exitCode = exitCode;
this.finishTimeMillis = finishTimeMillis;
this.children = children;
}

public BuildCompletingEvent(
DetailedExitCode detailedExitCode, long finishTimeMillis, Collection<BuildEventId> children) {
this.detailedExitCode = detailedExitCode;
this.exitCode = detailedExitCode.getExitCode();
this.finishTimeMillis = finishTimeMillis;
this.children = children;
}

public BuildCompletingEvent(ExitCode exitCode, long finishTimeMillis) {
this(exitCode, finishTimeMillis, ImmutableList.of());
}
Expand All @@ -65,13 +77,17 @@ public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventContext convert
.setCode(exitCode.getNumericExitCode())
.build();

BuildEventStreamProtos.BuildFinished finished =
BuildEventStreamProtos.BuildFinished.Builder finished =
BuildEventStreamProtos.BuildFinished.newBuilder()
.setOverallSuccess(ExitCode.SUCCESS.equals(exitCode))
.setExitCode(protoExitCode)
.setFinishTime(Timestamps.fromMillis(finishTimeMillis))
.setFinishTimeMillis(finishTimeMillis)
.build();
return GenericBuildEvent.protoChaining(this).setFinished(finished).build();
.setFinishTimeMillis(finishTimeMillis);

if (detailedExitCode != null && detailedExitCode.getFailureDetail() != null) {
finished.setFailureDetail(detailedExitCode.getFailureDetail());
}

return GenericBuildEvent.protoChaining(this).setFinished(finished.build()).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,9 @@ message BuildFinished {
google.protobuf.Timestamp finish_time = 5;

AnomalyReport anomaly_report = 4 [deprecated = true];

// Only populated if success = false, and sometimes not even then.
failure_details.FailureDetail failure_detail = 6;
}

message BuildMetrics {
Expand Down Expand Up @@ -965,6 +968,9 @@ message BuildMetrics {
PackageMetrics package_metrics = 4;

message TimingMetrics {
// For Skymeld,
// analysis_phase_time_in_ms + execution_phase_time_in_ms >= wall_time_in_ms
//
// The CPU time in milliseconds consumed during this build.
int64 cpu_time_in_ms = 1;
// The elapsed wall time in milliseconds during this build.
Expand All @@ -973,6 +979,10 @@ message BuildMetrics {
// When analysis and execution phases are interleaved, this measures the
// elapsed time from the first analysis work to the last.
int64 analysis_phase_time_in_ms = 3;
// The elapsed wall time in milliseconds during the execution phase.
// When analysis and execution phases are interleaved, this measures the
// elapsed time from the first action execution to the last.
int64 execution_phase_time_in_ms = 4;
}
TimingMetrics timing_metrics = 5;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public final class BuildCompleteEvent extends BuildCompletingEvent {

/** Construct the BuildCompleteEvent. */
public BuildCompleteEvent(BuildResult result, Collection<BuildEventId> children) {
super(result.getDetailedExitCode().getExitCode(), result.getStopTime(), children);
super(result.getDetailedExitCode(), result.getStopTime(), children);
this.result = checkNotNull(result);
}

Expand Down
Loading

0 comments on commit 372fa1c

Please sign in to comment.